Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$aubbc->add_tag( 'tag' => 'Tag', # Tag name: 'type' => '#', # Type number: tag style 'function' => '', # Function: subroutine to expa +nd methods 'message' => 'any', # Message: of tag 'extra' => '', # Extra: of tag 'markup' => '', # Template: output );
# This is an example of bold and italic in the same add_tag() # Tags: [b]message[/b] or [i]message[/i] # Output: <b>message</b> or <i>message</i> $aubbc->add_tag( 'tag' => 'b|i', # b or i 'type' => '2', 'function' => '', 'message' => 'any', 'extra' => '', 'markup' => '<%{tag}>%{message}</%{tag}>', );
sub new_function { # $tag, $message, $attrs are the captured group of its place my ($type, $tag, $message, $markup, $extra, $attrs) = @_; # expand functions.... # A) if there is a $message and blank $markup the $message wi +ll replace the tag. # B) if there is both $message and $markup, then $message can + be inserted # into $markup if $markup has %{message} or any "Markup Templ +ate Tags", # then markup will replace the tag. # C) if both are blank the tag doesnt change. return ($message, $markup); # May have to return more so we have better/more controle }
Markup:# tag: [dd=Stuff 7 attr=33]stuff[/dd] # output: <dd attr="33" alt="Stuff 7">stuff</dd> $aubbc->add_tag( 'tag' => 'dd', 'type' => '2', 'function' => '', 'message' => 'any', 'extra' => '-|attr/n{20-100},dd/w{7}', 'markup' => '<%{tag} attr="X{attr}" alt="X{dd}">%{message}</ +%{tag}>', ); # tag: [video height=90 width=115]http://www.video.com/video.m +p4[/video] # output: <video width="115" height="90" controls="controls"> #<source src="http://www.video.com/video.mp4" type="video/mp4" + /> #Your browser does not support the video tag. #</video> $aubbc->add_tag( 'tag' => 'video', 'type' => '2', 'function' => '', 'message' => 'src', 'extra' => '-|width/n{90-120},height/n{60-90}', 'markup' => '<video width="X{width}" height="X{height}" cont +rols="controls"> <source src="%{message}" type="video/mp4" /> Your browser does not support the video tag. </video>', );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AUBBC2 alpha development
by Anonymous Monk on Oct 19, 2011 at 10:58 UTC | |
by Anonymous Monk on Oct 20, 2011 at 10:09 UTC |