Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to remove backticks option from acting as

  • 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

    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

    ; do

    Any idea?

    thanks

Viewing 10 replies - 1 through 10 (of 10 total)

  • _ck_
    Participant

    @_ck_

    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.

    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

    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(“rn”, “r”), “n”, $text);

    $text = preg_replace(“|nnn+|”, “nn”, $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?


    zaerl
    Participant

    @zaerl

    Open function.bb-formatting.php.

    Change bb_decodeit and bb_code_trick with http://pastebin.com/SAx377E4

    No more backticks for you.

    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!*#!@&*(#!@!


    zaerl
    Participant

    @zaerl

    You are now GhettoBSD Approved!

    Added to résumé.

    Mark the topic as resolved. Have a nice day.


    _ck_
    Participant

    @_ck_

    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.


    zaerl
    Participant

    @zaerl

    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.


    chrishajer
    Participant

    @chrishajer

    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.

    http://heyrocker.com/hack_core.jpg

    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!

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar