Editorconfig & Format chapter number to %03d #30
Editorconfig & Format chapter number to %03d #30eight04 merged 6 commits intoeight04:masterfrom kuanyui:master
Conversation
|
I am going to make an option for this. |
|
To apply number format, add following to setting.ini: |
|
Where is the RegExp pattern |
| def replacer(match): | ||
| number = match.group() | ||
| return format.format(int(number)) | ||
| return re.sub("\d+", replacer, title) |
There was a problem hiding this comment.
I think this may cause wrongly replacement when the title itself contains digits.
There was a problem hiding this comment.
Maybe we should try to trim the mission title from the episode title first?
Some title examples:
泰安路47号 第006回
http://www.dm5.com/manhua-taianlu-47-hao/
原作版108(7)
第28-29話
http://tw.ikanman.com/comic/9637/
There was a problem hiding this comment.
Every site has different rules, so I use 第(\d+)[話话卷]? such a conservative pattern. Or maybe each site has its own digits formatter?
There was a problem hiding this comment.
Adding new API to format title is the safest, but let's consider if there is an universal solution first.
With above solution,
泰安路47号 第006回
原作版108(7)
第28-29話
becomes
泰安路47号 第006回
原作版108(007)
第028-029話
which looks good to me.
There was a problem hiding this comment.
Take a look of this extreme example: http://www.dm5.com/manhua-bianchengnageta/
There was a problem hiding this comment.
Sorry, my fault. I misunderstood something.
|
Awesome! I think it's time to merge this PR. BTW, Your skill in Python is so good, I never know that |
|
Released in 2017.1.6. |

For #22
Sorry for late. Too busy recently.