logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

HTML::Microformats::DocumentContext - context for microformat objects

Author

       Toby Inkster <tobyink@cpan.org>.

Bugs

       Please report any bugs to <http://rt.cpan.org/>.

Description

       Microformat objects need context when being parsed to properly make sense.  For example, a base URI is
       needed to resolve relative URI references, and a full copy of the DOM tree is needed to implement the
       include pattern.

   Constructor
       "$context = HTML::Microformats::DocumentContext->new($dom, $baseuri)"
           Creates a new context from a DOM document and a base URI.

           $dom will be modified, so if you care about keeping it pristine, make a clone first.

   PublicMethods
       "$context->cache"
           A  Microformat cache for the context. This prevents the same microformat object from being parsed and
           reparsed - e.g. an adr parsed first in its own right, and later as a child of an hCard.

       "$context->document"
           Return the modified DOM document.

       "$context->uri( [$relative_reference] )"
           Called without a parameter, returns the context's base URI.

           Called with a parameter, 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 the hCard for the person that is "represented by" the page (in the XFN sense), or undef if no
           suitable hCard could be found

       "$context->representative_person_id( [$as_trine] )"
           Equivalent to calling "$context->representative_hcard->id($as_trine,  'holder')",  however  magically
           works even if $context->representative_hcard returns undef.

       "$context->contact_hcard"
           Returns the hCard for the contact person for the page, or undef if 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.

       "$context->contact_person_id( [$as_trine] )"
           Equivalent  to  calling  "$context->contact_hcard->id($as_trine,  'holder')", however magically works
           even if $context->contact_hcard returns undef.

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.

perl v5.32.1                                       2021-09-12              HTML::Microfor...DocumentContext(3pm)

Name

       HTML::Microformats::DocumentContext - context for microformat objects

See Also

       HTML::Microformats

See Also