Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Embedding pod in other languages

by jpl (Monk)
on May 19, 2011 at 17:25 UTC ( [id://905760]=note: print w/replies, xml ) Need Help??


in reply to Re: Embedding pod in other languages
in thread Embedding pod in other languages

Good catch on the ^.* typo!

I'm not thrilled with the =v tag for verbatim lines, but I couldn't think of a better alternative. I considered a mechanism for starting and ending a "verbatim block", but controlling the amount of indent on each line fights with the desire to allow extra content up front. Assuming you start with a block of "verbatim text", most editors I know make it easy to paste a =v at the start of each line, after which you can adjust what comes before to suit the language and style.

Replies are listed 'Best First'.
Re^3: Embedding pod in other languages
by John M. Dlugosz (Monsignor) on May 19, 2011 at 19:17 UTC
    Is there some flaw in my suggestion of matching the indent level of the =code line that initiates it?

      There is no perfect solution. "Matching the indent level" of a mixture of blanks and tabs relies on knowing where the tab-stops are. We could add a bunch more options to support the notion of tab-stops, as perltidy does, but that doesn't protect you from an inadvertent (or deliberate) leading space that turns a line into a verbatim line when that wasn't the intent. For what I have been trying to do, verbatim lines are relatively uncommon, so I don't mind going a little out of my way to make other stuff foolproof, if that makes verbatim lines a bit clumsier.

      Given the response to this thread that could most charitably be described as "tepid", I have what I need, and I'm pleased that I'm not reinventing some existing wheel. If you have a preference for an alternative that works better for you, go for it. I'm not eager to push the idea much further.

        How does having the desired indent of the code fall after =v make that issue go away? It might look lined up under the current circumstances but will be all jumbled for someone else.

        I suppose you are saying that your way will at least ascribe all the lines to a verbatim paragraph, even though they may be indented wrong in the final presentation, as preferable to not identifying them properly at all.

        OK, how about after the =code initiates things, it will take all lines until another directive or zero-leading whitespace. It won't worry if the indention matches the initial line, but will clamp at zero after it removes the expected amount.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-26 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found