Info
- 11 posts
- 4 voices
- Started 1 year ago by ghettobsd
- Latest reply from ghettobsd
- This topic is resolved
How to remove backticks option from acting as
-
- Posted 1 year ago #
Hi,
How would I go about removing the backtick to code option?
I am trying to do this:
[code]
for i in [backtick] cat file[backtick]; do
echo $i
done
[/code]In that example
- [code] is code using the greater than less than.
- [backtick] is an actual backtick I want to show.So instead of showing ^^^ it shows:
for i in [code]cat file[/code]; do
Any idea?
thanks
-
- Posted 1 year ago #
If you want the code tag to keep working but disable backticks, you'll have to make a filter that encodes them into a html entity
(`)before it gets to bbpress's filters. -
- Posted 1 year ago #
I was looking for where I could do this. Would it possibly be in :
bbpress/bb-includes/backpress/functions.formatting.php ?
Or would it be in one of the posting php files?
Any more tips you can offer I'd appreciate!
I had seen in another post someone refer to the following:
$str = preg_replace( '/\`&[^;\s]{0,6}$/', '', $str );
could that be modified to do what you said? Taken from functions.formatting.php
Thank you
-
- Posted 1 year ago #
I also found in: bb-includes/functions.bb-formatting.php the following
function bb_encodeit( $matches ) {
$text = trim($matches[2]);
$text = htmlspecialchars($text, ENT_QUOTES);
$text = str_replace(array("\r\n", "\r"), "\n", $text);
$text = preg_replace("|\n\n\n+|", "\n\n", $text);
$text = str_replace('&', '&', $text);
$text = str_replace('<', '<', $text);
$text = str_replace('>', '>', $text);
$text = "$text";
if ( "`" != $matches[1] )
$text = "
$text
";
return $text;
}Could I change the last 3 lines starting from if?
-
- Posted 1 year ago #
Open function.bb-formatting.php.
Change
bb_decodeitandbb_code_trickwith http://pastebin.com/SAx377E4No more backticks for you.
-
- Posted 1 year ago #
hahaha I've been working on that section for a while!
Thank you very much.
You are now GhettoBSD Approved!
{:{D}
You're welcome on my site anytime! (ghettobsd.org)
Thank you very much zaerl!*#!@&*(#!@!
-
- Posted 1 year ago #
You are now GhettoBSD Approved!
Added to résumé.
Mark the topic as resolved. Have a nice day.
-
- Posted 1 year ago #
Directly changing the core is really not a good idea unless you are using SVN updates and know what you are doing.
Otherwise you'll get out of date for security updates.
-
- Posted 1 year ago #
It's the only way to do this. Otherwise you should replace the filter manually which is also a hugly hack. If you remove the filter and then add a custom code (I tried with a plugin) this doesn't work cause the filter must be at the same exact position (after bb_encode_bad and force_balance_tags.) Changing the code againg when the SVN update it's not difficult.
The first thing I've done after my very first installation of bbPress was to chage the backtick code. I think that using such character of inline code is not a wise choice. First of all cause that character is hard to find on keyboard layouts different from USA. Seconded cause that character is widely used on several language (Perl, Ruby, PHP, MySQL, Lisp, TeX and other.) I can't write significant portion of code without breaking the formatting.
-
- Posted 1 year ago #
If it can't be done without hacking the core, then maybe you should open a ticket at trac. If it's a good idea, it will be incorporated into core.
-
- Posted 1 year ago #
That's actually why I needed to remove the backtick, because I wouldn't be able to post code without it looking like barf.
Thanks for your help again guys, great work!
-
You must log in to post.