GithubHelp home page GithubHelp logo

panzer's People

Contributors

grea09 avatar kdelwat avatar msprev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

panzer's Issues

`--smart` and Beamer writer

I think the same thing needs to be done for the Beamer writer as for the LaTeX writer regarding the --smart option.

Biblatex option

I would like to use pandoc's --biblatex option. I though that the following 'style.yaml' file would do it:

########################################################################
#                     Base - parent of all styles                      #
########################################################################

Base:
    all:
        metadata:
            bibliography: /Users/thomas/Library/texmf/bibtex/bib/bibliography.bib
    latex:
        preflight:
            - run: tmp_out.py
        postflight:
            - run: latexmk.py
            - run: open_pdf.py
        cleanup:
            - run: tmp_back.py
            - run: rmlatex.py

########################################################################
#                               Paper                                #
########################################################################

Paper:
    parent:
        - Base
    all:
        metadata:
            numbersections: true
    latex:
        metadata:
            biblatex: true
        template: default.latex

But when I do $ panzer --output foo.tex foo.txt it's clear that the biblatex option hasn't been called: my cite keys haven't turned to citations commands, and biblatex hasn't been called. I do get numbered sections, so it's not that panzer doesn't see my files or anything like that.

By the way, doing this works fine: $panzer --biblatex --output foo.tex foo.txt. Have I failed to set something up right in my style file?

Command line option "--verbose" for pandoc not recognized by panzer?

I tried to use the --verbose option with panzer, it continues after throwing an error:

ERROR: do not recognize command line option "--verbose"---ignoring

This option is recognized by the bare pandoc command.

I was expecting panzer to pass this option to the invocation of pandoc

panzer version: 1.0
pandoc version: 1.17.0.2

Feature request: ---pandoc PATH/TO/EXECUTABLE and/or check PANDOC_PATH env variable

I just decided to be crazy enough to try a pandoc-nightly build to work around a bug in the stable release of Pandoc, but found that unless I'm not also crazy enough to drop it into ~/bin/ under the name pandoc I can't use it with panzer! What about adding a ---pandoc PATH/TO/EXECUTABLE option and/or check the PANDOC_PATH environment variable like Pandoc-Wrapper aka Pandoc.pm does1?

Personally I would be perfectly happy with the env variable, but Windows users might not agree!

