-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This Python file uses the following encoding: utf-8 | ||
|
||
from pandocfilters import Link, Str, Space | ||
|
||
import pandoc_numbering | ||
|
||
def init(): | ||
pandoc_numbering.count = {} | ||
pandoc_numbering.information = {} | ||
pandoc_numbering.collections = {} | ||
pandoc_numbering.headers = [0, 0, 0, 0, 0, 0] | ||
if hasattr(pandoc_numbering.getCiteShortCut, 'value'): | ||
delattr(pandoc_numbering.getCiteShortCut, 'value') | ||
if hasattr(pandoc_numbering.getDefaultLevels, 'value'): | ||
delattr(pandoc_numbering.getDefaultLevels, 'value') | ||
if hasattr(pandoc_numbering.getClasses, 'value'): | ||
delattr(pandoc_numbering.getClasses, 'value') | ||
if hasattr(pandoc_numbering.getFormat, 'value'): | ||
delattr(pandoc_numbering.getFormat, 'value') | ||
|
||
def createLink(attributes, text, reference_title): | ||
if pandoc_numbering.pandocVersion() < '1.16': | ||
return Link(text, reference_title) | ||
else: | ||
return Link(attributes, text, reference_title) | ||
|
||
def createMetaList(data): | ||
return {'t': 'MetaList', 'c': data} | ||
|
||
def createMetaMap(data): | ||
return {'t': 'MetaMap', 'c': data} | ||
|
||
def createMetaInlines(string): | ||
return {'t': 'MetaInlines', 'c': createListStr(string)} | ||
|
||
def createMetaString(string): | ||
return {'t': 'MetaString', 'c': string} | ||
|
||
def createMetaBool(boolean): | ||
return {'t': 'MetaBool', 'c': boolean} | ||
|
||
def createListStr(string): | ||
elements = string.split(' ') | ||
result = [Str(elements[0])] | ||
for elt in elements[1:]: | ||
result.append(Space()) | ||
result.append(Str(elt)) | ||
return result | ||
|