bbcode

Any good javascript BBCode parser? [closed]

南楼画角 提交于 2019-12-17 16:17:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 months ago . 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? 回答1: I haven't personally used

Best way to parse bbcode

一曲冷凌霜 提交于 2019-12-17 02:00:11
问题 I'd like to work on a bbcode filter for a php website. (I'm using cakephp, it would be a bbcode helper) I have some requirement. Bbcodes can be nested. So something like that is valid. [block] [block] [/block] [block] [block] [/block] [/block] [/block] Bbcodes can have 0 or more parameters. Exemple: [video: url="url", width="500", height="500"]Title[/video] Bbcodes might have mutliple behaviours. Let say, [url]text[/url] would be transformed to [url:url="text"]text[/url] or the video bbcode

How to make PHP BB Codes with RegExp?

无人久伴 提交于 2019-12-13 09:08:28
问题 for my website, I want a simple BB code system. Nothing special--just hyperlinks and images will be fine for now. I'm not good with RegExp. Period. But if someone could show me an example, I may be able to grasp it to clone it into different tags. Your help is very appreciated! 回答1: The user asked for something simple, so I gave him something simple. $input = "[link=http://www.google.com]test[/link]"; $replacement = preg_replace('/\[link=(.*?)\](.*?)\[\/link\]/', '<a href="$1">$2</a>', $input

Regex, doesnt stop matching

早过忘川 提交于 2019-12-13 04:47:45
问题 I'm working on a bbcode example, but i cannot seem to get it to work. the regex matches all the [img] tags and make it all look wierd. I'm trying to have the option to click on the image and get it full size and when I do, everything becomes a link (when i have more than once img-tag). Here's my text: [img size="small" clickable="no"]img1.jpg[/img] [img size="large" clickable="yes"]img2.jpg[/img] Here's my source code: var bbArray = [/\n/g, /\[img size="(.*?)" clickable="yes"\](.*?)\[\/img\]

How to convert bbcode url tag to an html hyperlink using the bbcode tag's values?

﹥>﹥吖頭↗ 提交于 2019-12-13 03:57:41
问题 How can I convert a bbcode [url] tag to an <a> tag with an href attribute and text between the opening and closing tag? Here are some sample strings: [url]https://any.com/any[/url] [URL="https://any.com/any?any=333"]text text[/URL] [url]http://www.any.com/any?any=44#sss[/url] *Notice that the double quoted substring in the opening [url] tag is optional and impacts the desired output... I've tried this pattern: (?:\[url="(https?://(?:www)?.+?)\]|\[url\](https?://(?:www)?.+\[)) \[url="(https?:\

How to extract the url+parameters out of a bbcode url tag?

谁说胖子不能爱 提交于 2019-12-13 02:55:34
问题 The following code outputs: http://www.google.com http://www.google.com&lang What is the simplest way to change the code so it outputs: http://www.google.com http://www.google.com&lang=en&param2=this&param3=that CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestRegex9928228 { class Program { static void Main(string[] args) { string text1 = "try out [url=http://www.google.com]this site (http://www.google.com)[/url]"; Console.WriteLine

Making a [code][/code] for BBcode with php regex

一曲冷凌霜 提交于 2019-12-12 10:03:42
问题 I would like to make a [code][/code] tag for bbcode so that what would be inside wouldn't be taken into account by the php regex that I made. Example : Hello [b]newbie[/b], to write in bold, use the following : [code][b](YOURTEXT)[/b][/code] Should return in HTML : Hello <strong>newbie</strong>, to write in bold, use the following : [b](YOURTEXT)[/b] Here is a view of a part of my bbcode function : <? function bbcode($var) { $var = preg_replace('`\[b\](.+)\[/b\]`isU', '<strong>$1</strong>',

BBCode for Ruby on Rails

纵饮孤独 提交于 2019-12-12 08:55:18
问题 So I'm putting together a simple forum. I'd like to allow my users limited formatting options and BBCode would be plenty for my users. Knowing that I'm assuredly not the first one to want to use BBCode with RoR I googled but couldn't find a straight forward tutorial on how to create a editor which accepts BBCode nor a way to parse and display BBCode formatted input. Any help or guides would be appreciated! 回答1: You should give bb-ruby a try. Its documentation on the web page seems to be very

show html tags in template - symfony and CKEDITOR. how safety?

﹥>﹥吖頭↗ 提交于 2019-12-12 02:05:43
问题 i use Symfony 1.4 and Doctrine 1.2. I installed plugin http://www.symfony-project.org/plugins/sfCkPlugin if i add net data from form this working ok, but in template this show me for example: <p><b>bold</b> <i>test</i></p> etc instead of bold test I must something add here: getDesc() ?> , but what? In database MySQL i have: <p> <strong>bold</strong> <u>test</u></p> this is safety? 回答1: This is happening because of the output escaper in symfony. You can fix it by calling getRawValue() on the

How to stop BB Code manipulation?

爱⌒轻易说出口 提交于 2019-12-12 01:32:31
问题 Hi I recently discovered an issue where people using BB Code to enter links are able to manipulate them. They are meant to enter something like: [LINK]http://www.domain.com[/LINK] However they can enter something like this to make the link color red: [LINK]http://www.domain.com 'span style="color:red;"'[/LINK] This is the code which converts it: $text = preg_replace("/\\[LINK\\\](.*?)\\[\/LINK\\]/is", "<a href='$1' target='_blank'>$1</a>", $text); Also , I forgot, this is the other type: