mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Run autopep8 on odf2xhtml
This commit is contained in:
parent
ed1571af6e
commit
609892eb81
@ -26,35 +26,46 @@ from .element import Element
|
||||
def Animate(**args):
|
||||
return Element(qname=(ANIMNS,'animate'), **args)
|
||||
|
||||
|
||||
def Animatecolor(**args):
|
||||
return Element(qname=(ANIMNS,'animateColor'), **args)
|
||||
|
||||
|
||||
def Animatemotion(**args):
|
||||
return Element(qname=(ANIMNS,'animateMotion'), **args)
|
||||
|
||||
|
||||
def Animatetransform(**args):
|
||||
return Element(qname=(ANIMNS,'animateTransform'), **args)
|
||||
|
||||
|
||||
def Audio(**args):
|
||||
return Element(qname=(ANIMNS,'audio'), **args)
|
||||
|
||||
|
||||
def Command(**args):
|
||||
return Element(qname=(ANIMNS,'command'), **args)
|
||||
|
||||
|
||||
def Iterate(**args):
|
||||
return Element(qname=(ANIMNS,'iterate'), **args)
|
||||
|
||||
|
||||
def Par(**args):
|
||||
return Element(qname=(ANIMNS,'par'), **args)
|
||||
|
||||
|
||||
def Param(**args):
|
||||
return Element(qname=(ANIMNS,'param'), **args)
|
||||
|
||||
|
||||
def Seq(**args):
|
||||
return Element(qname=(ANIMNS,'seq'), **args)
|
||||
|
||||
|
||||
def Set(**args):
|
||||
return Element(qname=(ANIMNS,'set'), **args)
|
||||
|
||||
|
||||
def Transitionfilter(**args):
|
||||
return Element(qname=(ANIMNS,'transitionFilter'), **args)
|
||||
|
@ -23,14 +23,17 @@ import re, types
|
||||
pattern_color = re.compile(r'#[0-9a-fA-F]{6}')
|
||||
pattern_vector3D = re.compile(r'\([ ]*-?([0-9]+(\.[0-9]*)?|\.[0-9]+)([ ]+-?([0-9]+(\.[0-9]*)?|\.[0-9]+)){2}[ ]*\)')
|
||||
|
||||
|
||||
def make_NCName(arg):
|
||||
for c in (':',' '):
|
||||
arg = arg.replace(c,"_%x_" % ord(c))
|
||||
return arg
|
||||
|
||||
|
||||
def cnv_anyURI(attribute, arg, element):
|
||||
return type(u'')(arg)
|
||||
|
||||
|
||||
def cnv_boolean(attribute, arg, element):
|
||||
if arg.lower() in ("false","no"):
|
||||
return "false"
|
||||
@ -39,42 +42,52 @@ def cnv_boolean(attribute, arg, element):
|
||||
return "false"
|
||||
|
||||
# Potentially accept color values
|
||||
|
||||
|
||||
def cnv_color(attribute, arg, element):
|
||||
""" A RGB color in conformance with §5.9.11 of [XSL], that is a RGB color in notation “#rrggbb”, where
|
||||
rr, gg and bb are 8-bit hexadecimal digits.
|
||||
"""
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_configtype(attribute, arg, element):
|
||||
if str(arg) not in ("boolean", "short", "int", "long",
|
||||
"double", "string", "datetime", "base64Binary"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_data_source_has_labels(attribute, arg, element):
|
||||
if str(arg) not in ("none","row","column","both"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
# Understand different date formats
|
||||
|
||||
|
||||
def cnv_date(attribute, arg, element):
|
||||
""" A dateOrDateTime value is either an [xmlschema-2] date value or an [xmlschema-2] dateTime
|
||||
value.
|
||||
"""
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_dateTime(attribute, arg, element):
|
||||
""" A dateOrDateTime value is either an [xmlschema-2] date value or an [xmlschema-2] dateTime
|
||||
value.
|
||||
"""
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_double(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_duration(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_family(attribute, arg, element):
|
||||
""" A style family """
|
||||
if str(arg) not in ("text", "paragraph", "section", "ruby", "table", "table-column", "table-row", "table-cell",
|
||||
@ -82,6 +95,7 @@ def cnv_family(attribute, arg, element):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
|
||||
def __save_prefix(attribute, arg, element):
|
||||
prefix = arg.split(':',1)[0]
|
||||
if prefix == arg:
|
||||
@ -93,6 +107,7 @@ def __save_prefix(attribute, arg, element):
|
||||
p = element.get_nsprefix(namespace)
|
||||
return type(u'')(arg)
|
||||
|
||||
|
||||
def cnv_formula(attribute, arg, element):
|
||||
""" A string containing a formula. Formulas do not have a predefined syntax, but the string should
|
||||
begin with a namespace prefix, followed by a “:” (COLON, U+003A) separator, followed by the text
|
||||
@ -101,22 +116,28 @@ def cnv_formula(attribute, arg, element):
|
||||
"""
|
||||
return __save_prefix(attribute, arg, element)
|
||||
|
||||
|
||||
def cnv_ID(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_IDREF(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_integer(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_legend_position(attribute, arg, element):
|
||||
if str(arg) not in ("start", "end", "top", "bottom", "top-start", "bottom-start", "top-end", "bottom-end"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
|
||||
pattern_length = re.compile(r'-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))')
|
||||
|
||||
|
||||
def cnv_length(attribute, arg, element):
|
||||
""" A (positive or negative) physical length, consisting of magnitude and unit, in conformance with the
|
||||
Units of Measure defined in §5.9.13 of [XSL].
|
||||
@ -126,27 +147,36 @@ def cnv_length(attribute, arg, element):
|
||||
raise ValueError("'%s' is not a valid length" % arg)
|
||||
return arg
|
||||
|
||||
|
||||
def cnv_lengthorpercent(attribute, arg, element):
|
||||
failed = False
|
||||
try: return cnv_length(attribute, arg, element)
|
||||
except: failed = True
|
||||
try: return cnv_percent(attribute, arg, element)
|
||||
except: failed = True
|
||||
try:
|
||||
return cnv_length(attribute, arg, element)
|
||||
except:
|
||||
failed = True
|
||||
try:
|
||||
return cnv_percent(attribute, arg, element)
|
||||
except:
|
||||
failed = True
|
||||
if failed:
|
||||
raise ValueError("'%s' is not a valid length or percent" % arg)
|
||||
return arg
|
||||
|
||||
|
||||
def cnv_metavaluetype(attribute, arg, element):
|
||||
if str(arg) not in ("float", "date", "time", "boolean", "string"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_major_minor(attribute, arg, element):
|
||||
if arg not in ('major','minor'):
|
||||
raise ValueError("'%s' is not either 'minor' or 'major'" % arg)
|
||||
|
||||
|
||||
pattern_namespacedToken = re.compile(r'[0-9a-zA-Z_]+:[0-9a-zA-Z._\-]+')
|
||||
|
||||
|
||||
def cnv_namespacedToken(attribute, arg, element):
|
||||
global pattern_namespacedToken
|
||||
|
||||
@ -154,6 +184,7 @@ def cnv_namespacedToken(attribute, arg, element):
|
||||
raise ValueError("'%s' is not a valid namespaced token" % arg)
|
||||
return __save_prefix(attribute, arg, element)
|
||||
|
||||
|
||||
def cnv_NCName(attribute, arg, element):
|
||||
""" NCName is defined in http://www.w3.org/TR/REC-xml-names/#NT-NCName
|
||||
Essentially an XML name minus ':'
|
||||
@ -167,6 +198,8 @@ def cnv_NCName(attribute, arg, element):
|
||||
# or a text string naming the style. If it is a text string, then it must
|
||||
# already have been converted to an NCName
|
||||
# The text-string argument is mainly for when we build a structure from XML
|
||||
|
||||
|
||||
def cnv_StyleNameRef(attribute, arg, element):
|
||||
try:
|
||||
return arg.getAttrNS(STYLENS, 'name')
|
||||
@ -177,6 +210,8 @@ def cnv_StyleNameRef(attribute, arg, element):
|
||||
# or a text string naming the style. If it is a text string, then it must
|
||||
# already have been converted to an NCName
|
||||
# The text-string argument is mainly for when we build a structure from XML
|
||||
|
||||
|
||||
def cnv_DrawNameRef(attribute, arg, element):
|
||||
try:
|
||||
return arg.getAttrNS(DRAWNS, 'name')
|
||||
@ -184,23 +219,31 @@ def cnv_DrawNameRef(attribute, arg, element):
|
||||
return arg
|
||||
|
||||
# Must accept list of Style objects
|
||||
|
||||
|
||||
def cnv_NCNames(attribute, arg, element):
|
||||
return ' '.join(arg)
|
||||
|
||||
|
||||
def cnv_nonNegativeInteger(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
pattern_percent = re.compile(r'-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%')
|
||||
|
||||
|
||||
def cnv_percent(attribute, arg, element):
|
||||
global pattern_percent
|
||||
if not pattern_percent.match(arg):
|
||||
raise ValueError("'%s' is not a valid length" % arg)
|
||||
return arg
|
||||
|
||||
|
||||
# Real one doesn't allow floating point values
|
||||
pattern_points = re.compile(r'-?[0-9]+,-?[0-9]+([ ]+-?[0-9]+,-?[0-9]+)*')
|
||||
#pattern_points = re.compile(r'-?[0-9.]+,-?[0-9.]+([ ]+-?[0-9.]+,-?[0-9.]+)*')
|
||||
|
||||
|
||||
def cnv_points(attribute, arg, element):
|
||||
global pattern_points
|
||||
if type(arg) in types.StringTypes:
|
||||
@ -214,32 +257,41 @@ def cnv_points(attribute, arg, element):
|
||||
raise ValueError("Points must be string or [(0,0),(1,1)] - not %s" % arg)
|
||||
return strarg
|
||||
|
||||
|
||||
def cnv_positiveInteger(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_string(attribute, arg, element):
|
||||
return type(u'')(arg)
|
||||
|
||||
|
||||
def cnv_textnoteclass(attribute, arg, element):
|
||||
if str(arg) not in ("footnote", "endnote"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
return str(arg)
|
||||
|
||||
# Understand different time formats
|
||||
|
||||
|
||||
def cnv_time(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
def cnv_token(attribute, arg, element):
|
||||
return str(arg)
|
||||
|
||||
|
||||
pattern_viewbox = re.compile(r'-?[0-9]+([ ]+-?[0-9]+){3}$')
|
||||
|
||||
|
||||
def cnv_viewbox(attribute, arg, element):
|
||||
global pattern_viewbox
|
||||
if not pattern_viewbox.match(arg):
|
||||
raise ValueError("viewBox must be four integers separated by whitespaces")
|
||||
return arg
|
||||
|
||||
|
||||
def cnv_xlinkshow(attribute, arg, element):
|
||||
if str(arg) not in ("new", "replace", "embed"):
|
||||
raise ValueError("'%s' not allowed" % str(arg))
|
||||
@ -1468,6 +1520,7 @@ attrconverters = {
|
||||
((XLINKNS,u'type'), None): cnv_string,
|
||||
}
|
||||
|
||||
|
||||
class AttrConverters:
|
||||
def convert(self, attribute, value, element):
|
||||
""" Based on the element, figures out how to check/convert the attribute value
|
||||
|
@ -22,65 +22,87 @@ from .namespaces import CHARTNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Axis(**args):
|
||||
return Element(qname=(CHARTNS,'axis'), **args)
|
||||
|
||||
|
||||
def Categories(**args):
|
||||
return Element(qname=(CHARTNS,'categories'), **args)
|
||||
|
||||
|
||||
def Chart(**args):
|
||||
return Element(qname=(CHARTNS,'chart'), **args)
|
||||
|
||||
|
||||
def DataPoint(**args):
|
||||
return Element(qname=(CHARTNS,'data-point'), **args)
|
||||
|
||||
|
||||
def Domain(**args):
|
||||
return Element(qname=(CHARTNS,'domain'), **args)
|
||||
|
||||
|
||||
def ErrorIndicator(**args):
|
||||
return Element(qname=(CHARTNS,'error-indicator'), **args)
|
||||
|
||||
|
||||
def Floor(**args):
|
||||
return Element(qname=(CHARTNS,'floor'), **args)
|
||||
|
||||
|
||||
def Footer(**args):
|
||||
return Element(qname=(CHARTNS,'footer'), **args)
|
||||
|
||||
|
||||
def Grid(**args):
|
||||
return Element(qname=(CHARTNS,'grid'), **args)
|
||||
|
||||
|
||||
def Legend(**args):
|
||||
return Element(qname=(CHARTNS,'legend'), **args)
|
||||
|
||||
|
||||
def MeanValue(**args):
|
||||
return Element(qname=(CHARTNS,'mean-value'), **args)
|
||||
|
||||
|
||||
def PlotArea(**args):
|
||||
return Element(qname=(CHARTNS,'plot-area'), **args)
|
||||
|
||||
|
||||
def RegressionCurve(**args):
|
||||
return Element(qname=(CHARTNS,'regression-curve'), **args)
|
||||
|
||||
|
||||
def Series(**args):
|
||||
return Element(qname=(CHARTNS,'series'), **args)
|
||||
|
||||
|
||||
def StockGainMarker(**args):
|
||||
return Element(qname=(CHARTNS,'stock-gain-marker'), **args)
|
||||
|
||||
|
||||
def StockLossMarker(**args):
|
||||
return Element(qname=(CHARTNS,'stock-loss-marker'), **args)
|
||||
|
||||
|
||||
def StockRangeLine(**args):
|
||||
return Element(qname=(CHARTNS,'stock-range-line'), **args)
|
||||
|
||||
|
||||
def Subtitle(**args):
|
||||
return Element(qname=(CHARTNS,'subtitle'), **args)
|
||||
|
||||
|
||||
def SymbolImage(**args):
|
||||
return Element(qname=(CHARTNS,'symbol-image'), **args)
|
||||
|
||||
|
||||
def Title(**args):
|
||||
return Element(qname=(CHARTNS,'title'), **args)
|
||||
|
||||
|
||||
def Wall(**args):
|
||||
return Element(qname=(CHARTNS,'wall'), **args)
|
||||
|
@ -22,17 +22,23 @@ from .namespaces import CONFIGNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def ConfigItem(**args):
|
||||
return Element(qname=(CONFIGNS, 'config-item'), **args)
|
||||
|
||||
|
||||
def ConfigItemMapEntry(**args):
|
||||
return Element(qname=(CONFIGNS,'config-item-map-entry'), **args)
|
||||
|
||||
|
||||
def ConfigItemMapIndexed(**args):
|
||||
return Element(qname=(CONFIGNS,'config-item-map-indexed'), **args)
|
||||
|
||||
|
||||
def ConfigItemMapNamed(**args):
|
||||
return Element(qname=(CONFIGNS,'config-item-map-named'), **args)
|
||||
|
||||
|
||||
def ConfigItemSet(**args):
|
||||
return Element(qname=(CONFIGNS, 'config-item-set'), **args)
|
||||
|
@ -22,21 +22,28 @@ from .namespaces import DCNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Creator(**args):
|
||||
return Element(qname=(DCNS,'creator'), **args)
|
||||
|
||||
|
||||
def Date(**args):
|
||||
return Element(qname=(DCNS,'date'), **args)
|
||||
|
||||
|
||||
def Description(**args):
|
||||
return Element(qname=(DCNS,'description'), **args)
|
||||
|
||||
|
||||
def Language(**args):
|
||||
return Element(qname=(DCNS,'language'), **args)
|
||||
|
||||
|
||||
def Subject(**args):
|
||||
return Element(qname=(DCNS,'subject'), **args)
|
||||
|
||||
|
||||
def Title(**args):
|
||||
return Element(qname=(DCNS,'title'), **args)
|
||||
|
||||
|
@ -23,20 +23,27 @@ from .element import Element
|
||||
from .draw import StyleRefElement
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Cube(**args):
|
||||
return StyleRefElement(qname=(DR3DNS,'cube'), **args)
|
||||
|
||||
|
||||
def Extrude(**args):
|
||||
return StyleRefElement(qname=(DR3DNS,'extrude'), **args)
|
||||
|
||||
|
||||
def Light(Element):
|
||||
return StyleRefElement(qname=(DR3DNS,'light'), **args)
|
||||
|
||||
|
||||
def Rotate(**args):
|
||||
return StyleRefElement(qname=(DR3DNS,'rotate'), **args)
|
||||
|
||||
|
||||
def Scene(**args):
|
||||
return StyleRefElement(qname=(DR3DNS,'scene'), **args)
|
||||
|
||||
|
||||
def Sphere(**args):
|
||||
return StyleRefElement(qname=(DR3DNS,'sphere'), **args)
|
||||
|
@ -21,6 +21,7 @@
|
||||
from .namespaces import DRAWNS, STYLENS, PRESENTATIONNS
|
||||
from .element import Element
|
||||
|
||||
|
||||
def StyleRefElement(stylename=None, classnames=None, **args):
|
||||
qattrs = {}
|
||||
if stylename is not None:
|
||||
@ -41,6 +42,7 @@ def StyleRefElement(stylename=None, classnames=None, **args):
|
||||
raise ValueError("Style's family must be either 'graphic' or 'presentation'")
|
||||
return Element(qattributes=qattrs, **args)
|
||||
|
||||
|
||||
def DrawElement(name=None, **args):
|
||||
e = Element(name=name, **args)
|
||||
if 'displayname' not in args:
|
||||
@ -48,134 +50,179 @@ def DrawElement(name=None, **args):
|
||||
return e
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def A(**args):
|
||||
return Element(qname=(DRAWNS,'a'), **args)
|
||||
|
||||
|
||||
def Applet(**args):
|
||||
return Element(qname=(DRAWNS,'applet'), **args)
|
||||
|
||||
|
||||
def AreaCircle(**args):
|
||||
return Element(qname=(DRAWNS,'area-circle'), **args)
|
||||
|
||||
|
||||
def AreaPolygon(**args):
|
||||
return Element(qname=(DRAWNS,'area-polygon'), **args)
|
||||
|
||||
|
||||
def AreaRectangle(**args):
|
||||
return Element(qname=(DRAWNS,'area-rectangle'), **args)
|
||||
|
||||
|
||||
def Caption(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'caption'), **args)
|
||||
|
||||
|
||||
def Circle(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'circle'), **args)
|
||||
|
||||
|
||||
def Connector(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'connector'), **args)
|
||||
|
||||
|
||||
def ContourPath(**args):
|
||||
return Element(qname=(DRAWNS,'contour-path'), **args)
|
||||
|
||||
|
||||
def ContourPolygon(**args):
|
||||
return Element(qname=(DRAWNS,'contour-polygon'), **args)
|
||||
|
||||
|
||||
def Control(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'control'), **args)
|
||||
|
||||
|
||||
def CustomShape(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'custom-shape'), **args)
|
||||
|
||||
|
||||
def Ellipse(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'ellipse'), **args)
|
||||
|
||||
|
||||
def EnhancedGeometry(**args):
|
||||
return Element(qname=(DRAWNS,'enhanced-geometry'), **args)
|
||||
|
||||
|
||||
def Equation(**args):
|
||||
return Element(qname=(DRAWNS,'equation'), **args)
|
||||
|
||||
|
||||
def FillImage(**args):
|
||||
return DrawElement(qname=(DRAWNS,'fill-image'), **args)
|
||||
|
||||
|
||||
def FloatingFrame(**args):
|
||||
return Element(qname=(DRAWNS,'floating-frame'), **args)
|
||||
|
||||
|
||||
def Frame(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'frame'), **args)
|
||||
|
||||
|
||||
def G(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'g'), **args)
|
||||
|
||||
|
||||
def GluePoint(**args):
|
||||
return Element(qname=(DRAWNS,'glue-point'), **args)
|
||||
|
||||
|
||||
def Gradient(**args):
|
||||
return DrawElement(qname=(DRAWNS,'gradient'), **args)
|
||||
|
||||
|
||||
def Handle(**args):
|
||||
return Element(qname=(DRAWNS,'handle'), **args)
|
||||
|
||||
|
||||
def Hatch(**args):
|
||||
return DrawElement(qname=(DRAWNS,'hatch'), **args)
|
||||
|
||||
|
||||
def Image(**args):
|
||||
return Element(qname=(DRAWNS,'image'), **args)
|
||||
|
||||
|
||||
def ImageMap(**args):
|
||||
return Element(qname=(DRAWNS,'image-map'), **args)
|
||||
|
||||
|
||||
def Layer(**args):
|
||||
return Element(qname=(DRAWNS,'layer'), **args)
|
||||
|
||||
|
||||
def LayerSet(**args):
|
||||
return Element(qname=(DRAWNS,'layer-set'), **args)
|
||||
|
||||
|
||||
def Line(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'line'), **args)
|
||||
|
||||
|
||||
def Marker(**args):
|
||||
return DrawElement(qname=(DRAWNS,'marker'), **args)
|
||||
|
||||
|
||||
def Measure(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'measure'), **args)
|
||||
|
||||
|
||||
def Object(**args):
|
||||
return Element(qname=(DRAWNS,'object'), **args)
|
||||
|
||||
|
||||
def ObjectOle(**args):
|
||||
return Element(qname=(DRAWNS,'object-ole'), **args)
|
||||
|
||||
|
||||
def Opacity(**args):
|
||||
return DrawElement(qname=(DRAWNS,'opacity'), **args)
|
||||
|
||||
|
||||
def Page(**args):
|
||||
return Element(qname=(DRAWNS,'page'), **args)
|
||||
|
||||
|
||||
def PageThumbnail(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'page-thumbnail'), **args)
|
||||
|
||||
|
||||
def Param(**args):
|
||||
return Element(qname=(DRAWNS,'param'), **args)
|
||||
|
||||
|
||||
def Path(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'path'), **args)
|
||||
|
||||
|
||||
def Plugin(**args):
|
||||
return Element(qname=(DRAWNS,'plugin'), **args)
|
||||
|
||||
|
||||
def Polygon(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'polygon'), **args)
|
||||
|
||||
|
||||
def Polyline(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'polyline'), **args)
|
||||
|
||||
|
||||
def Rect(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'rect'), **args)
|
||||
|
||||
|
||||
def RegularPolygon(**args):
|
||||
return StyleRefElement(qname=(DRAWNS,'regular-polygon'), **args)
|
||||
|
||||
|
||||
def StrokeDash(**args):
|
||||
return DrawElement(qname=(DRAWNS,'stroke-dash'), **args)
|
||||
|
||||
|
||||
def TextBox(**args):
|
||||
return Element(qname=(DRAWNS,'text-box'), **args)
|
||||
|
@ -41,10 +41,12 @@ _MAX_LIST_LEVEL = 10
|
||||
SHOW_ALL_LEVELS = True
|
||||
SHOW_ONE_LEVEL = False
|
||||
|
||||
|
||||
def styleFromString(name, specifiers, delim, spacing, showAllLevels):
|
||||
specArray = specifiers.split(delim)
|
||||
return styleFromList(name, specArray, spacing, showAllLevels)
|
||||
|
||||
|
||||
def styleFromList(styleName, specArray, spacing, showAllLevels):
|
||||
bullet = ""
|
||||
numPrefix = ""
|
||||
|
@ -31,6 +31,8 @@ from .attrconverters import AttrConverters
|
||||
# The following code is pasted form xml.sax.saxutils
|
||||
# Tt makes it possible to run the code without the xml sax package installed
|
||||
# To make it possible to have <rubbish> in your text elements, it is necessary to escape the texts
|
||||
|
||||
|
||||
def _escape(data, entities={}):
|
||||
""" Escape &, <, and > in a string of data.
|
||||
|
||||
@ -45,6 +47,7 @@ def _escape(data, entities={}):
|
||||
data = data.replace(chars, entity)
|
||||
return data
|
||||
|
||||
|
||||
def _quoteattr(data, entities={}):
|
||||
""" Escape and quote an attribute value.
|
||||
|
||||
@ -68,6 +71,7 @@ def _quoteattr(data, entities={}):
|
||||
data = '"%s"' % data
|
||||
return data
|
||||
|
||||
|
||||
def _nssplit(qualifiedName):
|
||||
""" Split a qualified name into namespace part and local part. """
|
||||
fields = qualifiedName.split(':', 1)
|
||||
@ -76,15 +80,21 @@ def _nssplit(qualifiedName):
|
||||
else:
|
||||
return (None, fields[0])
|
||||
|
||||
|
||||
def _nsassign(namespace):
|
||||
return nsdict.setdefault(namespace,"ns" + str(len(nsdict)))
|
||||
|
||||
# Exceptions
|
||||
|
||||
|
||||
class IllegalChild(Exception):
|
||||
""" Complains if you add an element to a parent where it is not allowed """
|
||||
|
||||
|
||||
class IllegalText(Exception):
|
||||
""" Complains if you add text or cdata to an element where it is not allowed """
|
||||
|
||||
|
||||
class Node(xml.dom.Node):
|
||||
""" super class for more specific nodes """
|
||||
parentNode = None
|
||||
@ -145,7 +155,7 @@ class Node(xml.dom.Node):
|
||||
if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
|
||||
for c in tuple(newChild.childNodes):
|
||||
self.appendChild(c)
|
||||
### The DOM does not clearly specify what to return in this case
|
||||
# The DOM does not clearly specify what to return in this case
|
||||
return newChild
|
||||
if newChild.nodeType not in self._child_node_types:
|
||||
raise IllegalChild("<%s> is not allowed in %s" % (newChild.tagName, self.tagName))
|
||||
@ -185,9 +195,11 @@ class Node(xml.dom.Node):
|
||||
val.append(type(u'')(c))
|
||||
return u''.join(val)
|
||||
|
||||
|
||||
defproperty(Node, "firstChild", doc="First child node, or None.")
|
||||
defproperty(Node, "lastChild", doc="Last child node, or None.")
|
||||
|
||||
|
||||
def _append_child(self, node):
|
||||
# fast path with less checks; usable by DOM builders if careful
|
||||
childNodes = self.childNodes
|
||||
@ -198,6 +210,7 @@ def _append_child(self, node):
|
||||
childNodes.append(node)
|
||||
node.__dict__["parentNode"] = self
|
||||
|
||||
|
||||
class Childless:
|
||||
""" Mixin that makes childless-ness easy to implement and avoids
|
||||
the complexity of the Node methods that deal with children.
|
||||
@ -237,6 +250,7 @@ class Childless:
|
||||
raise xml.dom.HierarchyRequestErr(
|
||||
self.tagName + " nodes do not have children")
|
||||
|
||||
|
||||
class Text(Childless, Node):
|
||||
nodeType = Node.TEXT_NODE
|
||||
tagName = "Text"
|
||||
@ -255,6 +269,7 @@ class Text(Childless, Node):
|
||||
if self.data:
|
||||
f.write(_escape(type(u'')(self.data).encode('utf-8')))
|
||||
|
||||
|
||||
class CDATASection(Text, Childless):
|
||||
nodeType = Node.CDATA_SECTION_NODE
|
||||
|
||||
@ -266,6 +281,7 @@ class CDATASection(Text, Childless):
|
||||
if self.data:
|
||||
f.write('<![CDATA[%s]]>' % self.data.replace(']]>',']]>]]><![CDATA['))
|
||||
|
||||
|
||||
class Element(Node):
|
||||
""" Creates a arbitrary element and is intended to be subclassed not used on its own.
|
||||
This element is the base of every element it defines a class which resembles
|
||||
@ -332,14 +348,16 @@ class Element(Node):
|
||||
"""
|
||||
global nsdict
|
||||
for ns,p in nsdict.items():
|
||||
if p == prefix: return ns
|
||||
if p == prefix:
|
||||
return ns
|
||||
return None
|
||||
|
||||
def get_nsprefix(self, namespace):
|
||||
""" Odfpy maintains a list of known namespaces. In some cases we have a namespace URL,
|
||||
and needs to look up or assign the prefix for it.
|
||||
"""
|
||||
if namespace is None: namespace = ""
|
||||
if namespace is None:
|
||||
namespace = ""
|
||||
prefix = _nsassign(namespace)
|
||||
if namespace not in self.namespaces:
|
||||
self.namespaces[namespace] = prefix
|
||||
|
@ -26,90 +26,119 @@ from .element import Element
|
||||
def Button(**args):
|
||||
return Element(qname=(FORMNS,'button'), **args)
|
||||
|
||||
|
||||
def Checkbox(**args):
|
||||
return Element(qname=(FORMNS,'checkbox'), **args)
|
||||
|
||||
|
||||
def Column(**args):
|
||||
return Element(qname=(FORMNS,'column'), **args)
|
||||
|
||||
|
||||
def Combobox(**args):
|
||||
return Element(qname=(FORMNS,'combobox'), **args)
|
||||
|
||||
|
||||
def ConnectionResource(**args):
|
||||
return Element(qname=(FORMNS,'connection-resource'), **args)
|
||||
|
||||
|
||||
def Date(**args):
|
||||
return Element(qname=(FORMNS,'date'), **args)
|
||||
|
||||
|
||||
def File(**args):
|
||||
return Element(qname=(FORMNS,'file'), **args)
|
||||
|
||||
|
||||
def FixedText(**args):
|
||||
return Element(qname=(FORMNS,'fixed-text'), **args)
|
||||
|
||||
|
||||
def Form(**args):
|
||||
return Element(qname=(FORMNS,'form'), **args)
|
||||
|
||||
|
||||
def FormattedText(**args):
|
||||
return Element(qname=(FORMNS,'formatted-text'), **args)
|
||||
|
||||
|
||||
def Frame(**args):
|
||||
return Element(qname=(FORMNS,'frame'), **args)
|
||||
|
||||
|
||||
def GenericControl(**args):
|
||||
return Element(qname=(FORMNS,'generic-control'), **args)
|
||||
|
||||
|
||||
def Grid(**args):
|
||||
return Element(qname=(FORMNS,'grid'), **args)
|
||||
|
||||
|
||||
def Hidden(**args):
|
||||
return Element(qname=(FORMNS,'hidden'), **args)
|
||||
|
||||
|
||||
def Image(**args):
|
||||
return Element(qname=(FORMNS,'image'), **args)
|
||||
|
||||
|
||||
def ImageFrame(**args):
|
||||
return Element(qname=(FORMNS,'image-frame'), **args)
|
||||
|
||||
|
||||
def Item(**args):
|
||||
return Element(qname=(FORMNS,'item'), **args)
|
||||
|
||||
|
||||
def ListProperty(**args):
|
||||
return Element(qname=(FORMNS,'list-property'), **args)
|
||||
|
||||
|
||||
def ListValue(**args):
|
||||
return Element(qname=(FORMNS,'list-value'), **args)
|
||||
|
||||
|
||||
def Listbox(**args):
|
||||
return Element(qname=(FORMNS,'listbox'), **args)
|
||||
|
||||
|
||||
def Number(**args):
|
||||
return Element(qname=(FORMNS,'number'), **args)
|
||||
|
||||
|
||||
def Option(**args):
|
||||
return Element(qname=(FORMNS,'option'), **args)
|
||||
|
||||
|
||||
def Password(**args):
|
||||
return Element(qname=(FORMNS,'password'), **args)
|
||||
|
||||
|
||||
def Properties(**args):
|
||||
return Element(qname=(FORMNS,'properties'), **args)
|
||||
|
||||
|
||||
def Property(**args):
|
||||
return Element(qname=(FORMNS,'property'), **args)
|
||||
|
||||
|
||||
def Radio(**args):
|
||||
return Element(qname=(FORMNS,'radio'), **args)
|
||||
|
||||
|
||||
def Text(**args):
|
||||
return Element(qname=(FORMNS,'text'), **args)
|
||||
|
||||
|
||||
def Textarea(**args):
|
||||
return Element(qname=(FORMNS,'textarea'), **args)
|
||||
|
||||
|
||||
def Time(**args):
|
||||
return Element(qname=(FORMNS,'time'), **args)
|
||||
|
||||
|
||||
def ValueRange(**args):
|
||||
return Element(qname=(FORMNS,'value-range'), **args)
|
||||
|
||||
|
@ -32,6 +32,8 @@ from .namespaces import OFFICENS
|
||||
#
|
||||
# Parse the XML files
|
||||
#
|
||||
|
||||
|
||||
class LoadParser(handler.ContentHandler):
|
||||
""" Extract headings from content.xml of an ODT file """
|
||||
triggers = (
|
||||
@ -95,7 +97,6 @@ class LoadParser(handler.ContentHandler):
|
||||
self.parent.addElement(e, check_grammar=False)
|
||||
self.parent = e
|
||||
|
||||
|
||||
def endElementNS(self, tag, qname):
|
||||
if self.parse == False:
|
||||
return
|
||||
|
@ -24,17 +24,23 @@ from .namespaces import MANIFESTNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Manifest(**args):
|
||||
return Element(qname=(MANIFESTNS,'manifest'), **args)
|
||||
|
||||
|
||||
def FileEntry(**args):
|
||||
return Element(qname=(MANIFESTNS,'file-entry'), **args)
|
||||
|
||||
|
||||
def EncryptionData(**args):
|
||||
return Element(qname=(MANIFESTNS,'encryption-data'), **args)
|
||||
|
||||
|
||||
def Algorithm(**args):
|
||||
return Element(qname=(MANIFESTNS,'algorithm'), **args)
|
||||
|
||||
|
||||
def KeyDerivation(**args):
|
||||
return Element(qname=(MANIFESTNS,'key-derivation'), **args)
|
||||
|
@ -25,6 +25,8 @@ from .element import Element
|
||||
# Mathematical content is represented by MathML 2.0
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Math(**args):
|
||||
return Element(qname=(MATHNS,'math'), **args)
|
||||
|
||||
|
@ -22,45 +22,60 @@ from .namespaces import METANS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def AutoReload(**args):
|
||||
return Element(qname=(METANS,'auto-reload'), **args)
|
||||
|
||||
|
||||
def CreationDate(**args):
|
||||
return Element(qname=(METANS,'creation-date'), **args)
|
||||
|
||||
|
||||
def DateString(**args):
|
||||
return Element(qname=(METANS,'date-string'), **args)
|
||||
|
||||
|
||||
def DocumentStatistic(**args):
|
||||
return Element(qname=(METANS,'document-statistic'), **args)
|
||||
|
||||
|
||||
def EditingCycles(**args):
|
||||
return Element(qname=(METANS,'editing-cycles'), **args)
|
||||
|
||||
|
||||
def EditingDuration(**args):
|
||||
return Element(qname=(METANS,'editing-duration'), **args)
|
||||
|
||||
|
||||
def Generator(**args):
|
||||
return Element(qname=(METANS,'generator'), **args)
|
||||
|
||||
|
||||
def HyperlinkBehaviour(**args):
|
||||
return Element(qname=(METANS,'hyperlink-behaviour'), **args)
|
||||
|
||||
|
||||
def InitialCreator(**args):
|
||||
return Element(qname=(METANS,'initial-creator'), **args)
|
||||
|
||||
|
||||
def Keyword(**args):
|
||||
return Element(qname=(METANS,'keyword'), **args)
|
||||
|
||||
|
||||
def PrintDate(**args):
|
||||
return Element(qname=(METANS,'print-date'), **args)
|
||||
|
||||
|
||||
def PrintedBy(**args):
|
||||
return Element(qname=(METANS,'printed-by'), **args)
|
||||
|
||||
|
||||
def Template(**args):
|
||||
return Element(qname=(METANS,'template'), **args)
|
||||
|
||||
|
||||
def UserDefined(**args):
|
||||
return Element(qname=(METANS,'user-defined'), **args)
|
||||
|
||||
|
@ -27,77 +27,102 @@ from .style import StyleElement
|
||||
def AmPm(**args):
|
||||
return Element(qname=(NUMBERNS,'am-pm'), **args)
|
||||
|
||||
|
||||
def Boolean(**args):
|
||||
return Element(qname=(NUMBERNS,'boolean'), **args)
|
||||
|
||||
|
||||
def BooleanStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'boolean-style'), **args)
|
||||
|
||||
|
||||
def CurrencyStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'currency-style'), **args)
|
||||
|
||||
|
||||
def CurrencySymbol(**args):
|
||||
return Element(qname=(NUMBERNS,'currency-symbol'), **args)
|
||||
|
||||
|
||||
def DateStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'date-style'), **args)
|
||||
|
||||
|
||||
def Day(**args):
|
||||
return Element(qname=(NUMBERNS,'day'), **args)
|
||||
|
||||
|
||||
def DayOfWeek(**args):
|
||||
return Element(qname=(NUMBERNS,'day-of-week'), **args)
|
||||
|
||||
|
||||
def EmbeddedText(**args):
|
||||
return Element(qname=(NUMBERNS,'embedded-text'), **args)
|
||||
|
||||
|
||||
def Era(**args):
|
||||
return Element(qname=(NUMBERNS,'era'), **args)
|
||||
|
||||
|
||||
def Fraction(**args):
|
||||
return Element(qname=(NUMBERNS,'fraction'), **args)
|
||||
|
||||
|
||||
def Hours(**args):
|
||||
return Element(qname=(NUMBERNS,'hours'), **args)
|
||||
|
||||
|
||||
def Minutes(**args):
|
||||
return Element(qname=(NUMBERNS,'minutes'), **args)
|
||||
|
||||
|
||||
def Month(**args):
|
||||
return Element(qname=(NUMBERNS,'month'), **args)
|
||||
|
||||
|
||||
def Number(**args):
|
||||
return Element(qname=(NUMBERNS,'number'), **args)
|
||||
|
||||
|
||||
def NumberStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'number-style'), **args)
|
||||
|
||||
|
||||
def PercentageStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'percentage-style'), **args)
|
||||
|
||||
|
||||
def Quarter(**args):
|
||||
return Element(qname=(NUMBERNS,'quarter'), **args)
|
||||
|
||||
|
||||
def ScientificNumber(**args):
|
||||
return Element(qname=(NUMBERNS,'scientific-number'), **args)
|
||||
|
||||
|
||||
def Seconds(**args):
|
||||
return Element(qname=(NUMBERNS,'seconds'), **args)
|
||||
|
||||
|
||||
def Text(**args):
|
||||
return Element(qname=(NUMBERNS,'text'), **args)
|
||||
|
||||
|
||||
def TextContent(**args):
|
||||
return Element(qname=(NUMBERNS,'text-content'), **args)
|
||||
|
||||
|
||||
def TextStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'text-style'), **args)
|
||||
|
||||
|
||||
def TimeStyle(**args):
|
||||
return StyleElement(qname=(NUMBERNS,'time-style'), **args)
|
||||
|
||||
|
||||
def WeekOfYear(**args):
|
||||
return Element(qname=(NUMBERNS,'week-of-year'), **args)
|
||||
|
||||
|
||||
def Year(**args):
|
||||
return Element(qname=(NUMBERNS,'year'), **args)
|
||||
|
@ -100,6 +100,7 @@ class TextProps:
|
||||
str(self.bold),
|
||||
str(self.fixed))
|
||||
|
||||
|
||||
class ParagraphProps:
|
||||
""" Holds properties of a paragraph style. """
|
||||
|
||||
@ -123,7 +124,6 @@ class ParagraphProps:
|
||||
def setCode(self, value):
|
||||
self.code = value
|
||||
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return "[bq=%s, h=%d, code=%s]" % (str(self.blockquote),
|
||||
@ -141,10 +141,8 @@ class ListProperties:
|
||||
self.ordered = value
|
||||
|
||||
|
||||
|
||||
class ODF2MoinMoin(object):
|
||||
|
||||
|
||||
def __init__(self, filepath):
|
||||
self.footnotes = []
|
||||
self.footnoteCounter = 0
|
||||
@ -183,8 +181,6 @@ class ODF2MoinMoin(object):
|
||||
if fontFace.getAttribute("style:font-pitch") == "fixed":
|
||||
self.fixedFonts.append(fontFace.getAttribute("style:name"))
|
||||
|
||||
|
||||
|
||||
def extractTextProperties(self, style, parent=None):
|
||||
""" Extracts text properties from a style element. """
|
||||
|
||||
@ -196,7 +192,8 @@ class ODF2MoinMoin(object):
|
||||
textProp = parentProp
|
||||
|
||||
textPropEl = style.getElementsByTagName("style:text-properties")
|
||||
if not textPropEl: return textProps
|
||||
if not textPropEl:
|
||||
return textProps
|
||||
|
||||
textPropEl = textPropEl[0]
|
||||
|
||||
@ -247,7 +244,6 @@ class ODF2MoinMoin(object):
|
||||
|
||||
return paraProps
|
||||
|
||||
|
||||
def processStyles(self, styleElements):
|
||||
""" Runs through "style" elements extracting necessary information.
|
||||
"""
|
||||
@ -256,7 +252,8 @@ class ODF2MoinMoin(object):
|
||||
|
||||
name = style.getAttribute("style:name")
|
||||
|
||||
if name == "Standard": continue
|
||||
if name == "Standard":
|
||||
continue
|
||||
|
||||
family = style.getAttribute("style:family")
|
||||
parent = style.getAttribute("style:parent-style-name")
|
||||
@ -284,7 +281,6 @@ class ODF2MoinMoin(object):
|
||||
|
||||
self.listStyles[name] = prop
|
||||
|
||||
|
||||
def load(self, filepath):
|
||||
""" Loads an ODT file. """
|
||||
|
||||
@ -344,7 +340,6 @@ class ODF2MoinMoin(object):
|
||||
else:
|
||||
return "[%s %s] " % (link.strip(), text.strip())
|
||||
|
||||
|
||||
def text_line_break(self, node):
|
||||
return "[[BR]]"
|
||||
|
||||
@ -448,7 +443,6 @@ class ODF2MoinMoin(object):
|
||||
self.lastsegment = cell.tagName
|
||||
return ''.join(buffer)
|
||||
|
||||
|
||||
def toString(self):
|
||||
""" Converts the document to a string.
|
||||
FIXME: Result from second call differs from first call
|
||||
@ -480,11 +474,9 @@ class ODF2MoinMoin(object):
|
||||
for cite, body in self.footnotes:
|
||||
buffer.append("%s: %s" % (cite, body))
|
||||
|
||||
|
||||
buffer.append("")
|
||||
return self.compressCodeBlocks('\n'.join(buffer))
|
||||
|
||||
|
||||
def textToString(self, element):
|
||||
|
||||
buffer = []
|
||||
@ -539,7 +531,8 @@ class ODF2MoinMoin(object):
|
||||
if outlinelevel:
|
||||
|
||||
level = int(outlinelevel)
|
||||
if self.hasTitle: level += 1
|
||||
if self.hasTitle:
|
||||
level += 1
|
||||
|
||||
if level >= 1:
|
||||
return "=" * level + " " + text + " " + "=" * level + "\n"
|
||||
@ -553,7 +546,6 @@ class ODF2MoinMoin(object):
|
||||
else:
|
||||
return self.wrapParagraph(text, indent=indent)
|
||||
|
||||
|
||||
def wrapParagraph(self, text, indent=0, blockquote=False):
|
||||
|
||||
counter = 0
|
||||
|
@ -35,6 +35,7 @@ MANIFESTNS="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class ODFManifestHandler(handler.ContentHandler):
|
||||
""" The ODFManifestHandler parses a manifest file and produces a list of
|
||||
content """
|
||||
@ -103,12 +104,14 @@ def manifestlist(manifestxml):
|
||||
|
||||
return odhandler.manifest
|
||||
|
||||
|
||||
def odfmanifest(odtfile):
|
||||
z = zipfile.ZipFile(odtfile)
|
||||
manifest = z.read('META-INF/manifest.xml')
|
||||
z.close()
|
||||
return manifestlist(manifest)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
result = odfmanifest(sys.argv[1])
|
||||
|
@ -23,81 +23,108 @@ from .element import Element
|
||||
from .draw import StyleRefElement
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Annotation(**args):
|
||||
return StyleRefElement(qname=(OFFICENS,'annotation'), **args)
|
||||
|
||||
|
||||
def AutomaticStyles(**args):
|
||||
return Element(qname=(OFFICENS, 'automatic-styles'), **args)
|
||||
|
||||
|
||||
def BinaryData(**args):
|
||||
return Element(qname=(OFFICENS,'binary-data'), **args)
|
||||
|
||||
|
||||
def Body(**args):
|
||||
return Element(qname=(OFFICENS, 'body'), **args)
|
||||
|
||||
|
||||
def ChangeInfo(**args):
|
||||
return Element(qname=(OFFICENS,'change-info'), **args)
|
||||
|
||||
|
||||
def Chart(**args):
|
||||
return Element(qname=(OFFICENS,'chart'), **args)
|
||||
|
||||
|
||||
def DdeSource(**args):
|
||||
return Element(qname=(OFFICENS,'dde-source'), **args)
|
||||
|
||||
|
||||
def Document(version="1.1", **args):
|
||||
return Element(qname=(OFFICENS,'document'), version=version, **args)
|
||||
|
||||
|
||||
def DocumentContent(version="1.1", **args):
|
||||
return Element(qname=(OFFICENS, 'document-content'), version=version, **args)
|
||||
|
||||
|
||||
def DocumentMeta(version="1.1", **args):
|
||||
return Element(qname=(OFFICENS, 'document-meta'), version=version, **args)
|
||||
|
||||
|
||||
def DocumentSettings(version="1.1", **args):
|
||||
return Element(qname=(OFFICENS, 'document-settings'), version=version, **args)
|
||||
|
||||
|
||||
def DocumentStyles(version="1.1", **args):
|
||||
return Element(qname=(OFFICENS, 'document-styles'), version=version, **args)
|
||||
|
||||
|
||||
def Drawing(**args):
|
||||
return Element(qname=(OFFICENS,'drawing'), **args)
|
||||
|
||||
|
||||
def EventListeners(**args):
|
||||
return Element(qname=(OFFICENS,'event-listeners'), **args)
|
||||
|
||||
|
||||
def FontFaceDecls(**args):
|
||||
return Element(qname=(OFFICENS, 'font-face-decls'), **args)
|
||||
|
||||
|
||||
def Forms(**args):
|
||||
return Element(qname=(OFFICENS,'forms'), **args)
|
||||
|
||||
|
||||
def Image(**args):
|
||||
return Element(qname=(OFFICENS,'image'), **args)
|
||||
|
||||
|
||||
def MasterStyles(**args):
|
||||
return Element(qname=(OFFICENS, 'master-styles'), **args)
|
||||
|
||||
|
||||
def Meta(**args):
|
||||
return Element(qname=(OFFICENS, 'meta'), **args)
|
||||
|
||||
|
||||
def Presentation(**args):
|
||||
return Element(qname=(OFFICENS,'presentation'), **args)
|
||||
|
||||
|
||||
def Script(**args):
|
||||
return Element(qname=(OFFICENS, 'script'), **args)
|
||||
|
||||
|
||||
def Scripts(**args):
|
||||
return Element(qname=(OFFICENS, 'scripts'), **args)
|
||||
|
||||
|
||||
def Settings(**args):
|
||||
return Element(qname=(OFFICENS, 'settings'), **args)
|
||||
|
||||
|
||||
def Spreadsheet(**args):
|
||||
return Element(qname=(OFFICENS, 'spreadsheet'), **args)
|
||||
|
||||
|
||||
def Styles(**args):
|
||||
return Element(qname=(OFFICENS, 'styles'), **args)
|
||||
|
||||
|
||||
def Text(**args):
|
||||
return Element(qname=(OFFICENS, 'text'), **args)
|
||||
|
||||
|
@ -64,12 +64,14 @@ odmimetypes = {
|
||||
'application/vnd.oasis.opendocument.text-web': '.oth',
|
||||
}
|
||||
|
||||
|
||||
class OpaqueObject:
|
||||
def __init__(self, filename, mediatype, content=None):
|
||||
self.mediatype = mediatype
|
||||
self.filename = filename
|
||||
self.content = content
|
||||
|
||||
|
||||
class OpenDocument:
|
||||
""" A class to hold the content of an OpenDocument document
|
||||
Use the xml method to write the XML
|
||||
@ -110,7 +112,8 @@ class OpenDocument:
|
||||
self.topnode.addElement(self.body)
|
||||
|
||||
def rebuild_caches(self, node=None):
|
||||
if node is None: node = self.topnode
|
||||
if node is None:
|
||||
node = self.topnode
|
||||
self.build_caches(node)
|
||||
for e in node.childNodes:
|
||||
if e.nodeType == element.Node.ELEMENT_NODE:
|
||||
@ -171,7 +174,6 @@ class OpenDocument:
|
||||
self.topnode.toXml(0, xml)
|
||||
return xml.getvalue()
|
||||
|
||||
|
||||
def contentxml(self):
|
||||
""" Generates the content.xml file
|
||||
Always written as a bytestream in UTF-8 encoding
|
||||
@ -295,8 +297,10 @@ class OpenDocument:
|
||||
mediatype, encoding = mimetypes.guess_type(filename)
|
||||
if mediatype is None:
|
||||
mediatype = ''
|
||||
try: ext = filename[filename.rindex('.'):]
|
||||
except: ext=''
|
||||
try:
|
||||
ext = filename[filename.rindex('.'):]
|
||||
except:
|
||||
ext=''
|
||||
else:
|
||||
ext = mimetypes.guess_extension(mediatype)
|
||||
manifestfn = "Pictures/%0.0f%s" % ((time.time()*10000000000), ext)
|
||||
@ -317,8 +321,10 @@ class OpenDocument:
|
||||
mediatype, encoding = mimetypes.guess_type(filename)
|
||||
if mediatype is None:
|
||||
mediatype = ''
|
||||
try: ext = filename[filename.rindex('.'):]
|
||||
except ValueError: ext=''
|
||||
try:
|
||||
ext = filename[filename.rindex('.'):]
|
||||
except ValueError:
|
||||
ext=''
|
||||
else:
|
||||
ext = mimetypes.guess_extension(mediatype)
|
||||
manifestfn = "Pictures/%0.0f%s" % ((time.time()*10000000000), ext)
|
||||
@ -439,7 +445,8 @@ class OpenDocument:
|
||||
|
||||
# Write any extra files
|
||||
for op in self._extra:
|
||||
if op.filename == "META-INF/documentsignatures.xml": continue # Don't save signatures
|
||||
if op.filename == "META-INF/documentsignatures.xml":
|
||||
continue # Don't save signatures
|
||||
self.manifest.addElement(manifest.FileEntry(fullpath=op.filename, mediatype=op.mediatype))
|
||||
zi = zipfile.ZipInfo(op.filename.encode('utf-8'), self._now)
|
||||
zi.compress_type = zipfile.ZIP_DEFLATED
|
||||
@ -455,7 +462,6 @@ class OpenDocument:
|
||||
del self._now
|
||||
del self.manifest
|
||||
|
||||
|
||||
def _saveXmlObjects(self, object, folder):
|
||||
if self == object:
|
||||
self.manifest.addElement(manifest.FileEntry(fullpath="/", mediatype=object.mimetype))
|
||||
@ -531,6 +537,8 @@ class OpenDocument:
|
||||
return self.element_dict.get(obj.qname, [])
|
||||
|
||||
# Convenience functions
|
||||
|
||||
|
||||
def OpenDocumentChart():
|
||||
""" Creates a chart document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.chart')
|
||||
@ -538,6 +546,7 @@ def OpenDocumentChart():
|
||||
doc.body.addElement(doc.chart)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentDrawing():
|
||||
""" Creates a drawing document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.graphics')
|
||||
@ -545,6 +554,7 @@ def OpenDocumentDrawing():
|
||||
doc.body.addElement(doc.drawing)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentImage():
|
||||
""" Creates an image document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.image')
|
||||
@ -552,6 +562,7 @@ def OpenDocumentImage():
|
||||
doc.body.addElement(doc.image)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentPresentation():
|
||||
""" Creates a presentation document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.presentation')
|
||||
@ -559,6 +570,7 @@ def OpenDocumentPresentation():
|
||||
doc.body.addElement(doc.presentation)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentSpreadsheet():
|
||||
""" Creates a spreadsheet document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.spreadsheet')
|
||||
@ -566,6 +578,7 @@ def OpenDocumentSpreadsheet():
|
||||
doc.body.addElement(doc.spreadsheet)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentText():
|
||||
""" Creates a text document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.text')
|
||||
@ -573,6 +586,7 @@ def OpenDocumentText():
|
||||
doc.body.addElement(doc.text)
|
||||
return doc
|
||||
|
||||
|
||||
def OpenDocumentTextMaster():
|
||||
""" Creates a text master document """
|
||||
doc = OpenDocument('application/vnd.oasis.opendocument.text-master')
|
||||
@ -605,6 +619,7 @@ def __loadxmlparts(z, manifest, doc, objectpath):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
def load(odffile):
|
||||
""" Load an ODF file into memory
|
||||
Returns a reference to the structure
|
||||
|
@ -23,63 +23,84 @@ from .element import Element
|
||||
|
||||
# ODF 1.0 section 9.6 and 9.7
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def AnimationGroup(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'animation-group'), **args)
|
||||
|
||||
|
||||
def Animations(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'animations'), **args)
|
||||
|
||||
|
||||
def DateTime(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'date-time'), **args)
|
||||
|
||||
|
||||
def DateTimeDecl(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'date-time-decl'), **args)
|
||||
|
||||
|
||||
def Dim(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'dim'), **args)
|
||||
|
||||
|
||||
def EventListener(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'event-listener'), **args)
|
||||
|
||||
|
||||
def Footer(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'footer'), **args)
|
||||
|
||||
|
||||
def FooterDecl(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'footer-decl'), **args)
|
||||
|
||||
|
||||
def Header(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'header'), **args)
|
||||
|
||||
|
||||
def HeaderDecl(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'header-decl'), **args)
|
||||
|
||||
|
||||
def HideShape(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'hide-shape'), **args)
|
||||
|
||||
|
||||
def HideText(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'hide-text'), **args)
|
||||
|
||||
|
||||
def Notes(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'notes'), **args)
|
||||
|
||||
|
||||
def Placeholder(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'placeholder'), **args)
|
||||
|
||||
|
||||
def Play(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'play'), **args)
|
||||
|
||||
|
||||
def Settings(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'settings'), **args)
|
||||
|
||||
|
||||
def Show(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'show'), **args)
|
||||
|
||||
|
||||
def ShowShape(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'show-shape'), **args)
|
||||
|
||||
|
||||
def ShowText(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'show-text'), **args)
|
||||
|
||||
|
||||
def Sound(**args):
|
||||
return Element(qname=(PRESENTATIONNS,'sound'), **args)
|
||||
|
||||
|
@ -25,6 +25,8 @@ from .element import Element
|
||||
# The <script:event-listener> element binds an event to a macro.
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def EventListener(**args):
|
||||
return Element(qname=(SCRIPTNS,'event-listener'), **args)
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
from .namespaces import STYLENS
|
||||
from .element import Element
|
||||
|
||||
|
||||
def StyleElement(**args):
|
||||
e = Element(**args)
|
||||
if args.get('check_grammar', True) == True:
|
||||
@ -29,119 +30,159 @@ def StyleElement(**args):
|
||||
return e
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def BackgroundImage(**args):
|
||||
return Element(qname=(STYLENS,'background-image'), **args)
|
||||
|
||||
|
||||
def ChartProperties(**args):
|
||||
return Element(qname=(STYLENS,'chart-properties'), **args)
|
||||
|
||||
|
||||
def Column(**args):
|
||||
return Element(qname=(STYLENS,'column'), **args)
|
||||
|
||||
|
||||
def ColumnSep(**args):
|
||||
return Element(qname=(STYLENS,'column-sep'), **args)
|
||||
|
||||
|
||||
def Columns(**args):
|
||||
return Element(qname=(STYLENS,'columns'), **args)
|
||||
|
||||
|
||||
def DefaultStyle(**args):
|
||||
return Element(qname=(STYLENS,'default-style'), **args)
|
||||
|
||||
|
||||
def DrawingPageProperties(**args):
|
||||
return Element(qname=(STYLENS,'drawing-page-properties'), **args)
|
||||
|
||||
|
||||
def DropCap(**args):
|
||||
return Element(qname=(STYLENS,'drop-cap'), **args)
|
||||
|
||||
|
||||
def FontFace(**args):
|
||||
return Element(qname=(STYLENS,'font-face'), **args)
|
||||
|
||||
|
||||
def Footer(**args):
|
||||
return Element(qname=(STYLENS,'footer'), **args)
|
||||
|
||||
|
||||
def FooterLeft(**args):
|
||||
return Element(qname=(STYLENS,'footer-left'), **args)
|
||||
|
||||
|
||||
def FooterStyle(**args):
|
||||
return Element(qname=(STYLENS,'footer-style'), **args)
|
||||
|
||||
|
||||
def FootnoteSep(**args):
|
||||
return Element(qname=(STYLENS,'footnote-sep'), **args)
|
||||
|
||||
|
||||
def GraphicProperties(**args):
|
||||
return Element(qname=(STYLENS,'graphic-properties'), **args)
|
||||
|
||||
|
||||
def HandoutMaster(**args):
|
||||
return Element(qname=(STYLENS,'handout-master'), **args)
|
||||
|
||||
|
||||
def Header(**args):
|
||||
return Element(qname=(STYLENS,'header'), **args)
|
||||
|
||||
|
||||
def HeaderFooterProperties(**args):
|
||||
return Element(qname=(STYLENS,'header-footer-properties'), **args)
|
||||
|
||||
|
||||
def HeaderLeft(**args):
|
||||
return Element(qname=(STYLENS,'header-left'), **args)
|
||||
|
||||
|
||||
def HeaderStyle(**args):
|
||||
return Element(qname=(STYLENS,'header-style'), **args)
|
||||
|
||||
|
||||
def ListLevelProperties(**args):
|
||||
return Element(qname=(STYLENS,'list-level-properties'), **args)
|
||||
|
||||
|
||||
def Map(**args):
|
||||
return Element(qname=(STYLENS,'map'), **args)
|
||||
|
||||
|
||||
def MasterPage(**args):
|
||||
return StyleElement(qname=(STYLENS,'master-page'), **args)
|
||||
|
||||
|
||||
def PageLayout(**args):
|
||||
return Element(qname=(STYLENS,'page-layout'), **args)
|
||||
|
||||
|
||||
def PageLayoutProperties(**args):
|
||||
return Element(qname=(STYLENS,'page-layout-properties'), **args)
|
||||
|
||||
|
||||
def ParagraphProperties(**args):
|
||||
return Element(qname=(STYLENS,'paragraph-properties'), **args)
|
||||
|
||||
|
||||
def PresentationPageLayout(**args):
|
||||
return StyleElement(qname=(STYLENS,'presentation-page-layout'), **args)
|
||||
|
||||
|
||||
def RegionCenter(**args):
|
||||
return Element(qname=(STYLENS,'region-center'), **args)
|
||||
|
||||
|
||||
def RegionLeft(**args):
|
||||
return Element(qname=(STYLENS,'region-left'), **args)
|
||||
|
||||
|
||||
def RegionRight(**args):
|
||||
return Element(qname=(STYLENS,'region-right'), **args)
|
||||
|
||||
|
||||
def RubyProperties(**args):
|
||||
return Element(qname=(STYLENS,'ruby-properties'), **args)
|
||||
|
||||
|
||||
def SectionProperties(**args):
|
||||
return Element(qname=(STYLENS,'section-properties'), **args)
|
||||
|
||||
|
||||
def Style(**args):
|
||||
return StyleElement(qname=(STYLENS,'style'), **args)
|
||||
|
||||
|
||||
def TabStop(**args):
|
||||
return Element(qname=(STYLENS,'tab-stop'), **args)
|
||||
|
||||
|
||||
def TabStops(**args):
|
||||
return Element(qname=(STYLENS,'tab-stops'), **args)
|
||||
|
||||
|
||||
def TableCellProperties(**args):
|
||||
return Element(qname=(STYLENS,'table-cell-properties'), **args)
|
||||
|
||||
|
||||
def TableColumnProperties(**args):
|
||||
return Element(qname=(STYLENS,'table-column-properties'), **args)
|
||||
|
||||
|
||||
def TableProperties(**args):
|
||||
return Element(qname=(STYLENS,'table-properties'), **args)
|
||||
|
||||
|
||||
def TableRowProperties(**args):
|
||||
return Element(qname=(STYLENS,'table-row-properties'), **args)
|
||||
|
||||
|
||||
def TextProperties(**args):
|
||||
return Element(qname=(STYLENS,'text-properties'), **args)
|
||||
|
@ -23,32 +23,43 @@ from .element import Element
|
||||
from draw import DrawElement
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def DefinitionSrc(**args):
|
||||
return Element(qname=(SVGNS,'definition-src'), **args)
|
||||
|
||||
|
||||
def Desc(**args):
|
||||
return Element(qname=(SVGNS,'desc'), **args)
|
||||
|
||||
|
||||
def FontFaceFormat(**args):
|
||||
return Element(qname=(SVGNS,'font-face-format'), **args)
|
||||
|
||||
|
||||
def FontFaceName(**args):
|
||||
return Element(qname=(SVGNS,'font-face-name'), **args)
|
||||
|
||||
|
||||
def FontFaceSrc(**args):
|
||||
return Element(qname=(SVGNS,'font-face-src'), **args)
|
||||
|
||||
|
||||
def FontFaceUri(**args):
|
||||
return Element(qname=(SVGNS,'font-face-uri'), **args)
|
||||
|
||||
|
||||
def Lineargradient(**args):
|
||||
return DrawElement(qname=(SVGNS,'linearGradient'), **args)
|
||||
|
||||
|
||||
def Radialgradient(**args):
|
||||
return DrawElement(qname=(SVGNS,'radialGradient'), **args)
|
||||
|
||||
|
||||
def Stop(**args):
|
||||
return Element(qname=(SVGNS,'stop'), **args)
|
||||
|
||||
|
||||
def Title(**args):
|
||||
return Element(qname=(SVGNS,'title'), **args)
|
||||
|
@ -26,282 +26,375 @@ from .element import Element
|
||||
def Body(**args):
|
||||
return Element(qname=(TABLENS,'body'), **args)
|
||||
|
||||
|
||||
def CalculationSettings(**args):
|
||||
return Element(qname=(TABLENS,'calculation-settings'), **args)
|
||||
|
||||
|
||||
def CellAddress(**args):
|
||||
return Element(qname=(TABLENS,'cell-address'), **args)
|
||||
|
||||
|
||||
def CellContentChange(**args):
|
||||
return Element(qname=(TABLENS,'cell-content-change'), **args)
|
||||
|
||||
|
||||
def CellContentDeletion(**args):
|
||||
return Element(qname=(TABLENS,'cell-content-deletion'), **args)
|
||||
|
||||
|
||||
def CellRangeSource(**args):
|
||||
return Element(qname=(TABLENS,'cell-range-source'), **args)
|
||||
|
||||
|
||||
def ChangeDeletion(**args):
|
||||
return Element(qname=(TABLENS,'change-deletion'), **args)
|
||||
|
||||
|
||||
def ChangeTrackTableCell(**args):
|
||||
return Element(qname=(TABLENS,'change-track-table-cell'), **args)
|
||||
|
||||
|
||||
def Consolidation(**args):
|
||||
return Element(qname=(TABLENS,'consolidation'), **args)
|
||||
|
||||
|
||||
def ContentValidation(**args):
|
||||
return Element(qname=(TABLENS,'content-validation'), **args)
|
||||
|
||||
|
||||
def ContentValidations(**args):
|
||||
return Element(qname=(TABLENS,'content-validations'), **args)
|
||||
|
||||
|
||||
def CoveredTableCell(**args):
|
||||
return Element(qname=(TABLENS,'covered-table-cell'), **args)
|
||||
|
||||
|
||||
def CutOffs(**args):
|
||||
return Element(qname=(TABLENS,'cut-offs'), **args)
|
||||
|
||||
|
||||
def DataPilotDisplayInfo(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-display-info'), **args)
|
||||
|
||||
|
||||
def DataPilotField(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-field'), **args)
|
||||
|
||||
|
||||
def DataPilotFieldReference(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-field-reference'), **args)
|
||||
|
||||
|
||||
def DataPilotGroup(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-group'), **args)
|
||||
|
||||
|
||||
def DataPilotGroupMember(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-group-member'), **args)
|
||||
|
||||
|
||||
def DataPilotGroups(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-groups'), **args)
|
||||
|
||||
|
||||
def DataPilotLayoutInfo(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-layout-info'), **args)
|
||||
|
||||
|
||||
def DataPilotLevel(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-level'), **args)
|
||||
|
||||
|
||||
def DataPilotMember(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-member'), **args)
|
||||
|
||||
|
||||
def DataPilotMembers(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-members'), **args)
|
||||
|
||||
|
||||
def DataPilotSortInfo(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-sort-info'), **args)
|
||||
|
||||
|
||||
def DataPilotSubtotal(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-subtotal'), **args)
|
||||
|
||||
|
||||
def DataPilotSubtotals(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-subtotals'), **args)
|
||||
|
||||
|
||||
def DataPilotTable(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-table'), **args)
|
||||
|
||||
|
||||
def DataPilotTables(**args):
|
||||
return Element(qname=(TABLENS,'data-pilot-tables'), **args)
|
||||
|
||||
|
||||
def DatabaseRange(**args):
|
||||
return Element(qname=(TABLENS,'database-range'), **args)
|
||||
|
||||
|
||||
def DatabaseRanges(**args):
|
||||
return Element(qname=(TABLENS,'database-ranges'), **args)
|
||||
|
||||
|
||||
def DatabaseSourceQuery(**args):
|
||||
return Element(qname=(TABLENS,'database-source-query'), **args)
|
||||
|
||||
|
||||
def DatabaseSourceSql(**args):
|
||||
return Element(qname=(TABLENS,'database-source-sql'), **args)
|
||||
|
||||
|
||||
def DatabaseSourceTable(**args):
|
||||
return Element(qname=(TABLENS,'database-source-table'), **args)
|
||||
|
||||
|
||||
def DdeLink(**args):
|
||||
return Element(qname=(TABLENS,'dde-link'), **args)
|
||||
|
||||
|
||||
def DdeLinks(**args):
|
||||
return Element(qname=(TABLENS,'dde-links'), **args)
|
||||
|
||||
|
||||
def Deletion(**args):
|
||||
return Element(qname=(TABLENS,'deletion'), **args)
|
||||
|
||||
|
||||
def Deletions(**args):
|
||||
return Element(qname=(TABLENS,'deletions'), **args)
|
||||
|
||||
|
||||
def Dependencies(**args):
|
||||
return Element(qname=(TABLENS,'dependencies'), **args)
|
||||
|
||||
|
||||
def Dependency(**args):
|
||||
return Element(qname=(TABLENS,'dependency'), **args)
|
||||
|
||||
|
||||
def Detective(**args):
|
||||
return Element(qname=(TABLENS,'detective'), **args)
|
||||
|
||||
|
||||
def ErrorMacro(**args):
|
||||
return Element(qname=(TABLENS,'error-macro'), **args)
|
||||
|
||||
|
||||
def ErrorMessage(**args):
|
||||
return Element(qname=(TABLENS,'error-message'), **args)
|
||||
|
||||
|
||||
def EvenColumns(**args):
|
||||
return Element(qname=(TABLENS,'even-columns'), **args)
|
||||
|
||||
|
||||
def EvenRows(**args):
|
||||
return Element(qname=(TABLENS,'even-rows'), **args)
|
||||
|
||||
|
||||
def Filter(**args):
|
||||
return Element(qname=(TABLENS,'filter'), **args)
|
||||
|
||||
|
||||
def FilterAnd(**args):
|
||||
return Element(qname=(TABLENS,'filter-and'), **args)
|
||||
|
||||
|
||||
def FilterCondition(**args):
|
||||
return Element(qname=(TABLENS,'filter-condition'), **args)
|
||||
|
||||
|
||||
def FilterOr(**args):
|
||||
return Element(qname=(TABLENS,'filter-or'), **args)
|
||||
|
||||
|
||||
def FirstColumn(**args):
|
||||
return Element(qname=(TABLENS,'first-column'), **args)
|
||||
|
||||
|
||||
def FirstRow(**args):
|
||||
return Element(qname=(TABLENS,'first-row'), **args)
|
||||
|
||||
|
||||
def HelpMessage(**args):
|
||||
return Element(qname=(TABLENS,'help-message'), **args)
|
||||
|
||||
|
||||
def HighlightedRange(**args):
|
||||
return Element(qname=(TABLENS,'highlighted-range'), **args)
|
||||
|
||||
|
||||
def Insertion(**args):
|
||||
return Element(qname=(TABLENS,'insertion'), **args)
|
||||
|
||||
|
||||
def InsertionCutOff(**args):
|
||||
return Element(qname=(TABLENS,'insertion-cut-off'), **args)
|
||||
|
||||
|
||||
def Iteration(**args):
|
||||
return Element(qname=(TABLENS,'iteration'), **args)
|
||||
|
||||
|
||||
def LabelRange(**args):
|
||||
return Element(qname=(TABLENS,'label-range'), **args)
|
||||
|
||||
|
||||
def LabelRanges(**args):
|
||||
return Element(qname=(TABLENS,'label-ranges'), **args)
|
||||
|
||||
|
||||
def LastColumn(**args):
|
||||
return Element(qname=(TABLENS,'last-column'), **args)
|
||||
|
||||
|
||||
def LastRow(**args):
|
||||
return Element(qname=(TABLENS,'last-row'), **args)
|
||||
|
||||
|
||||
def Movement(**args):
|
||||
return Element(qname=(TABLENS,'movement'), **args)
|
||||
|
||||
|
||||
def MovementCutOff(**args):
|
||||
return Element(qname=(TABLENS,'movement-cut-off'), **args)
|
||||
|
||||
|
||||
def NamedExpression(**args):
|
||||
return Element(qname=(TABLENS,'named-expression'), **args)
|
||||
|
||||
|
||||
def NamedExpressions(**args):
|
||||
return Element(qname=(TABLENS,'named-expressions'), **args)
|
||||
|
||||
|
||||
def NamedRange(**args):
|
||||
return Element(qname=(TABLENS,'named-range'), **args)
|
||||
|
||||
|
||||
def NullDate(**args):
|
||||
return Element(qname=(TABLENS,'null-date'), **args)
|
||||
|
||||
|
||||
def OddColumns(**args):
|
||||
return Element(qname=(TABLENS,'odd-columns'), **args)
|
||||
|
||||
|
||||
def OddRows(**args):
|
||||
return Element(qname=(TABLENS,'odd-rows'), **args)
|
||||
|
||||
|
||||
def Operation(**args):
|
||||
return Element(qname=(TABLENS,'operation'), **args)
|
||||
|
||||
|
||||
def Previous(**args):
|
||||
return Element(qname=(TABLENS,'previous'), **args)
|
||||
|
||||
|
||||
def Scenario(**args):
|
||||
return Element(qname=(TABLENS,'scenario'), **args)
|
||||
|
||||
|
||||
def Shapes(**args):
|
||||
return Element(qname=(TABLENS,'shapes'), **args)
|
||||
|
||||
|
||||
def Sort(**args):
|
||||
return Element(qname=(TABLENS,'sort'), **args)
|
||||
|
||||
|
||||
def SortBy(**args):
|
||||
return Element(qname=(TABLENS,'sort-by'), **args)
|
||||
|
||||
|
||||
def SortGroups(**args):
|
||||
return Element(qname=(TABLENS,'sort-groups'), **args)
|
||||
|
||||
|
||||
def SourceCellRange(**args):
|
||||
return Element(qname=(TABLENS,'source-cell-range'), **args)
|
||||
|
||||
|
||||
def SourceRangeAddress(**args):
|
||||
return Element(qname=(TABLENS,'source-range-address'), **args)
|
||||
|
||||
|
||||
def SourceService(**args):
|
||||
return Element(qname=(TABLENS,'source-service'), **args)
|
||||
|
||||
|
||||
def SubtotalField(**args):
|
||||
return Element(qname=(TABLENS,'subtotal-field'), **args)
|
||||
|
||||
|
||||
def SubtotalRule(**args):
|
||||
return Element(qname=(TABLENS,'subtotal-rule'), **args)
|
||||
|
||||
|
||||
def SubtotalRules(**args):
|
||||
return Element(qname=(TABLENS,'subtotal-rules'), **args)
|
||||
|
||||
|
||||
def Table(**args):
|
||||
return Element(qname=(TABLENS,'table'), **args)
|
||||
|
||||
|
||||
def TableCell(**args):
|
||||
return Element(qname=(TABLENS,'table-cell'), **args)
|
||||
|
||||
|
||||
def TableColumn(**args):
|
||||
return Element(qname=(TABLENS,'table-column'), **args)
|
||||
|
||||
|
||||
def TableColumnGroup(**args):
|
||||
return Element(qname=(TABLENS,'table-column-group'), **args)
|
||||
|
||||
|
||||
def TableColumns(**args):
|
||||
return Element(qname=(TABLENS,'table-columns'), **args)
|
||||
|
||||
|
||||
def TableHeaderColumns(**args):
|
||||
return Element(qname=(TABLENS,'table-header-columns'), **args)
|
||||
|
||||
|
||||
def TableHeaderRows(**args):
|
||||
return Element(qname=(TABLENS,'table-header-rows'), **args)
|
||||
|
||||
|
||||
def TableRow(**args):
|
||||
return Element(qname=(TABLENS,'table-row'), **args)
|
||||
|
||||
|
||||
def TableRowGroup(**args):
|
||||
return Element(qname=(TABLENS,'table-row-group'), **args)
|
||||
|
||||
|
||||
def TableRows(**args):
|
||||
return Element(qname=(TABLENS,'table-rows'), **args)
|
||||
|
||||
|
||||
def TableSource(**args):
|
||||
return Element(qname=(TABLENS,'table-source'), **args)
|
||||
|
||||
|
||||
def TableTemplate(**args):
|
||||
return Element(qname=(TABLENS,'table-template'), **args)
|
||||
|
||||
|
||||
def TargetRangeAddress(**args):
|
||||
return Element(qname=(TABLENS,'target-range-address'), **args)
|
||||
|
||||
|
||||
def TrackedChanges(**args):
|
||||
return Element(qname=(TABLENS,'tracked-changes'), **args)
|
||||
|
||||
|
@ -31,6 +31,7 @@ from odf.element import Node
|
||||
import odf.opendocument
|
||||
from odf.text import S,LineBreak,Tab
|
||||
|
||||
|
||||
class WhitespaceText(object):
|
||||
|
||||
def __init__(self):
|
||||
@ -63,7 +64,7 @@ class WhitespaceText(object):
|
||||
odfElement.addElement(Tab())
|
||||
i += 1
|
||||
elif ch == '\n':
|
||||
self._emitTextBuffer(odfElement);
|
||||
self._emitTextBuffer(odfElement)
|
||||
odfElement.addElement(LineBreak())
|
||||
i += 1
|
||||
elif ch == ' ':
|
||||
@ -90,7 +91,6 @@ class WhitespaceText(object):
|
||||
odfElement.addText(''.join(self.textBuffer))
|
||||
self.textBuffer = []
|
||||
|
||||
|
||||
def _emitSpaces(self, odfElement):
|
||||
""" Creates a <text:s> element for the current spaceCount.
|
||||
Side effect: sets spaceCount back to zero
|
||||
@ -100,10 +100,12 @@ class WhitespaceText(object):
|
||||
odfElement.addElement(spaceElement)
|
||||
self.spaceCount = 0
|
||||
|
||||
|
||||
def addTextToElement(odfElement, s):
|
||||
wst = WhitespaceText()
|
||||
wst.addTextToElement(odfElement, s)
|
||||
|
||||
|
||||
def extractText(odfElement):
|
||||
""" Extract text content from an Element, with whitespace represented
|
||||
properly. Returns the text, with tabs, spaces, and newlines
|
||||
@ -111,7 +113,7 @@ def extractText(odfElement):
|
||||
children of the given element, accumulating text and "unwrapping"
|
||||
<text:s>, <text:tab>, and <text:line-break> elements along the way.
|
||||
"""
|
||||
result = [];
|
||||
result = []
|
||||
|
||||
if len(odfElement.childNodes) != 0:
|
||||
for child in odfElement.childNodes:
|
||||
@ -119,7 +121,7 @@ def extractText(odfElement):
|
||||
result.append(child.data)
|
||||
elif child.nodeType == Node.ELEMENT_NODE:
|
||||
subElement = child
|
||||
tagName = subElement.qname;
|
||||
tagName = subElement.qname
|
||||
if tagName == (u"urn:oasis:names:tc:opendocument:xmlns:text:1.0", u"line-break"):
|
||||
result.append("\n")
|
||||
elif tagName == (u"urn:oasis:names:tc:opendocument:xmlns:text:1.0", u"tab"):
|
||||
|
180
src/odf/text.py
180
src/odf/text.py
@ -23,539 +23,719 @@ from .element import Element
|
||||
from .style import StyleElement
|
||||
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def A(**args):
|
||||
return Element(qname=(TEXTNS,'a'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndex(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexAutoMarkFile(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-auto-mark-file'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-entry-template'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexMark(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-mark'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexMarkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-mark-end'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexMarkStart(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-mark-start'), **args)
|
||||
|
||||
|
||||
def AlphabeticalIndexSource(**args):
|
||||
return Element(qname=(TEXTNS,'alphabetical-index-source'), **args)
|
||||
|
||||
|
||||
def AuthorInitials(**args):
|
||||
return Element(qname=(TEXTNS,'author-initials'), **args)
|
||||
|
||||
|
||||
def AuthorName(**args):
|
||||
return Element(qname=(TEXTNS,'author-name'), **args)
|
||||
|
||||
|
||||
def Bibliography(**args):
|
||||
return Element(qname=(TEXTNS,'bibliography'), **args)
|
||||
|
||||
|
||||
def BibliographyConfiguration(**args):
|
||||
return Element(qname=(TEXTNS,'bibliography-configuration'), **args)
|
||||
|
||||
|
||||
def BibliographyEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'bibliography-entry-template'), **args)
|
||||
|
||||
|
||||
def BibliographyMark(**args):
|
||||
return Element(qname=(TEXTNS,'bibliography-mark'), **args)
|
||||
|
||||
|
||||
def BibliographySource(**args):
|
||||
return Element(qname=(TEXTNS,'bibliography-source'), **args)
|
||||
|
||||
|
||||
def Bookmark(**args):
|
||||
return Element(qname=(TEXTNS,'bookmark'), **args)
|
||||
|
||||
|
||||
def BookmarkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'bookmark-end'), **args)
|
||||
|
||||
|
||||
def BookmarkRef(**args):
|
||||
return Element(qname=(TEXTNS,'bookmark-ref'), **args)
|
||||
|
||||
|
||||
def BookmarkStart(**args):
|
||||
return Element(qname=(TEXTNS,'bookmark-start'), **args)
|
||||
|
||||
|
||||
def Change(**args):
|
||||
return Element(qname=(TEXTNS,'change'), **args)
|
||||
|
||||
|
||||
def ChangeEnd(**args):
|
||||
return Element(qname=(TEXTNS,'change-end'), **args)
|
||||
|
||||
|
||||
def ChangeStart(**args):
|
||||
return Element(qname=(TEXTNS,'change-start'), **args)
|
||||
|
||||
|
||||
def ChangedRegion(**args):
|
||||
return Element(qname=(TEXTNS,'changed-region'), **args)
|
||||
|
||||
|
||||
def Chapter(**args):
|
||||
return Element(qname=(TEXTNS,'chapter'), **args)
|
||||
|
||||
|
||||
def CharacterCount(**args):
|
||||
return Element(qname=(TEXTNS,'character-count'), **args)
|
||||
|
||||
|
||||
def ConditionalText(**args):
|
||||
return Element(qname=(TEXTNS,'conditional-text'), **args)
|
||||
|
||||
|
||||
def CreationDate(**args):
|
||||
return Element(qname=(TEXTNS,'creation-date'), **args)
|
||||
|
||||
|
||||
def CreationTime(**args):
|
||||
return Element(qname=(TEXTNS,'creation-time'), **args)
|
||||
|
||||
|
||||
def Creator(**args):
|
||||
return Element(qname=(TEXTNS,'creator'), **args)
|
||||
|
||||
|
||||
def DatabaseDisplay(**args):
|
||||
return Element(qname=(TEXTNS,'database-display'), **args)
|
||||
|
||||
|
||||
def DatabaseName(**args):
|
||||
return Element(qname=(TEXTNS,'database-name'), **args)
|
||||
|
||||
|
||||
def DatabaseNext(**args):
|
||||
return Element(qname=(TEXTNS,'database-next'), **args)
|
||||
|
||||
|
||||
def DatabaseRowNumber(**args):
|
||||
return Element(qname=(TEXTNS,'database-row-number'), **args)
|
||||
|
||||
|
||||
def DatabaseRowSelect(**args):
|
||||
return Element(qname=(TEXTNS,'database-row-select'), **args)
|
||||
|
||||
|
||||
def Date(**args):
|
||||
return Element(qname=(TEXTNS,'date'), **args)
|
||||
|
||||
|
||||
def DdeConnection(**args):
|
||||
return Element(qname=(TEXTNS,'dde-connection'), **args)
|
||||
|
||||
|
||||
def DdeConnectionDecl(**args):
|
||||
return Element(qname=(TEXTNS,'dde-connection-decl'), **args)
|
||||
|
||||
|
||||
def DdeConnectionDecls(**args):
|
||||
return Element(qname=(TEXTNS,'dde-connection-decls'), **args)
|
||||
|
||||
|
||||
def Deletion(**args):
|
||||
return Element(qname=(TEXTNS,'deletion'), **args)
|
||||
|
||||
|
||||
def Description(**args):
|
||||
return Element(qname=(TEXTNS,'description'), **args)
|
||||
|
||||
|
||||
def EditingCycles(**args):
|
||||
return Element(qname=(TEXTNS,'editing-cycles'), **args)
|
||||
|
||||
|
||||
def EditingDuration(**args):
|
||||
return Element(qname=(TEXTNS,'editing-duration'), **args)
|
||||
|
||||
|
||||
def ExecuteMacro(**args):
|
||||
return Element(qname=(TEXTNS,'execute-macro'), **args)
|
||||
|
||||
|
||||
def Expression(**args):
|
||||
return Element(qname=(TEXTNS,'expression'), **args)
|
||||
|
||||
|
||||
def FileName(**args):
|
||||
return Element(qname=(TEXTNS,'file-name'), **args)
|
||||
|
||||
|
||||
def FormatChange(**args):
|
||||
return Element(qname=(TEXTNS,'format-change'), **args)
|
||||
|
||||
|
||||
def H(**args):
|
||||
return Element(qname=(TEXTNS, 'h'), **args)
|
||||
|
||||
|
||||
def HiddenParagraph(**args):
|
||||
return Element(qname=(TEXTNS,'hidden-paragraph'), **args)
|
||||
|
||||
|
||||
def HiddenText(**args):
|
||||
return Element(qname=(TEXTNS,'hidden-text'), **args)
|
||||
|
||||
|
||||
def IllustrationIndex(**args):
|
||||
return Element(qname=(TEXTNS,'illustration-index'), **args)
|
||||
|
||||
|
||||
def IllustrationIndexEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'illustration-index-entry-template'), **args)
|
||||
|
||||
|
||||
def IllustrationIndexSource(**args):
|
||||
return Element(qname=(TEXTNS,'illustration-index-source'), **args)
|
||||
|
||||
|
||||
def ImageCount(**args):
|
||||
return Element(qname=(TEXTNS,'image-count'), **args)
|
||||
|
||||
|
||||
def IndexBody(**args):
|
||||
return Element(qname=(TEXTNS,'index-body'), **args)
|
||||
|
||||
|
||||
def IndexEntryBibliography(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-bibliography'), **args)
|
||||
|
||||
|
||||
def IndexEntryChapter(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-chapter'), **args)
|
||||
|
||||
|
||||
def IndexEntryLinkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-link-end'), **args)
|
||||
|
||||
|
||||
def IndexEntryLinkStart(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-link-start'), **args)
|
||||
|
||||
|
||||
def IndexEntryPageNumber(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-page-number'), **args)
|
||||
|
||||
|
||||
def IndexEntrySpan(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-span'), **args)
|
||||
|
||||
|
||||
def IndexEntryTabStop(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-tab-stop'), **args)
|
||||
|
||||
|
||||
def IndexEntryText(**args):
|
||||
return Element(qname=(TEXTNS,'index-entry-text'), **args)
|
||||
|
||||
|
||||
def IndexSourceStyle(**args):
|
||||
return Element(qname=(TEXTNS,'index-source-style'), **args)
|
||||
|
||||
|
||||
def IndexSourceStyles(**args):
|
||||
return Element(qname=(TEXTNS,'index-source-styles'), **args)
|
||||
|
||||
|
||||
def IndexTitle(**args):
|
||||
return Element(qname=(TEXTNS,'index-title'), **args)
|
||||
|
||||
|
||||
def IndexTitleTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'index-title-template'), **args)
|
||||
|
||||
|
||||
def InitialCreator(**args):
|
||||
return Element(qname=(TEXTNS,'initial-creator'), **args)
|
||||
|
||||
|
||||
def Insertion(**args):
|
||||
return Element(qname=(TEXTNS,'insertion'), **args)
|
||||
|
||||
|
||||
def Keywords(**args):
|
||||
return Element(qname=(TEXTNS,'keywords'), **args)
|
||||
|
||||
|
||||
def LineBreak(**args):
|
||||
return Element(qname=(TEXTNS,'line-break'), **args)
|
||||
|
||||
|
||||
def LinenumberingConfiguration(**args):
|
||||
return Element(qname=(TEXTNS,'linenumbering-configuration'), **args)
|
||||
|
||||
|
||||
def LinenumberingSeparator(**args):
|
||||
return Element(qname=(TEXTNS,'linenumbering-separator'), **args)
|
||||
|
||||
|
||||
def List(**args):
|
||||
return Element(qname=(TEXTNS,'list'), **args)
|
||||
|
||||
|
||||
def ListHeader(**args):
|
||||
return Element(qname=(TEXTNS,'list-header'), **args)
|
||||
|
||||
|
||||
def ListItem(**args):
|
||||
return Element(qname=(TEXTNS,'list-item'), **args)
|
||||
|
||||
|
||||
def ListLevelStyleBullet(**args):
|
||||
return Element(qname=(TEXTNS,'list-level-style-bullet'), **args)
|
||||
|
||||
|
||||
def ListLevelStyleImage(**args):
|
||||
return Element(qname=(TEXTNS,'list-level-style-image'), **args)
|
||||
|
||||
|
||||
def ListLevelStyleNumber(**args):
|
||||
return Element(qname=(TEXTNS,'list-level-style-number'), **args)
|
||||
|
||||
|
||||
def ListStyle(**args):
|
||||
return StyleElement(qname=(TEXTNS,'list-style'), **args)
|
||||
|
||||
|
||||
def Measure(**args):
|
||||
return Element(qname=(TEXTNS,'measure'), **args)
|
||||
|
||||
|
||||
def ModificationDate(**args):
|
||||
return Element(qname=(TEXTNS,'modification-date'), **args)
|
||||
|
||||
|
||||
def ModificationTime(**args):
|
||||
return Element(qname=(TEXTNS,'modification-time'), **args)
|
||||
|
||||
|
||||
def Note(**args):
|
||||
return Element(qname=(TEXTNS,'note'), **args)
|
||||
|
||||
|
||||
def NoteBody(**args):
|
||||
return Element(qname=(TEXTNS,'note-body'), **args)
|
||||
|
||||
|
||||
def NoteCitation(**args):
|
||||
return Element(qname=(TEXTNS,'note-citation'), **args)
|
||||
|
||||
|
||||
def NoteContinuationNoticeBackward(**args):
|
||||
return Element(qname=(TEXTNS,'note-continuation-notice-backward'), **args)
|
||||
|
||||
|
||||
def NoteContinuationNoticeForward(**args):
|
||||
return Element(qname=(TEXTNS,'note-continuation-notice-forward'), **args)
|
||||
|
||||
|
||||
def NoteRef(**args):
|
||||
return Element(qname=(TEXTNS,'note-ref'), **args)
|
||||
|
||||
|
||||
def NotesConfiguration(**args):
|
||||
return Element(qname=(TEXTNS,'notes-configuration'), **args)
|
||||
|
||||
|
||||
def Number(**args):
|
||||
return Element(qname=(TEXTNS,'number'), **args)
|
||||
|
||||
|
||||
def NumberedParagraph(**args):
|
||||
return Element(qname=(TEXTNS,'numbered-paragraph'), **args)
|
||||
|
||||
|
||||
def ObjectCount(**args):
|
||||
return Element(qname=(TEXTNS,'object-count'), **args)
|
||||
|
||||
|
||||
def ObjectIndex(**args):
|
||||
return Element(qname=(TEXTNS,'object-index'), **args)
|
||||
|
||||
|
||||
def ObjectIndexEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'object-index-entry-template'), **args)
|
||||
|
||||
|
||||
def ObjectIndexSource(**args):
|
||||
return Element(qname=(TEXTNS,'object-index-source'), **args)
|
||||
|
||||
|
||||
def OutlineLevelStyle(**args):
|
||||
return Element(qname=(TEXTNS,'outline-level-style'), **args)
|
||||
|
||||
|
||||
def OutlineStyle(**args):
|
||||
return Element(qname=(TEXTNS,'outline-style'), **args)
|
||||
|
||||
|
||||
def P(**args):
|
||||
return Element(qname=(TEXTNS, 'p'), **args)
|
||||
|
||||
|
||||
def Page(**args):
|
||||
return Element(qname=(TEXTNS,'page'), **args)
|
||||
|
||||
|
||||
def PageContinuation(**args):
|
||||
return Element(qname=(TEXTNS,'page-continuation'), **args)
|
||||
|
||||
|
||||
def PageCount(**args):
|
||||
return Element(qname=(TEXTNS,'page-count'), **args)
|
||||
|
||||
|
||||
def PageNumber(**args):
|
||||
return Element(qname=(TEXTNS,'page-number'), **args)
|
||||
|
||||
|
||||
def PageSequence(**args):
|
||||
return Element(qname=(TEXTNS,'page-sequence'), **args)
|
||||
|
||||
|
||||
def PageVariableGet(**args):
|
||||
return Element(qname=(TEXTNS,'page-variable-get'), **args)
|
||||
|
||||
|
||||
def PageVariableSet(**args):
|
||||
return Element(qname=(TEXTNS,'page-variable-set'), **args)
|
||||
|
||||
|
||||
def ParagraphCount(**args):
|
||||
return Element(qname=(TEXTNS,'paragraph-count'), **args)
|
||||
|
||||
|
||||
def Placeholder(**args):
|
||||
return Element(qname=(TEXTNS,'placeholder'), **args)
|
||||
|
||||
|
||||
def PrintDate(**args):
|
||||
return Element(qname=(TEXTNS,'print-date'), **args)
|
||||
|
||||
|
||||
def PrintTime(**args):
|
||||
return Element(qname=(TEXTNS,'print-time'), **args)
|
||||
|
||||
|
||||
def PrintedBy(**args):
|
||||
return Element(qname=(TEXTNS,'printed-by'), **args)
|
||||
|
||||
|
||||
def ReferenceMark(**args):
|
||||
return Element(qname=(TEXTNS,'reference-mark'), **args)
|
||||
|
||||
|
||||
def ReferenceMarkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'reference-mark-end'), **args)
|
||||
|
||||
|
||||
def ReferenceMarkStart(**args):
|
||||
return Element(qname=(TEXTNS,'reference-mark-start'), **args)
|
||||
|
||||
|
||||
def ReferenceRef(**args):
|
||||
return Element(qname=(TEXTNS,'reference-ref'), **args)
|
||||
|
||||
|
||||
def Ruby(**args):
|
||||
return Element(qname=(TEXTNS,'ruby'), **args)
|
||||
|
||||
|
||||
def RubyBase(**args):
|
||||
return Element(qname=(TEXTNS,'ruby-base'), **args)
|
||||
|
||||
|
||||
def RubyText(**args):
|
||||
return Element(qname=(TEXTNS,'ruby-text'), **args)
|
||||
|
||||
|
||||
def S(**args):
|
||||
return Element(qname=(TEXTNS,'s'), **args)
|
||||
|
||||
|
||||
def Script(**args):
|
||||
return Element(qname=(TEXTNS,'script'), **args)
|
||||
|
||||
|
||||
def Section(**args):
|
||||
return Element(qname=(TEXTNS,'section'), **args)
|
||||
|
||||
|
||||
def SectionSource(**args):
|
||||
return Element(qname=(TEXTNS,'section-source'), **args)
|
||||
|
||||
|
||||
def SenderCity(**args):
|
||||
return Element(qname=(TEXTNS,'sender-city'), **args)
|
||||
|
||||
|
||||
def SenderCompany(**args):
|
||||
return Element(qname=(TEXTNS,'sender-company'), **args)
|
||||
|
||||
|
||||
def SenderCountry(**args):
|
||||
return Element(qname=(TEXTNS,'sender-country'), **args)
|
||||
|
||||
|
||||
def SenderEmail(**args):
|
||||
return Element(qname=(TEXTNS,'sender-email'), **args)
|
||||
|
||||
|
||||
def SenderFax(**args):
|
||||
return Element(qname=(TEXTNS,'sender-fax'), **args)
|
||||
|
||||
|
||||
def SenderFirstname(**args):
|
||||
return Element(qname=(TEXTNS,'sender-firstname'), **args)
|
||||
|
||||
|
||||
def SenderInitials(**args):
|
||||
return Element(qname=(TEXTNS,'sender-initials'), **args)
|
||||
|
||||
|
||||
def SenderLastname(**args):
|
||||
return Element(qname=(TEXTNS,'sender-lastname'), **args)
|
||||
|
||||
|
||||
def SenderPhonePrivate(**args):
|
||||
return Element(qname=(TEXTNS,'sender-phone-private'), **args)
|
||||
|
||||
|
||||
def SenderPhoneWork(**args):
|
||||
return Element(qname=(TEXTNS,'sender-phone-work'), **args)
|
||||
|
||||
|
||||
def SenderPosition(**args):
|
||||
return Element(qname=(TEXTNS,'sender-position'), **args)
|
||||
|
||||
|
||||
def SenderPostalCode(**args):
|
||||
return Element(qname=(TEXTNS,'sender-postal-code'), **args)
|
||||
|
||||
|
||||
def SenderStateOrProvince(**args):
|
||||
return Element(qname=(TEXTNS,'sender-state-or-province'), **args)
|
||||
|
||||
|
||||
def SenderStreet(**args):
|
||||
return Element(qname=(TEXTNS,'sender-street'), **args)
|
||||
|
||||
|
||||
def SenderTitle(**args):
|
||||
return Element(qname=(TEXTNS,'sender-title'), **args)
|
||||
|
||||
|
||||
def Sequence(**args):
|
||||
return Element(qname=(TEXTNS,'sequence'), **args)
|
||||
|
||||
|
||||
def SequenceDecl(**args):
|
||||
return Element(qname=(TEXTNS,'sequence-decl'), **args)
|
||||
|
||||
|
||||
def SequenceDecls(**args):
|
||||
return Element(qname=(TEXTNS,'sequence-decls'), **args)
|
||||
|
||||
|
||||
def SequenceRef(**args):
|
||||
return Element(qname=(TEXTNS,'sequence-ref'), **args)
|
||||
|
||||
|
||||
def SheetName(**args):
|
||||
return Element(qname=(TEXTNS,'sheet-name'), **args)
|
||||
|
||||
|
||||
def SoftPageBreak(**args):
|
||||
return Element(qname=(TEXTNS,'soft-page-break'), **args)
|
||||
|
||||
|
||||
def SortKey(**args):
|
||||
return Element(qname=(TEXTNS,'sort-key'), **args)
|
||||
|
||||
|
||||
def Span(**args):
|
||||
return Element(qname=(TEXTNS,'span'), **args)
|
||||
|
||||
|
||||
def Subject(**args):
|
||||
return Element(qname=(TEXTNS,'subject'), **args)
|
||||
|
||||
|
||||
def Tab(**args):
|
||||
return Element(qname=(TEXTNS,'tab'), **args)
|
||||
|
||||
|
||||
def TableCount(**args):
|
||||
return Element(qname=(TEXTNS,'table-count'), **args)
|
||||
|
||||
|
||||
def TableFormula(**args):
|
||||
return Element(qname=(TEXTNS,'table-formula'), **args)
|
||||
|
||||
|
||||
def TableIndex(**args):
|
||||
return Element(qname=(TEXTNS,'table-index'), **args)
|
||||
|
||||
|
||||
def TableIndexEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'table-index-entry-template'), **args)
|
||||
|
||||
|
||||
def TableIndexSource(**args):
|
||||
return Element(qname=(TEXTNS,'table-index-source'), **args)
|
||||
|
||||
|
||||
def TableOfContent(**args):
|
||||
return Element(qname=(TEXTNS,'table-of-content'), **args)
|
||||
|
||||
|
||||
def TableOfContentEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'table-of-content-entry-template'), **args)
|
||||
|
||||
|
||||
def TableOfContentSource(**args):
|
||||
return Element(qname=(TEXTNS,'table-of-content-source'), **args)
|
||||
|
||||
|
||||
def TemplateName(**args):
|
||||
return Element(qname=(TEXTNS,'template-name'), **args)
|
||||
|
||||
|
||||
def TextInput(**args):
|
||||
return Element(qname=(TEXTNS,'text-input'), **args)
|
||||
|
||||
|
||||
def Time(**args):
|
||||
return Element(qname=(TEXTNS,'time'), **args)
|
||||
|
||||
|
||||
def Title(**args):
|
||||
return Element(qname=(TEXTNS,'title'), **args)
|
||||
|
||||
|
||||
def TocMark(**args):
|
||||
return Element(qname=(TEXTNS,'toc-mark'), **args)
|
||||
|
||||
|
||||
def TocMarkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'toc-mark-end'), **args)
|
||||
|
||||
|
||||
def TocMarkStart(**args):
|
||||
return Element(qname=(TEXTNS,'toc-mark-start'), **args)
|
||||
|
||||
|
||||
def TrackedChanges(**args):
|
||||
return Element(qname=(TEXTNS,'tracked-changes'), **args)
|
||||
|
||||
|
||||
def UserDefined(**args):
|
||||
return Element(qname=(TEXTNS,'user-defined'), **args)
|
||||
|
||||
|
||||
def UserFieldDecl(**args):
|
||||
return Element(qname=(TEXTNS,'user-field-decl'), **args)
|
||||
|
||||
|
||||
def UserFieldDecls(**args):
|
||||
return Element(qname=(TEXTNS,'user-field-decls'), **args)
|
||||
|
||||
|
||||
def UserFieldGet(**args):
|
||||
return Element(qname=(TEXTNS,'user-field-get'), **args)
|
||||
|
||||
|
||||
def UserFieldInput(**args):
|
||||
return Element(qname=(TEXTNS,'user-field-input'), **args)
|
||||
|
||||
|
||||
def UserIndex(**args):
|
||||
return Element(qname=(TEXTNS,'user-index'), **args)
|
||||
|
||||
|
||||
def UserIndexEntryTemplate(**args):
|
||||
return Element(qname=(TEXTNS,'user-index-entry-template'), **args)
|
||||
|
||||
|
||||
def UserIndexMark(**args):
|
||||
return Element(qname=(TEXTNS,'user-index-mark'), **args)
|
||||
|
||||
|
||||
def UserIndexMarkEnd(**args):
|
||||
return Element(qname=(TEXTNS,'user-index-mark-end'), **args)
|
||||
|
||||
|
||||
def UserIndexMarkStart(**args):
|
||||
return Element(qname=(TEXTNS,'user-index-mark-start'), **args)
|
||||
|
||||
|
||||
def UserIndexSource(**args):
|
||||
return Element(qname=(TEXTNS,'user-index-source'), **args)
|
||||
|
||||
|
||||
def VariableDecl(**args):
|
||||
return Element(qname=(TEXTNS,'variable-decl'), **args)
|
||||
|
||||
|
||||
def VariableDecls(**args):
|
||||
return Element(qname=(TEXTNS,'variable-decls'), **args)
|
||||
|
||||
|
||||
def VariableGet(**args):
|
||||
return Element(qname=(TEXTNS,'variable-get'), **args)
|
||||
|
||||
|
||||
def VariableInput(**args):
|
||||
return Element(qname=(TEXTNS,'variable-input'), **args)
|
||||
|
||||
|
||||
def VariableSet(**args):
|
||||
return Element(qname=(TEXTNS,'variable-set'), **args)
|
||||
|
||||
|
||||
def WordCount(**args):
|
||||
return Element(qname=(TEXTNS,'word-count'), **args)
|
||||
|
@ -416,10 +416,12 @@ CGeAjdwhVVv/GQb3GhacACCAWIbY1bGwCKEL0NTU/A+1jxGaABiRIvs/NEcP6du0AAIMANtMxR3x
|
||||
N38FAAAAAElFTkSuQmCC\
|
||||
"""
|
||||
|
||||
|
||||
def thumbnail():
|
||||
icon = base64.decodestring(iconstr)
|
||||
return icon
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
icon = thumbnail()
|
||||
f = file("thumbnail.png","wb")
|
||||
|
@ -24,11 +24,15 @@ from .element import Element
|
||||
# ODF 1.0 section 11.2
|
||||
# XForms is designed to be embedded in another XML format.
|
||||
# Autogenerated
|
||||
|
||||
|
||||
def Model(**args):
|
||||
return Element(qname=(XFORMSNS,'model'), **args)
|
||||
|
||||
|
||||
def Instance(**args):
|
||||
return Element(qname=(XFORMSNS,'instance'), **args)
|
||||
|
||||
|
||||
def Bind(**args):
|
||||
return Element(qname=(XFORMSNS,'bind'), **args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user