diff --git a/README.md b/README.md
index b436842..cbb09dc 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,17 @@
```html
Hello
-
World
+
{{ name }}
Second Page
```
+
+## Data Example
+
+```yml
+title: Example Document
+lang: en
+name: World
+```
diff --git a/generate.py b/generate.py
index f437dae..eb029d6 100755
--- a/generate.py
+++ b/generate.py
@@ -62,12 +62,13 @@ BASE_TEMPLATE = Template(
{{ title }}
-
+
{{ content }}
@@ -86,19 +87,34 @@ if __name__ == "__main__":
"-s", "--css",
help="The path to the css file",
metavar="PATH",
- type=Path, required=True)
+ type=Path)
argp.add_argument(
"-d", "--data",
help="The path to the yaml file containing the variables used in the templates",
metavar="PATH",
type=Path, required=True)
+ argp.add_argument(
+ "--size",
+ help="The paper size (default: A4)",
+ choices=["A3", "A4", "A5", "letter", "legal"],
+ default="A4"
+ )
+ argp.add_argument(
+ "--orientation",
+ help="The page orientation (default: portrait)",
+ choices=["portrait", "landscape"],
+ default="portrait"
+ )
args = argp.parse_args()
# load data
with args.data.open("r") as f:
data = safe_load(f)
# load css
- with args.css.open("r") as f:
- css = f.read()
+ if args.css is None:
+ css = "/* empty */"
+ else:
+ with args.css.open("r") as f:
+ css = f.read()
# template content
with args.template.open("r") as f:
content_template = Template(f.read())
@@ -108,5 +124,13 @@ if __name__ == "__main__":
# render
content = content_template.render(data)
# template out complete html document
- result = BASE_TEMPLATE.render(lang=data["lang"], title=data["title"], paper_css=PAPER_CSS, css=css, content=content)
+ result = BASE_TEMPLATE.render(
+ lang=data["lang"],
+ title=data["title"],
+ paper_size=args.size,
+ orientation=args.orientation,
+ paper_css=PAPER_CSS,
+ css=css,
+ content=content
+ )
print(result)