case sensitive match of link can "break" links working in original chm file

12 views
Skip to first unread message

Reto

unread,
Nov 12, 2011, 11:57:02 AM11/12/11
to chm2pdf
Ciao!

In my application some links are not working in the PDF as I have some
upper/lower case errors in links.
As CHM is "windows stuff" this doesen't matter there, but "here" it
does!
So how about making the 1. pass matching case insensitive adding the (?
i) modifier in the regular expression?

I tried this and it seems to work!

# Substitutions in 1st pass: we replace the original
filenames with their corresponding "garbled" equivalents.
# added (?i) modifier to make a case insensitive match for
not breaking working
# links on windows in CHM files ....
for match_string in match_strings:
replace_string =
replace_garbled_strings[match_strings.index(match_string)]
page = re.sub('(?i)'+match_string, replace_string,
page)

Hope this helps someone!

Kind regards
Reto
Reply all
Reply to author
Forward
0 new messages