mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-02 05:35:38 +00:00
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
81 lines
1.4 KiB
Markdown
81 lines
1.4 KiB
Markdown
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\]
|
|
:::
|
|
```
|