[ Adding Org ML back to CC ] András Simonyi <andras.simo...@gmail.com> writes:
> On Thu, 19 Jan 2023 at 10:56, Ihor Radchenko <yanta...@posteo.net> wrote: >> So, do I understand correctly that italics, bold, subscript, >> superscript, small-caps, and nocase must be passed to the CSL processor >> in a format understood by CSL? Everything else could just be left in Org >> and later exported according to actual export settings? > > Unfortunately, the situation is a bit different -- the solution I see > the most viable is to export the affixes and the locator to a form in > which > the markup elements you listed (plus links, which I haven't mentioned > but are also supported) are in the required CSL > input form, but the rest is in plain text. What do you mean by plain text? Plain text as in Org or plain text as in ASCII export? > Anything else would be way > more complicated to handle in Citeproc and I don't > really see the benefits/use-case either (we are talking about elements > within a citation). This would "only" require a custom backend > exporting CSL-supported elements in the html-like CSL format and > everything else which is allowed by the Org syntax > in plain text. I am not much concerned about CSL format itself. I am concerned about the formatted citation returned back to Org by CSL. Consider the following: [cite:Prefix *bold* +strike-through+ @key] It will be interpreted by Org export as (citation (:style nil ...) (citation-reference (:key "key"... :prefix ("Prefix " (bold (... :post-blank 1 ...) "bold") (strike-through (... :post-blank 1 ...) "strike-through"))))) Now, consider that the user has a custom export filter that decorates "+strike-through+" like "!!strike-through!!" upon export. If we pass the original citation to the CSL, will the export filter be applied? Also, what if user decorates a CSL locator with Org markup like strike-through? >> May we: >> 1. Convert the Org markup supported by CSL into CSL-understood HTML >> format >> 2. Convert all other Org markup into verbatim > > I'm not sure what you mean by verbatim -- leaving it as Org markup? Whatever prevents CSL from altering the text. (Like escaping "_" you mentioned earlier) >> 3. Convert back non-verbatim markup altered by CSL into Org >> 4. Perform exporting Org->current export backend as usual. > > If verbatim is Org then step 3 could be rather complicated, we'd need > to identify > the Org fragments in citeproc's HTML and LaTeX output when those > backends are used. But can't CSL output in Org format? Isn't the whole CSL thing supposed to work for arbitrary export backend, not just HTML and LaTeX? > Also I'd worry that the result would not pass through Citeproc's > post-processing steps -- > there is now a user-customizable hook variable for citation post-processing > which acts on the internal representations. I envision the conversion back to Org to happen after _all_ the Citeproc's processing, be it user-customized or not. > All in all I'd first concentrate on the use-case: is there anything > important left out > if we go with simply using a custom backend to export the CSL-supported markup > in CSL input format and everything else as plain text, then do what we > do know, namely > either simply insert the Citeproc-formatted output into the exported document > without any post-processing (currently this is for LaTeX and HTML), or > parse and export > with Org when the Org Citeproc formatter is used (currently for all > other formats), What I imagine is doing "parse and export with Org" all the time, including HTML and LaTeX export. -- 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>