Yery cool idea. It would also be nice to be able to have code numbering continue from one block to the next (obviously under some user control). For example:

1 # This is the start of the code where we set up stuff 2 my $frob = 'gibber'; 3 my $handle = 'hum';

Then some descriptive narrative explaining what is going on. And I pick up from where I left off:

4 # Start doing the real work 5 do_the_real_work($frob, $handle);

Of course sometimes you want the first block and the second to be numbered separately, and you may want to interweave one set of numbers with another. So I would propose amending the syntax to be:

<NCODE section="some_name" start_line="1" order="1"> insert code here </NCODE>

All three attributes are optional. Each named section would have a running counter. The start_line attribute allows you to specify the starting line number of the section. Finally, the order attribute governs the order of the section in the resulting code. The order attribute allows you to talk about a chunk of code that is deep in the body then talk about the stuff that appears before it and have the line numbers make sense. Of course this is all becoming very similar to the Literate Programming stuff, since the "download code" link should reconstruct the code blocks into the right sections and into the right order (possibly with # line statements if lines were skipped).

Of course this is all very complex and tangled and vroom is probably way to busy to do something so frivolous. So how can I help? Is there a cadre of hand picked workers who help maintain the Monastery? Can I get my hands on the current source code through some CVS share and hack it in and submit patches?

-ben


In reply to Re: Suggestion: Optional Line Numbering Tag for CODE by knobunc
in thread Suggestion: Optional Line Numbering Tag for CODE by Masem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.