Skip to content
Snippets Groups Projects
Commit ac19f520 authored by Martyn Welch's avatar Martyn Welch Committed by Emanuele Aina
Browse files

Improve formatting of tables used for code blocks


The codeblock tables are being badly formatted, with the column for the
line numbers the same width as that for the content. Tweak the html for
tables with the `lntable` class so that the line numbers are only 3% of
the width.

Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
parent 4dabc0b4
No related branches found
No related tags found
1 merge request!52Wip/martyn/t7270 tweak designs
......@@ -71,6 +71,20 @@ def update_local_links(elem, prefix):
link.attrib['href'] = '%s/%s' % (prefix, href)
def format_lntables(elem):
tables = elem.xpath('.//table')
for table in tables:
cls = table.attrib.get('class')
if cls != 'lntable':
continue
col = etree.Element("col")
col.attrib['width'] = "97%"
table.insert(0, col)
col = etree.Element("col")
col.attrib['width'] = "3%"
table.insert(0, col)
def convert_images(elem, imgdir):
imgs = elem.xpath('.//img')
for img in imgs:
......@@ -116,6 +130,7 @@ def transform(args):
inpath = os.path.dirname(args.input)
tmpdir_path = tempfile.mkdtemp(prefix=os.path.join(inpath, ''))
convert_images(body, tmpdir_path)
format_lntables(body)
output.append('<!DOCTYPE html>')
output.append('<html lang="en">')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment