[Suggestion] Allow to escape dot character in modstitch-manifests

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
kotlin
Domain
build-system

Research direction

Start by locating how modstitch-manifests turns map keys containing dots into nested maps, then check the existing tests for that behavior. Add coverage for an escaped dot in a key; the change is done when escaped dots remain literal while unescaped dots still create nested maps.

Written by the indexing model from the issue text.

Description

Currently, when you use a dot in key in a map it gets turned into a new map:

val someInnerMap = mutableMapOf<String, String>()
someInnerMap["translation.key"] = "Something"
customData.put("some", someInnerMap)
// Outputs: 
// {
//  ..
//  "custom": {
//    "some": {
//      "translation": {
//        "key": "Something"
//      }
//    }
// }

But sometimes you need to have keys with dots, e. g. to add custom data for ModMenu

My Idea would be to add '\' as an escape character:

val someInnerMap = mutableMapOf<String, String>()
someInnerMap["translation\\.key"] = "Something"
customData.put("some", someInnerMap)
// Outputs: 
// {
//  ..
//  "custom": {
//    "some": {
//      "translation.key": "Something"
//    }
// }

this could be done with this regex: (?<!\\)\.
(which i found)

Dominant language
Kotlin
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from isXander/modstitch-toolkit

All issues in isXander/modstitch-toolkit

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.