| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## Markdown Parser Only - ~/lib/Markdown/Parser/Document.pm | ||||||||||||
| 3 | ## Version v0.3.0 | ||||||||||||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2021/08/23 | ||||||||||||
| 7 | ## Modified 2024/08/30 | ||||||||||||
| 8 | ## All rights reserved | ||||||||||||
| 9 | ## | ||||||||||||
| 10 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||
| 11 | ## under the same terms as Perl itself. | ||||||||||||
| 12 | ##---------------------------------------------------------------------------- | ||||||||||||
| 13 | package Markdown::Parser::Document; | ||||||||||||
| 14 | BEGIN | ||||||||||||
| 15 | 2 | ▶ | { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 2 | ▶ | use parent qw( Markdown::Parser::Element ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 2 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 2 | ▶ | use URI; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 2 | ▶ | use Scalar::Util (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 2 | our $VERSION = 'v0.3.0'; | |||||||||||
| 23 | 2 | ▶ | use constant MERMAID_RSRC_URI => 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | 2 | ▶ | use constant MERMAID_INIT => "mermaid.initialize({startOnLoad:true});"; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 25 | # https://katex.org/ | ||||||||||||
| 26 | 2 | ▶ | use constant KATEX_CSS_URI => 'https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | 2 | ▶ | use constant KATEX_JS_URI => 'https://cdn.jsdelivr.net/npm/katex/dist/katex.min.js'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 2 | ▶ | use constant KATEX_AUTO_RENDERER => 'https://cdn.jsdelivr.net/npm/katex/dist/contrib/auto-render.min.js'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 29 | 2 | ▶ | use constant KATEX_FONT_URI => 'https://cdn.jsdelivr.net/npm/webfontloader/webfontloader.js'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 30 | }; | ||||||||||||
| 31 | |||||||||||||
| 32 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 34 | |||||||||||||
| 35 | sub init | ||||||||||||
| 36 | 1 | ▶ | { | ||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 37 | 1 | my $self = shift( @_ ); | |||||||||||
| 38 | 1 | $self->{abbreviation_case_sensitive} = 0; | |||||||||||
| 39 | 1 | $self->{bolds} = {}; | |||||||||||
| 40 | 1 | $self->{default_email} = ''; | |||||||||||
| 41 | 1 | $self->{dict} = {}; | |||||||||||
| 42 | 1 | $self->{email_obfuscate_class} = 'courriel'; | |||||||||||
| 43 | 1 | $self->{email_obfuscate_data_host} = 'host'; | |||||||||||
| 44 | 1 | $self->{email_obfuscate_data_user} = 'user'; | |||||||||||
| 45 | 1 | $self->{encode_html_entities} = 1; | |||||||||||
| 46 | 1 | $self->{emphasis} = {}; | |||||||||||
| 47 | ## All footnotes objects ordered | ||||||||||||
| 48 | 1 | $self->{footnotes} = []; | |||||||||||
| 49 | ## Footnotes hash id => object | ||||||||||||
| 50 | 1 | $self->{footnotes_dict} = {}; | |||||||||||
| 51 | 1 | $self->{katex_delimiter} = ['$$','$$','$','$','\[','\]','\(','\)']; | |||||||||||
| 52 | 1 | $self->{links} = {}; | |||||||||||
| 53 | 1 | $self->{objects} = {}; | |||||||||||
| 54 | 1 | $self->{tag_name} = ''; | |||||||||||
| 55 | 1 | return( $self->SUPER::init( @_ ) ); | |||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | 1 | ▶ | sub abbreviation_case_sensitive { return( shift->_set_get_scalar( 'abbreviation_case_sensitive', @_ ) ); } | ||||||||||
|
Subroutine
abbreviation_case_sensitive: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 59 | |||||||||||||
| 60 | sub add_css_link | ||||||||||||
| 61 | 0 | ▶ | { | ||||||||||
|
Subroutine
add_css_link: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 62 | 0 | my $self = shift( @_ ); | |||||||||||
| 63 | 0 | ▶ | my $url = shift( @_ ) || return( $self->error( "No css link uri provided" ) ); | ||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No css link uri provided'))
MC/DC0%0/1
shift @_ || (return $self->error('No css link uri provided'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||
| 64 | 0 | my $opts = {}; | |||||||||||
| 65 | 0 | ▶ | $opts = shift( @_ ) if( $self->_is_hash( $_[-1] ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 66 | 0 | local $@; | |||||||||||
| 67 | # try-catch | ||||||||||||
| 68 | 0 | my $uri = eval{ URI->new( $url ) }; | |||||||||||
| 69 | 0 | ▶ | if( $@ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 70 | { | ||||||||||||
| 71 | 0 | return( $self->error( "Bad uri provided for this css link: '$url'" ) ); | |||||||||||
| 72 | } | ||||||||||||
| 73 | 0 | my $found; | |||||||||||
| 74 | $self->css_links->foreach(sub | ||||||||||||
| 75 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 76 | 0 | my $ref = shift( @_ ); | |||||||||||
| 77 | 0 | ▶ | if( $ref->{uri} eq $uri ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 78 | { | ||||||||||||
| 79 | 0 | $found++; | |||||||||||
| 80 | 0 | return; | |||||||||||
| 81 | } | ||||||||||||
| 82 | 0 | }); | |||||||||||
| 83 | 0 | ▶ | return( $uri ) if( $found ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 84 | 0 | $opts->{uri} = $uri; | |||||||||||
| 85 | 0 | $self->css_links->push( $opts ); | |||||||||||
| 86 | 0 | return( $self ); | |||||||||||
| 87 | } | ||||||||||||
| 88 | |||||||||||||
| 89 | sub add_js_data | ||||||||||||
| 90 | 0 | ▶ | { | ||||||||||
|
Subroutine
add_js_data: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 91 | 0 | my $self = shift( @_ ); | |||||||||||
| 92 | 0 | my $js = shift( @_ ); | |||||||||||
| 93 | # unless( $self->js_data->exists( $js ) ) | ||||||||||||
| 94 | # { | ||||||||||||
| 95 | # $self->js_data->push( $js ); | ||||||||||||
| 96 | # } | ||||||||||||
| 97 | 0 | my $found; | |||||||||||
| 98 | $self->js_data->foreach(sub | ||||||||||||
| 99 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 100 | 0 | ▶ | if( $_ eq $js ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 101 | { | ||||||||||||
| 102 | 0 | $found++; | |||||||||||
| 103 | 0 | return; | |||||||||||
| 104 | } | ||||||||||||
| 105 | 0 | }); | |||||||||||
| 106 | 0 | ▶ | $self->js_data->push( $js ) if( !$found ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 107 | 0 | return( $self ); | |||||||||||
| 108 | } | ||||||||||||
| 109 | |||||||||||||
| 110 | sub add_js_link | ||||||||||||
| 111 | 0 | ▶ | { | ||||||||||
|
Subroutine
add_js_link: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 112 | 0 | my $self = shift( @_ ); | |||||||||||
| 113 | 0 | ▶ | my $url = shift( @_ ) || return( $self->error( "No JavaScript link uri provided" ) ); | ||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No JavaScript link uri provided'))
MC/DC0%0/1
shift @_ || (return $self->error('No JavaScript link uri provided'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||
| 114 | 0 | my $opts = {}; | |||||||||||
| 115 | 0 | ▶ | $opts = shift( @_ ) if( $self->_is_hash( $_[-1] ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 116 | 0 | local $@; | |||||||||||
| 117 | # try-catch | ||||||||||||
| 118 | 0 | my $uri = eval{ URI->new( $url ) }; | |||||||||||
| 119 | 0 | ▶ | if( $@ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 120 | { | ||||||||||||
| 121 | 0 | return( $self->error( "Bad uri provided for this JavaScript link: '$url'" ) ); | |||||||||||
| 122 | } | ||||||||||||
| 123 | 0 | my $found; | |||||||||||
| 124 | $self->js_links->foreach(sub | ||||||||||||
| 125 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 126 | 0 | my $ref = shift( @_ ); | |||||||||||
| 127 | 0 | ▶ | if( $ref->{uri} eq $uri ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 128 | { | ||||||||||||
| 129 | 0 | $found++; | |||||||||||
| 130 | 0 | return; | |||||||||||
| 131 | } | ||||||||||||
| 132 | 0 | }); | |||||||||||
| 133 | 0 | ▶ | return( $uri ) if( $found ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 134 | 0 | $opts->{uri} = $uri; | |||||||||||
| 135 | 0 | $self->js_links->push( $opts ); | |||||||||||
| 136 | 0 | return( $self ); | |||||||||||
| 137 | } | ||||||||||||
| 138 | |||||||||||||
| 139 | sub add_object | ||||||||||||
| 140 | 0 | ▶ | { | ||||||||||
|
Subroutine
add_object: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 141 | 0 | my $self = shift( @_ ); | |||||||||||
| 142 | 0 | my $obj = shift( @_ ); | |||||||||||
| 143 | 0 | ▶ | return if( !ref( $obj ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 144 | 0 | ▶ | return if( !$self->_is_a( $obj, 'Markdown::Parser::Element' ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 145 | 0 | my $id = $obj->object_id; | |||||||||||
| 146 | 0 | $self->objects->set( $id => $obj ); | |||||||||||
| 147 | 0 | return( $id ); | |||||||||||
| 148 | } | ||||||||||||
| 149 | |||||||||||||
| 150 | sub as_markdown | ||||||||||||
| 151 | 1 | ▶ | { | ||||||||||
|
Subroutine
as_markdown: called CC=4 SCAR=18.9
Pod
documented
| |||||||||||||
| 152 | 1 | my $self = shift( @_ ); | |||||||||||
| 153 | 1 | ▶ | my $str = $self->children->map(sub{ $_->as_markdown })->join( '' ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 154 | 1 | ▶ | if( $self->links->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 155 | { | ||||||||||||
| 156 | 0 | $str .= "\n\n"; | |||||||||||
| 157 | 0 | ▶ | $str .= $self->links->map_array(sub{ $_[1]->as_markdown })->join( "\n" ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 158 | } | ||||||||||||
| 159 | 1 | ▶ | if( $self->dict->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 160 | { | ||||||||||||
| 161 | 0 | $str .= "\n\n"; | |||||||||||
| 162 | 0 | ▶ | $str .= $self->dict->map_array(sub{ $_[1]->as_markdown })->join( "\n" ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 163 | } | ||||||||||||
| 164 | 1 | ▶ | if( $self->footnotes->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 165 | { | ||||||||||||
| 166 | 0 | $str .= "\n\n"; | |||||||||||
| 167 | 0 | ▶ | $str .= $self->footnotes->map_array(sub{ $_[1]->as_markdown })->join( "\n" ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 168 | } | ||||||||||||
| 169 | 1 | return( $str ); | |||||||||||
| 170 | } | ||||||||||||
| 171 | |||||||||||||
| 172 | sub as_pod | ||||||||||||
| 173 | 0 | ▶ | { | ||||||||||
|
Subroutine
as_pod: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 174 | 0 | my $self = shift( @_ ); | |||||||||||
| 175 | 0 | ▶ | my $str = $self->children->map(sub{ $_->as_pod })->join( '' ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 176 | 0 | ▶ | if( $self->dict->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 177 | { | ||||||||||||
| 178 | 0 | $str .= "\n\n"; | |||||||||||
| 179 | 0 | ▶ | $str .= $self->dict->map_array(sub{ $_[1]->as_pod })->join( "\n" ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 180 | } | ||||||||||||
| 181 | 0 | ▶ | if( $self->footnotes->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 182 | { | ||||||||||||
| 183 | 0 | $str .= "\n\n"; | |||||||||||
| 184 | 0 | ▶ | $str .= $self->footnotes->map_array(sub{ $_[1]->as_pod })->join( "\n" ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 185 | } | ||||||||||||
| 186 | 0 | return( $str ); | |||||||||||
| 187 | } | ||||||||||||
| 188 | |||||||||||||
| 189 | sub as_string | ||||||||||||
| 190 | 0 | ▶ | { | ||||||||||
|
Subroutine
as_string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 191 | 0 | my $self = shift( @_ ); | |||||||||||
| 192 | 0 | my $arr = $self->new_array; | |||||||||||
| 193 | 0 | my $css_style; | |||||||||||
| 194 | 0 | my $css = $self->css; | |||||||||||
| 195 | 0 | my $temp_buffer = $self->new_array; | |||||||||||
| 196 | ## We need to set this temporary buffer because calling our children's as_string method does some set-ups that affects us | ||||||||||||
| 197 | 0 | ▶ | $temp_buffer->push( $self->children->map(sub{ $_->as_string })->join( "\n" )->scalar ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 198 | |||||||||||||
| 199 | 0 | $arr->push( <<EOT ); | |||||||||||
| 200 | <!DOCTYPE html> | ||||||||||||
| 201 | <html lang="en-GB"> | ||||||||||||
| 202 | <head> | ||||||||||||
| 203 | <meta charset="utf-8" /> | ||||||||||||
| 204 | <title></title> | ||||||||||||
| 205 | EOT | ||||||||||||
| 206 | $self->css_links->foreach(sub | ||||||||||||
| 207 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||
| 208 | 0 | my $ref = shift( @_ ); | |||||||||||
| 209 | 0 | my $e = $self->new_array( ['link'] ); | |||||||||||
| 210 | 0 | ▶ | $ref->{rel} = 'stylesheet' unless( length( $ref->{rel} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 211 | 0 | ▶ | $ref->{type} = 'text/css' unless( length( $ref->{type} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 212 | 0 | $ref->{href} = delete( $ref->{uri} ); | |||||||||||
| 213 | 0 | foreach my $k ( sort( keys( %$ref ) ) ) | |||||||||||
| 214 | { | ||||||||||||
| 215 | 0 | $e->push( sprintf( '%s="%s"', $k, $ref->{ $k } ) ); | |||||||||||
| 216 | } | ||||||||||||
| 217 | 0 | $arr->push( '<' . $e->join( ' ' )->scalar . ' />' ); | |||||||||||
| 218 | 0 | }); | |||||||||||
| 219 | 0 | ▶ | if( $css->elements->length > 0 ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 220 | { | ||||||||||||
| 221 | 0 | $css_style = $css->as_string; | |||||||||||
| 222 | 0 | $arr->push( <<EOT ); | |||||||||||
| 223 | <style> | ||||||||||||
| 224 | ${css_style} | ||||||||||||
| 225 | </style> | ||||||||||||
| 226 | EOT | ||||||||||||
| 227 | } | ||||||||||||
| 228 | $self->js_links->foreach(sub | ||||||||||||
| 229 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||
| 230 | 0 | my $ref = shift( @_ ); | |||||||||||
| 231 | 0 | my $e = $self->new_array( ['script'] ); | |||||||||||
| 232 | 0 | $ref->{src} = delete( $ref->{uri} ); | |||||||||||
| 233 | 0 | ▶ | $ref->{language} = 'JavaScript' unless( length( $ref->{language} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 234 | 0 | ▶ | $ref->{type} = 'text/javascript' unless( length( $ref->{type} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 235 | 0 | ▶ | $e->push( 'defer' ) if( delete( $ref->{defer} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 236 | 0 | foreach my $k ( sort( keys( %$ref ) ) ) | |||||||||||
| 237 | { | ||||||||||||
| 238 | 0 | $e->push( sprintf( '%s="%s"', $k, $ref->{ $k } ) ); | |||||||||||
| 239 | } | ||||||||||||
| 240 | 0 | $arr->push( '<' . $e->join( ' ' )->scalar . '></script>' ); | |||||||||||
| 241 | 0 | }); | |||||||||||
| 242 | $self->js_data->foreach(sub | ||||||||||||
| 243 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 244 | 0 | my $js = shift( @_ ); | |||||||||||
| 245 | 0 | ▶ | return( 1 ) if( !length( $js ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 246 | 0 | $arr->push( '<script type="text/javascript" language="JavaScript">' ); | |||||||||||
| 247 | 0 | $arr->push( $js ); | |||||||||||
| 248 | 0 | $arr->push( '</script>' ); | |||||||||||
| 249 | 0 | }); | |||||||||||
| 250 | 0 | $arr->push( <<EOT ); | |||||||||||
| 251 | </head> | ||||||||||||
| 252 | <body> | ||||||||||||
| 253 | EOT | ||||||||||||
| 254 | ## $arr->push( $self->children->map(sub{ $_->as_string })->join( "\n" )->scalar ); | ||||||||||||
| 255 | 0 | $arr->push( $temp_buffer->list ); | |||||||||||
| 256 | 0 | ▶ | if( $self->footnotes->length ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 257 | { | ||||||||||||
| 258 | 0 | my $fn = $self->new_array; | |||||||||||
| 259 | 0 | $fn->push( '<div class="footnotes" role="doc-endnotes">' ); | |||||||||||
| 260 | 0 | $fn->push( '<hr />' ); | |||||||||||
| 261 | 0 | $fn->push( '<ol>' ); | |||||||||||
| 262 | # $fn->push( $self->footnotes->map_array(sub{ $_[1]->as_string })->join( "\n" )->scalar ); | ||||||||||||
| 263 | 0 | ▶ | my $fn_str = $self->footnotes->map(sub{ $_->as_string })->join( "\n" )->scalar; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 264 | 0 | $fn->push( $fn_str ); | |||||||||||
| 265 | 0 | $fn->push( '</ol>' ); | |||||||||||
| 266 | 0 | $arr->push( $fn->join( "\n" )->scalar ); | |||||||||||
| 267 | } | ||||||||||||
| 268 | 0 | $arr->push( <<EOT ); | |||||||||||
| 269 | </body> | ||||||||||||
| 270 | </html> | ||||||||||||
| 271 | EOT | ||||||||||||
| 272 | 0 | return( $arr->join( "\n" )->scalar ); | |||||||||||
| 273 | } | ||||||||||||
| 274 | |||||||||||||
| 275 | 0 | ▶ | sub bolds { return( shift->_set_get_hash_as_mix_object( 'bolds', @_ ) ); } | ||||||||||
|
Subroutine
bolds: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 276 | |||||||||||||
| 277 | 1 | ▶ | sub css { return( shift->_set_get_object( 'css', 'CSS::Object', @_ ) ); } | ||||||||||
|
Subroutine
css: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 278 | |||||||||||||
| 279 | 0 | ▶ | sub css_links { return( shift->_set_get_array_as_object( 'css_links', @_ ) ); } | ||||||||||
|
Subroutine
css_links: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 280 | |||||||||||||
| 281 | 1 | ▶ | sub default_email { return( shift->_set_get_scalar_as_object( 'default_email', @_ ) ); } | ||||||||||
|
Subroutine
default_email: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 282 | |||||||||||||
| 283 | ## Ex: $self->dict->some_word( "Some value" ); | ||||||||||||
| 284 | ## Uses Module::Generic::Hash hash object | ||||||||||||
| 285 | 1 | ▶ | sub dict { return( shift->_set_get_hash_as_mix_object( 'dict', @_ ) ); } | ||||||||||
|
Subroutine
dict: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 286 | |||||||||||||
| 287 | ## Alias | ||||||||||||
| 288 | 0 | ▶ | sub dictionary { return( shift->_set_get_hash_as_mix_object( 'dict', @_ ) ); } | ||||||||||
|
Subroutine
dictionary: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 289 | |||||||||||||
| 290 | 1 | ▶ | sub email_obfuscate_class { return( shift->_set_get_scalar_as_object( 'email_obfuscate_class', @_ ) ); } | ||||||||||
|
Subroutine
email_obfuscate_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 291 | |||||||||||||
| 292 | sub email_obfuscate_data_host | ||||||||||||
| 293 | 1 | ▶ | { | ||||||||||
|
Subroutine
email_obfuscate_data_host: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||
| 294 | 1 | my $self = shift( @_ ); | |||||||||||
| 295 | 1 | ▶ | if( @_ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 296 | { | ||||||||||||
| 297 | 1 | ▶ | if( $_[0] =~ /^[a-zA-Z]\w+$/ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 298 | { | ||||||||||||
| 299 | 1 | return( $self->_set_get_scalar_as_object( 'email_obfuscate_data_host', @_ ) ); | |||||||||||
| 300 | } | ||||||||||||
| 301 | else | ||||||||||||
| 302 | { | ||||||||||||
| 303 | 0 | return( $self->error( "Invalid value \"$_[0]\" for the email obfuscation data-host attribute name." ) ); | |||||||||||
| 304 | } | ||||||||||||
| 305 | } | ||||||||||||
| 306 | 0 | return( $self->_set_get_scalar_as_object( 'email_obfuscate_data_host' ) ); | |||||||||||
| 307 | } | ||||||||||||
| 308 | |||||||||||||
| 309 | sub email_obfuscate_data_user | ||||||||||||
| 310 | 1 | ▶ | { | ||||||||||
|
Subroutine
email_obfuscate_data_user: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||
| 311 | 1 | my $self = shift( @_ ); | |||||||||||
| 312 | 1 | ▶ | if( @_ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 313 | { | ||||||||||||
| 314 | 1 | ▶ | if( $_[0] =~ /^[a-zA-Z]\w+$/ ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 315 | { | ||||||||||||
| 316 | 1 | return( $self->_set_get_scalar_as_object( 'email_obfuscate_data_user', @_ ) ); | |||||||||||
| 317 | } | ||||||||||||
| 318 | else | ||||||||||||
| 319 | { | ||||||||||||
| 320 | 0 | return( $self->error( "Invalid value \"$_[0]\" for the email obfuscation data-user attribute name." ) ); | |||||||||||
| 321 | } | ||||||||||||
| 322 | } | ||||||||||||
| 323 | 0 | return( $self->_set_get_scalar_as_object( 'email_obfuscate_data_user' ) ); | |||||||||||
| 324 | } | ||||||||||||
| 325 | |||||||||||||
| 326 | 2 | ▶ | sub encode_html_entities { return( shift->_set_get_boolean( 'encode_html_entities', @_ ) ); } | ||||||||||
|
Subroutine
encode_html_entities: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 327 | |||||||||||||
| 328 | 0 | ▶ | sub emphasis { return( shift->_set_get_hash_as_mix_object( 'emphasis', @_ ) ); } | ||||||||||
|
Subroutine
emphasis: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 329 | |||||||||||||
| 330 | 1 | ▶ | sub footnotes { return( shift->_set_get_array_as_object( 'footnotes', @_ ) ); } | ||||||||||
|
Subroutine
footnotes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 331 | |||||||||||||
| 332 | 0 | ▶ | sub footnotes_dict { return( shift->_set_get_hash_as_mix_object( 'footnotes_dict', @_ ) ); } | ||||||||||
|
Subroutine
footnotes_dict: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 333 | |||||||||||||
| 334 | sub get_abbreviation | ||||||||||||
| 335 | 0 | ▶ | { | ||||||||||
|
Subroutine
get_abbreviation: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 336 | 0 | my $self = shift( @_ ); | |||||||||||
| 337 | 0 | my $name = shift( @_ ); | |||||||||||
| 338 | 0 | ▶ | return if( !length( $name ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 339 | 0 | ▶ | $name = lc( $name ) unless( $self->abbreviation_case_sensitive ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 340 | 0 | ▶ | return if( !$self->dict->exists( $name ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 341 | 0 | my $elem = $self->dict->{ $name }; | |||||||||||
| 342 | 0 | return( $elem ); | |||||||||||
| 343 | } | ||||||||||||
| 344 | |||||||||||||
| 345 | sub get_footnote | ||||||||||||
| 346 | 0 | ▶ | { | ||||||||||
|
Subroutine
get_footnote: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 347 | 0 | my $self = shift( @_ ); | |||||||||||
| 348 | 0 | my $id = shift( @_ ); | |||||||||||
| 349 | 0 | ▶ | return if( !length( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 350 | 0 | ▶ | return if( !$self->footnotes_dict->exists( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 351 | 0 | my $elem = $self->footnotes_dict->{ $id }; | |||||||||||
| 352 | 0 | return( $elem ); | |||||||||||
| 353 | } | ||||||||||||
| 354 | |||||||||||||
| 355 | ## This method only make sense when called on the top most element, so we bubble up until we hit it | ||||||||||||
| 356 | sub get_link_by_id | ||||||||||||
| 357 | 0 | ▶ | { | ||||||||||
|
Subroutine
get_link_by_id: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 358 | 0 | my $self = shift( @_ ); | |||||||||||
| 359 | 0 | my $id = shift( @_ ); | |||||||||||
| 360 | 0 | ▶ | return if( !length( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 361 | 0 | $id = lc( $id ); | |||||||||||
| 362 | 0 | ▶ | return if( !$self->links->exists( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 363 | 0 | my $elem = $self->links->{ $id }; | |||||||||||
| 364 | 0 | return( $elem ); | |||||||||||
| 365 | } | ||||||||||||
| 366 | |||||||||||||
| 367 | 0 | ▶ | sub is_email_obfuscation_setup { return( shift->_set_get_boolean( 'is_email_obfuscation_setup', @_ ) ); } | ||||||||||
|
Subroutine
is_email_obfuscation_setup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 368 | |||||||||||||
| 369 | 0 | ▶ | sub is_katex_setup { return( shift->_set_get_boolean( 'is_katex_setup', @_ ) ); } | ||||||||||
|
Subroutine
is_katex_setup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 370 | |||||||||||||
| 371 | 0 | ▶ | sub is_mermaid_setup { return( shift->_set_get_boolean( 'is_mermaid_setup', @_ ) ); } | ||||||||||
|
Subroutine
is_mermaid_setup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 372 | |||||||||||||
| 373 | 0 | ▶ | sub js_data { return( shift->_set_get_array_as_object( 'js_data', @_ ) ); } | ||||||||||
|
Subroutine
js_data: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 374 | |||||||||||||
| 375 | 0 | ▶ | sub js_links { return( shift->_set_get_array_as_object( 'js_links', @_ ) ); } | ||||||||||
|
Subroutine
js_links: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 376 | |||||||||||||
| 377 | 1 | ▶ | sub katex_delimiter { return( shift->_set_get_array_as_object( 'katex_delimiter', @_ ) ); } | ||||||||||
|
Subroutine
katex_delimiter: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 378 | |||||||||||||
| 379 | 1 | ▶ | sub links { return( shift->_set_get_hash_as_mix_object( 'links', @_ ) ); } | ||||||||||
|
Subroutine
links: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 380 | |||||||||||||
| 381 | 0 | ▶ | sub objects { return( shift->_set_get_hash_as_mix_object( 'objects', @_ ) ); } | ||||||||||
|
Subroutine
objects: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 382 | |||||||||||||
| 383 | sub register_abbreviation | ||||||||||||
| 384 | 0 | ▶ | { | ||||||||||
|
Subroutine
register_abbreviation: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||
| 385 | 0 | my $self = shift( @_ ); | |||||||||||
| 386 | 0 | my $elem = shift( @_ ); | |||||||||||
| 387 | 0 | my $opts = {}; | |||||||||||
| 388 | 0 | ▶ | $opts = shift( @_ ) if( $self->_is_hash( $opts ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 389 | 0 | ▶ | return( $self->error( "No abbreviation definition was provided to register it." ) ) if( !length( $elem ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 390 | 0 | my $base = $self->base_class; | |||||||||||
| 391 | 0 | ▶ | return( $self->error( "Element provided \"$elem\" is not an ${base}::Abbr object." ) ) if( !$self->_is_a( $elem, "${base}::Abbr" ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 392 | 0 | my $name = $elem->name; | |||||||||||
| 393 | 0 | ▶ | $name = lc( $name ) if( !$opts->{abbreviation_case_sensitive} ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 394 | 0 | ▶ | return( $self->error( "No name is set for this abbreviation." ) ) if( !length( $name ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 395 | 0 | $self->dict->set( $name => $elem ); | |||||||||||
| 396 | 0 | return( $self ); | |||||||||||
| 397 | } | ||||||||||||
| 398 | |||||||||||||
| 399 | sub register_footnote | ||||||||||||
| 400 | 0 | ▶ | { | ||||||||||
|
Subroutine
register_footnote: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 401 | 0 | my $self = shift( @_ ); | |||||||||||
| 402 | 0 | my $elem = shift( @_ ); | |||||||||||
| 403 | 0 | ▶ | return( $self->error( "No link definition was provided to register it." ) ) if( !length( $elem ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 404 | 0 | my $base = $self->base_class; | |||||||||||
| 405 | 0 | ▶ | return( $self->error( "Element provided \"$elem\" is not an ${base}::Footnote object." ) ) if( !$self->_is_a( $elem, "${base}::Footnote" ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 406 | 0 | my $id = $elem->id; | |||||||||||
| 407 | 0 | ▶ | return( $self->error( "No id is set for this footnote." ) ) if( !length( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 408 | 0 | $self->footnotes_dict->set( lc( $id ) => $elem ); | |||||||||||
| 409 | 0 | $self->footnotes->push( $elem ); | |||||||||||
| 410 | 0 | return( $self ); | |||||||||||
| 411 | } | ||||||||||||
| 412 | |||||||||||||
| 413 | sub register_link_definition | ||||||||||||
| 414 | 0 | ▶ | { | ||||||||||
|
Subroutine
register_link_definition: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 415 | 0 | my $self = shift( @_ ); | |||||||||||
| 416 | 0 | my $elem = shift( @_ ); | |||||||||||
| 417 | 0 | ▶ | return( $self->error( "No link definition was provided to register it." ) ) if( !length( $elem ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 418 | 0 | my $base = $self->base_class; | |||||||||||
| 419 | 0 | ▶ | return( $self->error( "Element provided \"$elem\" is not an ${base}::LinkDefinition object." ) ) if( !$self->_is_a( $elem, "${base}::LinkDefinition" ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 420 | 0 | my $id = $elem->link_id; | |||||||||||
| 421 | 0 | ▶ | return( $self->error( "No id is set for this link definition." ) ) if( !length( $id ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 422 | 0 | $self->links->set( lc( $id ) => $elem ); | |||||||||||
| 423 | 0 | return( $self ); | |||||||||||
| 424 | } | ||||||||||||
| 425 | |||||||||||||
| 426 | sub setup_email_obfuscation | ||||||||||||
| 427 | 0 | ▶ | { | ||||||||||
|
Subroutine
setup_email_obfuscation: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 428 | 0 | my $self = shift( @_ ); | |||||||||||
| 429 | 0 | ▶ | return( $self ) if( $self->is_email_obfuscation_setup ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 430 | 0 | $self->is_email_obfuscation_setup( 1 ); | |||||||||||
| 431 | 0 | my $b = $self->css->builder; | |||||||||||
| 432 | 0 | ▶ | my $class = $self->email_obfuscate_class->length > 0 ? $self->email_obfuscate_class->scalar : 'courriel'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 433 | 0 | ▶ | my $data_host = $self->email_obfuscate_data_host->length > 0 ? $self->email_obfuscate_data_host->scalar : 'data-host'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 434 | 0 | ▶ | my $data_user = $self->email_obfuscate_data_user->length > 0 ? $self->email_obfuscate_data_user->scalar : 'data-user'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 435 | ## Credits for the css part: https://stackoverflow.com/a/21421949/4814971 | ||||||||||||
| 436 | 0 | $b->select( [".${class}:before"] )-> | |||||||||||
| 437 | content( sprintf( 'attr(data-%s) "\0040" attr(data-%s)', $data_host, $data_user ) )-> | ||||||||||||
| 438 | unicode_bidi( 'bidi-override' )-> | ||||||||||||
| 439 | direction( 'rtl' ); | ||||||||||||
| 440 | 0 | $self->add_js_data( <<EOT ); | |||||||||||
| 441 | (function() | ||||||||||||
| 442 | { | ||||||||||||
| 443 | var docLoaded = setInterval(function() | ||||||||||||
| 444 | { | ||||||||||||
| 445 | if( document.readyState !== "complete" ) return; | ||||||||||||
| 446 | clearInterval( docLoaded ); | ||||||||||||
| 447 | document.querySelectorAll('.${class}').forEach( item => | ||||||||||||
| 448 | { | ||||||||||||
| 449 | item.addEventListener('click', event => | ||||||||||||
| 450 | { | ||||||||||||
| 451 | if( !event.target.dataset.decoded ) | ||||||||||||
| 452 | { | ||||||||||||
| 453 | event.preventDefault(); | ||||||||||||
| 454 | function decode(a, r) | ||||||||||||
| 455 | { | ||||||||||||
| 456 | return a.split( '' ).reverse().join( '' ); | ||||||||||||
| 457 | }; | ||||||||||||
| 458 | var y = decode( event.target.dataset.${data_user} ) + '\@' + decode( event.target.dataset.${data_host} ); | ||||||||||||
| 459 | var enc = encodeURI( y ); | ||||||||||||
| 460 | enc = enc.replace( '?', '%3F' ); | ||||||||||||
| 461 | // console.log( "Final e-mail is: " + enc ); | ||||||||||||
| 462 | event.target.setAttribute( 'href', 'mai' + 'lto:' + enc ); | ||||||||||||
| 463 | event.target.dataset.decoded = true; | ||||||||||||
| 464 | // console.log( "Redirecting to " + enc ); | ||||||||||||
| 465 | window.location.href = 'mai' + 'lto:' + enc; | ||||||||||||
| 466 | return( false ); | ||||||||||||
| 467 | } | ||||||||||||
| 468 | }); | ||||||||||||
| 469 | }); | ||||||||||||
| 470 | }); | ||||||||||||
| 471 | })(); | ||||||||||||
| 472 | EOT | ||||||||||||
| 473 | 0 | return( $self ); | |||||||||||
| 474 | } | ||||||||||||
| 475 | |||||||||||||
| 476 | sub setup_katex | ||||||||||||
| 477 | 0 | ▶ | { | ||||||||||
|
Subroutine
setup_katex: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 478 | 0 | my $self = shift( @_ ); | |||||||||||
| 479 | 0 | ▶ | return( $self ) if( $self->is_katex_setup ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 480 | 0 | $self->add_css_link( KATEX_CSS_URI, { crossorigin => 'anonymous' }); | |||||||||||
| 481 | 0 | $self->add_js_link( KATEX_JS_URI, { crossorigin => 'anonymous' } ); | |||||||||||
| 482 | 0 | $self->add_js_link( KATEX_AUTO_RENDERER, { crossorigin => 'anonymous', defer => 1, onload => 'renderMathInElement(document.body);' }); | |||||||||||
| 483 | 0 | $self->add_js_data( <<'EOT' ); | |||||||||||
| 484 | window.WebFontConfig = | ||||||||||||
| 485 | { | ||||||||||||
| 486 | custom: | ||||||||||||
| 487 | { | ||||||||||||
| 488 | families: ['KaTeX_AMS', 'KaTeX_Caligraphic:n4,n7', 'KaTeX_Fraktur:n4,n7', | ||||||||||||
| 489 | 'KaTeX_Main:n4,n7,i4,i7', 'KaTeX_Math:i4,i7', 'KaTeX_Script', | ||||||||||||
| 490 | 'KaTeX_SansSerif:n4,n7,i4', 'KaTeX_Size1', 'KaTeX_Size2', 'KaTeX_Size3', | ||||||||||||
| 491 | 'KaTeX_Size4', 'KaTeX_Typewriter'], | ||||||||||||
| 492 | }, | ||||||||||||
| 493 | }; | ||||||||||||
| 494 | EOT | ||||||||||||
| 495 | 0 | $self->add_js_link( KATEX_FONT_URI, { crossorigin => 'anonymous', defer => 1 }); | |||||||||||
| 496 | 0 | my $map = | |||||||||||
| 497 | { | ||||||||||||
| 498 | '$$$$' => 'true', | ||||||||||||
| 499 | '$$' => 'false', | ||||||||||||
| 500 | '\[\]' => 'true', | ||||||||||||
| 501 | '\(\)' => 'false', | ||||||||||||
| 502 | }; | ||||||||||||
| 503 | 0 | my $delim = $self->new_array; | |||||||||||
| 504 | 0 | my $d = $self->katex_delimiter; | |||||||||||
| 505 | 0 | ▶ | for( my $i = 0; $i < $d->length; $i += 2 ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 506 | { | ||||||||||||
| 507 | 0 | my $k = join( '', @$d[$i..$i+1] ); | |||||||||||
| 508 | 0 | ▶ | $delim->push( sprintf( ' {left: "%s", right: "%s", display: %s},', $d->[$i], $d->[$i+1], $map->{ $k } ) ) if( exists( $map->{ $k } ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 509 | } | ||||||||||||
| 510 | 0 | my $delim_specs = $delim->join( "\n" )->scalar; | |||||||||||
| 511 | 0 | $self->add_js_data( <<EOT ); | |||||||||||
| 512 | document.addEventListener("DOMContentLoaded", function() | ||||||||||||
| 513 | { | ||||||||||||
| 514 | renderMathInElement(document.body, | ||||||||||||
| 515 | { | ||||||||||||
| 516 | delimiters: | ||||||||||||
| 517 | [ | ||||||||||||
| 518 | ${delim_specs} | ||||||||||||
| 519 | ] | ||||||||||||
| 520 | }); | ||||||||||||
| 521 | }); | ||||||||||||
| 522 | EOT | ||||||||||||
| 523 | 0 | $self->is_katex_setup( 1 ); | |||||||||||
| 524 | 0 | return( $self ); | |||||||||||
| 525 | } | ||||||||||||
| 526 | |||||||||||||
| 527 | sub setup_mermaid | ||||||||||||
| 528 | 0 | ▶ | { | ||||||||||
|
Subroutine
setup_mermaid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 529 | 0 | my $self = shift( @_ ); | |||||||||||
| 530 | 0 | ▶ | return( $self ) if( $self->is_mermaid_setup ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 531 | 0 | $self->add_js_link( MERMAID_RSRC_URI ); | |||||||||||
| 532 | 0 | $self->add_js_data( MERMAID_INIT ); | |||||||||||
| 533 | 0 | $self->is_mermaid_setup( 1 ); | |||||||||||
| 534 | 0 | return( $self ); | |||||||||||
| 535 | } | ||||||||||||
| 536 | |||||||||||||
| 537 | 2 | 1; | |||||||||||
| 538 | # NOTE: POD | ||||||||||||
| 539 | __END__ | ||||||||||||