Reto
unread,Nov 14, 2011, 5:43:36 PM11/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chm2pdf
I modified also here because in my file I have links like <a
href="#X1">X1</a> and so nothing of the link would be left:
# Replace links of the form "somefile.html#894" with
"somefile0206.html"
# The following will match anchors like '<a href="temp0206.html#894"'
and will store the 'temp0206.html' in backreference 1.
# The replace string will then replace it with '<a
href="temp0206.html"', i.e. it will take away the '#894' part.
# This is because the numbers after the '#' are often wrong or non-
existent. It is better to link to an existing
# chapter than to a non-existent part of an existing chapter.
page = re.sub('(?i)<a href="([^#|"]+)#[^"]*"', '<a href="\\1"', page)
in my optinion, in this case I prefer to leave the link intact, as it
points inside the same file!