forked from LiveCarta/BookConverter
Add chapter natural numbering
This commit is contained in:
@@ -432,8 +432,8 @@ class HTMLDocxPreprocessor:
|
|||||||
def clean_title_from_numbering(title: str):
|
def clean_title_from_numbering(title: str):
|
||||||
"""Function to remove digits from headers."""
|
"""Function to remove digits from headers."""
|
||||||
title = re.sub(r'^(\s+)+', '', title)
|
title = re.sub(r'^(\s+)+', '', title)
|
||||||
title = re.sub(r'^(?:\.?\d+\.? ?)+', '', title)
|
# title = re.sub(r'^(?:\.?\d+\.? ?)+', '', title) # delete chapter numbering from the title
|
||||||
# title = re.sub(r'^(?:\.?[MDCLXVIclxvi]+\.? ?)+ ', '', title) # delete chapter numbering from the title
|
# title = re.sub(r'^(?:\.?[MDCLXVIclxvi]+\.? ?)+ ', '', title) # delete chapter numbering(letters) from the title
|
||||||
# title = re.sub(r'^(?:[A-Za-z]\. ?)+', '', title) # delete chapter I, (ABC) from the title
|
# title = re.sub(r'^(?:[A-Za-z]\. ?)+', '', title) # delete chapter I, (ABC) from the title
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ def heading_tag_to_p_tag(body_tag):
|
|||||||
def clean_title_from_numbering(title: str):
|
def clean_title_from_numbering(title: str):
|
||||||
""" Function removes numbering from titles """
|
""" Function removes numbering from titles """
|
||||||
title = re.sub(r'^(\s+)+', '', title)
|
title = re.sub(r'^(\s+)+', '', title)
|
||||||
title = re.sub(r'^(?:\.?\d+\.? ?)+', '', title)
|
# title = re.sub(r'^(?:\.?\d+\.? ?)+', '', title) # delete chapter numbering from the title
|
||||||
# title = re.sub(r'^(?:\.?[MDCLXVIclxvi]+\.? ?)+ ', '', title) # delete chapter numbering from the title
|
# title = re.sub(r'^(?:\.?[MDCLXVIclxvi]+\.? ?)+ ', '', title) # delete chapter numbering(letters) from the title
|
||||||
# title = re.sub(r'^(?:[A-Za-z]\. ?)+', '', title) # delete chapter I, (ABC) from the title
|
# title = re.sub(r'^(?:[A-Za-z]\. ?)+', '', title) # delete chapter I, (ABC) from the title
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user