Skip to content

Commit

Permalink
Fix pre-existing header-includes
Browse files Browse the repository at this point in the history
  • Loading branch information
chdemko committed May 15, 2018
1 parent 4a6da2a commit e624004
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ python:
- "3.4"
- "3.5"
before_install:
- wget https://github.com/jgm/pandoc/releases/download/2.1.3/pandoc-2.1.3-1-amd64.deb
- sudo dpkg -i pandoc-2.1.3-1-amd64.deb
- wget https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
- sudo dpkg -i pandoc-2.2.1-1-amd64.deb
- pandoc -v
install:
- pip install coveralls
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# pandoc-latex-color
[![Build Status](https://img.shields.io/travis/chdemko/pandoc-latex-color/master.svg)](https://travis-ci.org/chdemko/pandoc-latex-color/branches)
[![Coveralls](https://img.shields.io/coveralls/github/chdemko/pandoc-latex-color/master.svg)](https://coveralls.io/github/chdemko/pandoc-latex-color?branch=master)
[![Build Status](https://img.shields.io/travis/chdemko/pandoc-latex-color/0.0.3.svg)](https://travis-ci.org/chdemko/pandoc-latex-color/branches)
[![Coveralls](https://img.shields.io/coveralls/github/chdemko/pandoc-latex-color/0.0.3.svg)](https://coveralls.io/github/chdemko/pandoc-latex-color?branch=0.0.3)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/chdemko/pandoc-latex-color.svg)](https://scrutinizer-ci.com/g/chdemko/pandoc-latex-color/)
[![PyPI version](https://img.shields.io/pypi/v/pandoc-latex-color.svg)](https://pypi.org/project/pandoc-latex-color/)
[![PyPI format](https://img.shields.io/pypi/format/pandoc-latex-color.svg)](https://pypi.org/project/pandoc-latex-color/)
[![License](https://img.shields.io/pypi/l/pandoc-latex-color.svg)](https://raw.githubusercontent.com/chdemko/pandoc-latex-color/master/LICENSE)
[![License](https://img.shields.io/pypi/l/pandoc-latex-color/0.0.3.svg)](https://raw.githubusercontent.com/chdemko/pandoc-latex-color/0.0.3/LICENSE)
[![Downloads](https://img.shields.io/pypi/dm/pandoc-latex-color.svg)](https://pypi.org/project/pandoc-latex-color/)
[![Python version](https://img.shields.io/pypi/pyversions/pandoc-latex-color.svg)](https://pypi.org/project/pandoc-latex-color/)
[![Development Status](https://img.shields.io/pypi/status/pandoc-latex-color.svg)](https://pypi.org/project/pandoc-latex-color/)
[![Python version](https://img.shields.io/pypi/pyversions/pandoc-latex-color/0.0.3.svg)](https://pypi.org/project/pandoc-latex-color/0.0.3/)
[![Development Status](https://img.shields.io/pypi/status/pandoc-latex-color/0.0.3.svg)](https://pypi.org/project/pandoc-latex-color/0.0.3/)

*pandoc-latex-color* is a [pandoc] filter for setting the color to `Span`, and `Div` that have speficied classes or `latex-color` attribute.

Expand Down
7 changes: 5 additions & 2 deletions pandoc_latex_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Pandoc filter for changing color in LaTeX
"""

from panflute import run_filter, debug, Span, Div, RawInline, RawBlock, MetaInlines
from panflute import run_filter, debug, Span, Div, RawInline, RawBlock, MetaInlines, MetaList

def x11colors():
# See https://www.w3.org/TR/css-color-3/#svg-color
Expand Down Expand Up @@ -229,7 +229,10 @@ def add_definition(defined, definition):
def finalize(doc):
# Add header-includes if necessary
if 'header-includes' not in doc.metadata:
doc.metadata['header-includes'] = []
doc.metadata['header-includes'] = MetaList()
# Convert header-includes to MetaList if necessary
elif not isinstance(doc.metadata['header-includes'], MetaList):
doc.metadata['header-includes'] = MetaList(doc.metadata['header-includes'])

# Add usefull LaTexPackage
doc.metadata['header-includes'].append(MetaInlines(RawInline('\\usepackage{xcolor}', 'tex')))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.0.2',
version='0.0.3',

# The project's description
description='A pandoc filter for changing font size in LaTeX',
Expand Down

0 comments on commit e624004

Please sign in to comment.