|
|
|
@ -119,7 +119,7 @@ class xmlDocPlasma(xmlDoc):
|
|
|
|
|
return False
|
|
|
|
|
nameArea = ""
|
|
|
|
|
if firstChild(nodesNewArea[0]) is not None:
|
|
|
|
|
nameArea = firstChild(nodesNewArea).text.strip()
|
|
|
|
|
nameArea = firstChild(nodesNewArea[0]).text.strip()
|
|
|
|
|
flagFindArea = False
|
|
|
|
|
baseNodes = []
|
|
|
|
|
newAreaAction = None
|
|
|
|
@ -159,7 +159,7 @@ class xmlDocPlasma(xmlDoc):
|
|
|
|
|
oldAreaNode = oName.getparent().getparent()
|
|
|
|
|
oldAreaQuote = xpath.Evaluate('child::caption/quote',
|
|
|
|
|
oldAreaNode)[0]
|
|
|
|
|
if oldAreaQuote and firstChild(oldAreaQuote) is None:
|
|
|
|
|
if oldAreaQuote is not None and firstChild(oldAreaQuote) is None:
|
|
|
|
|
newAreaQuote = xpath.Evaluate('child::caption/quote',
|
|
|
|
|
xmlNewArea)[0]
|
|
|
|
|
oldAreaCaption = xpath.Evaluate('child::caption',
|
|
|
|
@ -511,7 +511,7 @@ class plasma(samba):
|
|
|
|
|
quotes = []
|
|
|
|
|
xmlQuotes = xpath.Evaluate('child::caption/quote', xmlArea)
|
|
|
|
|
for node in xmlQuotes:
|
|
|
|
|
if firstChild(node):
|
|
|
|
|
if firstChild(node) is not None:
|
|
|
|
|
quotes.append(firstChild(node).text)
|
|
|
|
|
if len(quotes) == 0:
|
|
|
|
|
quotes.append("")
|
|
|
|
@ -524,7 +524,7 @@ class plasma(samba):
|
|
|
|
|
for xmlArea in xmlAreas:
|
|
|
|
|
# Перед пустой областью и после нее удаляем переводы строк
|
|
|
|
|
if getQuotesArea(xmlArea) == ["", ""]:
|
|
|
|
|
if (xmlArea.getprevious() and
|
|
|
|
|
if (xmlArea.getprevious() is not None and
|
|
|
|
|
self.docObj.getTypeField(
|
|
|
|
|
xmlArea.getprevious()) == "br"):
|
|
|
|
|
parentNode = xmlArea.getprevious().getparent()
|
|
|
|
@ -535,12 +535,12 @@ class plasma(samba):
|
|
|
|
|
parentNode.remove(
|
|
|
|
|
xmlArea.getprevious().getprevious())
|
|
|
|
|
parentNode.remove(xmlArea.getprevious())
|
|
|
|
|
if (xmlArea.getnext() and
|
|
|
|
|
if (xmlArea.getnext() is not None and
|
|
|
|
|
self.docObj.getTypeField(
|
|
|
|
|
xmlArea.getnext()) == "br"):
|
|
|
|
|
parentNode = xmlArea.getnext().getparent()
|
|
|
|
|
next_next_sbl = xmlArea.getnext().getnext()
|
|
|
|
|
if (next_next_sbl and
|
|
|
|
|
if (next_next_sbl is not None and
|
|
|
|
|
self.docObj.getTypeField(
|
|
|
|
|
next_next_sbl) == "br"):
|
|
|
|
|
parentNode.remove(xmlArea.getnext().getnext())
|
|
|
|
@ -602,7 +602,7 @@ class plasma(samba):
|
|
|
|
|
for node in xmlFields:
|
|
|
|
|
# Добавление перевода строк в если его нет между полями
|
|
|
|
|
if (self.docObj.getTypeField(node) == "var" and
|
|
|
|
|
node.getprevious() and
|
|
|
|
|
node.getprevious() is not None and
|
|
|
|
|
not (self.docObj.getTypeField(
|
|
|
|
|
node.getprevious()) in ("br", "comment"))):
|
|
|
|
|
insertBefore(xmlArea, self.docObj.createField("br",
|
|
|
|
@ -616,7 +616,7 @@ class plasma(samba):
|
|
|
|
|
xmlArea.remove(xmlFields[-1])
|
|
|
|
|
|
|
|
|
|
# Если предыдущим полем не (BR или комментарий) - добавляем BR
|
|
|
|
|
if (xmlArea.getprevious() and
|
|
|
|
|
if (xmlArea.getprevious() is not None and
|
|
|
|
|
not (self.docObj.getTypeField(
|
|
|
|
|
xmlArea.getprevious()) == "br" or
|
|
|
|
|
self.docObj.getTypeField(
|
|
|
|
@ -626,7 +626,7 @@ class plasma(samba):
|
|
|
|
|
"br", [], "", [], False, False), xmlArea)
|
|
|
|
|
# Если есть предыдущее поле, и поле предыдущеее предыдущему
|
|
|
|
|
# не равно BR или комментарий то добавляем BR
|
|
|
|
|
if xmlArea.getprevious():
|
|
|
|
|
if xmlArea.getprevious() is not None:
|
|
|
|
|
prPrSibling = xmlArea.getprevious().getprevious()
|
|
|
|
|
if (prPrSibling and
|
|
|
|
|
not (self.docObj.getTypeField(
|
|
|
|
@ -637,9 +637,9 @@ class plasma(samba):
|
|
|
|
|
insertBefore(parentNode, self.docObj.createField(
|
|
|
|
|
"br", [], "", [], False, False), xmlArea)
|
|
|
|
|
# Если после есть BR а за ним ничего нет, удаляем BR
|
|
|
|
|
if (xmlArea.getnext() and
|
|
|
|
|
if (xmlArea.getnext() is not None and
|
|
|
|
|
self.docObj.getTypeField(xmlArea.getnext()) == "br"):
|
|
|
|
|
if not xmlArea.getnext().getnext():
|
|
|
|
|
if xmlArea.getnext().getnext() is None:
|
|
|
|
|
parentNode = xmlArea.getnext().getparent()
|
|
|
|
|
parentNode.remove(xmlArea.getnext())
|
|
|
|
|
|
|
|
|
|