TagClouder

Mar. 2nd, 2006 12:47 pm
undyingking: (Default)
[personal profile] undyingking
I've added a feature to the TagClouder such that it now offers you the raw HTML to paste into your own page, etc. Unfortunately it comes out like this:


books car

Get your own tag cloud from the UKG TagClouder!




Presumably LJ is stripping out the <style> ... </style> for security reasons or some such... any thoughts for ways round this? I could go back to doing it with text attributes I suppose, but that seems a bit retrograde...
Any thoughts about this or further improvements welcome!


Edit: now a trial with no internal style spec, but linking to an external stylesheet:
books car

Get your own tag cloud from the UKG TagClouder!


Bah, no better.


Edit: now a trial with inline style:
books car

Get your own tag cloud from the UKG TagClouder!


oho! -- that looks more promising. Unfortuatnely it involves hacking into the <a> tag, which I'm keen to avoid doing as it will require all manner of hideous regexping. And it this way really any better than using <font>?

Date: 2006-03-02 01:19 pm (UTC)
From: [identity profile] wimble.livejournal.com
Ah. That'll be my fault, I suspect ;-)

It's not stripping out the style tags, as an examination of the source for this page shows:
<span class="size4"><a href="http://undyingking.livejournal.com/tag/books">books</a></span> <span class="size2"><a href="http://undyingking.livejournal.com/tag/car">car</a></span> <span class="size2"><a href="http://undyingking.livejournal.com/tag/cats">cats</a></span> <span class="size2"><a href="http://undyingking.livejournal.com/tag/christmas">christmas</a></span>


The problem, of course, is that it doesn't have any definitions in the CSS for what those styles should look like :(

(Reposted using blockquote tags, rather than pre tags, in order to improve the resulting layout)

Date: 2006-03-02 02:23 pm (UTC)
From: [identity profile] undyingking.livejournal.com
I'll try it linking to an external stylesheet, to see if that works...

Date: 2006-03-02 02:27 pm (UTC)
From: [identity profile] wimble.livejournal.com
Err, how?

You need to put <link rel="stylesheet" type="text/css" etc into the page header to do that. Unless I've missed a wonderfully useful trick somewhere!

And whilst you might be able to reconfigure (I don't know: I've not got to grips with LJ's styling modules) your page style to do that, it's not going to affect mine.

Date: 2006-03-02 02:28 pm (UTC)
From: [identity profile] undyingking.livejournal.com
Bah, it's stripped that out as well!

Why is this: what's so insecure about stylesheets I wonder?

Date: 2006-03-02 02:30 pm (UTC)
From: [identity profile] undyingking.livejournal.com
In FF at least the link doesn't have to be in the header, you can put it in the body. Which surprised me I must say, but I thought I might as well try it and it seems to be the case.

Date: 2006-03-02 03:11 pm (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
the fact you can run arbitrary code from them. :)

stylehseets can do clever things including running javascript from offsite, etc.

You tried inline styles? ie style attributes rather than using classes. Dunno if it will be any better but can't be hard to test. :)

Date: 2006-03-02 03:15 pm (UTC)
From: [identity profile] undyingking.livejournal.com
can they? blimey, I'll have to try that some time ;-)

Mm, good idea, I'll give that a go next.

Date: 2006-03-02 03:24 pm (UTC)
From: [identity profile] undyingking.livejournal.com
Well, that seems to work OK, but is it really much better than using <font> like I was in the original pre-CSS version?

Date: 2006-03-02 03:26 pm (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
yes. <font> is deprecated. :)

Also CSS is likely to play more nicely with other style stuff (eg if I want my default font sizes to be twice as big then CSS will probably scale nicely whereas <font> probably won't.

In general though whether it is any better really depends on what criteria you are using to measure.

Date: 2006-03-02 03:39 pm (UTC)
From: [identity profile] undyingking.livejournal.com
Bah, hideous regexps I guess it is then! -- but not today ;-)

Date: 2006-03-02 03:55 pm (UTC)
From: [identity profile] wimble.livejournal.com
Rather than hacking the <a> tags themselves, you could put the style information into the span tags.

So, on your site
.size4 { size4-style-rules; }
<span class="size4"<...>/span>


And for export:
<span style="size4-style-rules;">...<span>


Which isn't really a great advantage, but it does mean that the rest of the content is unchanged.

Date: 2006-03-02 04:12 pm (UTC)
From: [identity profile] undyingking.livejournal.com
Aha, I hadn't thought of that! Excellent, I'll give that a go.

Date: 2006-03-02 05:51 pm (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
It hadn't occured to me that you might do anything other than put it on the span tags, to be honest. :)

Date: 2006-03-03 12:38 pm (UTC)
From: [identity profile] undyingking.livejournal.com
I thought it was probably better practice to put it in the a tags and thus do without clunky spans altogether, but so much for that rare impulse towards clean code...

Date: 2006-03-03 12:46 pm (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
possibly. I may be confused by different versions and stuff but when you were using classes they were on span tags rather than the anchors weren't they? I figured that if you were putting classes on spans that you'd put inline style on spans. If you were going to put the styles on the anchors then I'm not sure why not put the classes on anchors too.

Best practice I think you are right though that the anchors should have the styles on them directly. This is fairly important if you are doing things like colours since the default of anchors being in a differnet colour will likely override you if you aren't careful when putting styles outside the anchors.

I guess the nasty regexs you were talking about were converting the spands with classes on into anchors with styles on? If so then just change both to have classes and styles on the anchors. Unless there is a reason I missed not to of course in which case don't.

I'm still desperately trying to be useful in the hopes that I can reclaim those thanks that I was denied! :)

the hopes that I can reclaim those thanks

Date: 2006-03-03 01:03 pm (UTC)
From: [identity profile] undyingking.livejournal.com
Pointing out that I'm talking nonsense isn't necessarily the best way to do that ;-)

Profile

undyingking: (Default)
undyingking

March 2012

S M T W T F S
     123
4 5678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 2nd, 2025 04:50 am
Powered by Dreamwidth Studios