#microformats 2018-04-10

2018-04-10 UTC
webchat291 joined the channel
#
jmac
Oh noes I'm starting to put my crappy mid-dogfooding unsafe-for-human-consumption MF2 software on GitHub. I would appreciate eyes & critique on my summary of MF2 found here: https://github.com/jmacdotorg/microformats2-perl#about-microformats2
#
Loqi
[jmacdotorg] microformats2-perl: A Microformats2 parser library for Perl 5.
#
aaronpk
Awesome!
#
aaronpk
I can't quite tell from the readme, but it sounds like this might be conflating the parsing step and consuming step
#
aaronpk
im looking at the ::Item class
#
aaronpk
Normally parsers will return a data structure that maps exactly to the Microformats JSON representation rather than defining their own classes for the objects within
#
aaronpk
A parser might also have tools to help access that data easier, but the parsing step should be as light as possible and reflect the documented JSON as accurately as possible
#
aaronpk
Does that make sense?
#
jmac
Interesting
#
jmac
I thought it'd be enough to have a ready-to-hand as_json() object method for serialization, but it sounds like you're arguing that really there shouldn't be anything to serialize, once parsed?
#
aaronpk
Yeah more or less. The parsed result is usually a native data structure of primitive types. Objects/Hashes, arrays and strings
#
aaronpk
That was actually one of the annoying things about the ruby parser before the rewrite. It used to return its own classes for everything so it made it cumbersome to deal with because you had to go read docs about how to access the values and iterate over things
#
jmac
This is *almost* that... it being Perl, all the sturctures are just primitives that are "blessed" into named classes (and the JSON export strips that out). But my "document" objects have a few extra indices and stuff to help with queries, as well.
#
jmac
And this is all build around what I as its notional sole user want to use at this time :) But I am 100% willing to reshape per community standards
#
jmac
I will add that the tests at github.com/microformats/tests are 💯, and this module's own tests are literally those, copied over with attribution. It passes 40-odd out of 70-odd tests, woo
#
jmac
datetimes are hard
#
aaronpk
yeah ultimately it's up to the you to make something that fits the perl expectations best, but we do also want to be somewhat consistent between the languages
[eddie] joined the channel
#
jmac
Yeah, cool, I'll take a look at the ruby one
webchat291, toomim, tantek_, Gaara- and [miklb] joined the channel
#
Zegnat
jmac also note that if you use those tests you need special code for dates. Those test files normalise datetime values even when it shouldn't.
[kevinmarks], BreakingFree, webchat256, [pfefferle], tantek_, webchat362, [snarfed], powww and onlinemarketinga joined the channel
#
@Switchstance_
To finish off #TechieTuesday we thought we'd incorporate a little SEO, enjoy these helpful tips on micro-formats and rich snippets #SEO #MicroFormats #RichSnippets #DigitalOptimisation #Data #DigitalMarketing #Sheffieldissuper
(twitter.com/_/status/983691075301687297)
twisted`, bigbluehat, [jgmac1106], webchat178, kaushalmodi, barpthewire, TallTed, tantek_, [kevinmarks], [gerwitz], sebsel and [eddie] joined the channel
#
@zarlino
Regà, se 10 anni fa invece de aprivve sti facebook e sti twitter ve imparavate a fa un blog coi microformats e a legge gli RSS, oggi non staremmo a sentì #Zuckerberg che ce racconta quanti cacchi nostri sa e quanto ce vole censurà.
(twitter.com/_/status/983800199725420545)
#
aaronpk
is there some way i can use the value of the "id" attribute as an mf2 property?
#
KartikPrabhu
aaronpk: afaik id attribute never shows up in any parsing
#
KartikPrabhu
what's the use-case?
#
aaronpk
I'm trying to use an id attribute as an in-page fragment link and generate a table of contents from it as well
#
aaronpk
for example <section class="h-entry" id="chapter-one"><h1 class="p-name">Chapter One</h1> ... </section>
#
aaronpk
if i run that through the parser I get a nice list of all the chapters and their names
#
aaronpk
i need that id attribute in order to generate the table of contents that links to it
#
KartikPrabhu
aaronpk: you could fake it by adding a <a> with the href=id of that element
#
aaronpk
yeah i did that with a <data> element but it means duplicating the id
#
KartikPrabhu
I usually add <a> with such a link to y section headings anyway
#
aaronpk
that doesn't make sense in this case
#
KartikPrabhu
example <section class="h-entry" id="chapter-one"><h1 class="p-name"><a class="u-url" href="#chapter-one>Chapter One</a></h1> ... </section>
#
aaronpk
i also can't really use an <a> tag in the header because it'll look wrong
#
KartikPrabhu
i suppose if the u-uid were implied from the id or name attribute
BreakingFree, [kevinmarks], [jgmac1106], tantek_ and KartikPrabhu joined the channel