bbcode

Textarea toggle selection tags with Javascript

北慕城南 提交于 2019-12-11 18:36:33
问题 I'm working on a BBcode editor, and was wondering how to toggle tags on selection using Javascript (similar to how the text editing menu works on StackOverflow). Example: Textarea Lorem ipsum dolor sit amet. If you select the text 'ipsum dolor' and click on the bold button, it'll become Lorem [b]ipsum dolor[/b] sit amet. If you click the bold button once again, it'll remove the tags. Thanks! 回答1: You can get the selected text caret positions, set the caret and then insert your text: TL;DS

removing BBcode from textarea with Javascript

会有一股神秘感。 提交于 2019-12-11 13:51:48
问题 I'm creating a small javscript for phpBB3 forum, that counts how much character you typed in. But i need to remove the special characters(which i managed to do so.) and one BBcode: quote my problem lies with the quote...and the fact that I don't know much about regex. this is what I managed to do so far but I'm stranded: http://jsfiddle.net/emjkc/ var text = ''; var char = 0; text = $('textarea').val(); text = text.replace(/[&\/\\#,+()$~%.'":*?<>{}!?(\r\n|\n|\r)]/gm, ''); char = text.length;

phpbb BBCode to HTML (regex or otherwise)

眉间皱痕 提交于 2019-12-11 12:58:01
问题 I'm in the process of migrating content from phpBB to WordPress. I have suceeded up to the point of translating the bbcode into html. The BBCode is complicated by an alphanumeric string that is injected into each tag. A common post will contain text like so... [url=url] Click here [/url:583ow9wo] [b:583ow9wo] BOLD [/b:583ow9wo] [img:583ow9wo] jpg [/img:583ow9wo] I am inexperienced with Regular Expressions but believe this may be a way out, as I found some help from the following post https:/

Handling more than one markup language in a text area

爷,独闯天下 提交于 2019-12-11 10:39:45
问题 I'd like to now how to handle multiple markup languages (textile, markdown and bbcode) in a text area using ruby on rails 3. The user would be able to select the markup language he/she wants to use, write in that language, and then the view would render the text using the markup language selected by the user. I'm currently handling that storing a field for each text area, but I'm sure there are better ways and I'd love to hear your opinions and come up with a better way. 回答1: When are you

PHP BBCode related issue. How to get values between two tags?

百般思念 提交于 2019-12-11 05:27:56
问题 I need to do the following for my website. $comment = "[item]Infinity Edge[/item]<br>[item]Eggnog Health Potion[/item]"; $this->site->bbcode->postBBCode($comment); The BBCode function is like this: function postBBCode($string) { $string = nl2br($string); $string = strip_tags($string, '<br></br>'); $string = $this->tagItem($string); return $string; } function tagItem($string) { //Get all values between [item] and [/item] values //Appoint them to an array. //foreach item_name in array, call

PHP - BBCode parser - Parse both bbcode link tag and not tagged link

末鹿安然 提交于 2019-12-11 04:28:29
问题 I need to do this : when a user insert a BBCode tag, with preg_replace and regex i do some trasformation. e.g. function forumBBCode($str){ $format_search=array( '#\[url=(.*?)\](.*?)\[/url\]#i' ); $format_replace=array( '<a class="lforum" target="_blank" href="$1">$2</a>' ); $str=preg_replace($format_search, $format_replace, $str); $str=nl2br($str); return $str; } now i want also this : when a user insert a normal text with a link, this must be trasformed too. i can't do this trought preg

Tinymce copy/paste from excel (Plugin BBcode)

一曲冷凌霜 提交于 2019-12-11 01:17:59
问题 I'm using tinyMCE, below you can see the implementation. Now the problem: when I copy some records from EXCEL and paste them in my tinymce field. It's displayed good enough for me (with plugin: paste, he will actually show the fields) When i ask the value from my field I get a return with a table struct depeding what you paste. But I don't want any html, see below what I want. Implementation code: tinyMCE.init({ mode : "exact", elements: "id", theme : "advanced", plugins : "bbcode,

BBCode or wiki markup libraries for .NET? [closed]

故事扮演 提交于 2019-12-10 17:48:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . What's your favourite library for .NET for handling either: BBCode markup Wiki markup Why do you use those libraries, what is so good about them and why should I use them? 回答1: Textile.Net will give you Textile syntax parsing, which is common in wikis. CodeKicker BBCode will

Why should I use BBCode but not HTML in comment forms?

心已入冬 提交于 2019-12-10 12:55:49
问题 I'm writing a comment parsing function in PHP. Since BBCode is not a real markup language, I'v never liked the writing style. So I'm giving visitors the ability to use basic HTML code in comment forms. And when posting, PHP will check for disallowed and invalid tags/attributes, and either replace or remove them. I believe it does the same job and output exactly the same as with BBCode. If this is true, why are there BBCode? Does BBcode have any advantages over HTML? update as monochrome

Remove nested quotes

一个人想着一个人 提交于 2019-12-10 12:01:56
问题 I have this text and I'm trying to remove all the inner quotes, just keeping one quoting level. The text inside a quote contains any characters, even line feeds, etc. Is this possible using a regex or I have to write a little parser? [quote=foo]I really like the movie. [quote=bar]World War Z[/quote] It's amazing![/quote] This is my comment. [quote]Hello, World[/quote] This is another comment. [quote]Bye Bye Baby[/quote] Here the text I want: [quote=foo]I really like the movie. It's amazing![