I dare you…
Thursday, 25 November 2004
…to make a mess of the comments of this entry. I’m working on a new plugin for Nucleus, called HTML Comments. It allows visitors to post comments in HTML, without (hopefully) allowing users to post malicious mark-up. If the plugin functions as I hope it does, every comment will still validate properly as XHTML. The code is based on lib-scrub and will be released under the GPL once I work out some of the bugs. So I dare you to try it out and post the most screwy HTML constructs you can find as I will monitor the performance of the new plugin.
Allowed tags are:
strong, b, em, i, del, strike, s, sup, sub, tt, kbd, code, pre, br, p, a, img
The plugin works in three modes:
- Plain text mode: If the text contains no tags, it will let Nucleus use it’s own filtering algorithm.
- HTML styling: If the poster does not specify any linebreaks or paragraphs it will try to build those from the hard line breaks present in the text. So you could post just like you are used to, except use tags like <b> or <em> for styling your post.
- Full HTML: If the poster does specify linebreaks or paragraphs the plugin will ignore any hard line breaks and base the presentation solely on the HTML code present in the post.
Check if the page is still valid XHTML with the W3C Validator
Update: I’m making quite a bit of progress with Lib-Scrub, the library on which this plugin is based. I’ve rewritten large parts of it since the last public release. Improvements include checking the document against a DTD, which will ensure that attributes or tags that are not allowed will not end up in the output. Next thing to do… checking if required attributes are present…
[b] bold [i] bold-italic [/b] italic [/i]
bold bold-italic italic
Yet another cool plugin
fromRakaz!!:)
I’m looking forward to the release :)
Is there any reason the <blockquote>-tag is not allowed?
some script code:
<script type="text/javascript">
window.alert("test");
</script>
TeRanEX: Hmm… your last post didn’t trigger one of the HTML modes… checking why…
TeRanEX: fixed!
How about that?
Well, it works…
rakaz, you may want check-out BLOG:CMS mods, at http://demo.blogcms.com/?it…
bold
Paragraph
Heading1
DivLooks like its working fine.
Just checking some inproper markup combined with javascripting… ;)
Wow, the blockquote containg the javascript was completely
removed!
Just checking some inproper markup combined with javascripting… ;)
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Well, it kinda broke… :)
KB: that’s just mean :)
KB: actually, youre example didn’t trigger any of the HTML modes, so technically my plugin isn’t at fault here :) Not that my plugin would do any better, but still :)
Haha, we need a wrap around here.
ItalicBoldUnderlined
Paragraph
List itemList ItemList Item(ordered list)List Item(ordered list)
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Better?
hmm… slightly better
background:#000000; border:0;">
Image :
hey, rakaz, i really like your blog. I couldn’t believe you are enabling
comments after upgrading to XHTML 1.1, though this page is not sent in
‘application/xhtml+xml’.
Ok, now let me try ur HTML comments stuff…
testingtesting
TeRanEX: The reason why
<blockquote>
is currentlynot allowed is for my own convenience. In XHTML 1.0 Transitional
<blockquote>
allowed children from the Flow type, in otherwords, every other tag. In XHTML 1.0 Strict
<blockquote>
only allows children from the type Block. Lib-scrub, which is used for the
filtering does not yet support inserting extra block elements into blockquotes,
allowing blockquotes would almost certainly lead to validation problems. It is
however something I am working on.
Just testing to really horrible tagsoup:
<em><b></b>L ine One<br></em><st
rong>Line Two
Line One
Line Two
This page validates as XHTML 1.1… awsome!
Which reminds me – I can’t wait ’till XHTML 2.0!! Or CSS 3!! Uaaaaargh!
Well, this sounds to be a good idea, so I’m gonna have a try with some php code :
<?php print(‘\"If you don’t see the PHP print instruction, it’s not good for php scripts !\"’)?>
RouXx
(Source: title="mozillaZine.org: WSDL Support in Mozilla 1.4 Final: TalkBack #13">mw22
over at mozillaZine.
Alright, it didn’t accept the HTML I put in. That’s good.
Just wondered in here from somewhere, checking out your firefox buttons…
might I say your blog is drop-dead gorgeous though?
some text
Image :
Hmm… image tag is allowed but doesn’t work?
http://www.webcoder.be/lode…
Hey rakaz! Why dont you have your menu position ‘fixed’ so that it stays near the screen at all times?
Aaron, that’s what I’m thinking, too. But maybe rakaz has the reason.
There is a very good reason for not using position fixed. Somehow the fontstyle switcher doesn’t like it. If it is set to fixed is will update the font and size, but it will not dynamically resize the menu to fit the text into it. So you could end up with text running out of it, or text being wrapped a the wrong point or even text running into each other because the line-height isn’t updated too.
see, rakaz has the good reason.
I’m just wondering why my gravatar’s not showing up here but it’s up on my site.
Maybe because I’m not using my email add here. Let me try.
NonO
why not?
Hi Niels,
I was wondering what happened to lib-scrub? I got a copy ages ago and have been using it to clean up code for my site for a while, but now I see you have taken the project page down. Have you abandoned development or can we expect a new version some time?