本文整理汇总了Python中appy.pod.odf_parser.OdfParser.endElement方法的典型用法代码示例。如果您正苦于以下问题:Python OdfParser.endElement方法的具体用法?Python OdfParser.endElement怎么用?Python OdfParser.endElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appy.pod.odf_parser.OdfParser
的用法示例。
在下文中一共展示了OdfParser.endElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: endElement
# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
def endElement(self, elem):
e = OdfParser.endElement(self, elem)
if elem == "%s:annotation" % e.ns(e.NS_OFFICE):
self.inAnnotation = False
self.ignore = False
if not self.ignore:
self.res += "</%s>" % elem
示例2: endElement
# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
def endElement(self, elem):
e = OdfParser.endElement(self, elem)
if elem == e.tags['style']:
e.state = READING
e.currentStyle = None
elif elem == e.tags['page-layout']:
e.state = READING
e.currentPageLayout = None
elif elem == e.tags['master-styles']:
e.state = READING
示例3: endElement
# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
def endElement(self, elem):
e = OdfParser.endElement(self, elem)
if elem == self.styleTag:
e.state = READING
e.currentStyle = None
示例4: endElement
# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
def endElement(self, elem):
e = OdfParser.endElement(self, elem)
ns = e.onEndElement()
officeNs = ns[e.NS_OFFICE]
textNs = ns[e.NS_TEXT]
if elem in e.ignorableElements:
e.state = e.READING_CONTENT
elif elem == e.tags['annotation']:
# Manage statement
oldCb = e.currentBuffer
actionElemIndex = oldCb.createAction(e.currentStatement)
e.currentStatement = []
if actionElemIndex != -1:
e.currentBuffer = oldCb.\
transferActionIndependentContent(actionElemIndex)
if e.currentBuffer == oldCb:
e.mode = e.ADD_IN_SUBBUFFER
else:
e.mode = e.ADD_IN_BUFFER
e.state = e.READING_CONTENT
else:
if e.state == e.IGNORING:
pass
elif e.state == e.READING_CONTENT:
# Dump the ODS POD expression if any
if e.currentOdsExpression:
e.currentBuffer.addExpression(e.currentOdsExpression,
tiedHook=e.currentOdsHook)
e.currentOdsExpression = None
e.currentOdsHook = None
# Dump the ending tag
e.currentBuffer.dumpEndElement(elem)
if elem in e.impactableElements:
if isinstance(e.currentBuffer, MemoryBuffer):
isMainElement = e.currentBuffer.isMainElement(elem)
# Unreference the element among the 'elements' attribute
e.currentBuffer.unreferenceElement(elem)
if isMainElement:
parent = e.currentBuffer.parent
if not e.currentBuffer.action:
# Delete this buffer and transfer content to
# parent.
e.currentBuffer.transferAllContent()
parent.removeLastSubBuffer()
e.currentBuffer = parent
else:
if isinstance(parent, FileBuffer):
# Execute buffer action and delete the
# buffer.
e.currentBuffer.action.execute()
parent.removeLastSubBuffer()
e.currentBuffer = parent
e.mode = e.ADD_IN_SUBBUFFER
elif e.state == e.READING_STATEMENT:
if e.currentElem.elem == Text.OD.elem:
statementLine = e.currentContent.strip()
if statementLine:
e.currentStatement.append(statementLine)
e.currentContent = ''
elif e.state == e.READING_EXPRESSION:
if (elem == e.tags['change-end']) or \
(elem == e.tags['conditional-text']):
expression = e.currentContent.strip()
e.currentContent = ''
# Manage expression
e.currentBuffer.addExpression(expression)
if e.exprHasStyle:
e.currentBuffer.dumpEndElement(e.tags['span'])
e.state = e.READING_CONTENT