table of contents
Pandoc::Filter::HeaderIdentifiers(3pm) | User Contributed Perl Documentation | Pandoc::Filter::HeaderIdentifiers(3pm) |
NAME¶
Pandoc::Filter::HeaderIdentifiers - Add identifiers to headers
SYNOPSIS¶
my $id = header_identifier( $header->content ); # calculate identifier Pandoc::Filter::HeaderIdentifiers->new->apply($doc); # add all identifiers
DESCRIPTION¶
This Pandoc::Filter adds identifier attributes (id) to all Headers elements. It uses the same algorithm as internally used by pandoc. The module also exports function "header_identifier" to calculate an identifier from a list of elements.
FUNCTIONS¶
header_identifier( $content [, $ids ] )¶
Returns an identifier for a given list of inlines or string ($content). Optionally takes into account and updates existing ids, given as hash reference mapping identifier to usage count ($ids).
METHODS¶
apply( $element [, $ids ] )¶
Add identifiers to all Header elements found at a given element (typically a Document. A hash reference of existing identifier counts (or an empty hash to get the new counts) can be passed in addition.
CHARACTER PROPERTIES¶
InPandocHeaderIdentifier¶
Matches all Unicode lowercase letters, digits 0 to 9, underscore, hyphen, and period. In the unlikely event that you want to check whether a given string could have been generated as header identifier, use this:
$id =~ /^\p{InPandocHeaderIdentifier}+$/ and $id =~ /^\p{Letter}/
SEE ALSO¶
2024-08-03 | perl v5.38.2 |