Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Stepner committed Dec 27, 2017
2 parents f8c262f + 5ddad75 commit 52d7119
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
*.pyc

# Distribution / packaging
build/
dist/
*.egg-info/

Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# pandoc-mustache: Variable Substitution in Pandoc

[![Development Status](https://img.shields.io/pypi/status/pandoc-mustache.svg)](https://pypi.python.org/pypi/pandoc-mustache/)
[![PyPI version](https://img.shields.io/pypi/v/pandoc-mustache.svg)](https://pypi.python.org/pypi/pandoc-mustache/)
[![Python version](https://img.shields.io/pypi/pyversions/pandoc-mustache.svg)](https://pypi.python.org/pypi/pandoc-mustache/)
[![Build Status](https://travis-ci.org/michaelstepner/pandoc-mustache.svg?branch=master)](https://travis-ci.org/michaelstepner/pandoc-mustache)

The **pandoc-mustache** filter allows you to put variables into your pandoc document text, with their values stored in a separate file. When you run `pandoc` the variables are replaced with their values.
Expand All @@ -8,17 +11,22 @@ The **pandoc-mustache** filter allows you to put variables into your pandoc docu

## Example

This document, `document.md`:
This document, in `document.md`:

> \-\-\-
> mustache: ./le_gaps.yaml
> \-\-\-
> The richest American men live {{diff_le_richpoor_men}} years longer than the poorest men, while the richest American women live {{diff_le_richpoor_men}} years longer than the poorest women.
```
---
mustache: ./le_gaps.yaml
---
The richest American men live {{diff_le_richpoor_men}} years longer than the poorest men,
while the richest American women live {{diff_le_richpoor_women}} years longer than the poorest women.
```

Combined with this dictionary, `le_gaps.yaml`:
Combined with these variable definitions, in `le_gaps.yaml`:

> diff_le_richpoor_men: "14.6"
> diff_le_richpoor_women: "10.1"
```yaml
diff_le_richpoor_men: "14.6"
diff_le_richpoor_women: "10.1"
```
Will be converted by `pandoc document.md --filter pandoc-mustache` to:

Expand Down Expand Up @@ -48,6 +56,7 @@ Python 2.7, 3.4+, pypy, and pypy3 are supported.
3. The pandoc document containing the mustache variables points to the YAML file (or files) which contain the variable definitions. These files are indicated using the mustache field in a [YAML metadata block](https://pandoc.org/MANUAL.html#metadata-blocks), typically placed at the top of the pandoc document. Absolute paths and relative paths are supported: relative paths are evaluated relative to the working directory where `pandoc` is being run.

An example:

```yaml
---
title: My Report
Expand All @@ -56,16 +65,16 @@ Python 2.7, 3.4+, pypy, and pypy3 are supported.
---
The temperature in {{place}} was {{temperature}} degrees.
```

Or, with more than one file:

```yaml
---
title: My Report
author: Jane Smith
mustache:
- ./vars.yaml
- ./additional_vars.yaml
- ./vars.yaml
- ./additional_vars.yaml
---
The temperature in {{place}} was {{temperature}} degrees.
The humidity was {{humidity}}%.
Expand Down
1 change: 1 addition & 0 deletions pandoc_mustache/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .version import __version__
import pandoc_mustache
2 changes: 1 addition & 1 deletion pandoc_mustache/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.1'
__version__ = '0.0.2'
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
'Development Status :: 3 - Alpha',

# Indicate who your project is intended for
'Environment :: Console',
Expand Down Expand Up @@ -83,11 +83,11 @@

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# packages=find_packages(exclude=['contrib', 'docs', 'tests', 'examples']),
packages=find_packages(exclude=['contrib', 'docs', 'tests', 'examples']),

# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
py_modules=["pandoc_mustache"],
# py_modules=["pandoc_mustache"],

# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
Expand Down

0 comments on commit 52d7119

Please sign in to comment.