(I could also do some symling shenanigans which is what I in the end did, but moving around/renaming symlinks isn't any more fun than renaming/moving around executables in the long run!)

Footnotes

  1. By my suggestion I have to admit, at that time because I used a wrapper script. In principle you could make Pandoc.pm invoke panzer!

Specifying markdown options in styles

I normally use pandoc with

--read=markdown+autolink_bare_uris+multiline_tables+table_captions+definition_lists

How can I specify this in a style definition? According to the doco the option read is not allowed in the commandline yaml field.

WARNING: no global style definitions found

Hi,

I must be making a basic mistake, but I can't get panzer to recognise my style definitions. I get this warning when I run panzer:

WARNING: no global style definitions found

but I have styles in:

$ ls ~/.panzer/styles/
styles.yaml

Any thoughts?

"~" and "*" not expanding before calling subprocesses

I want to create global styles with odt reference files. So I write this in the yaml file :

rapport:
    all:
        metadata:
            smart: true
            standalone: true
            numbersections: true
            secPrefix:
                - section
                - sections
            figPrefix:
                - figure
                - figures
            eqnPrefix:
                - equation
                - equations
            tblPrefix:
                - table
                - tables
            markdown_in_html_blocks: true
            bibliography: "~/.panzer/bibliography/zotero.bib"

        filter:
            - run: pandoc-crossref
            - run: pandoc-science.py
            - run: pandoc-citeproc
            - run: pandoc-svg.py
        postflight:
            - run: odt2pdf
        cleanup:
            - run: clean

    odt:
        commandline:
            reference-odt: "`~/.panzer/template/rapport.odt`"

The problem is that I get that output :

         ----- pandoc read -----
         running
         ----- style definitions -----
         global:
           rapport        
         ----- document style -----
         style:
           rapport
         full hierarchy:
           rapport
         writer:
           odt
         ----- run list -----
         filter:
          1  pandoc-crossref "~/.panzer/filter/pandoc-crossref"
          2  pandoc-science  "~/.panzer/filter/pandoc-science.py"
          3  pandoc-citeproc "pandoc-citeproc"
          4  pandoc-svg      "~/.panzer/filter/pandoc-svg.py"
         postflight:
          5  odt2pdf         "~/.panzer/postflight/odt2pdf"
         cleanup:
          6  clean           "~/.panzer/cleanup/clean"
         ----- filter -----
         [1/6] pandoc-crossref odt
         [2/6] pandoc-science odt
         [3/6] pandoc-citeproc odt
ERROR:     !pandoc-citeproc: Could not find ~/.panzer/bibliography/zotero.bib
ERROR:   failed to receive json object from filter---skipping filter
         [4/6] pandoc-svg odt
         ----- pandoc write -----
         pandoc writing with options:
           --reference-odt=~/.panzer/template/rapport.odt
ERROR:     !pandoc: ~/.panzer/template/rapport.odt: openBinaryFile: does not exist (No such file or directory)
         ----- postflight -----
         [5/6] odt2pdf
ERROR:     !Error: source file could not be loaded
         ----- cleanup -----
         [6/6] clean

Everything works with complete absolute paths but not with symbols that require expansion. I tried to use commands using the wildcard "*" that works in the terminal but not with Panzer. I think it is an issue with Python not expanding them unless told otherwise.

Thanks for the great tool, I use it even for redacting quite complex conference papers.

Test suite errors

I've just installed panzer, and thought I'd run the test suite on both 'pandoc' and 'panzer' supplied test files.

On each of the 130+ tests, for both remits, it gave this error: ERROR: do not recognize command line option "--smart"—ignoring.

Why "filter" instead of "filters"?

Since I keep my panzer support files in my pandoc data directory (to avoid redundancies), I wonder if there is a specific reason why panzer only looks for filters in a directory named "filter" when pandoc has a "filters" directory by convention?

The same applies to "template" vs "templates" but I've been successfully using "templates" as directory name so far.

--katex, --mathjax, etc. with URL argument

Some commmandline arguments of pandoc have an optional URL argument, i.e. they can be boolean switches (with default URL) or require an argument.
For example pandoc --katex and pandoc --katex=/home/user/katex both work.

In panzer, it works to add katex: true to the the YAML style definition, but katex: /home/user/katex does not work.

Though I didn’t test it with all of the ones below, I guess it is an issue with this list of parameters, too:

  • katex
  • mathjax
  • webtex
  • latexmathml

Thanks for writing this nice piece of software!

EDIT: I’m sorry, this was my own mistake. The correct way to declare the path for e.g. katex is this:
katex: "`/home/user/katex`"

---strict flag?

Brainstorming a bit, but is it feasible to set a ---strict flag that will stop on error?

It would require a minor chance in cli.py (stop if unknown is not empty) and in document.py (I'm not sure if changing do_not_stop is enough)

setup.py fails

Hi,
I'll try to run python3 setup.py install but It throws an error:

python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 1, in <module>
    from setuptools import setup
ImportError: No module named 'setuptools'

Python 3 version:

python3 --version
Python 3.4.0

local styles are note found

I try using local styles, but panzer gives message:

ERROR:   No style definition found for style "fotext" --- ignoring it

I attached a zipped MWE. (You need to change the extension to zip, because GitHub only allows JPGs, not ZIP files.): local-style-test_change-ext-to-zip.jpg

The complete input and out when I run panzer is:

$ panzer -w latex -o out.pdf fotext-doc.md
WARNING: no global style definitions found
         ----- pandoc read -----
         pandoc reading with options:
           --smart
         ----- style definitions -----
         no global definitions loaded
         ----- document style -----
         style:
           fotext
ERROR:   No style definition found for style "fotext" --- ignoring it
         full hierarchy:
           empty
         writer:
           latex
         ----- run list -----
           empty
         ----- pandoc write -----
         running
$ 

Local style.yaml files

It seems currently we can define style in .panzer/styles.yaml or locally in the yaml header.

It would be nice to be able to provide a path to a styles.yaml file that is local to our project, e.g.


---
stylepath: "`path/to/project/styles.yaml`"
style:MyTemplate

---

Any thoughts on this?

Support Pandoc pptx writer

As of 2.0.5 pandoc has a PowerPoint writer. I'm guessing it needs to be identified in panzer as a binary format because I'm getting an error about it looking for a default template.

Note: this is not a particularly urgent fix for me -- it's not a very useful writer yet.

panzer errors on --metadata-file option

As the heading says panzer errors on --metadata-file option introduced in pandoc 2.3. Could you please fix this? I would prefer to use this option instead of just prepending project-metadata.yaml to the input since it would make it possible to include the project metadata file through the document metadata, or so I hope.

Repeated 'header-includes'

When there there several uses of 'header-includes' in the style file only the last one is used. If I've understood the code right, the issue is that 'header-includes' isn't one of the additive options.

panzer won't start install due to Unicode error

After

git clone https://github.com/msprev/panzer
cd panzer
python3 setup.py install

I get

Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    readme_text = file.read()
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 127: ordinal not in range(128)

Any setting in the python3 package system needed?

Many thanks,
Leo

Why execute filters with subprocess?

Perhaps I'm missing something here. But it seems strange to me to have a python module which is using subprocess to execute other python files, passing information through stdout and stdin. Is there a reason you can't replace the if __name__ script with a main function and then just call each filters main function?

Traceback error on panzer invocation

I updated panzer today using the call pip3 install --upgrade git+https://github.com/msprev/panzer. When I run panzer now it gives me a traceback error:

Traceback (most recent call last):
  File "/usr/local/bin/panzer", line 11, in <module>
    load_entry_point('panzer==1.1', 'console_scripts', 'panzer')()
  File "/usr/local/lib/python3.6/site-packages/panzer/panzer.py", line 40, in main
    global_styledef, local_styledef = load.load_all_styledefs(doc.options)
  File "/usr/local/lib/python3.6/site-packages/panzer/load.py", line 58, in load_all_styledefs
    global_styledef = load_styledef(support_dir, options)
  File "/usr/local/lib/python3.6/site-packages/panzer/load.py", line 134, in load_styledef
    return meta.get_metadata(ast)
  File "/usr/local/lib/python3.6/site-packages/panzer/meta.py", line 176, in get_metadata
    metadata = ast['meta']
TypeError: list indices must be integers or slices, not str

I had updated my python using brew upgrade, not sure if that could be the cause of the problem.

panzer treats format+/-extension as a separate format

While I know that you don't think that panzer should concern itself with the arguments to pandoc's -r and -w options (or their synonyms) there is one aspect of them which panzer probably needs to at least be enough aware of to ignore: pandoc extensions. Currently panzer 1.3 considers e.g. html and html-smart as two different output formats, totally ignoring styles for html when running with -w html-smart. As you can see from the example at the end of this post it can be exploited, but most of the time it is just plain annoying. There is really no workaround except duplicating styles in YAML files albeit eased a bit by the use of YAML anchors and references. When using multiple extensions it gets hard to handle, because you must use the exact same extensions, specified in the exact same order each time! Arguably this is due to a design flaw in pandoc: rather than appending these cute +this-that suffixes to the reader/writer name there should have been proper options -X, --reader-extension +ENABLED and -x --writer-extension -DISABLED. I can see three and a half solutions to this:

  1. Just ignoring all extensions in the -w option argument when looking up styles. This is entirely acceptable but IMO a bit too limiting.

  2. Parsing out the extensions part of -w option arguments and format keys in styles alike, split it into format and individual extensions, sort sextensions ASCIIbetically, join them together again and do lookup based on that. This would however be messy and confusing, and what if a style contains several keys with the same format and extensions but in different order?

  3. Let panzer users specify extensions in styles as lists:

    1. Pretend that those --reader-extension and --writer-extension options actually exist, letting panzer users specify them in styles just like other options and then append them to the reader/writer format. This would work very well and might motivate jgm to actually provide those options in pandoc. Alas there is the possibility, however slight, that like-named options with other functions be introduced in pandoc.

    2. Better then to introduce an extensions field in styles:

      Fancy:
        markdown:
          extensions:
            reader:
              on:
                - '`four_space_rule`'     # Keep my sanity!
                - '`emoji`'               # One of the few other off-by-default extensions I might consider turning on!
              off:
                - '`tex_math`'            # Strictly empirical linguistics and humanities here!
      
      Simple:
        parent: Fancy
        markdown:
          extensions:
            writer:
              on:
                - '`smart`'               # Which actually means "NOT smart"! :-(
                - '`ascii_identifiers`'
              off:
                - '`bracketed_spans`'
                - '`fenced_divs`'

      The on/off level rather than +/-foo in the lists is of course not strictly needed, but would greatly help me for one to see at a glance what gives!

I'll fully understand, and be quite happy, if you opt for 1. for the time being (format = re.match('\w+', options['write']) or 'html' and call it a day!) but please keep 3.ii. in mind for the future!


Example:

~/Dokument/bugs/panzer/extensions$ cat example.md 
---
style: Foo
styledef:
  Foo:
    html:
      commandline:
        number-sections: true
    html-smart:
      commandline:
        number-sections: false
---

# Primum

## Primum "Alpha"

## Primum "Beta"

# Secundum

## Secundum "Alpha"

# Tertium

## Tertium "Alpha"

~/Dokument/bugs/panzer/extensions$ panzer example.md -w html
         ----- pandoc read -----
         running
         ----- style definitions -----
         global:
           <classified>
         document:
           Foo        
         ----- document style -----
         style:
           Foo
         full hierarchy:
           Foo
         writer:
           html
         ----- run list -----
           empty
         ----- pandoc write -----
         pandoc writing with options:
           --number-sections
<h1 id="primum"><span class="header-section-number">1</span> Primum</h1>
<h2 id="primum-alpha"><span class="header-section-number">1.1</span> Primum “Alpha”</h2>
<h2 id="primum-beta"><span class="header-section-number">1.2</span> Primum “Beta”</h2>
<h1 id="secundum"><span class="header-section-number">2</span> Secundum</h1>
<h2 id="secundum-alpha"><span class="header-section-number">2.1</span> Secundum “Alpha”</h2>
<h1 id="tertium"><span class="header-section-number">3</span> Tertium</h1>
<h2 id="tertium-alpha"><span class="header-section-number">3.1</span> Tertium “Alpha”</h2>

~/Dokument/bugs/panzer/extensions$ panzer example.md -w html-smart
         ----- pandoc read -----
         running
         ----- style definitions -----
         global:
           <classified>
         document:
           Foo        
         ----- document style -----
         style:
           Foo
         full hierarchy:
           Foo
         writer:
           html-smart
         ----- run list -----
           empty
         ----- pandoc write -----
         running
<h1 id="primum">Primum</h1>
<h2 id="primum-alpha">Primum "Alpha"</h2>
<h2 id="primum-beta">Primum "Beta"</h2>
<h1 id="secundum">Secundum</h1>
<h2 id="secundum-alpha">Secundum "Alpha"</h2>
<h1 id="tertium">Tertium</h1>
<h2 id="tertium-alpha">Tertium "Alpha"</h2>

Is it possible to relocate .panzer directory?

As far as I can see from the documentation, the ~/.panzer directory location for supporting scripts and styles is hard-coded. There are situations where you'd want multiple users to share the same files, and (in my case) the same user over several machines. Ideally I'd like to relocate this to sit in my Dropbox. I can probably do so with links, but if it's possible within panzer itself, that would be much better.

Path relative to files

I have been trying panzer a lot today. It is very convenient, good work!

To me, it would be useful to be able to define path realtive to files and not to the directory panzer is executed, e.g.


---
style: Default
styledef:
  Default:
    all:
      commandline:
        standalone: true
        include-in-header:
          - "` $pathtothisfile$/header_addon.html`"

---

Hello World!

Let's call this file website/sitesrc/project/projectOne.md (see below).

I have no idea about which syntax can be used and wether it is possible. Yet, it seems convenient when automatizing panzer calls. For example, if one wants to build a website, he will have to call panzer for all *.md files in a folder hierarchy and output in another folder under the same hierarchy, e.g.

Currently (with include-in-header: "header_addon.html") we must do:

cd website/sitesrc/project/projectOne.md
panzer projectOne.md -o ../../../sitebin/project/projectOne.html

Seems nicer if it could work like that:

panzer website/sitesrc/project/projectOne.md -o website/sitebin/project/projectOne.html

(with relative path for include-in-header: "$pathtothisfile$/header_addon.html")

If you think of building a serie of scripts that automate calls to panzer, the second option is easier to manage. And having the option to use relative paths is always nice :)

Creates ~/.panzer even though using ---panzer-support

I've moved the panzer configuration files from ~/.panzer to ~/.config/panzer. Even if I use the ---panzer-support option to specify ~/.config/panzer as the support directory (as per the Use instructions and #40), panzer insists on creating the ~/.panzer directory template anyway:

$ panzer ---panzer-support="/home/user/.config/panzer --to="html" --output="test.html" "test.md"
WARNING: default panzer support directory "/home/user/.panzer" not found
WARNING: create empty support directory "/home/user/.panzer"?
    Press Enter to continue...

Despite panzer's temporary obsession with ~/.panzer at the start of processing, it uses the nominated support directory for actual document processing.

Can this check for, and creation of, the default support directory be skipped when the ---panzer-support option is used?

Ability to select default writer in style

Hi,

I really like panzer a lot, and I have looked around for a while but could not find a way to specify the default writer in the style. Didn't I get it or is there no such option available?

IMHO this would be helpful (especially in the case you have to select the latex output for example, but with postprocessing you get a pdf anyway) and will also reduce characters to type and remember for calling panzer.

Matthias

Support 'includes' directory similar to 'template' directory

I have a directory ~/.pandoc/includes/ and often a directory ./includes/ containing reusable header includes files like fancy-headings.ltx. The irritating thing about this is that when using panzer I still have to supply these as command line options with a full path and without smartness in the lookup:

commandline:
  include-in-header:
    - '`/home/bpj/.pandoc/includes/fancy-headings.ltx`'

In short I wish I could say

headerincludes:
  # These load titlesec and does stuff with it
  - kill: plain-headings.ltx 
  - use:  fancy-headings.ltx
beforebodyincludes:
  - use:  foo.ltx
afterbodyincludes:
  - kill: bar.ltx

and have panzer look for the files similarly to how it looks for filters and templates,

# look for
1 ./fancy-headings.ltx
2 ./includes/fancy-headings.ltx
3 ./includes/fancy-headings/fancy-headings.ltx
4 ~/.panzer/includes/fancy-headings.ltx
5 ~/.panzer/includes/fancy-headings/fancy-headings.ltx

building an includes list for each of the three locations.

Notes:

  • I only ever use header includes this way, but it seems to make sense to support before/after body includes as well. If they are not included somebody will certainly find a need for them! :-)

  • I'm not enough of a Python programmer, my language of choice being Perl, to suggest any code for doing this, but hopefully the code for looking up filters, templates etc. can largely be reused.

