panvimwiki.filter package¶
Submodules¶
panvimwiki.filter.delete_bullet_star module¶
Remove * bullet list items from unordered list.
Plain text prefilter
delete_bullet_star: Remove unordered lists which use the star (asterisk) bullet marker. The pre-filter does not remove task list items (see |delete_task_pending|).Read stdin.
Remove non-task * bullet lines, e.g., * [[URI|Description]] or * Text.
Write filtered result to stdout.
echo <<EOF | delete_bullet_star
'- Bulleted list item 1 should appear'
'* Bulleted list item 6 should NOT appear'
EOF
- Bulleted list item 1 should appear
panvimwiki.filter.delete_empty_heading module¶
Remove empty headings from Vimwiki file.
Headings are not empty if they contain tag lines. Execute delete_tag_lines.py first to empty such headings.
Pandoc filter using panflute
- panvimwiki.filter.delete_empty_heading.action(elem, doc)[source]¶
Remove empty headings from Vimwiki file.
panvimwiki.filter.delete_tag_lines module¶
Remove Vimwiki tag lines, e.g., :tag1:tag2:.
Pandoc filter using panflute
- panvimwiki.filter.delete_tag_lines.action(elem, doc)[source]¶
Remove Vimwiki tag lines, e.g., :tag1:tag2:.
Pandoc filter using panflute
In-line tags in paragraphs and lists remain.
panvimwiki.filter.delete_task_pending module¶
Remove Pending and Waiting tasks and set Start tasks to [.]{.done1}.
Plain text filter
Read stdin.
Remove Pending [ ] and Waiting [W] tasks.
Change Start [S] task to [.].
Write filtered result to stdout.
Example
echo '1. [ ] Numbered list done0 item 0 should NOT appear\n' \
'2. [.] Numbered list done1 item 1 should appear' |
delete_task_pending
2. [.] Numbered list done1 item 1 should appear
panvimwiki.filter.delete_taskwiki_heading module¶
Remove taskwiki heading.
Pandoc filter using panflute
Example
bash> echo ‘== Taskwiki Viewports | should not appear | should not appear ==’ |
bash> pandoc –from=vimwiki –to=markdown –filter=delete_taskwiki_heading
## Taskwiki Viewports {#Taskwiki Viewports }
panvimwiki.filter.do_nothing module¶
Return the input with no changes.
Plain text filter
panvimwiki.filter.prefilter module¶
Main function shared by prefilters.
- panvimwiki.filter.prefilter.action(line: str, delete: str | None = None, replace: tuple[str, str] | None = None) str | None[source]¶
Filter Vimwiki text by deleting lines or replacing text in lines.
- Parameters:
line – Line from Vimwiki file.
delete – Regex string matching all or part of line to be deleted.
replace – Regex re.search string and replacement string for re.sub.
- Returns:
Convert line matching replace[0] regex by substituting replace[1]. To delete line matching delete regex, return None. Otherwise return the original line. Replace precedes delete.
- Return type:
str or None
- panvimwiki.filter.prefilter.prefilter(delete: str | None = None, replace: tuple[str, str] | None = None) None[source]¶
Read stdin, filter with action() to stdout.
- Parameters:
delete – Regex string matching all or part of line to be deleted.
replace – Regex re.search string and replacement string for re.sub.
panvimwiki.filter.reference_citation module¶
Convert pandoc citeproc bibliography to reference links.
Plain text filter
Pandoc reads a markdown file with citeproc references to a BibLaTeX or other supported database and returns citations and a reference list. See Pandoc Citations for details.
Assume the default CSL citation style. reference_citation converts the reference list to Reference links.
The markdown output may conflict with Markdownlint.
pandoc --citeproc \
--bibliography=default.bib \
--metadata='link-citations:true' \
--from=markdown+wikilinks_title_after_pipe \
--standalone \
--to=markdown-citations \
--wrap=preserve \
example.md |
reference_citation
Example
Create a Pandoc markdown file, e.g., example.md, with citeproc references.
@bloggs-jones
Blah blah [@bloggs-jones; @chomsky-73]
[@chomsky-73]
A citeproc compatible database, e.g., BibLaTeX default.bib.
@Article{bloggs-jones,
author = "A. J. Bloggs and X. Y. Jones",
title = "Title title title title title title title title title title",
journal = "Journal journal journal",
year = "1959",
}
@Inproceedings{chomsky-73,
author = "N. Chomsky",
year = "1973",
title = "Conditions on Transformations",
booktitle = "A festschrift for {Morris Halle}",
editor = "S. R. Anderson and P. Kiparsky",
publisher = "Holt, Rinehart \& Winston",
address = "New York",
}
Pandoc outputs markdown citation format.
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-bloggs-jones .csl-entry}
Bloggs, A. J., and X. Y. Jones. 1959. "Title Title Title Title Title Title Title Title Title Title." *Journal Journal Journal*.
:::
::: {#ref-chomsky-73 .csl-entry}
Chomsky, N. 1973. "Conditions on Transformations." In *A Festschrift for Morris Halle*, edited by S. R. Anderson and P. Kiparsky. New York: Holt, Rinehart & Winston.
:::
:::
reference_citation converts to reference link format. The anchor uses #tag format.
[#ref-bloggs-jones]: Bloggs, A. J., and X. Y. Jones. 1959. "Title Title Title Title Title Title Title Title Title Title." *Journal Journal Journal*.
[#ref-chomsky-73]: Chomsky, N. 1973. "Conditions on Transformations." In *A Festschrift for Morris Halle*, edited by S. R. Anderson and P. Kiparsky. New York: Holt, Rinehart & Winston.
panvimwiki.filter.wikilink_markdown module¶
Convert GitHub Flavored Markdown (gfm) to Vimwiki/Taskwiki syntax.
Remove backslashes from [ ] tasks
Remove backslashes from apostrophe-s, `s.
Remove link title “wikilink”.
Unescape taskwiki octothorpe and use asterisk-marker.
Plain text prefilter or post filter
Module contents¶
Panvimwiki pre-filter, filter and post-filter scripts.