computable-pandoc/tests/pass.lit.infos.md

203 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

---
bool: true
int: 1
float: 1.1
string: foo all
list:
- true
- 1
- 1.1
- foo all
- "`fn1()`"
- Another test `fn2()`
fn1_test: "`fn1()`"
fn2_test: Another test `fn2()`
...
2023-06-15 18:42:23 -06:00
# Calls Before Declarations
- `fn1()``fn2()`
- `fn3(true)`
- `fn4(2.0, 3.1)`
- `fn3(n: false)`
- `fn4(b: 4, a: 5)`
2023-06-15 18:42:23 -06:00
# Declarations
2023-06-15 18:42:23 -06:00
All literate declarations goes in code blocks that should be printed on
`--verbose`.
Minimal (Lua by default):
---
id: fn1
...
1 + 2 + 3
With scape:
---
id: fn2
...
"\#x"
With arg:
---
id: fn3
args:
n: str
...
#n == #n
With lang and args:
---
id: fn4
lang: fennel
args:
a: 1
b: 2
...
(* #a #b)
With cmd (ignores lang):
---
id: fn5
cmd: python -E -X utf8
args:
n: 2
...
#n + #n
With shift:
---
id: fn6
shift: true
...
"The literate block is shifted by its eval result."
With wipe:
---
id: fn7
wipe: true
...
"This evals but it is wipe from doc."
With typed:
---
id: fn4
typed: true
args:
a: 1
b: 2
...
#a * #b
With link and alt:
---
id: fn8
lang: graphviz
link: ./graph.png
alt: A graph.
...
digraph G {
a -> b;
b -> c
c -> a;
}
With img and alt:
---
id: fn9
lang: graphviz
img: ./graph.png
alt: A graph.
...
digraph G {
a -> b;
b -> c
c -> a;
}
With dump and quote:
---
id: fn10
dump: ./dump.txt
quote: true
...
This code is saved into './dump.txt' because of 'dump'.
This code is not evaluated because 'quote' is true.
With inner function:
---
id: fn11
args:
x: 2
...
`fn1()` * x
With inner function with args:
---
id: fn12
args:
y: 1
z: 2
...
#y + `fn4(3, 4)` + #z
With inner inner function:
---
id: fn13
args:
a: 1
...
#a + `fn4(#a, `fn1()`)`
2023-06-15 18:42:23 -06:00
# Code Blocks That Are Not Declarations
Always ignored:
---
echo "Ignore me!"
2023-06-15 18:42:23 -06:00
# Calls and Data Types
- `fn3(true)`
- `fn3(false)`
- `fn3([])`
- `fn3([0, 1])`
- `fn3({})`
- `fn3({"k1": 1, "k2": 2})`
- `fn4(3)`
- `fn5(1.0)`
- `fn5("str")`
2023-06-15 18:42:23 -06:00
# Messy Calls
- `fn1( )`
- `fn3("\"str\"")`
- `fn3( 4)`
- `fn3(5 )`
- `fn3( 6 )`
- `fn3( n: 7)`
- `fn3(n: 8 )`
- `fn3( n: 9 )`
- `fn3(n:10)`
- `fn4( a: 6, b: 7)`
- `fn4( a: 8 , b: 9)`
- `fn4( a: 10 , b: 11)`
- `fn4( a: 12 , b: 13)`
- `fn4( a: 14 , b: 15 )`
- `fn4(a:16,b:17)`