cleanit
cleanit copied to clipboard
Using custom config with existing tags
Hello,
First off, thanks for making this library, I'm finding a lot of use for it! Really appreciate all the tags that are included out of the box.
I'm looking to add some custom rules, and have made a cleanit-custom.yml config that looks like this (based on the example one given in README):
templates:
- &custom
tags:
- custom
priority: 10000
languages: en
rules:
replace-str-start-J-with-music-note[custom]:
<<: *custom
patterns: '^J '
replacement: '♪ '
replace-str-end-J-with-music-note[custom]:
<<: *custom
patterns: ' J$'
replacement: ' ♪'
replace-line-start-J-with-music-note[custom]:
<<: *custom
patterns: '\nJ '
replacement: '\n♪ '
replace-line-end-J-with-music-note[custom]:
<<: *custom
patterns: ' J\n'
replacement: ' ♪\n'
This runs no problem if I use the -c cleanit-custom.yml -t custom on the command line, and I can verify the output using --debug, but I have a few questions:
- How is
priorityused: is a higher number executed later or sooner than lower numbers? - What are the
&customand*customsupposed to represent? - Probably related to first question, if I wanted to execute all default rules first (
-t default), then my custom rules afterwards, how could I do this in a single command? I.e. if I use both the-cand-tswitches on the command line, which gets looked at first: the config file then the rules tagged default, or the other way around?
Thanks :)