bbcode

Java BBCode library [closed]

蓝咒 提交于 2019-11-28 05:02:49
Has anybody used a good Java implementation of BBCode? I am looking at javabbcode : nothing to see kefir-bb : Listed as alpha BBcode parser in JBoss source code. Are there any better options? The current version of KefirBB 0.6 is not listed as beta anymore. I find the KefirBB parser very easy to configure and extend with my own tags: kefir-bb.sourceforge.net (This is the best BBCode parser I've found so far) I also found this code at fyhao.com , but it does protect you against incorrectly nested tags (thus not suitable for parsing user entered input): public static String bbcode(String text) {

Cleaning HTML by removing extra/redundant formatting tags

左心房为你撑大大i 提交于 2019-11-28 04:54:54
I have been using CKEditor wysiwyg editor for a website where users are allowed to use the HTML editor to add some comments. I ended up having some extremely redundant nested HTML code in my database that is slowing down the viewing/editing of these comments. I have comments that look like this (this is a very small example. I have comments with over 100 nested tags): <p> <strong> <span style="font-size: 14px"> <span style="color: #006400"> <span style="font-size: 14px"> <span style="font-size: 16px"> <span style="color: #006400"> <span style="font-size: 14px"> <span style="font-size: 16px">

Convert BBcode to HTML using JavaScript/jQuery

早过忘川 提交于 2019-11-28 01:25:49
Could I please get some help with coverting some PHP code to jQuery/JavaScript? What I want is a simple BBCode to HTML converter. Here is the PHP code. I want to achieve the same thing using jQuery/JavaScript. $str = htmlentities($str); // The array of regex patterns to look for $format_search = array( '#\[b\](.*?)\[/b\]#is', '#\[i\](.*?)\[/i\]#is', '#\[u\](.*?)\[/u\]#is', ); // The matching array of strings to replace matches with $format_replace = array( '<strong>$1</strong>', '<em>$1</em>', '<span style="text-decoration: underline;">$1</span>', ); // Perform the actual conversion $str =

Any good javascript BBCode parser? [closed]

怎甘沉沦 提交于 2019-11-27 22:20:49
Currently i'm parsing bbcode server side but i'd like to show a preview just like this site does. If I process the bbcode serverside using ajax it's a bit laggy, so i thought doing it client side, to just show the preview. Do you guys know any bbcode parser written in javascript? I haven't personally used any Javascript BBcode parsers, but the top two Google results ( bbcodejs and this blog post ) seem pretty weak. The former only seems to support simple find-and-replace, and the latter seems to have pre-set BBcode built in, so you'd probably have to hack it a bit if you chose that solution.

php regex [b] to <b>

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 05:42:24
"'\[b\](.*?)\[/b\]'is", Is my current RegEx working. But I want to change the [] to be <> instead. But it doesn't work... What more then just the [] do I need to change. Gordon There are various BBCode parsers available for PHP, for instance http://www.php.net/manual/en/book.bbcode.php which allows you to simply define your replacement rules by hand: echo bbcode_parse( bbcode_create( array( 'b' => array( 'type' => BBCODE_TYPE_NOARG, 'open_tag' => '<b>', 'close_tag' => '</b>' ) ) ), '[b]Bold Text[/b]' ); // prints <b>Bold Text</b> Also check the various similar questions about BBCode Parsers:

How to convert HTML to BBCode

孤人 提交于 2019-11-27 05:11:28
I maintain a bulletin board that saves rich text messages in HTML. Now I need to migrate all those messages into Joomla Kunena bulletin board that requires BBCode representation of HTML. Is there any library to convert HTML to BBCode cleanly. There are bunch of scripts out there for BBCode to HTML but not the other way around. Thanks... It should be doable with XSLT in text output mode : <xsl:output method="text"> … <xsl:template match="b|strong">[b]<xsl:apply-templates/>[/b]</xsl:template> <xsl:template match="br"> </xsl:template> <xsl:template match="p"> <xsl:apply-templates/> </xsl:template

Cleaning HTML by removing extra/redundant formatting tags

∥☆過路亽.° 提交于 2019-11-27 00:42:37
问题 I have been using CKEditor wysiwyg editor for a website where users are allowed to use the HTML editor to add some comments. I ended up having some extremely redundant nested HTML code in my database that is slowing down the viewing/editing of these comments. I have comments that look like this (this is a very small example. I have comments with over 100 nested tags): <p> <strong> <span style="font-size: 14px"> <span style="color: #006400"> <span style="font-size: 14px"> <span style="font

Regex to split BBCode into pieces

元气小坏坏 提交于 2019-11-26 22:57:17
I have this: str = "some html code [img]......[/img] some html code [img]......[/img]" and I want to get this: ["[img]......[/img]","[img]......[/img]"] Yaser Sulaiman irb(main):001:0> str = "some html code [img]......[/img] some html \ code [img]......[/img]" "some html code [img]......[/img] some html code [img]......[/img]" irb(main):002:0> str.scan(/\[img\].*?\[\/img\]/) ["[img]......[/img]", "[img]......[/img]"] Keep in mind that this is a very specific answer that is based on your exact question. Change str by, say, adding an image tag within an image tag , and all Hell will break loose

Convert BBcode to HTML using JavaScript/jQuery

百般思念 提交于 2019-11-26 21:54:41
问题 Could I please get some help with coverting some PHP code to jQuery/JavaScript? What I want is a simple BBCode to HTML converter. Here is the PHP code. I want to achieve the same thing using jQuery/JavaScript. $str = htmlentities($str); // The array of regex patterns to look for $format_search = array( '#\[b\](.*?)\[/b\]#is', '#\[i\](.*?)\[/i\]#is', '#\[u\](.*?)\[/u\]#is', ); // The matching array of strings to replace matches with $format_replace = array( '<strong>$1</strong>', '<em>$1</em>'

php regex [b] to <b>

余生颓废 提交于 2019-11-26 17:34:31
问题 "'\[b\](.*?)\[/b\]'is", Is my current RegEx working. But I want to change the [] to be <> instead. But it doesn't work... What more then just the [] do I need to change. 回答1: There are various BBCode parsers available for PHP, for instance http://www.php.net/manual/en/book.bbcode.php which allows you to simply define your replacement rules by hand: echo bbcode_parse( bbcode_create( array( 'b' => array( 'type' => BBCODE_TYPE_NOARG, 'open_tag' => '<b>', 'close_tag' => '</b>' ) ) ), '[b]Bold