UEdit capable of displaying formatted BBCode?

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

UEdit capable of displaying formatted BBCode?

Postby amby » Mon Nov 05, 2007 4:09 am

I just downloaded the BBCode tag list, and it works great. Thanks to the developer!

But I'd like to know if there's any way I can preview the file I'm working on with all or most of the BBCode formatting displayed.
User avatar
amby
Newbie
 
Posts: 2
Joined: Sat Dec 16, 2006 12:00 am

Re: UEdit capable of displaying formatted BBCode?

Postby Mofi » Mon Nov 05, 2007 8:56 am

BBCode is on forum pages translated to HTML code with PHP scripts. Therefore you need a local PHP script interpreter installed and the script which reads the file you pass to the script and outputs the HTML file to the browser.

So the answer is NO, UltraEdit cannot display a file with BBCode as formatted HTML file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: UEdit capable of displaying formatted BBCode?

Postby jorrasdk » Mon Nov 05, 2007 4:43 pm

As Mofi writes, BBcodes are transformed into HTML by the forum/board software (often written in PHP). Each forum also have one or more style sheets that determines how the html should be presented (font, spacing, graphics etc).

So it isn't really possible to ask UE to supply a preview option for BBcode.

In some forum software you are even able to define your own BBcodes (like in phpBB) and they are stored in the phpBB application and a text editor like UE can't have any knowledge of this.

But if you for some reason (like working offline, without local PHP script interpreter) you need to see how your BBcode-tagged document looks like in a browser, then if you are a version 13 user then check out the script attached:

It basically copies your BBcode-tagged document into a new temporary document. Runs through a number of predefined BBcode to HTML conversions (using Regular expressions). After the script has run, then just toggle View - Toggle Browser View.

You have to modify the script to your specific purpose. See the function defineSupportedTranslations(); In this you will find pairs of

// Check for bold text
BBcodes.push("\\[b\\]([^ÿ]+?)\\[/b]");
HTML.push('<strong>\\1</strong>');


You should add similar pairs for your BBcode use if some are missing.

Also some BBcodes - code, PHP, quote - have larger HTML replacements. These should be modified also. They reference styles in an external stylesheet.

This external stylesheet has to be referenced in the function named writeHTMLtop(). Look for http://www.yourserver.com.

The script is "as is". There's plenty of room for improvements. Use at own risk.
Attachments
parsebbcode.zip
(1.8 KiB) Downloaded 218 times
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: UEdit capable of displaying formatted BBCode?

Postby amby » Mon Nov 05, 2007 8:02 pm

jorrasdk, I am greatly indebted to you for such an outstandingly informative and helpful post. Although I understand and appreciate why a built-in or similar BBcode parser and previewer is an unreasonable request, I am honor bound to tell you that the script you so kindly provided works adequately for my purposes as is.

Thank you!

As an aside, would you prefer that I send any observations of problematic features to you or someone else? Please don't interpret that question to at all encourage or request you to spend time you may well not have or not wish to spend on such a task.



I, too, am currently using: UE13.20 (English edition). Windows XP SP2
User avatar
amby
Newbie
 
Posts: 2
Joined: Sat Dec 16, 2006 12:00 am

Re: UEdit capable of displaying formatted BBCode?

Postby jorrasdk » Mon Nov 05, 2007 8:28 pm

I'm glad it was useful.
amby wrote:As an aside, would you prefer that I send any observations of problematic features to you or someone else?

Observations of that nature are welcome since it will only improve the value of what's on this board - not necessarily improved value for me - but for the next visitor seeking a similar solution. Just post your observations and I or other users will respond.
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark


Return to UltraEdit General Discussion