* Re: CDATA auto aggregation
@ 2022-09-29 11:58 David Lukeš
2022-09-30 3:14 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: David Lukeš @ 2022-09-29 11:58 UTC (permalink / raw)
To: theophilusx, diego.vincent.rodriguez; +Cc: emacs-orgmode
Diego Rodriguez <diego.vincent.rodriguez@gmail.com> writes:
> Where does this CDATA tag gets added automatically and how can I modify this behavior?
Do you have auto-formatting on save configured in Emacs -- perhaps even
via a starter kit like Doom Emacs, so that you're only half aware of it?
And are you by any chance on macOS, which ships with the tidy program
(HTML Tidy) by default? Or failing that, did you install it manually?
To cut a long-story short: HTML auto-formatting on save runs tidy, which
mangles the HTML in various ways, including this CDATA thing. This also
happens in buffers with generated Org export output.
I posted the long version to the mailing list in February:
https://list.orgmode.org/CAEPTPEwOZjJLX1jyFmVR6jarsocyuD=Zf7HJ1i9G4SfWk4mUpQ@mail.gmail.com/
I suggested a patch, but it probably got buried in the noise:
https://list.orgmode.org/20220228140750.75761-1-dafydd.lukes@gmail.com/
Instead, I see that another fix was merged yesterday (for different
reasons AFAICS, but it should help with this auto-formatting issue too):
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d7a55bbd537314d2776b082bd92a1a08b3edc84e
This should be enough for HTML exports, but two more tweaks are needed
for ODT exports in ox-odt.el -- see my original patch. Or use
https://github.com/kjambunathan/org-mode-ox-odt, which has already
incorporated them.
Tim Cross <theophilusx@gmail.com> writes:
> We probably should consider moving the existing ox-html to an ox-xhtml
> and implementing a new ox-html that is based on html5.
+1 on that, although obviously, I'm aware it's quite a chore.
Best,
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CDATA auto aggregation
2022-09-29 11:58 CDATA auto aggregation David Lukeš
@ 2022-09-30 3:14 ` Ihor Radchenko
2022-10-01 5:13 ` David Lukeš
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-09-30 3:14 UTC (permalink / raw)
To: David Lukeš; +Cc: theophilusx, diego.vincent.rodriguez, emacs-orgmode
David Lukeš <dafydd.lukes@gmail.com> writes:
> I suggested a patch, but it probably got buried in the noise:
> https://list.orgmode.org/20220228140750.75761-1-dafydd.lukes@gmail.com/
>
> Instead, I see that another fix was merged yesterday (for different
> reasons AFAICS, but it should help with this auto-formatting issue too):
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d7a55bbd537314d2776b082bd92a1a08b3edc84e
>
> This should be enough for HTML exports, but two more tweaks are needed
> for ODT exports in ox-odt.el -- see my original patch. Or use
> https://github.com/kjambunathan/org-mode-ox-odt, which has already
> incorporated them.
Sorry. I think you patch fell within the time when maintainers were not
actively watching the mailing list.
Can you please update your original patch to work with the latest main?
--
Ihor Radchenko,
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CDATA auto aggregation
2022-09-30 3:14 ` Ihor Radchenko
@ 2022-10-01 5:13 ` David Lukeš
2022-10-02 3:35 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: David Lukeš @ 2022-10-01 5:13 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: theophilusx, diego.vincent.rodriguez, emacs-orgmode
No worries! I'd forgotten about it myself, until it bit me again on
Thursday, and I hit upon Diego's post while googling (because I
thought at first my patch had been long since merged, and assumed it
was a different issue).
I'm happy to update the patch for ODT, but just FYI, I still don't
have the FSF copyright assignment sorted out, which you warned me
about since my tinychanges are accumulating. I've been in contact with
both the FSF and my university, and long story short, the easiest way
is probably for me to wait until I graduate (hopefully a few months
from now) so that I don't need a university disclaimer at all.
Best,
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CDATA auto aggregation
2022-10-01 5:13 ` David Lukeš
@ 2022-10-02 3:35 ` Ihor Radchenko
2022-10-02 4:04 ` David Lukeš
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-10-02 3:35 UTC (permalink / raw)
To: David Lukeš; +Cc: theophilusx, diego.vincent.rodriguez, emacs-orgmode
David Lukeš <dafydd.lukes@gmail.com> writes:
> I'm happy to update the patch for ODT, but just FYI, I still don't
> have the FSF copyright assignment sorted out, which you warned me
> about since my tinychanges are accumulating. I've been in contact with
> both the FSF and my university, and long story short, the easiest way
> is probably for me to wait until I graduate (hopefully a few months
> from now) so that I don't need a university disclaimer at all.
Noted. I haven't seen any report related to this popping up in the list.
So, it should be fine to wait until you can comfortably sort out the
legal paperwork.
Looking forward to your future contributions!
--
Ihor Radchenko,
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* CDATA auto aggregation
@ 2021-11-24 17:58 Diego Rodriguez
2021-11-27 0:54 ` Tim Cross
0 siblings, 1 reply; 7+ messages in thread
From: Diego Rodriguez @ 2021-11-24 17:58 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2273 bytes --]
Hello,
I am customizing my org-mode installation but there is something that I
don't understand.
When I execute the following statement:
```
(setq org-html-mathjax-template
"
<script type=\"text/x-mathjax-config\">
MathJax.Hub.Config({
displayAlign: \"%ALIGN\",
displayIndent: \"%INDENT\",
\"HTML-CSS\": { scale: %SCALE,
linebreaks: { automatic: \"%LINEBREAKS\" },
webFont: \"%FONT\"
},
SVG: {scale: %SCALE,
linebreaks: { automatic: \"%LINEBREAKS\" },
font: \"%FONT\"},
NativeMML: {scale: %SCALE},
TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
MultLineWidth: \"%MULTLINEWIDTH\",
TagSide: \"%TAGSIDE\",
TagIndent: \"%TAGINDENT\"
}
});
</script>
<script src=\"%PATH\"></script>
")
```
A `CDATA` tag gets appended in my HTML export as shown below:
```html
<script type="text/x-mathjax-config">
<![CDATA[
mathjax.hub.config({
displayalign: "center",
displayindent: "0em",
"html-css": { scale: 100,
linebreaks: { automatic: "false" },
webfont: "TeX"
},
svg: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
nativemml: {scale: 100},
tex: { equationnumbers: {autonumber: "AMS"},
multlinewidth: "85%",
tagside: "right",
tagindent: ".8em"
}
});
]]>
</script>
<script src=
"
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML
"
type="text/javascript">
</script>
```
As you can see above, when I set the variable I have no CDATA tag on it.
Where does this tag come from? The problem is that the CDATA tag messes up
with the MathJax configuration parser, as it expects a JavaScript script
inside. But, instead, it finds a CDATA tag that, while it might be valid
according to W3, the MathJax parser throws an `eval` error in the console
since it tries to parse the body of that HTML node.
Where does this CDATA tag gets added automatically and how can I modify
this behavior?
Diego Rodriguez.
[-- Attachment #2: Type: text/html, Size: 3342 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CDATA auto aggregation
2021-11-24 17:58 Diego Rodriguez
@ 2021-11-27 0:54 ` Tim Cross
0 siblings, 0 replies; 7+ messages in thread
From: Tim Cross @ 2021-11-27 0:54 UTC (permalink / raw)
To: emacs-orgmode
Diego Rodriguez <diego.vincent.rodriguez@gmail.com> writes:
> Hello,
>
> I am customizing my org-mode installation but there is something that I don't understand.
>
> When I execute the following statement:
>
> ```
> (setq org-html-mathjax-template
>
> "
> <script type=\"text/x-mathjax-config\">
> MathJax.Hub.Config({
> displayAlign: \"%ALIGN\",
> displayIndent: \"%INDENT\",
> \"HTML-CSS\": { scale: %SCALE,
> linebreaks: { automatic: \"%LINEBREAKS\" },
> webFont: \"%FONT\"
> },
> SVG: {scale: %SCALE,
> linebreaks: { automatic: \"%LINEBREAKS\" },
> font: \"%FONT\"},
> NativeMML: {scale: %SCALE},
> TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
> MultLineWidth: \"%MULTLINEWIDTH\",
> TagSide: \"%TAGSIDE\",
> TagIndent: \"%TAGINDENT\"
> }
> });
> </script>
> <script src=\"%PATH\"></script>
> ")
> ```
>
> A `CDATA` tag gets appended in my HTML export as shown below:
>
> ```html
> <script type="text/x-mathjax-config">
> <![CDATA[
> mathjax.hub.config({
> displayalign: "center",
> displayindent: "0em",
> "html-css": { scale: 100,
> linebreaks: { automatic: "false" },
> webfont: "TeX"
> },
> svg: {scale: 100,
> linebreaks: { automatic: "false" },
> font: "TeX"},
> nativemml: {scale: 100},
> tex: { equationnumbers: {autonumber: "AMS"},
> multlinewidth: "85%",
> tagside: "right",
> tagindent: ".8em"
> }
> });
> ]]>
> </script>
> <script src=
> "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"
> type="text/javascript">
> </script>
> ```
>
> As you can see above, when I set the variable I have no CDATA tag on it. Where does this tag come from? The problem is that the
> CDATA tag messes up with the MathJax configuration parser, as it expects a JavaScript script inside. But, instead, it finds a CDATA tag
> that, while it might be valid according to W3, the MathJax parser throws an `eval` error in the console since it tries to parse the body of
> that HTML node.
>
> Where does this CDATA tag gets added automatically and how can I modify this behavior?
>
Unfortunately, I don't know precisely where that tag gets added from. I
suspect it could be related to the ox-html stuff, which is still based
on xhtml rather than html5. I did suggest some months back that it was
probably about time we updated to export as html5 rather than the now
deprecated xhtml, but there were a few who felt that this would result
in the loss of key functionality they wanted to maintain.
We probably should consider moving the existing ox-html to an ox-xhtml
and implementing a new ox-html that is based on html5.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-10-02 4:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-29 11:58 CDATA auto aggregation David Lukeš
2022-09-30 3:14 ` Ihor Radchenko
2022-10-01 5:13 ` David Lukeš
2022-10-02 3:35 ` Ihor Radchenko
2022-10-02 4:04 ` David Lukeš
-- strict thread matches above, loose matches on Subject: below --
2021-11-24 17:58 Diego Rodriguez
2021-11-27 0:54 ` Tim Cross
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.