in reply to Re^32: aXML vs TT2
in thread aXML vs TT2
Please fill in the missing blank for me please.
| input | output |
|---|---|
| & | & |
| &lab; | &lab; |
| &lab; | < |
| ??? | &lab; |
(aXML is format agnostic, so I really mean the output of aXML, and not how it would look if interpreted as HTML by a browser.)
It sounds like you changed aXML from
| input | output |
|---|---|
| & | & |
| <post_include>path/to/lt</post_include> | < |
| &lab; | &lab; |
to
| input | output |
|---|---|
| & | & |
| &lab; | < |
| <post_include>path/to/lab</post_include> | &lab; |
which means
sub plugin_name { my $text_to_return = ...; $text_to_return =~ s{<}{<post_include>path/to/lt</post_include>}g; return $text_to_return; }
is now
my %subst = ( '<' => '&lab;', '&lab;' => '<post_include>path/to/lab</post_include>', ); my ($subst_re) = map qr/$_/, join '|', map quotemeta, keys %subst; sub plugin_name { my $text_to_return = ...; $text_to_return =~ s/($subst_re)/$subst{$1}/g; return $text_to_return; }
You made things worse!
No matter whether it's based on regex, yacc or something, building the parser is the easy part — there are books that teach how to do that — it's building the language that's hard.
|
|---|