NAME
Perl6::Pod::Parser::AddIds - generate attribute id for elements
SYNOPSIS
DESCRIPTION
DOCUMENTING !DOCUMENTING !DOCUMENTING !DOCUMENTING !DOCUMENTING !
_make_id($text[, $base_id])
Function will construct an element id string. Id string is composed of join (':', $base_id || $parser->{base_id} , $text)
, where $text
in most cases is the pod heading text.
The xml id string has strict format. Checkout "cleanup_id" function for specification.
_make_uniq_id($text)
Calls $parser->make_id($text)
and checks if such id was already generated. If so, generates new one by adding _i1 (or _i2, i3, ...) to the id string. Return value is new uniq id string.
_cleanup_id($id_string)
This function is used internally to remove/change any illegal characters from the elements id string. (see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name for the id string specification)
$id_string =~ s/<!\[CDATA\[(.+?)\]\]>/$1/g; # keep just inside of CDATA
$id_string =~ s/<.+?>//g; # remove tags
$id_string =~ s/^\s*//; # ltrim spaces
$id_string =~ s/\s*$//; # rtrim spaces
$id_string =~ tr{/ }{._}; # replace / with . and spaces with _
$id_string =~ s/[^\-_a-zA-Z0-9\.: ]//g; # closed set of characters allowed in id string
In the worst case when the $id_string
after clean up will not conform with the specification, warning will be printed out and random number with leading colon will be used.