Max Nikulin <maniku...@gmail.com> writes: > On 02/10/2022 11:59, Ihor Radchenko wrote: >> Can you please illustrate how to use the described AST markup for the >> following Texinfo snippet: >> >> By convention, the dynamic library for @var{language} is >> @code{libtree-@{sitter@}-@var{"language"}.@var{ext}}, where @var{ext} >> is the >> system-specific extension for dynamic libraries. > > If you are asking how to represent such construct without introducing > custom elements then (it may be e.g. :type, not :class) parsed AST > should be like > > (code nil ("libtree-{sitter}-" > (code (:class var) "\"language\"") > "." > (code (:class var) "ext")))
This is not much different from @name[nil]{<contents>} idea, but more verbose. Also, more importantly, I strongly dislike the need to wrap the text into "". You will have to escape \". And it will force third-party parsers to re-implement Elisp sexp reader. > If there was some syntax for object attributes then simple cases would > be like > > [[attr:(:class var)]]~language~ I do not like this idea. It will require non-trivial changes in Org parser and fontification. Using dedicated object properties or at least inheriting properties from :parent is the style we employ more commonly across the code: @var{language} or @code[:class var]{language} or @attr[:class var]{~language~} > I have no idea concerning particular markup that can be used inside > source blocks. It might be LaTeX-like commands as discussed in the > sibling subthread or HTML (XML) based syntax that is more verbose than > TeX-like notation. > > By convention, the dynamic library > for src_alt{\code[class=var]{language}} is > > src_alt{\code{libtree-\{sitter\}-\code[class=var]{"language"}.\code[class=var]{ext}}}, > where src_alt{\code[class=var]{ext}} is the > system-specific extension for dynamic libraries. I am against the idea of LaTeX-like commands. It will clash with latex-fragment object type. https://orgmode.org/worg/dev/org-syntax.html#LaTeX_Fragments > or > > By convention, the dynamic library for > src_alt{<code class="var">language</code>} is > src_alt{<code>libtree-{sitter}-<code > class="var">"language"</code>.<code class="var">ext</code></code>}, > where src_alt{<code class="var">ext</code>} is the > system-specific extension for dynamic libraries. This style will indeed make things easier for the parser. But I find it too verbose for practical usage. This is why I instead proposed the idea with variable number of brackets: @code{{can have } inside}}. > Hypothetical "alt" babel language has default :results ast :export > results header arguments to inject AST bypassing Org markup stage. The problem with src block emitting AST is clashing with the way src blocks work during export. What `org-export-as' does is replacing/adding src block output into the actual Org buffer text before the parsing is done. Handling direct AST sexps will require a rewrite on how babel integration with export works. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>