IRC channel logs

2019-11-17.log

back to list of logs

***daviid is now known as Guest65407
***daviid is now known as Guest35010
***Guest35010 is now known as daviid
***catonano_ is now known as catonano
<ArneBab_>sneek: later tell ng0: however this many times slower might be changed by 2.9
<sneek>Okay.
<ArneBab_>sneek: later tell ng0: as far as I understood, (read) got much slower with 2.0 — so much slower that some people couldn’t work with it.
<sneek>Got it.
<ArneBab_>sneek: later tell ng0: in addition some non-documented tricks used by lilypond stopped to work on 2.0 and some errors appeared multiple times, which cause frustration that led to reduced investment into getting to 2.0. My opinion is that this problem was caused by mistakes on Guiles side (you shouldn’t change things that break the one tool using your language that achieved total domination in its domain). But that’s done now, and I hope it
<ArneBab_>won’t happen again.
<sneek>Will do.
***sneek_ is now known as sneek
<numerobis>Hi #guile! I am writing a website using guile, and my pages are generated by something like: (static-page "Research" `(main ,(read-xml "html/research.html"))). Here 'static-page' is a function that adds header and footer, and 'research.html' contains only the contents of the main section of the page. I use mathjax, and it seems that the latex alignment character '&' causes issue with the function
<numerobis>read-xml. Does it look to any of you like there is an easy workaround to avoid this issue?
<RhodiumToad>html isn't necessarily valid xml
<amz3>+1, see htmlprag in guilelib.
<RhodiumToad>iirc, in xml & is always used for an entity except inside CDATA
<amz3> https://github.com/a-guile-mind/Culturia/raw/v0/src/htmlprag.scm
<RhodiumToad>speaking of xml, is the SXML module supposed to be actually useful?
<numerobis>RhodiumToad: yes, I hadn't really foreseen these sorts of issues.
<numerobis>amz3: thank you!
<numerobis>RhodiumToad: I don't know what it's supposed to be, but I find it very useful!
<RhodiumToad>it struck me as ... odd that sxml->xml basically does not work due to lack of any attempt to handle namespaces?
<RhodiumToad>I mean it can output valid xml, but only if you do all the namespace work yourself
<RhodiumToad>and if you just try and do xml->sxml on some input and then sxml->xml to output it, you just get garbage
<amz3>RhodiumToad: that is what yxml (https://dev.yorhel.nl/yxml) does ie. it does not handle namespaces, neither does microxml (https://www.w3.org/community/microxml/)
<RhodiumToad>uhh, so?
<amz3>RhodiumToad: what you mean with "do all the namespace work"?
<RhodiumToad>trivial example: (sxml->xml (xml->sxml "<svg xmlns=\"http://www.w3.org/2000/svg\"></svg>"))
<RhodiumToad>results in Invalid QName: more than one colon http://www.w3.org/2000/svg:svg
<amz3>yes
<RhodiumToad>and, (sxml->xml (xml->sxml "<svg xmlns=\"http://www.w3.org/2000/svg\"></svg>" #:namespaces '((svg . "http://www.w3.org/2000/svg"))))
<RhodiumToad>outputs <svg:svg />
<amz3>I did not do extensive work with xml or xml namespaces. The thing is there are security issues related to namespaces handling that are adressed in microxml by dropping explicit namespace support.
<RhodiumToad>well I don't know what you're processing then but it's not xml, since namespaces are a rather fundamental part of that
<RhodiumToad>security issues?
<amz3>in past $WORK, xml namespaces seemed more like creating more problems.
<amz3>RhodiumToad: TEI, ATOM, RSS.. all those.
<amz3>RhodiumToad: IIRC, xml namespace requires to pull external files.
<RhodiumToad>not at all
<RhodiumToad>DTDs are what you're thinking of there
<amz3>maybe.
<RhodiumToad>namespace names may look like urls but they're never fetched
<RhodiumToad>they use that format only for uniqueness
<amz3>ok
<amz3>TIL
<amz3>still, what is the point of xml namespaces?
<RhodiumToad>the namespaces are to distinguish tags or attribute names that have the same name in different document formats.
<amz3>that is what I understand too. again based on my tiny past experience, it is useless.
<RhodiumToad>that doesn't really help when, for example, proper namespace declarations are required to generate valid output.
<amz3>the only thing that make xml namespaces maybe useful is when you need to interleave tag with the same name (but different namespaces), like ATOM does? but again, one could invent a xml format where there is no name class between tags (avoiding xml namespaces).
<amz3>s/name class/name clash/
<amz3>RhodiumToad: yeah, that is prolly a bug in sxml, if it is still there it is because people using guile do not rely on namespaces.
<amz3>e.g. texmacs use xml but does rely (apparantly) on xml namespaces.
<amz3>e.g. texmacs use xml but does NOT rely (apparantly) on xml namespaces.
<RhodiumToad>how do you expect to do something as trivial as generating valid SVG without it?
<amz3>there is many ways, usually, one does a thing only when they need or enjoy it.
<numerobis>Something like this gets me closer to the solution: (sxml->xml (xml->sxml "<p>hola &align; hello</p>" #:entities '((align . "&amp;"))))
<numerobis>It produces <p>hola &amp; hello</p>. But I don't really understand the concept of 'entity' and the sxml documentation is quite terse on the topic, so I don't quite know how to adapt this to get just '&'.
<RhodiumToad>that seems a bit dubious
<RhodiumToad>entities are the &blah; things in html and xml
<RhodiumToad>&lt; and &amp; are basically essential in order to represent text containing < or & which, in xml, would otherwise be taken as tags
<RhodiumToad>in html, due to pressure of usage, there are various laxities
<numerobis>RhodiumToad: I agree, but at least that's a way to pass a special character.
<RhodiumToad>in xml, you can define entities within a document and do various tricks (some of which have security implications)
<numerobis>(xml->sxml "<p>hola &align; hello</p>" #:entities '((align . "SOMETHING"))) gives (*TOP* (p "hola SOMETHING hello"))
<numerobis>The thing is that now I'd like sxml->xml to interpret something as '&'.
<RhodiumToad>it's not legal to have a bare & in a text node in xml. you can have it in a cdata node or escaped as &amp;
<RhodiumToad>so (p "foo & bar") outputs as <p>foo &amp; bar</p> as it should
<RhodiumToad>sxml seems to have no ability to output CDATA.
<numerobis>RhodiumToad: yes, that's right.
<numerobis>In fact, it seems that putting &amp; instead of & as the latex character just works, for some reason :)
<numerobis>(that is, '&amp;' is interpreted by mathjax as just '&')
<amz3>numerobis: to generate to do sxml->html I use https://github.com/a-guile-mind/guile-web/blob/master/src/web/html.scm
<RhodiumToad> https://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters
<RhodiumToad>note that what the mathjax docs say about putting spaces around < and & only works for html and is explicitly invalid in xml
<numerobis>amz3: Thanks, will have a look at that. But the current solution seems fine. In fact, RhodiumToad docs seem to confirm that using &lt; and all in math equations is actually officially supported by Mathjax?
<RhodiumToad>yes
<wingo>amz3: fwiw what i do is here: https://github.com/wingo/tekuti/blob/master/tekuti/page-helpers.scm#L89-L236
*RhodiumToad was hoping for a simpler (than xslt) way to do simple xml transformations, but I guess this isn't it
<wingo>well html isn't xml :/
<wingo>i tried to believe it was for a long time too, but it's better to accept that it's different
<RhodiumToad>I know, see earlier discussion
<wingo>some similar techniques can apply of course
<RhodiumToad>my problem (unlike numerobis') doesn't involve html
***apteryx_ is now known as apteryx
<jcowan>I'm receiving email about bug #38235, but I don't know how to see that bug on the Web.
<amz3> https://debbugs.gnu.org/
<jcowan>ta
***jao is now known as Guest22630
<RhodiumToad>hm. am I understanding this correctly: the SSAX parser will return QNames as (url . name), but those aren't considered valid in SXML?
<RhodiumToad>xml->sxml is smushing the url and name together itself, and everything else seems to assume that if (car tree) is a pair then it's looking at a node-set
*RhodiumToad trying to figure out the best way of outputting a document with its namespace declarations at least semantically equal to the input, and ideally using the same naming and positioning
<RhodiumToad>ugh, ssax makes it hard or impossible to find the original namespace declarations