[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [proof of concept] inline language blocks
From: |
Juan Manuel Macías |
Subject: |
Re: [proof of concept] inline language blocks |
Date: |
Wed, 28 Feb 2024 13:15:12 +0000 |
Max Nikulin writes:
> Juan Manuel your ":fr{}" and similar objects is a domain-specific
> language that is quite different from a generic element proposed by
> Samuel. Do you think it makes sense to modify your inline special
> block patch to allow creation of concise DSL?
>
> Juan Manuel Macías. [testing patch] inline-special-block with full
> implementation for LaTeX backend. Fri, 23 Feb 2024 23:50:52 +0000.
> 87ttlyloyr.fsf@posteo.net">https://list.orgmode.org/87ttlyloyr.fsf@posteo.net
>
> I mean &fr{bonjour} defined using "#+options:" or some new keyword or
> a special block. A definition of "fr" may be (using a bit different
> names)
>
> :latex_element "foreignlanguage" :latex_prefix "french"
> :html_element "span" :html_attr (:lang "fr")
>
> &fr{} is no heavier than :fr{}. The only drawback is necessity to
> define elements for each language used in the document. I do not
> think, even a dozen of declarations is a significant burden.
Hi, Maxim,
In the end I abandoned the concept of inline language block to the
detriment of the more general concept of inline special block (as,
rightly, proposed Ihor). I feel that at the beginning both concepts
overlapped. The patch you mention deals exclusively with the inline
special block concept, as well as the experimental branch that I hope to
publish shortly.
The syntax of my approach, summarized, would be:
-basic form: &foo[optional attributes]{lorem ipsum dolor}
==> LaTeX \foo{lorem ipsum dolor} ; ==> HTML <span class="foo">lorem
ipsum dolor</span>
- anonymous variant: &_{lorem ipsum dolor}
Common to all backends (so far I have only implemented LaTeX and HTML)
are a series of universal attributes. At the moment I have thought about
the following: :lang, :smallcaps and :color. For example:
&foo[:lang el :color blue :smallcaps t]{contents}
==> LaTeX:
{\scshape\color{blue}\foreignlanguage{greek}{\foo{contents}}}
==> HTML
<span class="foo" lang="el"
style="color:blue;font-variant:small-caps;">contents</span>
There is also the :html attribute and for LaTeX the :prelatex and
:postlatex attributes. Groups of attributes can also be defined, as if
they were styles, and combined with single attributes:
#+options: inline-special-block-aliases:(("latin" :lang "la" :color blue
:prelatex "\\itshape " :html "style=\"font-style:italic;\""))
This is an example of Latin text: &_[@latin@]{lorem ipsum dolor sit amet}.
This is an example of Latin text with small caps: &_[@latin@ :smallcaps
t]{lorem ipsum dolor sit amet}.
==> LaTeX:
This is an example of Latin text: {\color{blue}\foreignlanguage{latin}{\itshape
lorem ipsum dolor sit amet}}.
This is an example of Latin text with small caps:
{\scshape{}\color{blue}\foreignlanguage{latin}{\itshape lorem ipsum dolor sit
amet}}
==> HTML:
This is an example of Latin text: <span style="color:blue;font-style:italic;"
lang="la">lorem ipsum dolor sit amet</span>.
This is an example of Latin text with small caps: <span
style="color:blue;font-variant:small-caps;font-style:italic;" lang="la">lorem
ipsum dolor sit amet</span>.
- Re: [proof of concept] inline language blocks, (continued)
- Re: [proof of concept] inline language blocks, Ihor Radchenko, 2024/02/21
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/21
- [proof of concept] inline-special-block (was: [proof of concept] inline language blocks), Juan Manuel Macías, 2024/02/21
- Re: [proof of concept] inline-special-block, Juan Manuel Macías, 2024/02/21
- Re: [proof of concept] inline-special-block, Juan Manuel Macías, 2024/02/22
- Re: [proof of concept] inline language blocks, Samuel Wales, 2024/02/21
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/21
- Re: [proof of concept] inline language blocks, Samuel Wales, 2024/02/21
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/21
- Re: [proof of concept] inline language blocks, Max Nikulin, 2024/02/28
- Re: [proof of concept] inline language blocks,
Juan Manuel Macías <=
- Re: [proof of concept] inline language blocks, Max Nikulin, 2024/02/28
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/28
- Re: [proof of concept] inline language blocks, Max Nikulin, 2024/02/29
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/29
- Re: [proof of concept] inline language blocks, Max Nikulin, 2024/02/29
- Re: [proof of concept] inline language blocks, Juan Manuel Macías, 2024/02/29
- Re: [proof of concept] inline language blocks, Suhail Singh, 2024/02/21