generated from tarleb/lua-filter-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
2 changed files
with
39 additions
and
24 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 |
---|---|---|
@@ -1,27 +1,6 @@ | ||
# Name of the filter file, *with* `.lua` file extension. | ||
FILTER_FILE := $(wildcard *.lua) | ||
# Name of the filter, *without* `.lua` file extension | ||
FILTER_NAME = $(patsubst %.lua,%,$(FILTER_FILE)) | ||
|
||
# Allow to use a different pandoc binary, e.g. when testing. | ||
PANDOC ?= pandoc | ||
# Allow to adjust the diff command if necessary | ||
DIFF = diff | ||
|
||
# Test that running the filter on the sample input document yields | ||
# the expected output. | ||
# | ||
# The automatic variable `$<` refers to the first dependency | ||
# (i.e., the filter file). | ||
test: $(FILTER_FILE) test/input.md test/test.yaml | ||
$(PANDOC) --defaults test/test.yaml | \ | ||
$(DIFF) test/expected.native - | ||
# Use perevir to run the test | ||
test: test/perevirka.md | ||
perevir $< | ||
|
||
# Ensure that the `test` target is run each time it's called. | ||
.PHONY: test | ||
|
||
# Re-generate the expected output. This file **must not** be a | ||
# dependency of the `test` target, as that would cause it to be | ||
# regenerated on each run, making the test pointless. | ||
test/expected.native: $(FILTER_FILE) test/input.md test/test.yaml | ||
$(PANDOC) --defaults test/test.yaml --output=$@ |
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,36 @@ | ||
--- | ||
perevir: | ||
filters: | ||
- parse-latex.lua | ||
--- | ||
|
||
The below Markdown contains LaTeX snippets to set the color of | ||
some words, and to define a table. | ||
|
||
``` markdown {#input} | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec | ||
hendrerit \textcolor{red}{tempor tellus}. Donec pretium posuere | ||
tellus. Proin quam nisl, tincidunt et, mattis eget, convallis nec, | ||
purus. | ||
|
||
\begin{tabularx}{0.8\textwidth} { l | c | r } | ||
lorem 1 & ipsum 1 & nullus \\ | ||
\hline | ||
lorem 2 & ipsum 2 & nullus \\ | ||
\end{tabularx} | ||
``` | ||
|
||
Both uses of LaTeX are picked up and translated to Markdown. | ||
|
||
> <div id="output"> | ||
> | ||
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec | ||
> hendrerit [tempor tellus]{style="color: red"}. Donec pretium posuere | ||
> tellus. Proin quam nisl, tincidunt et, mattis eget, convallis nec, | ||
> purus. | ||
> | ||
> | lorem 1 | ipsum 1 | nullus | | ||
> |:--------|:-------:|-------:| | ||
> | lorem 2 | ipsum 2 | nullus | | ||
> | ||
> </div> |