From 5358bf5e6b7b341aeca22bf13792950de3a7159f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 12 Jun 2020 17:45:27 +0200 Subject: [PATCH] Trying another method of parsing the meta string --- nw/core/document.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/nw/core/document.py b/nw/core/document.py index 835ecdba..560815e6 100644 --- a/nw/core/document.py +++ b/nw/core/document.py @@ -226,21 +226,17 @@ class NWDoc(): break theClass = nwItemClass.NO_CLASS + for aClass in nwItemClass: + if theMeta.startswith(aClass.name): + theClass = aClass + theMeta = theMeta.lstrip(aClass.name+":") + theLayout = nwItemLayout.NO_LAYOUT - theData = theMeta.split(":") + for aLayout in nwItemLayout: + if theMeta.startswith(aLayout.name): + theLayout = aLayout + theMeta = theMeta.lstrip(aLayout.name+":") - if (n := len(theData)) > 1: - if theData[0] in nwItemClass.__members__: - theClass = nwItemClass[theData[0]] - if n > 2: - if theData[1] in nwItemLayout.__members__: - theLayout = nwItemLayout[theData[1]] - theName = theData[2] - else: - theName = theData[1] - else: - theName = theData[0] - - return theName, thePath, theClass, theLayout + return theMeta, thePath, theClass, theLayout # END Class NWDoc