pandoc-quick-ref.markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#---------------------------------------------------------------------- | |
# pandoc-small-caps.pl | |
# | |
# Pandoc filter to convert spans with class 'small-caps' | |
# (and optionally ~~Strikeout~~) to SmallCaps. | |
# | |
# pandoc -F pandoc-small-caps.pl [-M strikeout2smallcaps] ARGUMENTS... | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# wikilink2link.pl - Convert GitHub wikilinks to Markdown links. | |
# | |
# Preserves wikilink-like substrings in delimited code and fenced code | |
# blocks. | |
# | |
# Now lives at: <https://gist.github.com/daf711474eb53318b722> | |
# | |
# USAGE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
=encoding UTF-8 | |
This is a Pandoc <http://pandoc.org> filter to turn | |
code blocks and code spans which have certain specified | |
classes into RawBlock or RawInline elements in specified | |
output formats, wrapping them in specified markup as needed. | |
It can be used e.g. to output LaTeX math in both LaTeX and HTML, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#---------------------------------------------------------------------- | |
# pandoc-poetry.pl | |
# ================ | |
# | |
# A pandoc filter to format poetry nicely for HTML. | |
# | |
# See <https://groups.google.com/d/msg/pandoc-discuss/_JnTJnsSK3k/SkM9tjfYyg0J> | |
# |
Note: This documents the usage of both the perl and the python version. I have made the perl and python version work as alike as I could. In order to not favoritize either side hashes/dictionaries are called "associative arrays" and depicted as JSON objects in all their ugliness! :-)
The string2attrs function parses a string, e.g. a title string from a Pandoc Link or Image element, with attributes similar to those used with Pandoc Code, CodeBlock and Header elements (minus the braces) into an associative array of key--value pairs. Something like
"#foo .bar lang=la baz='biz buz'"
becomes
{"baz":"biz buz","id":"foo","lang":"la","class":"bar"}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
=pod | |
Pandoc filter which emulate the LaTeX endfloat package by extracting all | |
elements which would be LaTeX floats (figures and tables) from a | |
document and putting them in div with the id "figures" or "tables" | |
respectively. You must mark the points in the document where you want | |
the floats to go with a paragraph containing *only* the text | |
"FiguresHere" or "TablesHere" -- exactly as written here in CamelCase -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set ft=vim et tw=80: | |
" A foldexpr function to fold both Pod and Perl code sensibly in the same | |
" file. It folds Pod according to its logical structure and code by | |
" indentation. | |
" | |
" Author: Benct Philip Jonsson <[email protected]> | |
" Version: 2015-12-11-14 (YYYY-MM-DD-HH) | |
" | |
" It requires that the Pod blocks are well-behaved and start with `=pod` or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Pandoc filter to wrap Span/Div in LaTeX based on classes | |
""" | |
import pandocfilters as pf | |
import re | |
begin_command = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Pandoc filter to restore pre 1.16 behavior of wrapping Span contents in braces in LaTeX output, | |
since I and maybe others have documents and/or filters relying on the old behavior | |
""" | |
import pandocfilters as pf | |
want_braces = None | |
open_brace = [pf.RawInline('tex', '{')] |
OlderNewer