-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
56 additions
and
25 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
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,34 +1,13 @@ | ||
# 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.md - | ||
test: test/perevirka.md | ||
$(PANDOC) lua test/runtests.lua $< | ||
|
||
# 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.md: $(FILTER_FILE) test/input.md test/test.yaml | ||
$(PANDOC) --defaults test/test.yaml --output=$@ | ||
|
||
# | ||
# Clean | ||
# | ||
.PHONY: clean | ||
clean: | ||
rm -f _site/output.md _site/index.html _site/style.css |
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,38 @@ | ||
--- | ||
perevir: | ||
filters: | ||
- cito.lua | ||
metastrings-to-inlines: true | ||
--- | ||
|
||
``` markdown {#input} | ||
# Abstract | ||
|
||
This is an example article. It was written under the influence of | ||
coffee, which acts to counter fatigue [@cites_as_evidence:Li95]. | ||
|
||
# Further reading | ||
|
||
Authors struggling to fill their document with content are referred to | ||
@recommended_reading:Upper_writers_1974. | ||
``` | ||
|
||
``` markdown {#expected} | ||
--- | ||
cito_cites: | ||
citesAsEvidence: | ||
- Li95 | ||
citesAsRecommendedReading: | ||
- Upper_writers_1974 | ||
--- | ||
|
||
# Abstract | ||
|
||
This is an example article. It was written under the influence of | ||
coffee, which acts to counter fatigue [@Li95]. | ||
|
||
# Further reading | ||
|
||
Authors struggling to fill their document with content are referred to | ||
@Upper_writers_1974. | ||
``` |
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,9 @@ | ||
#!/usr/bin/env pandoc-lua | ||
--- Run tests with perevir. | ||
-- | ||
-- Copyright: © 2024 Albert Krewinkel <[email protected]> | ||
-- License: MIT | ||
|
||
local perevir = require 'perevir' | ||
local opts = perevir.parse_args(arg) | ||
perevir.do_checks(opts) |