Skip to content
Permalink
Browse files
Code tidy before merge
  • Loading branch information
aa9863 committed Jul 5, 2020
1 parent 1472467 commit 2f448db88484e03e2cbf64cea48191367687e454
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 55 deletions.
@@ -3,4 +3,6 @@ output-format=json

[MESSAGES CONTROL]
disable=C0103,
W1202
W1202,
C0413,
C0115
@@ -1,9 +1,14 @@
# Current

- Add a Generic template that does its best to build a sensible report from a file
- Keep track of Section order in the parser
- Calculate Marks
- "Personalsation" of the report via header.
# 0.3.1

- Software
- Add a Generic template that does its best to build a sensible report from a file
- Keep track of Section order in the parser
- Calculate Marks
- "Customisation" of the report via header.
- Documentation
- Draft Documentation added
- Install
- Walk-through of Generic Template

# 0.3

@@ -16,25 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""


"""
Use Markdown to generate various uni documents
Controller code to get the workflows working.
Two use cases at the moment:
1. Called with all parts specifid
- Template
- Input File
1. Called with just an input file. Which contains the template.
Things to think about:
1. Batch conversion, point him at a directory
1. PDF conversion, use something (QT?) to render the HTML to PDF.
"""

import logging
import pathlib

@@ -44,16 +25,15 @@ import remarkable.renderer as renderer

class RenderError(Exception):
"""Exception raised for errors in the input.
@message: explanation of the error
"""

def __init__(self, message):
super().__init__()
self.message = message

#env.list_templates()

def convertFile(inputFile, templateFile=None, templateDir=None, outputFile=None):
"""
Given a set of options convert a file from markdown
@@ -16,12 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""


"""
File to read Markdown files and generate
whatever AST we need to generate
"""

import logging
import re

@@ -75,7 +69,7 @@ class MarkdownParser():
marks = int(marks)
if maxMarks:
maxMarks = int(maxMarks)

#And delete the marks part
cleanLine = marksRe.sub("", cleanLine)
cleanLine = cleanLine.strip()
@@ -186,7 +180,7 @@ class MarkdownParser():
theSection = section.Section(out,
marks=currentMarks,
header=headerText,
maxMarks = maxMarks)
maxMarks=maxMarks)

sections[currentSection] = theSection
self.sectionOrder.append(currentSection)
@@ -16,14 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""


"""And a Class for Rendering Files
I cant see this going much beyond HTML, but lets keep it here for
completeness.
"""

import logging

import jinja2
@@ -142,7 +134,7 @@ class HTMLRenderer(Renderer):

calcs = {"marksAwarded": totalAwarded,
"marksPossible": totalPossible}

out = self.template.render({"content":sections,
"header": header,
"order": theParser.sectionOrder,
@@ -54,8 +54,8 @@ def main():


parser.add_argument("filename",
help = "File to Convert")
help="File to Convert")

parser.add_argument("-t", "--template",
help="Template file to use for rendering")

@@ -17,11 +17,6 @@
"""


"""
possibly a little overkill, but I may want
to do per section stuff. Saves Refactoring down the line
"""

import remarkable.renderer as renderer

class Section():
@@ -88,7 +83,7 @@ class Section():
"""
Render the marks
Either show the awarded marks,
Either show the awarded marks,
or the Awarded Marks as part of a total
<Awarded>
@@ -20,7 +20,7 @@ setup(
name="remarkable",
author="Dan Goldsmith",
author_email="djgoldsmith@googlemail.com",
version="0.3.0",
version="0.3.1",
#Dependencies
install_requires=requires,
tests_require=testRequires,

0 comments on commit 2f448db

Please sign in to comment.