#microformats 2021-04-08

2021-04-08 UTC
#
KartikPrabhu
btrem: MathML can go in e-content
#
btrem
Like in h-entry.
#
btrem
Right. I was writing about using elements *inside* svg in my post.
#
KartikPrabhu
can you use MathML in SVG? does it render in any browser?
#
btrem
Well, I discussed both: using e-logo for a container wrapping svg, but also p-name on a `<text>` element.
#
btrem
No. We're crossing messages.  :/
[KevinMarks] joined the channel
#
KartikPrabhu
oh, I guess we are agreeing on the MathML as e-content but there a separate question on elements inside SVG
#
btrem
!@#!@#!@ I hate this web/chat window! Just lost my whole message.  @$E#@
#
sknebel
I mentioned MathML for completeness/context because it and SVG are the formats that are explicitly called out for parsing in the HTML5 parsing spec after Zegnat asked if a HTML parser would put them in the DOM
#
btrem
Right. My real world use case is adding `p-name` on a `<text>` element for an `h-card`.
#
btrem
I don't see that coming up with MathML.
#
KartikPrabhu
if the svg is directly in the HTML then the HTML parsers should pick it up
#
KartikPrabhu
if it is in an <img> tag then they won't
#
sknebel
and given that its explicitly mentioned I would expect an HTML parser to produce a DOM for it, and thus a microformats parser to find classes and everything to work
#
btrem
So far, the parsers I've tested have picked them up.
#
btrem
Using the python and php microformats validators linked from the mf wiki.
#
sknebel
(there is always some risk that not all parsers are always using HTML5 parsers and might do different things, but it answers "what do I expect" to me)
#
btrem
There's a screenshot of the results in the article, using the python one.
#
KartikPrabhu
yes that risk will always be there for any mf2 parsing
#
sknebel
right, and very much in "bug"/"you choose this tradeoff, we tell you to do otherwise" fields.
#
btrem
Well, it *appears* that Google is doing something useful with it. It does show the street-address, locality, etc. Those are on html elements. It also shows the name of the business that is definitely coming from the svg text element.
#
KartikPrabhu
oh that is interesting
#
btrem
Whether that's due to microformats h-card classed, or just Google using that text, is hard to say.
#
sknebel
might be worth testing with PHP and python when they are not using HTML5 parsers - I'd vote for explicitly making them support SVG if they happen to fail it in that case
#
btrem
Yes, the search results for Google and DuckDuckGo are very encouraging.
#
btrem
the python validator does work with the html.parser option selected.
#
sknebel
thats good, because that's truly terrible :D
#
btrem
haha
#
btrem
Until you posted that, I didn't even realize what that meant!  :-D
#
btrem
That is truly terrible! SVG and MathML and html is a real mess.
#
btrem
I'm lmao.
#
btrem
Hmm, I did just notice something odd, though: the logo is an svg inside `<h1 class="e-logo">`. So in the JSON there's logo.0.html is the embedded svg markup, as it should; and logo.0.value, which is "Greenbank Plant Nursery  Greenbank  Plant Nursery".
#
btrem
Because the SVG has a title set to "Greenbank Plant Nursery", and there's also a `text` element with "Greenbank Plant Nursery."
#
sknebel
right, and the algorithm doesn't care about the tags its in, it just uses the text content of all the tags
#
btrem
That's correct, according to the parsing rules.
#
btrem
But not ideal.
#
btrem
The `title` element does offer accessibility. But maybe it isn't needed in this case, since the text is visible and accessible to e.g. a screen reader.
#
sknebel
right, not sure about best practices here
#
btrem
Probably not worth solving right now, but it might be worth keeping in the back of the mind, if svg starts getting used more.
#
btrem
The rule now is drop <script> and <style>. Maybe drop <script>, <style>, and <title> instead.
#
btrem
Because the <title> does not add to the text content of an html document (does it?). So maybe it shouldn't for svg, as well.
j12t joined the channel
#
@aaronpk
↩️ Nice! The thing that does most of the work for me is all in a library XRay: https://github.com/aaronpk/xray It normalizes content from Microformats feeds as well as Twitter and other stuff. Then it's a matter of reformatting the resulting JSON into a nice feed using some templates
(twitter.com/_/status/1379990018911993856)
KartikPrabhu, Seirdy, mxd, [tw2113_Slack_], [jeremycherfas], hendursaga, [Murray], [KevinMarks], [snarfed], [scojjac], [tantek], [kimberlyhirsh], [schmarty], tomlarkworthy, [Rose], [aciccarello], IWSlackGateway and indy joined the channel