HTML::...Context(3pm)
π NAME π
ok so bestie, welcome to HTML::Microformats::DocumentContext β it's literally the context for microformat objects β¨ (perl v5.32.1 vibes, and yes this page is the HTML::...Context(3pm) one π)
πΈ DESCRIPTION πΈ
okay so here's the tea: microformat objects are like, needy. They need context to actually make sense when you're parsing them π«Ά For example, you need a base URI to resolve relative URI references, and you need a full copy of the DOM tree to implement the include pattern. No context, no slay. Periodt.
β¨ Constructor β¨
$context = HTML::Microformats::DocumentContext->new($dom, $baseuri)β creates a new context from a DOM document and a base URI π
β οΈ heads up bestie: $dom will be modified, so if you care about keeping it pristine, make a clone first. this is not a drill π
π¦ Public Methods π¦
$context->cacheβ a Microformat cache for the context π This prevents the same microformat object from being parsed and reparsed β like, anadrparsed first in its own right, and later as a child of anhCard. obsessed with the efficiency honestly.$context->documentβ returns the modified DOM document π$context->uri( [$relative_reference] )β called without a parameter, it returns the context's base URI. Called with a parameter, it resolves the URI reference relative to the base URI β¨$context->document_uriβ returns a URI representing the document itself π (usually the same as the base URI.)$context->make_bnode( [$element] )β mint a blank node identifier or a URI π If an element is passed, this may be used to construct a URI in some way.$context->profilesβ a list of profile URIs declared by the document π$context->has_profile(@profiles)β returns true iff any of the profiles in the array are declared by the document π$context->add_profile(@profiles)β declare these additional profiles π«Ά$context->representative_hcardβ returns thehCardfor the person that is "represented by" the page (in the XFN sense), orundefif no suitablehCardcould be found π$context->representative_person_id( [$as_trine] )β equivalent to calling$context->representative_hcard->id($as_trine, 'holder'), however it magically works even if$context->representative_hcardreturnsundefβ¨ lowkey iconic behaviour$context->contact_hcardβ returns thehCardfor the contact person for the page, orundefif none can be found π
hCards are considered potential contact hCards if they are contained within an HTML <address> tag, or their root element is an <address> tag. If there are several such hCards, then the one in the shallowest <address> tag is used; if there are several <address> tags equally shallow, the first is used. iykyk πΈ
$context->contact_person_id( [$as_trine] )β equivalent to calling$context->contact_hcard->id($as_trine, 'holder'), however it magically works even if$context->contact_hcardreturnsundefπ« again with the magic, we love her for it
π BUGS π
please report any bugs to <http://rt.cpan.org/> π bestie if you find one, tell the people, don't just suffer in silence π
π SEE ALSO π
HTML::Microformatsβ¨
π AUTHOR π
Toby Inkster <tobyink@cpan.org> π
π COPYRIGHT AND LICENCE π
Copyright 2008-2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself π
π«Ά DISCLAIMER OF WARRANTIES π«Ά
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. π«‘ no cap, it really says that, read it and weep
okay bestie that's the whole page, you ate it up π this was perl v5.32.1, dated 2021-09-12, and it's the HTML::...Context(3pm) manual β go forth and parse those microformats, main character energy only πβ¨
π¦ where this page comes from
- debian bookworm: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms