bbcode

Linebreaks in TinyMCE editor show extra line on preview, not in code

Deadly 提交于 2019-12-10 03:34:26
问题 I'm using the BBCode plugin with TinyMCE and see that line breaks are not showing the same between the preview and the HTML code. I have the following lines in the editor window: This is line one This is line three Line two is empty. When I'm viewing this in HTML I get the following. This is line one This is line three Without the extra empty line. tinyMCE.init({ mode : "textareas", theme : "advanced", plugins : "bbcode", entity_encoding : "raw", remove_linebreaks : false, force_p_newlines :

Problem with tinymce and list-items

限于喜欢 提交于 2019-12-08 16:07:15
问题 I am having a problem with using the bbcodeplugin and list-items. While the lists are being safed as bbcode as i want it, when reopening and editing the text, tinymce adds additional markup to lists, so that something like <ul> <li>one</li> </ul> becomes <ul> <ul><li>one</li></ul> </ul> So each <li> item is being wrapped with an additional <ul> which I would like to prevent. How could I possibly exclude all list-items from being modified by the tinymce-javascript? This issue seems related to

Howto encode texts outside the <pre></pre> tag with htmlentities()? (PHP)

蹲街弑〆低调 提交于 2019-12-08 13:46:09
问题 I'm trying to make my own BBCode parser for my website and I'm looking for a way to "htmlentities()" except the codes inside PRE tags, and the PRE tag itself. For example: <b>Hello world</b> (outputs <b>Hello world<>) <pre>"This must not be converted to HTML entities"</pre> (outputs <pre>"This must not be converted to HTML entities"</pre>) I really got no idea on how to do this. Any kind of help would be appreciated :) Thanks. 回答1: You could convert the <pre> … </pre> back to <pre> … </pre> :

How to convert bbcode to html in usage of SCEditor

余生颓废 提交于 2019-12-08 12:15:51
问题 I used SCEditor in my forum. I managed inserting bbcodes to database. But when I try to show codes in the page, bbcodes are shown without styling. No html, no style. Only bad bbcodes. I am investigating for a long time in its documentation pages but I did not find any php parser. Here is the screenshot. Please, could you help me, how do I parse bbcode to html in PHP? 回答1: You can use SBBCodeParser. SCEditor and this class were coded by the same person. So it would be more compatible. 来源:

How convert html to BBcode in C#

别说谁变了你拦得住时间么 提交于 2019-12-08 08:32:24
问题 I need to convert html text into bbcodes . Where i can find how should i do this? For example, I convert links: regex = new Regex("<a href=\"(.+?)\">(.+?)</a>"); htmlCode = regex.Replace(htmlCode, "[URL]$1[/URL]"); How can i convert all html tags in bbcodes (and replace to empty which isn't bb codes, tag P 回答1: For some HTML tags, you can just do a simple string.Replace . BBCode is in many ways just a 1:1, tag-for-tag mapping, for example <b> and </b> mapping to [B] and [/B] respectively. So

PHP preg_replace to JavaScript | BBCode

淺唱寂寞╮ 提交于 2019-12-08 03:47:28
问题 I have regex patterns in PHP $s = preg_replace("#\[URL\=(.*)\](.*)\[\/URL\]#Ui", "<a href=\"$1\" target=\"_blank\">$2</a>", $s); $s = preg_replace("#\[CODE\=(.*)\](.*)\[\/CODE\]#Uis", "<pre class=\"brush: $1\">$2</pre>", $s); $s = preg_replace("#\[URL\](.*)\[\/URL\]#Ui", "<a href=\"$1\" target=\"_blank\">$1</a>", $s); $s = preg_replace("#\[IMG\](.*)\[\/IMG\]#Ui", "<p align='center'><img src=\"$1\" border=\"0\" /></p>", $s); How could I convert those to JavaScript ? I tried for this

URL-BBCode Regex

只愿长相守 提交于 2019-12-08 01:03:55
问题 I'm currently trying to get an URL from a BBCode. There are four possibilities for it, and that's my current problem: [url]http://stackoverflow.com/[/url] [url='http://stackoverflow.com/']http://stackoverflow.com/[/url] [url="http://stackoverflow.com/"]http://stackoverflow.com/[/url] [url=http://stackoverflow.com/]http://stackoverflow.com/[/url] I need both. This is, what i have so far: /\[url(?:\=\'([^\'"]+)\')?](.+?)\[\/url]/i But that does just work with case 1 & 2. EDIT: This works better

How convert html to BBcode in C#

寵の児 提交于 2019-12-07 16:04:28
I need to convert html text into bbcodes . Where i can find how should i do this? For example, I convert links: regex = new Regex("<a href=\"(.+?)\">(.+?)</a>"); htmlCode = regex.Replace(htmlCode, "[URL]$1[/URL]"); How can i convert all html tags in bbcodes (and replace to empty which isn't bb codes, tag P For some HTML tags, you can just do a simple string.Replace . BBCode is in many ways just a 1:1, tag-for-tag mapping, for example <b> and </b> mapping to [B] and [/B] respectively. So that's easily accomplished with just: html.Replace("<b>", "[b]").Replace("</b>", "[/b]") If it's really dead

Parsing BBCode with xslt 2.0

拈花ヽ惹草 提交于 2019-12-06 18:24:26
I need help finding a viable solution to convert bbcode to html, this is where ive come so far, but fails when bbcodes get wrapped. Src: [quote id="ohoh81"]asdasda [quote id="ohoh80"]adsad [quote id="ohoh79"]asdad[/quote] [/quote] [/quote] Code: <xsl:variable name="rules"> <code check=" " ><br/></code> <code check="\[(quote)(.*)\]" ><span class="quote"></code> </xsl:variable> <xsl:template match="text()" mode="BBCODE"> <xsl:call-template name="REPLACE_EM_ALL"> <xsl:with-param name="text" select="." /> <xsl:with-param name="pos" select="number(1)" /> </xsl:call-template> </xsl:template> <xsl

URL-BBCode Regex

家住魔仙堡 提交于 2019-12-06 12:10:14
I'm currently trying to get an URL from a BBCode. There are four possibilities for it, and that's my current problem: [url]http://stackoverflow.com/[/url] [url='http://stackoverflow.com/']http://stackoverflow.com/[/url] [url="http://stackoverflow.com/"]http://stackoverflow.com/[/url] [url=http://stackoverflow.com/]http://stackoverflow.com/[/url] I need both. This is, what i have so far: /\[url(?:\=\'([^\'"]+)\')?](.+?)\[\/url]/i But that does just work with case 1 & 2. EDIT: This works better: /\[url(?:\=(?:[\"|'])?(.*)(?:[^[]+)?)?\](.*)\[\/url\]/i But still not perfect. EDIT: I guess, i got