table background color removed

Bug #890877 reported by Reto Knaak
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chm2pdf
Unknown
Unknown
chm2pdf (Ubuntu)
Confirmed
High
Unassigned

Bug Description

The first bgcolor="#001122" afre a link will become bgcolor="", due to this regex which is too greedy:
            # 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)

because it matches everything until the next #, even if it is outside the link!

How about this? Is this the way to go? .. at least it seems to work!
            page = re.sub('(?i)<a href="([^(#|")]*)#[^"]*"', '<a href="\\1"', page)

I modified the same place even more, because in my file I have links like <a href="#X1">X1</a> and so nothing of the link would be left: in my optinion, in this case I prefer to leave the link intact, as it points inside the same file!
            page = re.sub('(?i)<a href="([^#|"]+)#[^"]*"', '<a href="\\1"', page)

Tags: patch
Steve Stalcup (vorian)
Changed in chm2pdf (Ubuntu):
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → High
Revision history for this message
Reto Knaak (reto-knaak) wrote :

This is the first time I try to generate a patch... hope this is correct!

Changed one regular expression:
- added (?i) to make regex case insensitive
- search for #links stops at # and "
- * changed to + to ignore internal links "#..."

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "removed background color patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Reto Knaak (reto-knaak)
summary: - table background color removed Options
+ table background color removed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.