Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

convert html to new format

  • Loading branch information...
commit 217a5784d9cb02807640e68673883fe84644d2ba 1 parent 0929a30
@poundifdef authored
View
35 resumebabel/ResumeHTML.py
@@ -1,35 +0,0 @@
-import sys
-import json
-from pprint import pprint
-from copy import deepcopy
-from genshi.template import MarkupTemplate, TemplateLoader
-
-class ResumeHTML(object):
- def __init__(self, resume):
- self.resume = resume
-
- def convert_to_hresume(self):
- # TODO: htmlencode
- # TODO: markdown to html
- hresume = deepcopy(self.resume)
-
- # TODO: Convert json to hresume-specific formats (ie iso date format)
- hresume['hresume'] = deepcopy(self.resume)
- return hresume
-
- def create_output(self):
- r = self.convert_to_hresume()
-
- loader = TemplateLoader('.')
- templ = loader.load('ResumeHTMLTemplate.html')
- stream = templ.generate(**r)
-
- # TODO: output to file? method param for this?
- print stream.render('xhtml')
-
-if __name__ == '__main__':
- fd = open('resume.json')
- resume = json.load(fd)
-
- r = ResumeHTML(resume)
- r.create_output()
View
28 resumebabel/converters/html_converter.py
@@ -0,0 +1,28 @@
+import sys
+import json
+from pprint import pprint
+from copy import deepcopy
+from genshi.template import MarkupTemplate, TemplateLoader
+
+from converter_parent import ConverterParent
+
+class HTMLConverter(ConverterParent):
+ def preprocess_resume(self):
+ # TODO: htmlencode
+ # TODO: markdown to html
+ self.hresume = deepcopy(self.resume)
+
+ # TODO: Convert json to hresume-specific formats (ie iso date format)
+ self.hresume['hresume'] = deepcopy(self.resume)
+ #return hresume
+
+ def do_conversion(self):
+ #r = self.convert_to_hresume()
+
+ loader = TemplateLoader('.')
+ templ = loader.load(self.get_resource('html_template.html'))
+ stream = templ.generate(**self.hresume)
+ #stream = templ.generate(**r)
+
+ # TODO: output to file? method param for this?
+ self.generated_resume = stream.render('xhtml')
View
0  resumebabel/ResumeHTMLTemplate.html → resumebabel/resources/html_template.html
File renamed without changes

0 comments on commit 217a578

Please sign in to comment.
Something went wrong with that request. Please try again.