Ive implemented a new displaytype called 'selectcode', its supposed to work in tandem with 'displaycode'. The new htmlcode node selectcode and the existing extractcode now work together to allow the user to select which code blocks should be downloaded.

IMO a future direction is a user option to put links underneath block code sections to allow that specific block to be downloaded directly without requiring use of the selection code. But until that is done the selectcode page and links will prove useful IMO.

Ive put a switch in that allows you to ignore 'inlined' code blocks by default, although currently the setting is only available from the selectcode view. It should also be added to the appropriate User Settings page.

As usual there are probably rough edges in this stuff, so patches welcome.

You can use this node to test, here is some inlined, here is some in c-tags and here is some block code:

print "Hello World!";

and some more

print "more" for 1..100;

Note the additional link at the bottom of the node: 'Select Code To Download'

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re: New displaytype 'selectcode'
by davidrw (Prior) on Jun 12, 2005 at 14:22 UTC
    I had trouble finding the link at first -- it's the same blue font as the bar the bottom of the OP .. Is that on purpose for testing, or is it just missing the <font color="white"> tag that the "comment on New displaytype 'selectcode'" and "Download Code" links have?
    Update: Note that once the link is folowed, it is a different color blue that the bar, so it is visible..

      I had trouble finding the link at first -- it's the same blue font as the bar the bottom of the OP

      Fixed. Thanks.

      ---
      $world=~s/war/peace/g

Re: New displaytype 'selectcode' (concise)
by tye (Sage) on Jun 13, 2005 at 13:48 UTC

    I'd replace the table with "<p>checkbox, d/l link<br />first few lines of code...last few lines of code</p>". Code blocks tend to be large and wide and the table just makes the wideness worse and separating check boxes with huge chunks of code doesn't seem like a great interface...

    If you want that interface, just put "download this" links after each code block in the original node. Yes, I'd make such links the default with a user setting to turn them off. That way, everyone knows about the capability but those who don't like it can avoid it.

    I'd default to not showing inline code chunks. The times when downloading such is useful are certainly the exception. I wouldn't mind if the only way to get the inline chunks is to "download all", but providing a link "show in-line code chunks" would be fine too.

    - tye        

Re: New displaytype 'selectcode'
by hossman (Prior) on Jun 13, 2005 at 02:46 UTC

    I would think that the page should default to having all of the checkboxes checked, with a javascript button for unselecting all.

    I would also think that the "Ignore Inline" option would make the most sense not by ignoring the inline code completely, but by having box for inlinve code not checked by default.

    Either way, having some sort of visual cue in the table rows for inlined code might be handy for people in some nodes that are very full of code, as a reminder of why that one random snippet is in it's own section.

    These are of course just my opinions, I don't presume everyone thinks the way i do, but it's something you might wnat to consider.