-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorconfig & Format chapter number to %03d #30
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may cause wrongly replacement when the title itself contains digits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look of this extreme example: http://www.dm5.com/manhua-bianchengnageta/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.