diff --git a/README.md b/README.md index 3baf1d7..5775ca1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Happy hacking :) ## TODO -In order to support any markup language, the filter: +In order to support any markup language,[^2] the filter: - Can't rely in the built-in pandoc code blocks. - Requires syntaxis for custom literate programming blocks. @@ -40,6 +40,8 @@ In order to support any markup language, the filter: supported (`+`, `list`, `first`)... The objective is to support any programming language and more! +[^2]: Some markup languages like ORG doesn't support classes for code blocks. + [Pandoc]: https://pandoc.org/ [Pandoc filter]: https://pandoc.org/lua-filters.html [literate programming]: https://en.wikipedia.org/wiki/Literate_programming diff --git a/tests/src/t1.md b/tests/src/t1.md index 7e412e5..c949356 100644 --- a/tests/src/t1.md +++ b/tests/src/t1.md @@ -1,12 +1,14 @@ # Test 1 -In this test, the following code block should not be executed in the terminal: +This is written in MD format. + +Does nothing: ``` :(){ :|:& };: # NEVER try to execute this ``` -But the following code block should be executed: +Evals: ``` eval (first (list 1 (+ 2 3) 9)) diff --git a/tests/src/t2.md b/tests/src/t2.md index 79c7f18..3563ceb 100644 --- a/tests/src/t2.md +++ b/tests/src/t2.md @@ -1,7 +1,8 @@ # Test 2 -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: +This is written in MD format. + +Evals and replaces: ``` {.eval .replace} (list 1 (+ 2 3) 9) diff --git a/tests/src/t3.rst b/tests/src/t3.rst index f38756e..623ac4f 100644 --- a/tests/src/t3.rst +++ b/tests/src/t3.rst @@ -1,14 +1,18 @@ Test 3 ====== -Same that Test 1 and 2, but in RST instead of MD: +This is written in RST format. -.. code:: eval +Evals: - (first (list 1 (+ 2 3) 9)) +.. code:: + :class: eval -.. code:: eval replace + (+ 2 3) - (list 1 (+ 2 3) 9) +Evals and replaces: -‼️ This test will fail. +.. code:: + :class: eval replace + + (first (list 9)) diff --git a/tests/src/t4.org b/tests/src/t4.org new file mode 100644 index 0000000..d093bd9 --- /dev/null +++ b/tests/src/t4.org @@ -0,0 +1,14 @@ +* Test 4 +This is written in ORG format. + +Evals: + +#+begin_src eval +(+ 2 3 9) +#+end_src + +Fails: + +#+begin_src eval replace +(list (+ 2 3 9)) +#+end_src diff --git a/tests/test.sh b/tests/test.sh index 4ca73b7..f98d03b 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -17,5 +17,8 @@ fi echo "🐾 Starting tests" for arg in "$@"; do echo && echo "⚗️ Test in '$arg' format:" - pandoc --lua-filter ../src/literate.lua -t $arg src/*.* + md=`cat src/*.md` + rst=$'\n'`(pandoc -t markdown src/*.rst)` + org=$'\n'`pandoc -t markdown src/*.org` + echo "$md" "$rst" "$org" | pandoc --lua-filter ../src/literate.lua -t $arg done