Fixed About [CODE] BB CODE Problem

yoching

Member
General code [CODE ][PHP ][HTML ]….
Sometimes want to code a program marking of special colors for easy identification.

On the editor is also normal to show. But after issuing. There will be[COLOR]the relevant text appears.

Please see my articles in the test area from http://xenforo.com/community/threads/test-code.16213/

Not sure if this problem is solved in the future.

一般放程式碼不外乎用[CODE ][PHP ][HTML ]….等
有時候會想將程式碼標上特別的顏色方便識別。

在編輯器上用是還可以正常的顯示。可是一發文後。就會出現[COLOR]的相關文字出現。

請查看我在測試區發的文章 http://xenforo.com/community/threads/test-code.16213/

不知這問題日後是否能解決。
 
Simple, use =rich after the first BB TAG: [ CODE=rich ]
If you have other tags inside the CODE BB Code, they will transform.
 
Well ~~~ This indeed feasible.

But why not in accordance with RICH As the main default ??
Because many COPY From the program. Sometimes from a Web pageCOPY. Most of them will follow the color.

Well, even if not RICH When major default. If that can be increased by more than a check on editors?
This will be relatively easy because the members can decide to not add =RICH 。

This is when the proposed. In fact, if not the last person that can use=RICH. I do not know can also be used. I believe many members do not know it.

嗯~~~這樣的確可行。

但為什麼不要依RICH為主要預設呢??
因為很多COPY過來的程式。有時是從網頁COPY過來的。大多也會跟著顏色過來。

好吧,就算不要將RICH當為主要預設。那是否能在編輯器上多增加一個勾選的?
這因該也會比較方便會員可以決定要不要加=RICH。

這就當建議吧。其實如果不是上一個人說可以用=RICH。我也不知道可以這樣子用的。相信很多會員也不知道才對。
 
This is indeed an annoying issue, though unfortunately it's also rather tricky to deal with as we have to mix understanding the context of HTML and BB code together. It is something I have some ideas about, though I don't know exactly how to implement it yet. The changes are significant to say the least, so it won't be until a future release when they become feasible.
 
This is my own idea of being amended. May be provided for your reference.
My current forum has changed.

Amended \library\XenForo\BbCode\Formatter\Base.php

Search
PHP:
public function parseValidateTagCode(array $tagInfo, $tagOption)
    {
        if (strtolower($tagOption) == 'rich')
        {
            return true;
        }
        else
        {
            return array('plainChildren' => true);
        }
    }

Repair to

PHP:
public function parseValidateTagCode(array $tagInfo, $tagOption)
    {
            //YOCHING 修正code不轉換的問題。加上txt字串區分不轉換時的處理。預設為處理。
            switch(strtolower($tagOption))
            {
                case 'txt':
                    return array('plainChildren' => true);
                case 'rich':
                    return true;
            }
            return true;
            /*
        if (strtolower($tagOption) == 'rich')
        {
            return true;
        }
        else
        {
            return array('plainChildren' => true);
        }
            *
            */
    }
 
Taking into account the user's habits.
So I decided to default is =RICH

However analysis of the way did you want to keep. So I have added their own=txtof improvement.
That is, an extra parameter is set to do analysis of treatment.

Usage, just reverse the operation. I think this way for members of experience would be better. Also more in line with.

由於考量到用戶的習慣。
所以我還是決定預設是=RICH

不過不分析的方式的確也得要保留。所以我自行加上了=txt的改良方式。
也就是額外再訂出一個參數來做不分析的處理。

用法一樣,只是反向其操作。我覺得這樣子做對於會員的體驗會比較好。也比較符合。
 
Top Bottom