makeinvoice

command module
v0.0.0-...-41cbd92 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: MIT Imports: 4 Imported by: 0

README

makeinvoice

makeinvoice is a simple utility to convert CSV files into beautiful HTML or PDF. You create your template (in HTML, text or Markdown) and you're ready to go.

You can also use it to convert CSV into markdown directly.

Usage

makeinvoice reads your output to determine in what format the result should be exported.

  • It can read a template in text, HTML or Markdown.
  • It can export in Markdown, HTML or PDF.
makeinvoice --template template.html --output result.pdf sales.csv revenues.csv

Template

You can write your template to specify how the data should be presented.

It uses standard Go templates. Each CSV can be referenced by its name in the template.

Minimal example in HTML:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
  <!-- Name references `name.csv`. Note that the first char is capitalized. -->
  {{ index . "Name" }}
</body>
</html>

You can also iterate over all the CSV:

...
<body>
  {{ range . }}
    {{ . }}
  {{ end }}
</body>
...

Or if you'd rather get the index and element:

...
<body>
  {{ range $i, $e := .  }}
    <h1>Data #{{ $i }}</h1>
    <div>{{ $e }}</div>
  {{ end }}
</body>
...

Requirements

External
  • http://wkhtmltopdf.org/ - you need this package to export in PDF. On Mac OS X, you can install it with brew cask install wkhtmltopdf.
Build

Go:

TODO

  • Choose the key for a CSV in the template files, like makeinvoice name=test.csv.
  • Vendor Go libraries.
  • Tests.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
common

Jump to

Keyboard shortcuts

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