English Amiga Board


Go Back   English Amiga Board > abime.net - Home Projects > project.EAB

 
 
Thread Tools
Old 09 December 2013, 16:08   #1
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
BBCode formatting for code

I'm wondering if it's possible to add/enable one of those convenient BBCode extensions that allow you to insert highlighted and formatted code in the middle of a line of text, without all the line breaks that [CODE] gives.

Sort of like this:
http://stackoverflow.com/questions/2...g-point-values
Leffmann is offline  
Old 09 December 2013, 17:06   #2
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
yup, all RCK needs to do is to add a new user defined BBCode like the following

New tag = [hl] (short for highlight)

<span style="background-color: yellow;">{param}</span> (yellow being the highlight colour, this can be changed of course)

And that's it

And add a custom button image to use
DH is offline  
Old 09 December 2013, 17:10   #3
RCK
Administrator
 
RCK's Avatar
 
Join Date: Feb 2001
Location: Paris / France
Age: 45
Posts: 3,084
For syntax highlighting, you can try the PHP BB code.
For other language I would have to code something that use parsing lib like GeSHi.
Have you one code sample to parse here to see ?
RCK is offline  
Old 09 December 2013, 17:19   #4
RCK
Administrator
 
RCK's Avatar
 
Join Date: Feb 2001
Location: Paris / France
Age: 45
Posts: 3,084
Quote:
Originally Posted by DH View Post
yup, all RCK needs to do is to add a new user defined BBCode like the following

New tag = [hl] (short for highlight)

<span style="background-color: yellow;">{param}</span> (yellow being the highlight colour, this can be changed of course)

And that's it

And add a custom button image to use
This will work to add some yellow background to one text, but I don't think it will work inside a [code] formated text
Leffmann: post one example of what you would like
RCK is offline  
Old 09 December 2013, 19:28   #5
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Syntax highlighting is not necessary, just a fixed width font and a change of background color, so you can write a small bit of legible code in the middle of a sentence. Like [CODE], but inlined.

edit: the one on the right that reads "malloc" looks just right I think, same font and colors as [CODE] here on EAB.
Attached Thumbnails
Click image for larger version

Name:	Skärmavbild 2013-12-09 kl. 19.19.09.png
Views:	297
Size:	7.5 KB
ID:	38118   Click image for larger version

Name:	Skärmavbild 2013-12-09 kl. 19.24.59.png
Views:	254
Size:	12.2 KB
ID:	38119   Click image for larger version

Name:	Skärmavbild 2013-12-09 kl. 19.57.16.png
Views:	454
Size:	7.2 KB
ID:	38120  

Last edited by Leffmann; 09 December 2013 at 20:01.
Leffmann is offline  
Old 09 December 2013, 21:04   #6
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
<font face="courier new"><span style="background-color:#e7e8f5; color:black">{param}</span></font>

That above code will use the 'Courier New' fixed width font (the same font used in EAB's [CODE] tag), give it the background colour the same as your 3rd image, and keep the font colour black.



Is that what you're asking Leffmann? And just to clarify, what you're wanting isn't to be included within [CODE] tags as RCK mentioned earlier?

Last edited by DH; 09 December 2013 at 22:09. Reason: Updated example image
DH is offline  
Old 09 December 2013, 21:45   #7
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Cool

How about Lucida Console: move.l d0,(a0)+ Seems nice.
Thorham is offline  
Old 09 December 2013, 23:04   #8
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Yes exactly as you've done there, DH, for use in the middle of a regular sentence, outside of [CODE]. Important is also that it must stop parsing just like [CODE], so it doesn't consolidate spaces and replace text with smilie-icons.

I like the font and colors that [CODE] uses, it just makes all the code snippets look more consistent.
Leffmann is offline  
Old 10 December 2013, 01:30   #9
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
I have a feeling this is going to be rather more difficult than I first thought.

What you're wanting is a bbcode that will [noparse] the given text that is to be highlighted (We'll call it that for now), but I already know it can't do that without the [noparse] destroying the highlighting bbcode at the same time, because the very text you're wanting to highlight is the very same text you are wanting to strip with [noparse]

