wf49670 / ppgen

Post-processing generator for DP
6 stars 4 forks source link

page numbers are not generated when they fall within a table #4

Closed davem2 closed 10 years ago

davem2 commented 10 years ago

In Pph.doTable(), if a page number is found while processing a .ta row it's stripped from the input so that cell widths can be properly sized then added back before generating the HTML for the table row. The problem is its not being added back (for most cases)

Here is the original code with the issue:

# convert leading spaces to padding
t1 = v[k]
t2 = re.sub(r"^ⓢ+","", v[k])
if len(t1) - len(t2) > 0:
  padleft = (len(t1) - len(t2))*0.7
  padding += 'padding-left:{}em'.format(padleft)
  v[k] = savedpage + t2
t.append("    <td style='{}{}{}'>".format(valigns[k],haligns[k],padding) + v[k].strip() + "</td>")

The fix:

# convert leading spaces to padding
t1 = v[k]
t2 = re.sub(r"^ⓢ+","", v[k])
if len(t1) - len(t2) > 0:
  padleft = (len(t1) - len(t2))*0.7
  padding += 'padding-left:{}em'.format(padleft)
# inject saved page number
if k == 0:
  v[k] = savedpage + t2
t.append("    <td style='{}{}{}'>".format(valigns[k],haligns[k],padding) + v[k].strip() + "</td>")
ghost commented 10 years ago

Fixed in 3.24U. Thank you for the report and the code.