ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 크레올레 탈출하기... 도쿠위키...
    컴터 2014. 3. 12. 02:15

    도쿠위키 ( http://vaslor.net/tech/dokuwiki ) 에서 제목을 나타내려면 두개이상의 ‘=‘로 둘러싸면 된다. 

     

    에를 들자면...

     

    ====== 도쿠위키 ======

     

    반면에, 도쿠위키의 크레올레( http://vaslor.net/tech/creole ) 문법은

    제목을 나타내는 === 을 앞에만 해도 된다. 

     

    즉, 

     

    ====== 도쿠위키 크레올레

     

    쓰다보면 편하긴 한데,

    호환성에서 문제가 생길 수 있다. 

     

    저장 할 때 검사하여

    앞에만 = 가 있으면 같은 개수 만큼 뒤에도 붙여주도록 해보았다.

     

    function register(&$controller)
    {
    $controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'codebutton__headercheck');
    }

    function codebutton__headercheck(&$event, $args) {

    global $ID;
    $lines=explode("\n",$event->data[0][1]);
    $modified=false;
    foreach ($lines as &$line ) {
    $num=substr_count($line,"=");
    if ($num>0 ) {
    if (substr_count(substr(trim($line),0,$num),"=")==$num) {
    $line.=str_repeat("=",$num);
    $modified=true;
    }
    }
    } unset($line);

    if ($modified) $event->data[0][1]=implode("\n",$lines);
    return ;
    }

     

    이런 식이다.

     

     

     

     

     

Designed by Tistory.