Formex 4 to CALS converter¶
New in version 0.5.0.
-
class
benker.converters.formex2cals.Formex2CalsConverter¶ Bases:
benker.converters.base_converter.BaseConverterFormex 4 to CALS converter
-
builder_cls¶ alias of
benker.builders.cals.CalsBuilder
-
parser_cls¶ alias of
benker.parsers.formex.FormexParser
-
-
benker.converters.formex2cals.convert_formex2cals(src_xml, dst_xml, **options)¶ Convert Formex 4 tables to Cals tables.
Parameters: - src_xml (str) – Source path of the XML file to convert.
- dst_xml (str) – Destination path of the XML file to produce.
- options –
Dictionary of parsing/building options.
Common parsing options:
encoding(default: “utf-8”):- XML encoding of the destination file.
Formex parser options:
formex_ns(defaultNone):- Namespace to use for Formex elements and attributes parsing.
Set
None(or “”) if you don’t use namespace. cals_ns(defaultNone):- Namespace to use for CALS-like elements and attributes parsing.
Set
None(or “”) if you don’t use namespace. embed_gr_notes(defaultFalse):- If
True, Embed theGR.NOTESin a row/cell, else only copy the content (not theGR.NOTEStag).
CALS builder options:
cals_ns(default:None):- Namespace to use for CALS-like elements and attributes to generate.
Set
None(or “”) if you don’t want to use namespace. cals_prefix(default:None):- Namespace prefix to use for CALS-like elements and attributes to generate.
width_unit(default: “mm”):- Unit to use for column widths. Possible values are: ‘cm’, ‘dm’, ‘ft’, ‘in’, ‘m’, ‘mm’, ‘pc’, ‘pt’, ‘px’.
table_in_tgroup(default:False):- Where should we put the table properties:
Falseto insert the attributes@colsep,@rowsep, and@tabstylein the<table>element,Trueto insert the attributes@colsep,@rowsep, and@tgroupstylein the<tgroup>element.
tgroup_sorting(default:["header", "footer", "body"]):- List used to sort (and group) the rows in a
tgroup. The sorting is done according to the row natures which is by default:["header", "footer", "body"](this order match the CALS DTD defaults, where the footer is between the header and the body. To move the footer to the end, you can use["header", "body", "footer"].
Changed in version 0.5.0: Add the options cals_ns, cals_prefix, tgroup_sorting.