my( $html, $just )= @_; my $AUTHOR= getNodeById( $NODE->{author_user} ); my %var= ( id => $NODE->{node_id}, title => $NODE->{title}, author_id => $AUTHOR->{node_id}, author_name => $AUTHOR->{title}, author_title => $AUTHOR->{title}, user_id => $USER->{node_id}, user_name => $USER->{title}, user_title => $USER->{title}, ); # root_id root_title sect_id sect_title $html =~ s{`([\[\]]|`+|(\w+)([%&]?)`?|.)}{ my $s= $1; if( '[' eq $s ) { $just ? '[' : '`{'; } elsif( ']' eq $s ) { $just ? ']' : '`}'; } elsif( defined $2 ) { my( $key, $suff )= ( $2, $3 ); my $val; if( $key =~ /^_./ ) { $val= $q->param($key); $val= $q->param( substr($key,1) ) if ! defined $val; } else { $val= $var{ lc $key }; } if( ! defined $val ) { $val= "`$key$suff`" } elsif( $suff eq '%' ) { $val= $q->escape($val); } elsif( $suff eq '&' ) { $val= $q->escapeHTML($val); } $val; } elsif( $s =~ /^`/ ) { $just ? $s : '`'.$s; } else { $just ? '`'.$s : '``'.$s; } }seg; return $html if $just; $html =~ s{()|\[([^\[\]]{1,4096})\]}{ $1 ? $1 : handleLinks($2) }seg; $html =~ s{`([{}]|`+|.)}{ my $s= $1; if( '{' eq $s ) { '['; } elsif( '}' eq $s ) { ']'; } elsif( $s =~ /^`/ ) { $s; } else { '`'.$s; } }seg; return $html;