Join 3,512 readers in helping fund MetaFilter (Hide)


Blogging application that includes line-numbering?
January 25, 2004 11:02 PM   Subscribe

Blogging application that includes line-numbering? I'd like to publish content for peer review, in chonologic blog format, with automatic line numbering, so that people can comment, by line number, on my writing. Obviously, the line breaks and numbers have to be the same for everyone. AfterDinner.com offers this functionality, though it isn't really a blogging application. I'm a veteran Blogger user, and willing to do a little bit of creative coding (eg: light hacking of Moveable Type). Any help?
posted by scarabic to Computers & Internet (12 answers total)
 
I reckon one or more of these might give you the functionality you need.

When I first read this I thought it would be trivial to code into a template. The more I think about it, the more I think it might not be. With MT you have MTGetVar and MTSetVar so you could establish and retrieve a variable to get a count, and with a fixed-width layout, you should be able to make the result the same for all users, but I can't see off the top of my head how you'd increment line numbers without manually typing in some token at the end of each line (possible, but clunky)...
posted by stavrosthewonderchicken at 3:48 AM on January 26, 2004


relying on fixed width to give the same display to everyone sounds risky (fonts, browsers). <pre>, <br> and <table> are all going to be more reliable, if less fashionable.
1 maybe the simplest solution is to take the final text, add
2 line numbers to the text using a simple script, and stick
3 the whole thing in <pre>.  i know the typewriter look
4 is a bit of a cliche (courier etc), but for presenting draft
5 text it might be appropriate.  there's probably a font out
6 there somwhere that has the vertical position shifted
7 slightly for each letter... :o)
(which would look a lot better without matt's weird <br> paragraph hack (which is giving the double spacing)).

posted by andrew cooke at 4:58 AM on January 26, 2004


There's a pretty simple way to do this in Movable Type by using the Loop plugin. The documentation has an example of how to do it (scroll down to the code fragment under the "delimiter" attribute).
posted by staggernation at 5:03 AM on January 26, 2004


Although, upon rereading your post, I see that the content is not necessarily already broken into lines (like a code listing), so that wouldn't quite work. Hmm. You'd have to combine it with a plugin that wrapped the text. That would be pretty simple. Stay tuned...
posted by staggernation at 8:53 AM on January 26, 2004


  1. If you used a bit of CSS (or just HTML,)
  2. you could get this effect by making your lines of text
  3. list items. You would just have to watch the length
  4. of your lines of text, or find some other CSS attribute
  5. which covers that. Still, it'd beats writing a script to
  6. number your lines.

posted by trondant at 9:51 AM on January 26, 2004


OK, I just threw together a little plugin called TextWrap. Won't have a chance to write documentation and release it until tomorrow, but you can grab it here. And the MT template code you'd use to display numbered lines wrapped to 80 characters would be something like this:
<MTEntries>
 <MTLoop delimiter="\n" values="[MTTextWrap columns='80'][MTEntryBody convert_breaks='0'][/MTTextWrap]">
  <$MTLoopN$>: <$MTLoopValue$><br>
 </MTLoop>
</MTEntries>

posted by staggernation at 10:42 AM on January 26, 2004


Wow. Not that's AskMe at its best. Well done, staggernation.
posted by stavrosthewonderchicken at 3:01 PM on January 26, 2004


Sorry : 'not'='now'
posted by stavrosthewonderchicken at 3:02 PM on January 26, 2004


A non-Mefite friend recommends PurplePlugin for MT content numbering (in PurpleWiki format.) The additional wiki functionality it provides is reportedly optional, mind you.
posted by Danelope at 3:24 PM on January 26, 2004


Awesome, staggernation! I'll be digging into Moveable Type for the first time here, so it might take me a while to get there, but I REALLY appreciate it!
posted by scarabic at 6:31 PM on January 26, 2004


Yet another (slightly different) option would be to use straight CSS to style plain paragraphs as numbered list items. Granted, this would give you numbering by paragraph, not line, but it's a start, and would have the benefit of more fluid layouts.
posted by adamrice at 6:48 PM on January 26, 2004


You could also try the Textile plugin for MT and start each line with #, making it a numbered list item automatically. The Loop solution is appealingly elegant, though.
posted by anildash at 8:12 PM on January 26, 2004


« Older Where do t-shirts come from? I...   |  A question on Anorgasmia. [Mor... Newer »
This thread is closed to new comments.