The three tags that could be used are <pre> <xmp> <textarea>, but unfortunately, none of them work and none of them keep the highlight, despite the [noparse] tags being place inside the highlight code.

I'm not an html expert, so if anyone else knows of a way around, feel free to jump in

For me it's a kinda catch 22 situation, unless RCK can come up with some kind of script that will perform the noparsing but keep the highlight, then I have really no idea.
DH is offline  
Old 10 December 2013, 05:54   #10
haps
Rumpig
 
haps's Avatar
 
Join Date: Aug 2006
Location: The bottom of the bottle
Age: 92
Posts: 243
VB custom bbcode construction includes a 'Disable Smilies Within This BB Code' checkbox.

I just did a test using the html you posted above DH and here is the result:

haps is offline  
Old 10 December 2013, 16:11   #11
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
Haps, does that still consolidate spaces?

EDIT: nm, I have just checked and no it doesn't unfortunately

Last edited by DH; 10 December 2013 at 16:26.
DH is offline  
Old 10 December 2013, 16:32   #12
haps
Rumpig
 
haps's Avatar
 
Join Date: Aug 2006
Location: The bottom of the bottle
Age: 92
Posts: 243
Not an addon. 'VB custom bbcode construction' was obviously a poor choice of words (sounded good to drunken me at the time), I was just using the 'Add New BBCode' option.

My testing was done on VB4.2.2, and whatever I put between those custom tags came out exactly as I wrote it, could be it is not the same with this version.
haps is offline  
Old 10 December 2013, 16:34   #13
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
I have sorted it

Do as you suggested and Disable smilies within the bbcode and use this code in replacement \o/

<pre style="display: inline; background-color:#e7e8f5; color:black">{param}</pre>

EDIT: Now it's up to RCK to decide if he'll add it

Example below:-



EDIT2: Excuse the colours I used, as it's been done on our vBulletin site using our default colour scheme

EDIT3: @haps, my testing was done in vB4.2.1 and I wouldn't expect there to be any difference between vB versions as it's using standard html code Anyway, if it wasn't for you mentioning the smilies could be disabled, I may not have pursued it and eventually figuring it out So hats off to you haps for making me succeed

Last edited by DH; 10 December 2013 at 22:19.
DH is offline  
Old 11 December 2013, 13:05   #14
RCK
Administrator
 
RCK's Avatar
 
Join Date: Feb 2001
Location: Paris / France
Age: 45
Posts: 3,084
let's test "code2" in a
demo with [    WhiteSpace]
sentence.
versus "code" in
Code:
demo with [    WhiteSpace]
another sentence.

It seems OK
Thanks to DH for all testing and compilation of html info
RCK is offline  
Old 11 December 2013, 14:23   #15
DH
Global Moderator
 
DH's Avatar
 
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
Thanks RCK

All of this is continuing to help me learn a little more of html code, just glad to have helped, albeit in a very small way
DH is offline  
Old 11 December 2013, 15:59   #16
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Yep that's perfect! Thanks a lot, all of you.
Leffmann is offline  
Old 12 December 2013, 21:28   #17
prowler
Global Moderator
 
prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
Yes, that's a useful feature for highlighting small code excerpts. Thanks RCK and DH!
prowler is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Of Code For XAMOS fishyfish support.Apps 1 29 July 2013 18:15
Formatting a disc chris_newton support.WinUAE 4 07 October 2009 22:02
help before formatting fc.studio support.Apps 3 25 December 2007 00:21
Formatting my HD ? blade002 support.Apps 5 21 September 2007 22:19
3D code and/or internet code for Blitz Basic 2.1 EdzUp Retrogaming General Discussion 0 10 February 2002 11:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:28.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12605 seconds with 16 queries