This site is now 100% read-only, and retired.

XML logo

New formatting options
Posted by Steve on Wed 31 Jan 2007 at 09:40
Tags:

In the next day or two there will be an update to comment posting, and weblog posting.

Right now it is just undergoing more testing and there are still a few pieces of code missing (for saving/using a "default" format, etc).

Currently users may make comments in "plain text", or "html". With the new code these choices have been extended to:

  • BBCode
  • HTML
  • Plain Text.
  • Textile

The escaping issues plaguing some users should have been resolved, and I should be able to easily add support for additional formats in the future. (Markdown is on the TODO list - whether it comes now, or takes a little bit of time is still up in the air.)

The formatters themselves are nice and small and can be updated independently of each other - so it should be simple to extend in the future if things change. Ultimately all comments are converted, in some manner, to HTML before saving into the database. This does make editing a little annoying, but otherwise keeps things simple. (I don't want to have to convert, or otherwise modify, existing comments!)

Still I'm looking forward to making the changes live.

 

Comments on this Entry

Re: New formatting options
Posted by mar (89.102.xx.xx) on Wed 31 Jan 2007 at 10:04
[ View Weblogs ]
Good! Especially i was _missing_ textile (just wrote my 1st weblog here and was forced to <p> every par :-)

[ Parent ]

Re: New formatting options
Posted by Steve (80.68.xx.xx) on Wed 31 Jan 2007 at 10:08
[ View Weblogs ]

There is a test installation running here with a reasonably recent dump of the database - with email sending disabled.

Feel free to try it out and report bugs. It'll go offline once I'm happy with the changes, but till then it is a good way of testing it out.

Steve

[ Parent ]

Re: New formatting options
Posted by mar (89.102.xx.xx) on Thu 1 Feb 2007 at 07:14
[ View Weblogs ]

Just tried:

  1. entry is here
  2. Not all textile formatting is supported, but ok for my needs. Most usefull features are ok.
  3. After saving the textile formatting is converted to HTML -- that's ok? I thought all will be in textile and converted to html on the fly with something like python-textile module or so.

regards, m.

[ Parent ]

Re: New formatting options
Posted by Steve (80.68.xx.xx) on Thu 1 Feb 2007 at 09:56
[ View Weblogs ]

I'm using the Text::Textile Perl module (this site is 100% perl-based!) so almost anything supported by that should be allowed.

The process works like this:

  • Text entry.
  • Conversion to HTML via the Text::Textile module.
  • Filtering to avoid javascript injection, and prohibited tags.
  • Insertion/Display.

I might be filtering things out at step 3, but otherwise I'd expect everything to work correctly. I'll take a look at the dashing options and the centering - I'm pretty sure centering is something which is being filtered, on the basis that I don't explicitly allow it and it hasn't ever seemed important before!

As for the on-the-fly conversion, not yet. It does make sense but first I'd have to retroactively add a "comment type" column to the comments table - and for the moment it seems simplest to leave everything in the database as HTML and not treat textile/anything else specially.

(Perhaps in retrospect it was a bad decision to store comments as HTML in the database, but at least it wasn't my decision ;)

Thanks very much for taking the time to test it.

Steve

[ Parent ]

Re: New formatting options
Posted by mar (89.102.xx.xx) on Thu 1 Feb 2007 at 11:44
[ View Weblogs ]
  • ad testing: no problem, suprisingly enough, today im not in a hurry :-)
  • ad features: as i said, most usefull features (lists, emphasizing, auto-paragraphs) are ok

=> so the support is fine imho.

it would be nice to:

  1. get back the formatting you used to write your comment/entry (ie. store in in the db not in HTML), but i understand there are more important things than that.
  2. and maybe tables -- the module should understand the syntax, but somehow does not work? (see my next attempt here)

anyway, once again, i'm fine with the support as is, m.

P.S. no offense with python :-)

[ Parent ]

Re: New formatting options
Posted by Steve (80.68.xx.xx) on Thu 1 Feb 2007 at 11:58
[ View Weblogs ]

For the moment reverting back to the input for editing purposes just isn't going to be supported. Once I start "improving" the database schema it might be an option though.

(Interestingly some of the modules I'm using do support conversion in both directions, so turning HTML into BBCode should be simple enough - but not all of them do, so it isn't a trivial job.)

Anyway I've added table support now, and created a test entry using it, so barring major problems the textile support is done :)

I'll still need to work on a new preference somewhere - but otherwise we're mostly ready to go live.

Steve

[ Parent ]

Re: New formatting options
Posted by eric (194.2.xx.xx) on Wed 31 Jan 2007 at 14:19
[ View Weblogs ]
Great news, i don't really like BBcode formatting (don't know Textile) but it's simpler than formatting in pure HTML.

:eric:
http://blog.sietch-tabr.com

[ Parent ]

Re: New formatting options
Posted by Steve (80.68.xx.xx) on Wed 31 Jan 2007 at 15:03
[ View Weblogs ]

I'm too used to wanting control, so all my comments are usually entered in HTML. Still the newer options will probably help people who have their own preferences.

The big motivation was actually to get rid of the outstanding escaping bugs which cause a lot of irritation when they're noticed.

Steve

[ Parent ]