diff --git a/yaml_resume/cli.py b/yaml_resume/cli.py index b5b1779..d101d16 100644 --- a/yaml_resume/cli.py +++ b/yaml_resume/cli.py @@ -9,8 +9,13 @@ THEMES = { "classic": "optional", "material": "mandatory", + "modern": "optional" } # optional or mandatory depending if the theme must have an profile picture +PAGE_FORMATS = { + "A4": "@page { size: A4; margin: 0cm }", + "US_Letter": "@page { size: letter; margin: .5in }" +} def no_tag(self, *args, **kw): """Drop tag in yaml.dump() @@ -106,7 +111,14 @@ def validate(filename): ) @click.option("-i", "--image", default=None, help="Portrait to include in the resume.") @click.option("-o", "--output", default="resume", help="Name of the file to write.") -def export(filename, theme, extension, image, output): +@click.option( + "-pt", + "--page-type", + default="A4", + type=click.Choice(PAGE_FORMATS), + help="Page Type: A4 or 8.5\"x11\"" +) +def export(filename, theme, extension, image, output, page_type): """cli subcommand to export a YAML resume to HTML or PDF This function is a subcommand of yaml-resume. @@ -117,7 +129,13 @@ def export(filename, theme, extension, image, output): :type filename: str :param theme: The name of the theme to use. :type theme: str - :param format: The format of the exported data. + :param extension: The format of the exported data. + :type format: str + :param image: Path to Resume Image + :type format: str + :param output: Output filename + :type format: str + :param page: Page Type :type format: str :raises: ClickException @@ -146,7 +164,7 @@ def export(filename, theme, extension, image, output): outfile.close() else: html = HTML(string=template.render(resume=resume, image=image)) - css = CSS(string="@page { size: A4; margin: 0cm }") + css = CSS(string=PAGE_FORMATS[page_type]) html.write_pdf("{}.{}".format(output, extension), stylesheets=[css]) diff --git a/yaml_resume/resume/__init__.py b/yaml_resume/resume/__init__.py index 4d42b3f..5eb678d 100644 --- a/yaml_resume/resume/__init__.py +++ b/yaml_resume/resume/__init__.py @@ -76,6 +76,8 @@ def ask(): if click.confirm("Do you want to add a Projects section?", default=False): print("## Projects ##") projects = Project.ask() + else: + projects = [] print("## Hobbies ##") hobbies = Hobby.ask() return Resume( diff --git a/yaml_resume/templates/modern.css b/yaml_resume/templates/modern.css new file mode 100644 index 0000000..60dbaf5 --- /dev/null +++ b/yaml_resume/templates/modern.css @@ -0,0 +1,48 @@ +* { + font-family: Montserrat; +} + +.header { + text-align: center; + width: 100%; +} + +.header h1,h2 { + display: block; +} + +.header h2 { + font-weight: 200; +} + +.details { + text-align: center; +} + +.details ul > li { + display: inline-block +} + +.details li:not(:first-child)::before { + content: '| ' +} + +h3 .date { + font-weight: 100; +} + +.experience h4 { + font-weight: 100; + font-style: italic; +} + +.education h4 { + font-weight: 100; + font-style: italic; +} + +.tags { + font-size: 10pt; + color: #999; + padding-bottom: 5px; +} \ No newline at end of file diff --git a/yaml_resume/templates/modern.html b/yaml_resume/templates/modern.html new file mode 100644 index 0000000..25876a9 --- /dev/null +++ b/yaml_resume/templates/modern.html @@ -0,0 +1,74 @@ + + + + {{ resume.contact.name }}'s Resume + + + + + +
+

{{ resume.contact.name }}

+

{{ resume.contact.job }}

+
+
+
+ + + {% if resume.contact.summary %} + {{ resume.contact.summary }} + {% endif %} +
+
+
+

Experience

+ {% for e in resume.experiences %} +
+

{{ e.company }} | {{ e.start_date }} - {% if not e.end_date %}Present{% else %}{{ e.end_date }}{% endif %}

+

{{ e.position }}

+ + {% if e.tags %}
-{% for tag in e.tags %} {{ tag }} -{% endfor %}
{% endif %} +
+ {% endfor %} +
+
+
+

Education

+ {% for e in resume.education %} +
+

{{ e.institution }} | {{ e.start_date }} - {% if not e.end_date %}Present{% else %}{{ e.end_date }}{% endif %}

+

{{ e.degree }}

+
+ {% endfor %} +
+
+
+

Skills

+ {% if resume.skills|selectattr('level', 'gt', 50)|list|length %} +

Proficient

+ + {% endif %} + {% if resume.skills|selectattr('level', 'le', 50)|list|length %} +

Known

+ + {% endif %} +
+
+ + \ No newline at end of file