From e624004997f3402dde952797b966269eb45d069e Mon Sep 17 00:00:00 2001 From: Christophe Demko Date: Tue, 15 May 2018 10:08:14 +0200 Subject: [PATCH] Fix pre-existing header-includes --- .travis.yml | 4 ++-- README.md | 10 +++++----- pandoc_latex_color.py | 7 +++++-- setup.py | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index eda076f..436ade2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index 91b0260..e939b5e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/pandoc_latex_color.py b/pandoc_latex_color.py index 4eaef65..7a81ec8 100644 --- a/pandoc_latex_color.py +++ b/pandoc_latex_color.py @@ -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 @@ -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'))) diff --git a/setup.py b/setup.py index e9401a6..7e68a5b 100644 --- a/setup.py +++ b/setup.py @@ -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',