project-yuki / planning

Project YUKI planning
GNU General Public License v3.0
0 stars 0 forks source link

Add support for custom text modifier using regex #7

Open tianyume opened 5 years ago

tianyume commented 5 years ago

Add support for custom text modifier using regex, maybe with some examples. In different games, users can use different text modifiers to extract correct texts.

tinyAdapter commented 5 years ago

I agree. And this is a flexible solution for any “regular” incorrect texts. But there still need some specs. What configuration process can be the most convenient for end-users? You know, if something is related to regex, things could become much more complicated.

As far as I'm concerned, here are the things to take into account:

Then a big refactor comes...

tianyume commented 5 years ago

For the configuration, I believe an array of dictionary may be better. For example: [ { "matcher": "/(.{4,})\\1+/g", "replacer": "$1", "recursive": true // Maybe just use recursive as default } ] Compared to using an array directly, it's easier to maintain and be validated. Also, if any further changes are needed, we can simply add some more fields to make it compatible to older versions.

For the error message and hot reload, I'd suggest to do the following step by step:

  1. Define the initial configuration format, loading configuration at the start time, add regex replacer feature into current middleware. Building an initial workable solution. (Non hot reload version)
  2. Add error message exposure to the users. Maybe something like adding a debug button, creating a new window displaying all the debug messages. I'm not sure what would be the best practice either. (Seems that the debug messages are either truncated in CMD or broken, I cannot get the full debug messages in CMD)
  3. Add hot reload configuration feature into the whole configuration system. If users can get the raw texts, like in step 2, they can test their regex online. This would be a good UX enhancement but not as urgent as the previous steps.
tinyAdapter commented 5 years ago

OK, I think this is a feasible solution. But I have no enough time to implement it these days...You may see that there are so many plans in this repo, maybe after a month or two can I finish all my work and thus turn to implement these features. 😥