Skip to content

Commit

Permalink
Fixes script to allow hyphen characters in substitutions fix qgis#2810 (
Browse files Browse the repository at this point in the history
  • Loading branch information
SrNetoChan authored Nov 28, 2018
1 parent e07ce40 commit 3ae8fe3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/find_set_subst.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_subst_from_file(file):

# defines a pattern for a substitution
# anything inside || except is preceded by ..
s_pattern = re.compile(r"(?<!\.\. )\|([\w\d]+)\|")
s_pattern = re.compile(r"(?<!\.\. )\|([\w\d-]+)\|")
s_title = re.compile(r"\.\. Substitutions definitions - AVOID EDITING "
r"PAST THIS LINE\n")
subs = []
Expand Down Expand Up @@ -96,10 +96,10 @@ def read_subst(file):
subs_dict = dict()

# Create patterns for image, width and replace substitutions
image_pattern = re.compile(r"\.\. \|([\w\d\s]+)\|\s+image::\s+([^\n]+)")
image_pattern = re.compile(r"\.\. \|([\w\d\s-]+)\|\s+image::\s+([^\n]+)")
width_pattern = re.compile(r"\s+:width:\s+([^\n]+)")
replace_pattern = re.compile(r"\.\. \|([\w\d\s]+)\|\s+replace::\s+([^\n]+)")
unicode_pattern = re.compile(r"\.\. \|([\w\d\s]+)\|\s+unicode::\s+([^\n]+)")
replace_pattern = re.compile(r"\.\. \|([\w\d\s-]+)\|\s+replace::\s+([^\n]+)")
unicode_pattern = re.compile(r"\.\. \|([\w\d\s-]+)\|\s+unicode::\s+([^\n]+)")

# read substitutions file line by line searching for pattern matches
with open (file, "r") as f:
Expand Down

0 comments on commit 3ae8fe3

Please sign in to comment.