w:siteconfig

本wiki的個性化修改

本wiki的系統管理員在安裝DokuWiki時,發現有些功能未如理想,稍作修改。本wiki系統管理員支持開源軟件精神,故特此在這兒公開所有對DokuWiki或附加元件作出的修改。

2024-02-06a "Kaos"

另外﹐管理員亦自行開發了自動進行異體字轉換的附加元件canonicalchinese

以下是本wiki的系統管理員,對DokuWiki作出的修改(patch file):

  • 加入DokuWiki預設裏欠缺的wiki間互連(interwiki)。
    創建 <dokuwiki_path>/conf/interwiki.local.conf
  • 修改預設CSS
    創建 <dokuwiki_path>/conf/userall.css
  • 修改連結顯示方式:內部連結顯示分類名稱,wiki間互連顯示所連結的wiki名稱。
    patch file: cd <dokuwiki_path>; patch -p1 < <patch file>
    dokuwiki-xhtml.patch
    --- dokuwiki/inc/parser/xhtml.php.orig      2023-04-26 19:15:00.905534428 +0800
    +++ dokuwiki/inc/parser/xhtml.php   2023-04-26 19:14:22.273538184 +0800
    @@ -836,10 +836,10 @@
             }
     
             // default name is based on $id as given
    -        $default = $this->_simpleTitle($id);
    +        $default = $id;
     
             // now first resolve and clean up the $id
    -        $id = (new PageResolver($ID))->resolveId($id, $this->date_at, true);
    +        $id = (new PageResolver($id))->resolveId($id, $this->date_at, true);
             $exists = page_exists($id, $this->date_at, false, true);
     
             $link = array();
  • 修改連結顯示方式:[[somelink]]連往主 namespace,而不是當前頁面的namespace
    patch file: cd <dokuwiki_path>; patch -p1 < <patch file>
    dokuwiki-pageutils.patch
    --- dokuwiki/inc/pageutils.php.orig	2015-03-18 14:54:42.733615088 +0800
    +++ dokuwiki/inc/pageutils.php	2015-03-18 14:55:10.362012523 +0800
    @@ -477,7 +477,7 @@
             $id = implode(':', $result);
         }elseif($ns !== false && strpos($id,':') === false){
             //if link contains no namespace. add current namespace (if any)
    -        $id = $ns.':'.$id;
    +        $id = ':'.$id;
         }
     
         if($clean) $id = cleanID($id);
  • 創建<dokuwiki_path>/conf/lang/zh-tw/lang.php
    lang.php
    <?php
    $lang['qb_code']               = '英文等寬體';
    ?>
  • patch file: cd <dokuwiki_path>/lib/plugins/colorpicker; patch -p1 < <patch file>
    (https://github.com/gbirke/colorpicker/issues/2)
    script.js.patch
    --- colorpicker/script.js.orig  2014-01-04 18:21:00.224688000 +0800
    +++ colorpicker/script.js   2014-01-04 18:22:02.515250800 +0800
    @@ -28,7 +28,7 @@
         };
       }
     
    -    var $picker              = jQuery('<div class="picker" id="' + id + '"></div>');
    +    var $picker              = jQuery('<div class="picker a11y" id="' + id + '" aria-hidden="true"></div>');
         $picker.css({position:'absolute', 'marginLeft': '-10000px'});
     
         for(var key in list){
  • 創建<dokuwiki_path>/lib/plugins/colorpicker/lang/zh-tw/lang.php
    lang.php
    <?php
    $lang['colorpicker'] = '文字顏色';
    $lang['js']['buttontext'] ='文字';
    ?>
  • 創建<dokuwiki_path>/lib/plugins/colorpicker/lang/zh-tw/settings.php (未有中文化)
    settings.php
    <?php
    $lang['colorscheme'] = 'Color scheme.<br/><span style="font-size:80%">The color name, followed by a an equals sign and a text color name. A background color can be added with a slash after the foreground color.<br/><br/>Example:<br/><pre style="margin:0;padding:5px;font-size:100%;background:#c0c0c0;">Info=green<br/>Attention=black/red</pre></span>';
    ?>
  • 色板設定:
    初音未來=#008080
    鏡音鈴=#ED6F00
    鏡音連=#BFAA15
    巡音流歌=#FF00FF
    Kaito=#0000FF
    Meiko=#FF0000
    Gumi=#008000
    神威樂步=#5F00BD
    Lily=#FF9900
    亞北音留=#000000
    弱音鉑=#808080
    重音Teto=#FF8080
    洛天依=#66CCFF
    言和=#66FFCC
    歌愛雪=#BA0033
    冰山清輝=#000080
    貓村伊呂波=#FF4E00
    龍斗=#7FB80E
    VY1 Mizki=#E54C4C
    VY2 Yuma=#D6006F
    歌手音Piko=#534948
    結月緣=#AE35FF
    蒼姬瑾瑜=#2A5CAA
    兔眠莉音=#800080
    IA=#8567B6
    Cul=#700000
    SeeU=#897B52
    Oliver=#FFCE00
  • 創建<dokuwiki_path>/lib/plugins/fontsize2/lang/zh-tw/lang.php
    lang.php
    <?php
    /**
     * German language file
     *
     * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
     * @author     Esther Brunner <wikidesign@gmail.com>
     */
     
    // custom language strings for the plugin
    $lang['fs_picker']  = '文字大小';
     
    $lang['fs_xxs']            = 'Tiny Text';
    $lang['fs_xxs_sample']     = 'This is a tiny text';
    $lang['fs_xs']             = 'Very Small Text';
    $lang['fs_xs_sample']      = 'This is a very small text';
    $lang['fs_s']              = 'Small Text';
    $lang['fs_s_sample']       = 'This is a small text';
    $lang['fs_m']              = 'Medium Text (is bigger than default)';
    $lang['fs_m_sample']       = 'This is a medium size text';
    $lang['fs_l']              = 'Large Text';
    $lang['fs_l_sample']       = 'This is a large text';
    $lang['fs_xl']             = 'Very Large Text';
    $lang['fs_xl_sample']      = 'This is a very large text';
    $lang['fs_xxl']            = 'Huge Text';
    $lang['fs_xxl_sample']     = 'This is a huge text';
    $lang['fs_smaller']        = 'Smaller than default text';
    $lang['fs_smaller_sample'] = 'This text is smaller than default text';
    $lang['fs_larger']         = 'Larger than default text';
    $lang['fs_larger_sampel']  = 'This text is larger than default text';
     
     
    //Setup VIM: ex: et ts=2 enc=utf-8 :
  • 創建<dokuwiki_path>/lib/plugins/hidden/lang/zh-tw/lang.php
    lang.php
    <?php
    /**
     * English language file
     *
     * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
     * @author     Guillaume Turri <guillaume.turri@gmail.com>
     */
     
    $lang['encoding']              = 'utf-8';
    $lang['direction']             = 'ltr';
    $lang['onHidden']              = 'Click to display ⇲';
    $lang['onVisible']             = 'Click to hide ⇱';
    $lang['edit']                  = 'Edit hidden section';
    $lang['button']                = '隱藏段落';
  • 改變tag頁面連結顯示方式。
    patch file: cd <dokuwiki_path>/lib/plugins/pagelist; patch -p1 < <patch file>
    (ref: https://github.com/dokufreaks/plugin-pagelist/issues/26)
    helper.php.patch
    --- helper.php.orig	2023-04-04 09:08:12.691946216 +0800
    +++ helper.php	2023-04-04 09:08:53.072735704 +0800
    @@ -486,7 +486,7 @@
     
             // produce output
             $content = '<a href="' . wl($id) . (!empty($this->page['section']) ? '#' . $this->page['section'] : '') .
    -            '" class="' . $class . '" title="' . $id . '">' . $title . '</a>';
    +            '" class="' . $class . '" title="' . $id . '">' . $id . '</a>';
             if ($this->style == 'list') {
                 $content = '<ul><li>' . $content . '</li></ul>';
             }
  • 無論與tag同名的條目是否存在,tag 連結均永遠連往頁面清單
    patch file: cd <dokuwiki_path>/lib/plugins/tag; patch -p1 < <patch file>
    helper.php.patch
    --- helper.php.orig     2023-05-26 17:10:39.877109983 +0800
    +++ helper.php  2023-05-26 17:10:39.805108672 +0800
    @@ -192,7 +192,7 @@
                 // Compatibility with older releases
                 resolve_pageid($this->namespace, $tag, $exists);
             }
    -        if ($exists) {
    +        /* if ($exists) {
                 $class = 'wikilink1';
                 $url   = wl($tag);
                 if ($conf['useheading']) {
    @@ -202,7 +202,7 @@
                         $tagTitle = $heading;
                     }
                 }
    -        } else {
    +        } else { */
                 if ($dynamic) {
                     $pages = $this->getTopic('', 1, $svtag);
                     if (empty($pages)) {
    @@ -214,7 +214,7 @@
                     $class = 'wikilink1';
                 }
                 $url   = wl($tag, ['do'=>'showtag', 'tag'=>$svtag]);
    -        }
    +        // }
             if (!$title) {
                 $title = $tagTitle;
             }
    @@ -226,7 +226,7 @@
             ];
             Event::createAndTrigger('PLUGIN_TAG_LINK', $link);
             return '<a href="'.$link['href'].'" class="'.$link['class'].'" title="'.$link['tooltip'].'" rel="tag">'
    -                .$link['title']
    +                .$link['tooltip']
                     .'</a>';
         }
  • 加入文字對齊按鈕
    • 下載 http://canto.acgvlyric.org/_upload/wrap_align.zip ,解壓至 <dokuwiki_path>/lib/plugins/wrap/images/toolbar
    • patch file: cd <dokuwiki_path>/lib/plugins/wrap; patch -p1 < <patch file>
      action.php.diff
      diff -ru dokuwiki_plugin_wrap-stable.orig/action.php dokuwiki_plugin_wrap-stable/action.php
      --- dokuwiki_plugin_wrap-stable.orig/action.php 2014-02-04 18:59:07.000000000 +0800
      +++ dokuwiki_plugin_wrap-stable/action.php      2014-06-08 14:22:33.886052654 +0800
      @@ -35,6 +35,34 @@
                   'list' => array(
                       array(
                           'type'   => 'format',
      +                    'title'  => $this->getLang('pleft'),
      +                    'icon'   => '../../plugins/wrap/images/toolbar/pleft.png',
      +                    'open'   => '<WRAP leftalign>\n',
      +                    'close'  => '\n</WRAP>\n',
      +                ),
      +                array(
      +                    'type'   => 'format',
      +                    'title'  => $this->getLang('pright'),
      +                    'icon'   => '../../plugins/wrap/images/toolbar/pright.png',
      +                    'open'   => '<WRAP rightalign>\n',
      +                    'close'  => '\n</WRAP>\n',
      +                ),
      +                array(
      +                    'type'   => 'format',
      +                    'title'  => $this->getLang('pcenter'),
      +                    'icon'   => '../../plugins/wrap/images/toolbar/pcenter.png',
      +                    'open'   => '<WRAP centeralign>\n',
      +                    'close'  => '\n</WRAP>\n',
      +                ),
      +                array(
      +                    'type'   => 'format',
      +                    'title'  => $this->getLang('pjustify'),
      +                    'icon'   => '../../plugins/wrap/images/toolbar/pjustify.png',
      +                    'open'   => '<WRAP justify>\n',
      +                    'close'  => '\n</WRAP>\n',
      +                ),
      +                array(
      +                    'type'   => 'format',
                           'title'  => $this->getLang('column'),
                           'icon'   => '../../plugins/wrap/images/toolbar/column.png',
                           'open'   => '<'.$syntaxDiv.' group>\n<'.$syntaxDiv.' half column>\n',
      diff -ru dokuwiki_plugin_wrap-stable.orig/helper.php dokuwiki_plugin_wrap-stable/helper.php
      --- dokuwiki_plugin_wrap-stable.orig/helper.php 2014-02-04 18:59:07.000000000 +0800
      +++ dokuwiki_plugin_wrap-stable/helper.php      2014-06-08 14:23:09.078548277 +0800
      @@ -44,12 +44,26 @@
                       continue;
                   }
       
      +            //get bgcolor
      +            $token_match = array();
      +            if (preg_match('/bgcolor=(.*)/', $token, $token_match)) {
      +                $attr['bgcolor'] = $token_match[1];
      +                continue;
      +            }
      +
      +            //get color
      +            if (preg_match('/color=(.*)/', $token, $token_match)) {
      +                $attr['color'] = $token_match[1];
      +                continue;
      +            }
      +
                   //get id
                   if (preg_match('/#([A-Za-z0-9_-]+)/', $token)) {
                       $attr['id'] = trim($token,'#');
                       continue;
                   }
       
      +
                   //get classes
                   //restrict token (class names) characters to prevent any malicious data
                   if (preg_match('/[^A-Za-z0-9_-]/',$token)) continue;
      @@ -93,13 +107,17 @@
                   elseif($addClass)  $out .= ' class="'.$addClass.'"';
                   if($attr['id'])    $out .= ' id="'.hsc($attr['id']).'"';
                   // width on spans normally doesn't make much sense, but in the case of floating elements it could be used
      -            if($attr['width']) {
      +            if($attr['width'] || $attr['bgcolor'] || $attr['color']) {
      +                 $out .= ' style="';
                       if (strpos($attr['width'],'%') !== false) {
      -                    $out .= ' style="width: '.hsc($attr['width']).';"';
      +                    $out .= ' width: '.hsc($attr['width']).';';
                       } else {
                           // anything but % should be 100% when the screen gets smaller
      -                    $out .= ' style="width: '.hsc($attr['width']).'; max-width: 100%;"';
      +                    $out .= ' width: '.hsc($attr['width']).'; max-width: 100%;';
                       }
      +                if($attr['bgcolor']) $out .= ' background-color:'.hsc($attr['bgcolor']).'; ';
      +                if($attr['color'])   $out .= ' color:'.hsc($attr['color']).'; ';
      +                $out .= '"';
                   }
                   // only write lang if it's a language in lang2dir.conf
                   if($attr['dir'])   $out .= ' lang="'.$attr['lang'].'" xml:lang="'.$attr['lang'].'" dir="'.$attr['dir'].'"';
      diff -ru dokuwiki_plugin_wrap-stable.orig/lang/en/lang.php dokuwiki_plugin_wrap-stable/lang/en/lang.php
      --- dokuwiki_plugin_wrap-stable.orig/lang/en/lang.php   2014-02-04 18:59:07.000000000 +0800
      +++ dokuwiki_plugin_wrap-stable/lang/en/lang.php        2014-06-08 14:22:33.886052654 +0800
      @@ -17,3 +17,8 @@
       $lang['em']        = 'especially emphasised';
       $lang['hi']        = 'highlighted';
       $lang['lo']        = 'less significant';
      +
      +$lang['pleft']     = 'left align';
      +$lang['pright']    = 'right align';
      +$lang['pcenter']   = 'center align';
      +$lang['pjustify']  = 'justify';
      diff -ru dokuwiki_plugin_wrap-stable.orig/lang/zh-tw/lang.php dokuwiki_plugin_wrap-stable/lang/zh-tw/lang.php
      --- dokuwiki_plugin_wrap-stable.orig/lang/zh-tw/lang.php        2014-02-04 18:59:07.000000000 +0800
      +++ dokuwiki_plugin_wrap-stable/lang/zh-tw/lang.php     2014-06-08 14:22:33.886052654 +0800
      @@ -17,3 +17,8 @@
       $lang['em']        = '特別強調';
       $lang['hi']        = '醒目標記';
       $lang['lo']        = '不重要';
      +
      +$lang['pleft']     = '靠左對齊';
      +$lang['pright']    = '靠右對齊';
      +$lang['pcenter']   = '置中對齊';
      +$lang['pjustify']  = '左右對齊';
  • 修改<dokuwiki_path>/lib/plugins/wrap/lang/zh-tw/lang.php,找出
    $lang['picker']

    一行,並將其值改爲

    進階格式
  • w/siteconfig.txt
  • 上一次變更: 2024/04/13 13:04 +0800
  • leeyc0