Adding an ORG test; fixed test.sh
This commit is contained in:
parent
0b742179bc
commit
0b5213c078
|
@ -31,7 +31,7 @@ Happy hacking :)
|
||||||
|
|
||||||
## TODO
|
## 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.
|
- Can't rely in the built-in pandoc code blocks.
|
||||||
- Requires syntaxis for custom literate programming 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
|
supported (`+`, `list`, `first`)... The objective is to support any
|
||||||
programming language and more!
|
programming language and more!
|
||||||
|
|
||||||
|
[^2]: Some markup languages like ORG doesn't support classes for code blocks.
|
||||||
|
|
||||||
[Pandoc]: https://pandoc.org/
|
[Pandoc]: https://pandoc.org/
|
||||||
[Pandoc filter]: https://pandoc.org/lua-filters.html
|
[Pandoc filter]: https://pandoc.org/lua-filters.html
|
||||||
[literate programming]: https://en.wikipedia.org/wiki/Literate_programming
|
[literate programming]: https://en.wikipedia.org/wiki/Literate_programming
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
# Test 1
|
# 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
|
:(){ :|:& };: # NEVER try to execute this
|
||||||
```
|
```
|
||||||
|
|
||||||
But the following code block should be executed:
|
Evals:
|
||||||
|
|
||||||
``` eval
|
``` eval
|
||||||
(first (list 1 (+ 2 3) 9))
|
(first (list 1 (+ 2 3) 9))
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# Test 2
|
# Test 2
|
||||||
|
|
||||||
In this test, the following code block should be executed in the terminal, the
|
This is written in MD format.
|
||||||
code should be saved as an attribute, and the block should be the result:
|
|
||||||
|
Evals and replaces:
|
||||||
|
|
||||||
``` {.eval .replace}
|
``` {.eval .replace}
|
||||||
(list 1 (+ 2 3) 9)
|
(list 1 (+ 2 3) 9)
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
Test 3
|
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))
|
||||||
|
|
|
@ -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
|
|
@ -17,5 +17,8 @@ fi
|
||||||
echo "🐾 Starting tests"
|
echo "🐾 Starting tests"
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
echo && echo "⚗️ Test in '$arg' format:"
|
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
|
done
|
||||||
|
|
Loading…
Reference in New Issue