Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Accept millimeter in column definition
  • Loading branch information
kthoden committed Sep 2, 2020
1 parent 338c075 commit 8346d7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/imxml2django.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-05-27 13:10:27 (kthoden)>
# Time-stamp: <2020-09-02 13:33:37 (kthoden)>

"""
Create an XML file that can be inserted into the Django database
Expand Down Expand Up @@ -441,13 +441,14 @@ def djangoParseObject(xmlElement, indent=False, listtype=None, listnumber=0, uid
# Transform width of Columns
strColumnString = xmlElement.find(".//EOAtablecolumns").text
strColumnString = re.sub(r"\|", "", strColumnString)
reMatchObjects = re.findall(r'([L|R|C].*?cm)', strColumnString)
reMatchObjects = re.findall(r'([L|R|C].*?[c|m]m)', strColumnString)
intTableWidth = 0
listColumnAlignments = [None]
listColumnWidths = [None]
intNumberOfColumns = 0
for strColumnDefinition in reMatchObjects:
strColumnDefinition = strColumnDefinition.rstrip("cm")
logging.info(strColumnDefinition)
strColumnAlignment = strColumnDefinition[0]
if strColumnAlignment == "L":
strColumnAlignment = "left"
Expand Down
5 changes: 2 additions & 3 deletions src/imxml2epub.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-05-27 13:09:21 (kthoden)>
# Time-stamp: <2020-09-02 09:13:11 (kthoden)>

""" Convert a customized DocBook XML file into a set of files that
constitute the contents of an EPUB file.
Expand Down Expand Up @@ -1537,14 +1537,13 @@ class FootnoteError(Exception):
strColumnString = xmlTable.find(".//EOAtablecolumns").text
strColumnString = re.sub(r"\|", "", strColumnString)
xmlTable.remove(xmlTable.find(".//EOAtablecolumns"))
reMatchObjects = re.findall(r'([L|R|C].*?cm)', strColumnString)
reMatchObjects = re.findall(r'([L|R|C].*?[c|m]m)', strColumnString)
intTableWidth = 0
listColumnAlignments = [None]
listColumnWidths = [None]
intNumberOfColumns = 0
for strColumnDefinition in reMatchObjects:
strColumnDefinition = strColumnDefinition.rstrip("cm")
strColumnDefinition = strColumnDefinition.rstrip("mm")
strColumnAlignment = strColumnDefinition[0]
if strColumnAlignment == "L":
strColumnAlignment = "left"
Expand Down

0 comments on commit 8346d7c

Please sign in to comment.