Fixed a bug in the tokenizer for root folder headings
This commit is contained in:
+41
-21
@@ -217,7 +217,7 @@ class Tokenizer():
|
|||||||
theTitle = "Notes: %s" % theItem.itemName
|
theTitle = "Notes: %s" % theItem.itemName
|
||||||
self.theTokens = []
|
self.theTokens = []
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_TITLE, theTitle, None, self.A_PBB | self.A_CENTRE
|
self.T_TITLE, 0, theTitle, None, self.A_PBB | self.A_CENTRE
|
||||||
))
|
))
|
||||||
self.theMarkdown = "# %s\n\n" % theTitle
|
self.theMarkdown = "# %s\n\n" % theTitle
|
||||||
|
|
||||||
@@ -320,8 +320,10 @@ class Tokenizer():
|
|||||||
# Tag lines starting with specific characters
|
# Tag lines starting with specific characters
|
||||||
if len(aLine.strip()) == 0:
|
if len(aLine.strip()) == 0:
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_EMPTY, nLine,
|
self.T_EMPTY,
|
||||||
"", None,
|
nLine,
|
||||||
|
"",
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("\n")
|
tmpMarkdown.append("\n")
|
||||||
@@ -330,16 +332,20 @@ class Tokenizer():
|
|||||||
cLine = aLine[1:].strip()
|
cLine = aLine[1:].strip()
|
||||||
if cLine.lower().startswith("synopsis:"):
|
if cLine.lower().startswith("synopsis:"):
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_SYNOPSIS, nLine,
|
self.T_SYNOPSIS,
|
||||||
cLine[9:].strip(), None,
|
nLine,
|
||||||
|
cLine[9:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
if self.doSynopsis:
|
if self.doSynopsis:
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
else:
|
else:
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_COMMENT, nLine,
|
self.T_COMMENT,
|
||||||
aLine[1:].strip(), None,
|
nLine,
|
||||||
|
aLine[1:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
if self.doComments:
|
if self.doComments:
|
||||||
@@ -347,8 +353,10 @@ class Tokenizer():
|
|||||||
|
|
||||||
elif aLine[0] == "@":
|
elif aLine[0] == "@":
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_KEYWORD, nLine,
|
self.T_KEYWORD,
|
||||||
aLine[1:].strip(), None,
|
nLine,
|
||||||
|
aLine[1:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
if self.doKeywords:
|
if self.doKeywords:
|
||||||
@@ -356,32 +364,40 @@ class Tokenizer():
|
|||||||
|
|
||||||
elif aLine[:2] == "# ":
|
elif aLine[:2] == "# ":
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_HEAD1, nLine,
|
self.T_HEAD1,
|
||||||
aLine[2:].strip(), None,
|
nLine,
|
||||||
|
aLine[2:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
|
|
||||||
elif aLine[:3] == "## ":
|
elif aLine[:3] == "## ":
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_HEAD2, nLine,
|
self.T_HEAD2,
|
||||||
aLine[3:].strip(), None,
|
nLine,
|
||||||
|
aLine[3:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
|
|
||||||
elif aLine[:4] == "### ":
|
elif aLine[:4] == "### ":
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_HEAD3, nLine,
|
self.T_HEAD3,
|
||||||
aLine[4:].strip(), None,
|
nLine,
|
||||||
|
aLine[4:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
|
|
||||||
elif aLine[:5] == "#### ":
|
elif aLine[:5] == "#### ":
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_HEAD4, nLine,
|
self.T_HEAD4,
|
||||||
aLine[5:].strip(), None,
|
nLine,
|
||||||
|
aLine[5:].strip(),
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
@@ -407,16 +423,20 @@ class Tokenizer():
|
|||||||
# sorted by position
|
# sorted by position
|
||||||
fmtPos = sorted(fmtPos, key=itemgetter(0))
|
fmtPos = sorted(fmtPos, key=itemgetter(0))
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_TEXT, nLine,
|
self.T_TEXT,
|
||||||
aLine, fmtPos,
|
nLine,
|
||||||
|
aLine,
|
||||||
|
fmtPos,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
|
|
||||||
# Always add an empty line at the end
|
# Always add an empty line at the end
|
||||||
self.theTokens.append((
|
self.theTokens.append((
|
||||||
self.T_EMPTY, nLine,
|
self.T_EMPTY,
|
||||||
"", None,
|
nLine,
|
||||||
|
"",
|
||||||
|
None,
|
||||||
self.A_NONE
|
self.A_NONE
|
||||||
))
|
))
|
||||||
tmpMarkdown.append("\n")
|
tmpMarkdown.append("\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user