Adding a RST test

This commit is contained in:
perro tuerto 2023-02-17 11:38:38 -08:00
parent f5eb91aa1b
commit 0b742179bc
5 changed files with 30 additions and 5 deletions

View File

@ -5,6 +5,9 @@ because Pandoc is also a document parser. Thanks to this capability, this repo
is a [Pandoc filter] for [literate programming][]: evaluate the code written in
your documents with Pandoc and [Lua].
> NOTE: Pandoc has [Literate Haskell support], but it doesn't support all input
> and output formats. This filter tries to support to all of them.
## Usage
In your terminal, just execute:
@ -26,6 +29,13 @@ Check [this test] if you don't known what I am talking about.
Happy hacking :)
## TODO
In order to support any markup language, the filter:
- Can't rely in the built-in pandoc code blocks.
- Requires syntaxis for custom literate programming blocks.
[^1]: Right now this is only for testing, so only a subset of Lisp function are
supported (`+`, `list`, `first`)... The objective is to support any
programming language and more!
@ -34,6 +44,7 @@ Happy hacking :)
[Pandoc filter]: https://pandoc.org/lua-filters.html
[literate programming]: https://en.wikipedia.org/wiki/Literate_programming
[Lua]: https://www.lua.org/
[Literate Haskell support]: https://pandoc.org/MANUAL.html#literate-haskell-support
[FORMAT namespaces]: https://pandoc.org/MANUAL.html#option--to
[fenced code blocks]: https://pandoc.org/MANUAL.html#fenced-code-blocks
[this test]: https://git.cuates.net/perro/literate-pandoc/src/branch/no-masters/tests/src/t2.md?display=source

View File

@ -1,12 +1,12 @@
# Test 1
In this test, the following block code should not be executed in the terminal:
In this test, the following code block should not be executed in the terminal:
```
:(){ :|:& };: # NEVER try to execute this
```
But the following block code should be executed:
But the following code block should be executed:
``` eval
(first (list 1 (+ 2 3) 9))

View File

@ -1,8 +1,8 @@
# Test 2
In this test, the following block code should be executed in the terminal, the
In this test, the following code block should be executed in the terminal, the
code should be saved as an attribute, and the block should be the result:
``` {.numberLines .eval .replace}
``` {.eval .replace}
(list 1 (+ 2 3) 9)
```

14
tests/src/t3.rst Normal file
View File

@ -0,0 +1,14 @@
Test 3
======
Same that Test 1 and 2, but in RST instead of MD:
.. code:: eval
(first (list 1 (+ 2 3) 9))
.. code:: eval replace
(list 1 (+ 2 3) 9)
‼️ This test will fail.

View File

@ -17,5 +17,5 @@ fi
echo "🐾 Starting tests"
for arg in "$@"; do
echo && echo "⚗️ Test in '$arg' format:"
pandoc --lua-filter ../src/literate.lua -t $arg src/*.md
pandoc --lua-filter ../src/literate.lua -t $arg src/*.*
done