[enhancement] Allow metadata field value to be used in styles

It would be nice if one could use values from metadata fields in styles definition. For instance, in a document:

---
metadata: work3.yaml
style: MyStyle
---
# My document

And in styles.yaml:

MyStyle:
  all:
    commandline:
      metadata-file: "`$metadata$`" # I suggest $ as it's syntax from Pandoc templates

In this case, panzer would put in command line --metadata-file=work3.yaml (I know this case would also need #48 to completely work).

Is it possible? (In the past I've already faced other situations where this would elegantly solve problems, but unfortunately I can't remember whose situations were those...)

Doubled bibliography

Hi,
I noticed that if you use a child style that use filter: - run: pandoc-citeproc and the parent also use the same filter, this is runned two times: in this case it causes the bibliography to be listed two times.

Default style

Is there a name for a default style which (if it is defined in the styles.yaml file) is used when the document contains no style definition?

Lua filters don't receive pandoc's AST, and don't output anything

Starting with panzer 1.4, lua filters are supported (many thanks to @msprev !!). So I tried some lua filters that I wrote myself, and none of them got expected behaviour. In fact, it seems lua filters are receiving JSON, when should receive AST instead (according to pandoc's doc on lua filters).

For instance, I have this lua filter (very first example on lua filters in pandoc's doc). It should turn Strong elements into SmallCaps elements:

function Strong(elem)
  return pandoc.SmallCaps(elem.c)
end

Running directly with pandoc, it works. Using panzer, nothing happens. Below is my styles.yaml (excerpt), which only puts that lua filter to run:

Base:
  all:
    metadata:
      numbersections: true
      lang: "pt-BR"
    commandline:
      standalone: true
    lua-filter:
      - run: myfilter.lua

The filter is correctly found by panzer, and apparently runs, but no errors on lua-filter are shown when running panzer. Even print('some debug') doesn't output anything to console. I tried to use JSON on the lua filter, but I couldn't realize how to do that. My first try was like code below, withou any results:

function test(key, value, format, meta)
  return pandoc.Str(value)
end

toJSONFilter(test)

Am I missing something?

Panzer doesn't run on Windows

Using latest version on Win7x64 + Python 3.5.

When running panzer, I get

failed to create process

I've added the python directories to the path, but this doesn't seem to help. Any ideas?

Running filter on Windows gives ERROR [WinError 193] "%1 is not a valid Win32 application"

On Windows (10 x64), trying to run python filters on dot-panzer always gives me ERROR [WinError 193] %1 is not a valid Win32 application. For instance, for a filter named smallcaps and output type set to html5, the following lines return:

[1/3] smallcaps html5
ERROR:     [WinError 193] %1 is not a valid Win32 application

I guess %1, in this case, is html5. All python filters result in the same error. The location of each filter, printed in command line, is correct. I tried these things, all unsuccessful:

  • run chmod +x on filter (using Git Bash on Windows)
  • change first line of filter, from #!/usr/bin/env python3 to #!c:\users\netot\appdata\local\programs\python\python36-32\python.exe
  • change filter name to ./<filter>:
    • move filter to current directory
    • run chmod +x on filter
    • change first line as above
    • change filter name to ./<filter> on styles.yaml

My styles.yaml is like following (for filter named smallcaps.py:

Base:
  all:
    filter:
      - run: ./smallcaps.py

I think I'm doing something wrong here... Python is on the path, and I can run a postflight bat script (similar to bash script on Linux) successfully (though I have to write path separators as \\ in styles.yaml for this bat file).

Passing a csl file to panzer

An important part of styling is to define the csl file. After a quick search I was unable to see any document or example for using a csl file. Just wanted to know if and how specifying a csl file was supported using panzer.

I tried to put a csl field in my style, passing a path to the csl file I wish to use. However, the bibliography was still styled using pandoc's default styling. Setting the csl field in the metadata, using only pandoc does work.

I was unable to get the exact call to pandoc that panzer makes, but I did generate a DEBUG file. Am pasting the relevant (I think) sections below:

Deleted the logs as I figured out the issue please see below for more information

Suggestion: allow compact style field

One of the excellent effects of using panzer has been that it massively streamlines my document metadata block by moving its contents to the style file. It is not uncommon for metadata block to now look something like:

title:  "My Doc"
author: Me
date:   Now
style:
  - Standard
  - Latex12pt
  - PaginateSections

Over half the lines are due to the style field. If style values were parsed as comma- and/or space-delimited lists in themselves, this could be written as:

title:  "My Doc"
author: Me
date:   Now
style:  Standard, Latex12pt, PaginateSections

This is intuitive, more compact (displaying more document content when I open a file) and perhaps even elegant

Assuming style names have never been able to contain spaces or commas, such a change would be universally backwards-compatible. Is there any technical reason this could not be implemented?

Allow specifying the output name in the document metadata?

Currently Panzer does not allow setting the output filename or to format in the document metadata. I think I understand the current design. But sometimes it would be nice to run the same Panzer command line and specify the output in the document itself. This is the way some other systems like pandocomatic can be run.

An example usecase is to auto-run panzer on any target folder change...

Location of Temp Path

Is there a way to change the current directory when building the PDF files?
I'm on Windows and use Dropbox, so when Pandoc creates the tex2pdf.### folder , Dropbox reads the files, uploads them, then recognizes their deletion, and finally removes them from the server, which slows the process quite a bit.

On Windows the standard way is to use %TMP% when creating temporary files (which can be accesses from python with tempfile.gettempdir()

Also, on a related note: is there a way for a filter to know the initial path of the markdown file? (e.g. if I want to add tables located in ./Tables)

Thanks!
Sergio

Pandoc 2.0

Pandoc has been updated to 2.0 status. I'm sure it will take some time to go through all the changes, but right away I notice that the --smart/-S option has been deprecated which panzer tries to use when making pdf's. I tried to get around it with no-tex-ligatures but that's been deprecated, too. The latex-engine command line option has also changed to pdf-engine which panzer is not aware of.

ensure `commandline` works with repeated options

  • For pandoc key-values, the value should be a quoted inline code span, e.g. include-in-header: "path/to/my/header".

Not having tested I wonder if you have noted that some options
beside -F and -M are repeatable and therefore should take a list
(of 'codes') as value?

E.g. the default latex template says:

 $for(header-includes)$ 
 $header-includes$ 
 $endfor$ 

and it works with plain pandoc:

 $ echo '\foo' >foo.ltx 
 $ echo '\bar' >bar.ltx 
 $ pandoc -w latex -H foo.ltx -H bar.ltx 
 ^D 
 ... 
 \foo 
 \bar 

 \begin{document} 
 ... 

I use particularly -H like that so I reacted at the wording of the
readme.

/bpj

smallcaps.py RecurrsionError

I'm getting a strange RecursionError when running your smallcaps.py filter.

pandocfilters (1.4.2)
panzer (1.4.1)

pandoc (2.2.1)
Compiled with pandoc-types 1.17.5.1, texmath 0.11.0.1, skylighting 0.7.3

ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 124, in walk
ERROR:     !    x[k] = walk(x[k], action, format, meta)
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 118, in walk
ERROR:     !    array.append(walk(res, action, format, meta))
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 124, in walk
ERROR:     !    x[k] = walk(x[k], action, format, meta)
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 118, in walk  
ERROR:     !    array.append(walk(res, action, format, meta))
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 124, in walk
ERROR:     !    x[k] = walk(x[k], action, format, meta)
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 118, in walk
ERROR:     !    array.append(walk(res, action, format, meta))
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 124, in walk
ERROR:     !    x[k] = walk(x[k], action, format, meta)
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 118, in walk
ERROR:     !    array.append(walk(res, action, format, meta))
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 124, in walk
ERROR:     !    x[k] = walk(x[k], action, format, meta)
ERROR:     !  File "/home/thomas/.local/lib/python3.6/site-packages/pandocfilters.py", line 111, in walk
ERROR:     !    item['c'] if 'c' in item else None, format, meta)
ERROR:     !  File "/home/thomas/.panzer/filter/smallcaps/smallcaps.py", line 52, in smallcaps
ERROR:     !    if clean(value) in get_list(meta):
ERROR:     !  File "/home/thomas/.panzer/filter/smallcaps/smallcaps.py", line 41, in clean
ERROR:     !    word_index = range(0, len(word))
ERROR:     !RecursionError: maximum recursion depth exceeded while calling a Python object
ERROR:   failed to receive json object from filter---skipping filter

Problem working with stdin

panzer doesn't seem to work well with stdin. This is unfortunate because a number of tools (eg the Atom editor) can use a custom markdown processor (ie pandoc) but won't work with panzer.

For example if I run something like:

cat file.md | panzer

it won't work. It detects the style, but not everything runs. Furthermore, pandoc doesn't seem to be getting the full file

The panzer output (which doesn't include postflight, filters, or html-specific options that I've defined):

 ----- pandoc read -----
         running
         ----- style definitions -----
         global:
           AddLatexRefs  Article  Base       BookReview  Braindead   
           CV            Draft    Letter     Manuscript  Marking     
           Mumford       Notes    NotesSans  Plain       Thesis-Draft
           Thesis-Final                                              
         ----- document style -----
         style:
           Thesis-Draft
         full hierarchy:
           Base, Manuscript, Thesis-Draft
         writer:
           html
         ----- pandoc read with metadata options -----
         pandoc reading with options:
           --smart
         ----- run list -----
           empty
         ----- pandoc write -----
         pandoc writing with options:
           --self-contained --standalone --dpi=300

The output to stdout is just a blank html doc as if pandoc got nothing:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>

</body>
</html>

Running filter gives ERROR: [Errno 13] Permission denied

When I run a filter with pandoc, it works fine, when I use it via panzer it fails with the following error:
ERROR: [Errno 13] Permission denied

The filter is at: https://gist.github.com/bpj/f591a9e29fe974fa791f#file-pandoc-collect-floats-py

MWE:

# This is a test

Before the table

|A|B|C|
|-|-|-|
|1|2|3|

After the Table

TablesHere

Running with pandoc test.pdc --filter ~/.panzer/filter/collect_floats/collect_floats.py -o test.docx works file but when I do panzer test.pdc --filter ~/.panzer/filter/collect_floats/collect_floats.py -o test.docx, it gives me:

     ----- pandoc read -----
     running
     ----- style definitions -----
     global:
       AamjStyle     AddLatexRefs  AomjStyle     ApaStyle       Article
       Base          BiblatexPdf   Book          BookReview     Braindead
       CIM           CV            ChadStyle     Draft          JlosStyle
       LeadJouStyle  Letter        LodjStyle     MthemePres     Mumford
       Notes         NotesSans     PanCite       Plain          PropStyle
       RefAOM        RefAPA        RefAPA_nodoi  ReferJournals  Story
       Work
     ----- document style -----
     no "style" field found, run only pandoc
     writer:
       docx
     ----- run list -----
     filter:
      1  collect_floats  "~/.panzer/filter/collect_floats/collect_floats.py"
     ----- filter -----
     [1/1] collect_floats docx
ERROR:     [Errno 13] Permission denied
     ----- pandoc write -----
     running

My usecase is to apply this filter only with certain styles.

I can't override style settings from the document's YAML block

Hello, I'm trying to override some of my style settings from the markdown document's YAML data block, but it's not working. Here is my style.yaml (this all works as it should):

Letter:
    parent:
        - Base
  #  all:
      #  metadata:

    latex:
        template: myletter.tex
        metadata:
            fontsize: 12pt
            geometry: margin=1in
            mainfont: Minion Pro
            # opening: false
            fromaddress: |
                    | my street
                    | my town
                    | my postcode
                    | my email
            toaddress:  |
                    | Department
                    | University
                    | City
            closing: Yours sincerely
            signature: my name

I am trying to override latex: metadata: toaddress

I have tried various things in the document's YAML block eg:


---
style: Letter

metadata:
    - toaddress: person I'm writing to
...

and also:


---
style: Letter

latex:
    metadata:
        - toaddress: person I'm writing to
...

Both of them with and without the hyphens.
But every time it just gets processed with the settings from the styles.yaml file. What am I doing wrong?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.