Thursday 15 August 2013

Customize Perl Markdown to recognize note paragraphs with title (newbie to perl) -


I do not know anything about Pearl, but I really need to make changes to this one small markdoc syntax So I apologize that I am asking a very basic question.

I want to create a customized markdown to do this

  & lt; Div class = "note" & gt; & Lt; B & gt; My note title & lt; / B & gt; My note book & lt; / Div & gt;   

I've found that with div note class, with the syntax below:

  ~? Is this a note block ~? ~! This is a warning block ~!   

However, I want to be able to specify a title for the note, by adding the title in some symbols something like the following:

  ~? #title # is this a note block ~?   

Perl customized class

  sub__DoNotesAndWarnings {my $ text = shift; $ Text = ~ s {\ n ~ ([\! \?]) # $ 1 = Style class (. +?) # $ 2 = Block text ~ [\! \?] # Close syntax} {my $ style = ($ 1 Eq '!')? "Warning": "Note"; "& Lt; div class = \" style $ "& gt;" . _RunSpanGamut ("& lt; b & gt; Style: & lt; / b & gt; \ n". $ 2). "& Lt; / div> \ n \ n"; } Egsx; Return $ text; }   

How should I modify this code? Thanks a lot for helping!

What do you want:

  sub__DoNotesAndWarnings {my $ text = Shift; $ Text = ~ s {\ n ~ ([\! \?]) # $ 1 = Style class (?: \ S * \ # ([^ \ #] +) \ # \ s *)? # $ 2 = Title, Alternate (. +?) # $ 3 = Block Text ~ [\! \?] # Close syntax} {my $ style = ($ 1 EC '!')? "Warning": "Note"; My $ title = $ 2 || $ Style; "& Lt; div class = \" style $ "& gt;" . _RunSpanGamut ("& lt; b & gt; $ Title: & lt; / b & gt; \ n". $ 3). "& Lt; / div> \ n \ n"; } Egsx; Return $ text; }    

No comments:

Post a Comment