Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^3: Make a Markup Method in Perl?

by tinita (Parson)
on May 16, 2012 at 12:04 UTC ( #970822=note: print w/replies, xml ) Need Help??

in reply to Re^2: Make a Markup Method in Perl?
in thread Make a Markup Method in Perl?

Honestly davido, I do have a plan. The only thing I don't know is how to change the look of the text.
You have two problems here. You want to invent a markup. Since you don't show any, that's up to you. You have to write a parser for that markup.

The second problem is you want to change the look of the text. But where is that text to be displayed? if in a terminal, then Term::ANSIColor (which you already mentioned) would be a good choice. but you said above that this module doesn't help you. you only forget to mention why.

So what do you actually want? if you want help you need to add more information. text is just text and has no format. if you add terminal escape sequences to it, then in a terminal it can be bold, coloured. displaying terminal escape sequences in a browser or in Tk is of no use, on the other hand.

See Parse::BBCode (one of my modules) for example. It's a simple markup, and the module parses it, returns a parse tree and renders it to HTML or text or any format you define.

Replies are listed 'Best First'.
Re^4: Make a Markup Method in Perl?
by perl.j (Pilgrim) on May 16, 2012 at 18:48 UTC
    I said in my original post that it will be outputted into an RTF file (.rtf). So Term::ANSIColor wouldn't work. Even if I was using a terminal, not many useful features are supported in the Windows DOS (which I'm using).

      If you want to write some formatted output to an RTF file then you have 2 options:

      • Learn about the RTF file format and write a method which transforms your original text into this format
      • Use an existing module which already does that. Searching for "rtf" on CPAN returns many results, so going through these results would be a good first step

      Maybe I also misunderstood your question, but to me it sounds like that's all you want

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://970822]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2017-03-29 10:33 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (345 votes). Check out past polls.