resify

command module
v0.0.0-...-aac88c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2020 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Command resify takes a resume YAML file and runs it through a template (by default index.tem), loaded from a templates directory. Templates can optionally emit either HTML-specific or text output. This is specifically for controlling context-specific escaping in templates.

$ go get go.spiff.io/resify

resify understands two commands: 'render' and 'yaml'. If given the render command, it will read any YAML files given on the command line, after the 'render' command, and one by one render them to the output given (by default the standard output).

If given the yaml command, resify will write an example YAML file for use with resify to the output. This can be modified for generating resume outputs in any text or HTML-based format.

resify expects to find templates under pwd/templates with the file extension ".tem". If any templates fail to compile or cannot be rendered, an error is written to standard error and resify returns 1.

Templates have access to any data under templates/ and all data associated with the rtype.Resume data structure.

All templates, regardless of text- or HTML-based output, have the following functions available in addition to those built into the template packages:

embed: Load a file beneath the template directory and return its contents. This may need to be piped to either html,
    attr, or css depending on the context.

html: In HTML output, declare that the string passed to html is safe for the HTML context.

attr: In HTML output, declare that the string passed is safe for the HTML attribute context.

css: In HTML output, declare that the string passed is safe for the CSS context.

js: In HTML output, declare that the string passed is safe for the Javascript context.

linkify: Returns the string given to it with all instances of ((URL label)) with whatever the result of using the "link"
    template to render them is. If no "link" (not "link.tem") template is defined, the result is the label string.
    If there is no label string, the result is some form of the URL.

An example template for use with resify (as templates/index.tem):

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{{ .Me.Chosen }}: Resume</title>
</head>
<body>
    <h1>{{ .Me.Chosen }}</h1>
    {{ if .Meta.statement }}<p>{{ .Meta.statement }}</p>{{ end }}

    <h2>Employment</h2>
    <ul>{{ range $e := .Employment }}
        <li>
            <h3>{{ .Title }}</h3>
            <p>{{ .Where.Name }} ({{ .Where.Place }})</p>
            <p>{{ .Description | linkify }}</p>
        </li>
    {{ end }}</ul>

    <h2>Education</h2>
    <ul>{{ range $e := .Education }}
        <li>
            <h3>{{ .Where.Name }} ({{ .Where.Place }})</h3>
            <p>{{ .Where.Place }}</p>
            <p><em>{{ or .Received "No degree" }}.</em></p>
            {{ if .Fields }}
            <p>Studied {{ range $nth, $f := .Fields }}{{ if gt $nth 0 }}, {{ end }}<em>{{ . }}</em>{{ end }}</p>
            {{ end }}
            <p>{{ .Description | linkify }}</p>
        </li>
    {{ end }}</ul>
</body>
</html>

The only noteworthy part of the above template is the Meta.statement block -- most, but not all, data in the YAML file given can also have associated metadata that may be used to populate fields that may be specialized/esoteric (e.g., your manager's name, a note about some unusual thing, etc.).

This is obviously not the be-all-end-all of tools for separating resume data and rendition, it's just good enough for my purposes, which is mainly so I don't have to update three different formats all the time. At most, I need to update the data, and then any change in format can be handled by a template.

Some massaging of the data that I intended to have but didn't do because it didn't really make sense, like filling in empty fields based on others if you didn't provide one, are on the TODO list and probably won't actually happen unless there's some reason I need them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL