Merge branch 'main' into doc_meta

This commit is contained in:
Veronica K. B. Olsen
2020-10-24 18:32:49 +02:00
27 changed files with 118 additions and 94 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Project Document
================================
Class holding a document
Class holding a single novelWriter document
File History:
Created: 2018-09-29 [0.0.1]
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Project Index
=============================
Class holding the index of tags
Class holding the project index of tags, headers and references
File History:
Created: 2019-05-27 [0.1.4]
+30 -20
View File
@@ -29,7 +29,7 @@ import logging
from lxml import etree
from nw.common import checkInt
from nw.common import checkInt, isHandle
from nw.constants import nwItemType, nwItemClass, nwItemLayout
logger = logging.getLogger(__name__)
@@ -104,27 +104,37 @@ class NWItem():
if "parent" in xItem.attrib:
self.itemParent = xItem.attrib["parent"]
setMap = {
"name" : self.setName,
"order" : self.setOrder,
"type" : self.setType,
"class" : self.setClass,
"layout" : self.setLayout,
"status" : self.setStatus,
"expanded" : self.setExpanded,
"exported" : self.setExported,
"charCount" : self.setCharCount,
"wordCount" : self.setWordCount,
"paraCount" : self.setParaCount,
"cursorPos" : self.setCursorPos,
}
retStatus = True
for xValue in xItem:
if xValue.tag in setMap:
setMap[xValue.tag](xValue.text)
if xValue.tag == "name":
self.setName(xValue.text)
elif xValue.tag == "order":
self.setOrder(xValue.text)
elif xValue.tag == "type":
self.setType(xValue.text)
elif xValue.tag == "class":
self.setClass(xValue.text)
elif xValue.tag == "layout":
self.setLayout(xValue.text)
elif xValue.tag == "status":
self.setStatus(xValue.text)
elif xValue.tag == "expanded":
self.setExpanded(xValue.text)
elif xValue.tag == "exported":
self.setExported(xValue.text)
elif xValue.tag == "charCount":
self.setCharCount(xValue.text)
elif xValue.tag == "wordCount":
self.setWordCount(xValue.text)
elif xValue.tag == "paraCount":
self.setParaCount(xValue.text)
elif xValue.tag == "cursorPos":
self.setCursorPos(xValue.text)
else:
logger.error("Unknown tag '%s'" % xValue.tag)
retStatus = False
return True
return retStatus
@staticmethod
def _subPack(xParent, name, attrib=None, text=None, none=True):
@@ -153,7 +163,7 @@ class NWItem():
"""Set the item handle, and ensure it is valid.
"""
if isinstance(theHandle, str):
if len(theHandle) == 13:
if isHandle(theHandle):
self.itemHandle = theHandle
else:
self.itemHandle = None
@@ -167,7 +177,7 @@ class NWItem():
if theParent is None:
self.itemParent = None
elif isinstance(theParent, str):
if len(theParent) == 13:
if isHandle(theParent):
self.itemParent = theParent
else:
self.itemParent = None
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Spell Check Classes
===================================
Wrapper class for spell checking
Wrapper class for spell checking tools
File History:
Created: 2019-06-11 [0.1.5]
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Project Item Status Class
=========================================
Class holding the status elements of a project item
Class holding the status/importance elements of a project item
File History:
Created: 2019-05-19 [0.1.3]
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Text Tokenizer
==============================
Splits a piece of nW markdown text into its elements
Splits a piece of novelWriter markdown text into its elements
File History:
Created: 2019-05-05 [0.0.1]
+1 -1
View File
@@ -3,7 +3,7 @@
novelWriter Project Tree Class
==================================
Class holding the data of the project tree
Class holding the project's tree of project items
File History:
Created: 2020-05-07 [0.4.5]