Skip to content
Permalink
Browse files
Merge branch 'aa9863-master', incorporating pre-render from base fork
  • Loading branch information
digehode committed Sep 4, 2020
2 parents 319d8be + 661d80f commit b102bc4474f67895d92d985c5266bfc9f39438e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
@@ -41,3 +41,6 @@ passwords of any length, with (almost) all ASCII characters as valid
symbols, making use of a flaw in the binaries that allows a "timing
attack".

## Due date

The couresework is due by {{page.meta.due}}
@@ -19,6 +19,7 @@
import logging
import re

import jinja2
import yaml

import remarkable.section as section
@@ -43,6 +44,7 @@ class MarkdownParser():
#And things we are storing
self.sections = None
self.header = None
self.page = None
#Add this for the generic template
self.sectionOrder = []

@@ -163,10 +165,27 @@ class MarkdownParser():
sections based on the line headings.
"""





#TODO: ---------- Fix this Kludge ------------
tempHeader = {"page":{"meta":self.header}}

#First pass of the text with jinja
preRender = jinja2.Template("\n".join(theText))
postRender = preRender.render(tempHeader)
print(postRender)
postRender = postRender.split("\n")

currentSection = None
out = []
sections = {}
for line in theText:
#for line in theText:
for line in postRender:
print("------")
print(line)
print("-------")
#self.log.debug(" {0}".format(line))
if line.startswith("# "): #Kludgy Space for matching
if currentSection:
@@ -134,11 +134,9 @@ class HTMLRenderer(Renderer):

calcs = {"marksAwarded": totalAwarded,
"marksPossible": totalPossible}
page={"meta":header} # Alias header info to match mk_docs reference to page variables in the "page.meta" namesapce
out = self.template.render({"content":sections,
"header": header,
"order": theParser.sectionOrder,
"calcs": calcs,
"page": page
})
"page":{"meta": header}})
return out

0 comments on commit b102bc4

Please sign in to comment.