Lost password? | Help

[ advanced search ]

Thursday, 15. December 2005, 17:37:59

SerbianFighter

Friendly bot

avatar

Posts: 1144

Upgrade: Real "Code" tag needed badly...

There is [ code ] tag here (both forums and blogs)... and it looks nice (css and stuff) but... how functional is it?!
If you have any experience with forum, you know that code is used when you want to post certain content what you either:
1. Can't post without that tag such as BBcode "source"
2. Want to preserve full content of some code...

Some have highliting for php/perl/c/java, some don't but the main purpose is making users possible to post content that won't be parsed...
So... I for example need to write a tutorial for begginers and show im how to make fancy text effects for their blog... Something I would like to document and illustrate to them so they can easily copy paste it.. but here.. code parses bb code...

Example:
Lorem ipsum dolor
Now code:
[SIZE=4][FONT=Georgia][COLOR=royalblue]Lorem[/COLOR][COLOR=firebrick] ipsum [/COLOR][COLOR=green]dolor[/COLOR][/FONT][/SIZE]

And it should show (without blanks):
[ SIZE=4 ][ FONT=Georgia ][ COLOR=royalblue ]Lorem[ /COLOR ][ COLOR=firebrick ] ipsum [ /COLOR ][ COLOR=green ]dolor[ /COLOR ][ /FONT ][ /SIZE ]


The good thing about current code tag is the fact that you can use colors to highlight something manually... for example:
Example 3:
[COLOR=firebrick][B]#subtitle[/B][/COLOR] {
[B]margin:[/B]top;
[B]width:[/B]100%;
[B]overflow:[/B]hidden;
[B]font-size:[/B][COLOR=purple]20px[/COLOR];
[B]font-family:[/B]'[COLOR=purple]Comic Sans MS[/COLOR]',arial,helvetica,sans-serif;
[b]color[/b]:[COLOR=purple]#FFFFFF[/COLOR];
}


So.. current code should stay..but maybe we should have some other tag for posting html / bb sources..... [noparse] or something like that... anyhow... it should be added :wink:

Friday, 16. December 2005, 00:46:41

sgunhouse

Volunteer

avatar

Posts: 52828

Flag City, USA

The current "code" tag should really be considered as some sort of a "fixed" tag. It switches to a fixed-width font and it preserves linebreaks, but that's about it. If your code happens to include a < /a> tag (without the space) the tag won't show, but everything after that will be outside the code block.

Friday, 24. March 2006, 12:12:33

SerbianFighter

Friendly bot

avatar

Posts: 1144

:eyes::cheers:Will it work on blogs too?

Friday, 24. March 2006, 12:20:56

olekasper

Monkey Master

avatar

Posts: 1117

Norway

should work everywhere

Friday, 24. March 2006, 15:52:58

sgunhouse

Volunteer

avatar

Posts: 52828

Flag City, USA

Barring that all previous munged code will now show how it was munged ... but we knew that would happen eventually.

Friday, 24. March 2006, 15:59:30

olekasper

Monkey Master

avatar

Posts: 1117

Norway

Originally posted by sgunhouse:

Barring that all previous munged code will now show how it was munged ... but we knew that would happen eventually.


Yes. :frown: I'm sorry it took so long. Now; it's Friday 17:00... :cheers: :D

Friday, 24. March 2006, 15:59:52

SerbianFighter

Friendly bot

avatar

Posts: 1144

That is true, that is why I suggested couple of times before that new string should be used, but.. heh..

Monday, 27. March 2006, 08:07:22

olekasper

Monkey Master

avatar

Posts: 1117

Norway

Well code is code. Having

[ code ] (doesn't work really, don't use it)
and
[ code_w0rkz ] (use this! :up: )

wouldn't quite cut it IMO. :smile:

Monday, 27. March 2006, 08:12:05

SerbianFighter

Friendly bot

avatar

Posts: 1144

[noparse] ... :smile: [/noparse]

If code is code as you say than it should have been like that from the beggining.. but doesn't matter...

Tuesday, 28. March 2006, 12:21:33

scipio

Undutchable

avatar

Posts: 29747

Netherlands

Hmm... I can't say I'm too happy about the inability to use forum tags to highlight or color certain parts of the code. :frown: HTML should be displayed as it was typed (i.e. not parsed), but why apply that rule to [b], [i] and [color=...] too?

Tuesday, 28. March 2006, 14:17:15 (edited)

olekasper

Monkey Master

avatar

Posts: 1117

Norway

a[i] = "string" + i++;


I guess that we could have allowed for example color tags, but then the complexity would increase. Maybe we could have an optional parameter ( [ code="allowcolor"] ) in the future.

Tuesday, 28. March 2006, 14:18:01

olekasper

Monkey Master

avatar

Posts: 1117

Norway

haha. Just realised that using uppercase code tags retains the old behaviour p:

a[i] = "string" + i++;


will fix.

Tuesday, 28. March 2006, 14:20:37

scipio

Undutchable

avatar

Posts: 29747

Netherlands

Originally posted by olekasper:

a[i] = "string" + i++;


:idea: Hadn't thought of that...

Wednesday, 29. March 2006, 09:29:23

SerbianFighter

Friendly bot

avatar

Posts: 1144

Workaround - quick fix for all those who used BB tags for coloring code elements:
Edit... replace
[CODE]

with:
[QUOTE][FONT=courier new]

and
[/ CODE]

with:
[/FONT][/QUOTE]

Example: http://my.opera.com/WhyOpera/blog/show.dml/63665

Wednesday, 29. March 2006, 10:39:09

euricomatos

Dain Bramaged

avatar

Posts: 2664

Originally posted by SerbianFighter:

Workaround - quick fix for all those who used BB tags for coloring code elements:

Quick if you don't have many p:

That works fine in most layouts, but in a few it looks weird (mine, for example).

Using the html pre tag seems to work well, but it looks like it just the opening tag works, not the closing one. That way, all the post from that point gets in the pre.

An hr before and another after makes a nice effect, though :D

Wednesday, 29. March 2006, 13:56:14

scipio

Undutchable

avatar

Posts: 29747

Netherlands

Originally posted by euricomatos:

Quick if you don't have many


And if you know how to find them. I've searched for [b][/b] combined with my username but that didn't give any results. I guess I will have to incidentally fix old posts when I accidentally see them.

Wednesday, 29. March 2006, 14:06:42

euricomatos

Dain Bramaged

avatar

Posts: 2664

:eyes: I forgot the forums. I only thought about the blog...

Originally posted by scipio:

I've searched for [b][/b] combined with my username but that didn't give any results.

b as in bold?!?!? Don't you mean 'code'? Or are you trying to restrict the search even more?

Try a search with \[code\] (with the escape character) and it should work fine


edit: yep, it does. more than 60 results for me. I don't want to imagine yours :D

Wednesday, 29. March 2006, 14:31:40

SerbianFighter

Friendly bot

avatar

Posts: 1144

I used it mostly on my blogs in posts that are popular so I know where they are :smile:

Forums » Opera Community » Opera Community and other Opera services » Opera's Web sites: Feedback, questions and discussions