Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Formatting

by wfsp (Abbot)
on Jul 10, 2004 at 14:15 UTC ( [id://373363]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Formatting
in thread Formatting

Glad you liked it. I've put another condition in the if block:
if ( $tag->{ $style }->{ block } and ! $block_flag ){ $output = join( '', $output, $tag->{ $style }->{ block_open }, $line_out ); $block_flag = $style; } elsif ( ! $tag->{ $style }->{ block } and $block_flag ){ $output = join( '', $output, $tag->{ $block_flag }->{ block_close }, "\n", $line_out, "\n" ); $block_flag = ''; } elsif ( ! $tag->{ $style }->{ block } ){ $output = join( '', $output, $line_out, "\n" ); } else{ $output = join( '', $output, $line_out ); }

Replies are listed 'Best First'.
Re^4: Formatting
by mrxg4 (Initiate) on Jul 11, 2004 at 21:56 UTC
    Thanks again!

    Just got 2 questions that have arisen and should be easy to do now that you have kindly provided me with this script.

    First, the simplest, how do I add the '#' as one of the first characters to check? I have tried adding another one of those blocks, but as you know Perl's comment character is #. Adding "\#" didn't help either. How can I express this in a way that will work without Perl interpreting it as a comment?

    And lastly, how can I make the "K" statements be separated as "Perl,%Monks,%Is,%Cool"? I've experimented with adding a ",". For example:
    my $tag = { K => { open => ',%',
    close => '',
    block => 1,
    block_open => '<p>',
    block_close => '</p>'

    But as you probably realized, this has a nasty habit of adding an extra "," even to the first statement, as in ,%Perl,%Monks,%Is,%Cool .

    I want you to know that I really appreciate the help you have provided so far, since I'm very close to having this finished and saving me tons of future hours :)

    Best Regards,
    Marcos
      Important: read the health warning below.

      Does a # in the data indicate a comment? If it does the code below skips lines begining with a #. If I have not understood you correctly, please give an example of the data.
      The code also adds a comma to each 'inline' style.
      I've added a variable to help make the code clearer.

      Health warning
      There is more than one way to do this! This is how I do it and it is heavily influenced by the fact that my main experience in coding is vb which makes most people around here shudder! For example, in Programing Perl, a long list of elsifs is frowned on. I tell myself that as I'm using the less well known 'baby idiom' (to be polite) it is ok. Until, at least, I learn a better way.
      Also my main motive for helping is to hone my own skills (which badly need honing).

        John,
        The "#" in my code would be a comment, but it should be translated to a <!-- Whatever comment -->, not completely ignored.

        I really appreciate your help, and if you have AOL/ICQ/MSN or e-mail, please let me know so we can discuss this in a simpler manner.

        Thanks again,
        Marcos

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://373363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-24 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found