aboutsummaryrefslogtreecommitdiff
path: root/test/command
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-10-18 17:12:31 +0200
committerAlbert Krewinkel <[email protected]>2025-10-18 17:35:23 +0200
commit13a5b1a4df90813cb0e622fd7816ec633f2af9a6 (patch)
tree36debc2095ef9a33546e6dc54d410a101ac90497 /test/command
parent941b5662d794035f7f400abd41e9d63d3213e95d (diff)
Org reader: parse parameter lists on unknown blocks.
The reader tries to parse the rest of the opening line of a block, e.g., `#+begin_myblock …`, as a parameters list. It first assumes that the parameters are in lisp-style (`:key value`), then alternatively tries to read python-style key-value pairs (`key=value`) and falls back to reading the entire remaining line as a single `parameter` attribute. This method is also applied to dynamic blocks. Closes: #11188
Diffstat (limited to 'test/command')
-rw-r--r--test/command/11188.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/test/command/11188.md b/test/command/11188.md
new file mode 100644
index 000000000..a982b2dff
--- /dev/null
+++ b/test/command/11188.md
@@ -0,0 +1,80 @@
+Parsing PARAMETERS of Org-mode blocks
+
+```
+% pandoc -f org --to=native
+#+attr_html: :width 10px
+#+BEGIN_myex :this that
+huhu
+#+END_myex
+^D
+[ Div
+ ( ""
+ , [ "myex" ]
+ , [ ( "width" , "10px" ) , ( "this" , "that" ) ]
+ )
+ [ Para [ Str "huhu" ] ]
+]
+```
+
+Python-style parameters are accepted, too.
+
+```
+% pandoc -f org --to=native
+#+BEGIN_myblock width=10px
+[[image.svg][logo]]
+#+END_myblock
+^D
+[ Div
+ ( "" , [ "myblock" ] , [ ( "width" , "10px" ) ] )
+ [ Para
+ [ Span
+ ( ""
+ , [ "spurious-link" ]
+ , [ ( "target" , "image.svg" ) ]
+ )
+ [ Emph [ Str "logo" ] ]
+ ]
+ ]
+]
+```
+
+The fallback is to put the remainder of the line into a `parameters`
+attribute.
+
+```
+% pandoc -f org --to=native
+#+BEGIN_myblock these are parameters in an unsupported format
+/OK/
+#+END_myblock
+^D
+[ Div
+ ( ""
+ , [ "myblock" ]
+ , [ ( "parameters"
+ , "these are parameters in an unsupported format"
+ )
+ ]
+ )
+ [ Para [ Emph [ Str "OK" ] ] ]
+]
+```
+
+Also works on dynamic blocks.
+
+```
+% pandoc -f org --to=markdown
+#+BEGIN: clocktable :scope subtree :maxlevel 3
+#+CAPTION: Clock summary at [2025-10-18 Sat 17:23]
+| Headline | Time |
+|--------------+--------|
+| *Total time* | *0:00* |
+#+END:
+^D
+::: {.clocktable scope="subtree" maxlevel="3"}
+ Headline Time
+ ---------------- ----------
+ **Total time** **0:00**
+
+ : Clock summary at \[2025-10-18 Sat 17:23\]
+:::
+```