DokuWiki 命名空间管理插件

为了更好的组织结构,Dokuwiki提供了命名空间这个功能,那怎么管理命名空间的,其实可以安装插件去管理

Add New Page Plugin:新建界面

https://www.dokuwiki.org/plugin:addnewpage

Move Plugin:方便移动页面和命名空间

https://www.dokuwiki.org/plugin:move

Pagemove plugin:也是方便移动页面和命名空间

https://www.dokuwiki.org/plugin:pagemove

上面三个插件提供了创建和修改命名空间的功能。

当然如果不安装插件也可以创建,比如你有一个界面中的连接指向了一个新的截面,但是这个界面是在命名空间中,但是这个命名空间不存在,那么系统会自动创建一个命名空间。当然也可以使用Add New Page这个插件创建

参考:

http://www.ligenyuan.cn/wiki/reproduce:dokuwiki_page_name

https://www.dokuwiki.org/plugin:addnewpage

DokuWiki Plugin 精選

– 版面相關

– yalist

– box

<box 80% round orange|a title> the box contents</box>
<box 50% left blue>the box contents</box|a caption>
<box 60% round #f99 #fc9 #fcc #f60|title>the box contents></box|caption>
  • 呈現範例

a title

the box contents

the box contents

a caption

title

the box contents>

caption

– styler

– note

– include

– columns

– Translation

設定說明

– source

– code2

因為 code3 在中文字顯示會有太小不清楚的問題, 在短時間內我又無法調整好 style.css, 所以就直接改用這個 code2 的方案

如果對 code3 還是有興趣者, 可以點這裡參考以下是調整 code3 的處理方式(調整之後, 在 FireFox 還是會出現行距太高的問題.)

點這裡看基本語法

1|h 點這裡可看 code2 的 Sample|h

<?php # 13:09 2007/10/29 # Update by Jonathan Tsai #  require_once("twitter.conf.php");   # 設定傳入參數改以 p_ 開頭變數表示 import_request_variables('gp', 'p_');   $username = ($p_username!="")?$p_username:$username; $password = ($p_password!="")?$p_password:$password; : : ?>

– 操作功能

– rss

– addnewpage

– alphaindex

– indexmenu

– tag

– searchresults

{{search>"關鍵字" @namespace}}
{{backlinks>wiki}}

– Page Redirector

~~REDIRECT>namespace:page~~

– Folded

點這看使用說明(也用 block 方式展示)

– Select

<select 我的最愛> tech:menu|技術分享資訊 start:software:list|推薦免費軟體

http://blog.ichiayi.com|Jonathan’s Blog http://www.google.com|Google http://docs.google.com | Google Office </select>

  • 語法如下:
<select 我的最愛>
tech:menu|技術分享資訊
start:software:list|推薦免費軟體

http://blog.ichiayi.com|Jonathan's Blog
http://www.google.com|Google
http://docs.google.com | Google Office
</select>

– BookmarkMe

  • 使用說明:
    1. 安裝後預設是每頁底下都會出現這個加入書籤的工具列
    2. 透過管理選單的系統設定將 「Display social bookmarks」打勾拿掉
    3. 在需要顯示的頁面加入這語法

      ~~BOOKMARKME:on~~

  • 增加推推王黑米書籤網站說明
    1. – 編輯 lib/plugins/bookmarkme/bookmark.ini|

..

funp   http://funp.com/push/submit/add.php
hemidemi  http://www.hemidemi.com/user_bookmark/new?title=%title%&amp;url=%permalink%
  1. 將 funp 與 hemedemi 的代表小圖檔放入 lib/plugins/bookmarkme/img/ 內命名為 funp.gif 與 hemidemi.gif 2)
  2. 在 管理選單的系統設定 內「Enable bookmarking for」底下加上 funp,hemidemi 這個兩個定義名稱, 中間用“,”隔開

– Keyboard

– CAPTCHA

– 應用類型

– s5

~~SLIDESHOW~~

– Ditaa

<ditaa name=test>

+--------+     /--------\
|  Test  +---->| Test 2 |
+--------+     \--------/

</ditaa>

<ditaa name=test>

+——–+ /——–\

Test +—→ Test 2

+——–+ \——–/

</ditaa>

安裝後要修改實際 java 與 jar 路徑

– graphviz

FIXME

– contact

– poll

– AV Bar Chart

1000|A:500,B:50,C:250,D:1000

<barchart>1000|A:500,B:50,C:250,D:1000</barchart>

– doodle

<doodle [disable] [single] [login]| [id]>
^ [choice] ^ [choice] ^ ... ^
</doodle>
  • disable : 表示不可以投票(只能看結果)
  • single : 表示單選(不指定就是複選)
  • login : 使用 login name (沒有 login 只能看無法投票)

– freemind

參數說明與呈現範例

– abc

– googlemap

25.027459,121.475862,宜家男的髮藝造型

<googlemap width="300px" height="300px" lat="25.027459" lon="121.475862" type="map" zoom="16">
25.027459,121.475862,宜家男的髮藝造型
</googlemap>

– youtube

– flowplay

– mp3play

– AutoViewer

語法與範例:

– imstatus

– 系統管理

– googleanalytics

– Loglog

– Statistics

– superacl

– Bad Behaviour

– 待評估項目

Dokuwiki 相簿應用的 plugin

以下是整理最近安裝 Gallery Plugin後整理出來方便上傳與呈現的相簿相關 plugin

– 安裝相關 plugin

– 設定與建立頁面

  • 本範例是將 scucs83:gallery 當相簿清單頁面, 主要的 code 如下:
====== 電子相簿 ======
|新增相簿|{{NEWPAGE>scucs83:gallery}}|
<style box>
{{indexmenu>scucs83:gallery#1|js navbar nocookie msort#date:modified rsort}}
</style>
  • scucs83:gallery:20080630 當相簿內頁, 主要的 code 如下:
====== 東吳校園現況 ======
{{gallery>scucs83:gallery:20080630?lightbox}}

– 相簿內頁 template

  • 讓每次建立新的相簿內頁都會自動帶出這些預設資訊
cd data/pages/scucs83/galley
vi _template.txt
====== 相簿主題 ======
{{gallery>scucs83:gallery:@PAGE@?lightbox}}

– 新增相簿

  1. 在 PC 端建立一個 20080703 的相簿目錄
  2. 先將要上傳的照片檔都放入 20080703 相簿目錄內
  3. 使用 7-zip 將這個目錄押成 20080703.zip
  4. 透過相簿清單頁面的新增頁面功能輸入 20080703 → 新增頁面
  5. 將 template 所帶出來的 相簿主題 改成實際的主題
  6. 點下加入圖案或檔案 icon 選 20080703.zip 並勾選 Unpack archive after upload 上傳
  7. 關閉上傳視窗
  8. 儲存新增頁面

– 展示

Dokuwiki 插件整理

内置插件

非内置插件

  • Add New Page plugin:addnewpage 在页面中显示添加新页面表单
  • Ace Editor plugin:aceeditor 支持键盘功能键的编辑器。注意:该插件已不再维护。请使用CodeMirror插件。
  • markdownextra plugin:markdownextra 支持markdown语法
  • mathpublish plugin:mathpublish 数学公式渲染
  • move plugin:move 移动页面的同时移动对应的媒体,修改链接到它的页面链接。
  • Meta plugin:meta 指定页面元数据,比如页面标题、作者、创建时间等。以用作其他用途。不会覆盖data/meta中数据
  • OpenOffice.org Export plugin:odt 导出odt格式文档(相当于word)

更多参考

Dokuwiki 侧边栏配置

Dokuwiki 侧边栏配置

默认的模版 dokuwiki,支持侧边栏。

  • (1)配置里有个 sidebar 侧边栏的页面名称,这里填写 页面路径
  • (2)创建这个页面。

此时,侧边栏就出来了。

当同级命名空间下有相应的侧边栏页面,则使用此页面。

相关插件

simplenavi

根据访问者权限列出所有命名空间,默认自动展开当前页面所属空间,不能折叠此空间。

命名空间页面链接自动指向:start页。

{{simplenavi>}}

可以指定起始空间:{{simplenavi>some:namespace}}
simpleindex

根据访问者权限列出所有命名空间,默认自动关闭所有命名空间。

<simpleindex>

可以指定排除的空间:<simpleindex ns1,ns2>
indexmenu

基于dtree,

navi

利用一个页面中的链接生成导航。自动根据当前页面展开命名空间。

Sidebar Template

自动加载本命名空间的sidebar页面。展示形式跟Dokuwiki的站点地图一样。

NsToC

列出指定命名空间的标题,可以指定标题的层级。场景:比如图书的目录等。

其他

pageindex,catlist, dir, nspages, pagequery

Dokuwiki 语法插件开发

Dokuwiki 语法插件开发

对语法标签的匹配采用PHP preg函数进行。

插件类需要实现以下方法:

  • getType() 返回此插件定义的模式类型。比如标签内部是纯文本等。
  • getSort() 返回此插件的优先级。数字越小,优先级越高。比如:需要替换系统的<code>标签。
  • connectTo($mode) 用来向词法分析器Lexer注册模式匹配的正则表达式。
  • postConnect() 当在connectTo()中注册的是起始正则表达式,则需要实现此函数,注册中止正则表达式。
  • handle($match, $state, $pos, Doku_Handler &$handler) 处理匹配出的内容,返回在渲染器中使用的内容。
  • render($mode, Doku_Renderer &$renderer, $data) 渲染内容。

当需要的时候,可以重载以下方法:

  • getPType() 返回生成内容的段落的形式。
  • getAllowedTypes() 返回允许内联的模式。(默认array())
  • accepts($mode) 返回是否允许内联自己的模式。

参考:devel:syntax_plugins devel:parser

dw2pdf – 导出 pdf 插件

dw2pdf插件用于导出一个wiki页面为一个pdf文件。官网https://www.dokuwiki.org/plugin:dw2pdf

安装

  1. 下载并安装插件
  2. 下载mPdf库最新版,替换掉插件自带的
  3. 修改mpdf/config.php,大致44行,将useAdobeCJK改为true: 此时导出中文正常
  4. 修改Dokuwiki主题模版,添加导出按钮
// Dokuwiki template
// Insert:   <form class="button" method="get" action="<?php wl($ID)?>">
    <div class="no">
    <button type="submit" class="button">
    <img src="<?php echo DOKU_BASE?>lib/images/fileicons/pdf.png" alt="PDF Export" />
    </button>
        <input type="hidden" name="do" value="export_pdf" />
        <input type="hidden" name="rev" value="<?php global $REV; echo $REV?>" />
        <input type="hidden" name="id" value="<?php echo $ID?>" />
    </div>
</form>   // in lib/tpl/dokuwiki/main.php
// after   <!-- PAGE ACTIONS -->
<div id="dokuwiki__pagetools">
    <h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
    <div class="tools">
        <ul>
            <?php
                tpl_action('edit',      1, 'li', 0, '<span>', '</span>');
                tpl_action('revert',    1, 'li', 0, '<span>', '</span>');
                tpl_action('revisions', 1, 'li', 0, '<span>', '</span>');
                tpl_action('backlink',  1, 'li', 0, '<span>', '</span>');
                tpl_action('subscribe', 1, 'li', 0, '<span>', '</span>');
                tpl_action('top',       1, 'li', 0, '<span>', '</span>');
            ?>   // DW2pdf-Icon will be on the floating menu.

模版语法

<TEXT> The following replacement patterns can be used within the header and footer files.

@PAGE@ – current page number in the PDF @PAGES@ – number of all pages in the PDF @TITLE@ – The article’s title @WIKI@ – The wiki’s title @WIKIURL@ – URL to the wiki @DATE@ – time when the PDF was created (might be in the past if cached) @BASE@ – the wiki base directory @TPLBASE@ – the PDF template base directory (use to reference images) Remark about Bookcreator: The page depended replacements are only for citation.html updated for every page. In the headers and footers the ID of the bookmanager page of the Bookcreator is applied.

@ID@ – The article’s pageID @PAGEURL@ – URL to the article @UPDATE@ – Time of the last update of the article @QRCODE@ – QR code image pointing to the original page url </TEXT>

注意事项

  1. include插件兼容性

<TEXT> To work with the include plugin you have to add dw2pdf to its action_plugin_include supportedModes member variable

var $supportedModes = array('xhtml', 'metadata','dw2pdf');

Otherwise you may have problems with caching. </TEXT>

Gallery – 列出图片目录插件

Gallery – 列出图片目录插件

语法

{{gallery>namespace}}

{{gallery>namespace:someimage.jpg}}

{{gallery> namespace}} (right aligned)
{{gallery>namespace }} (left aligned)
{{gallery> namespace }} (centered)

{{gallery>http://www.23hq.com/rss/schabloni}}

参数

参数以?开头,用&分割,所有参数的否定在前面加no,比如:cache,nocache

{{gallery>images:vacation?image_*.jpg&80x80&crop&lightbox}}
// 所有
{{gallery>?crop&lightbox}}

<markdown> <table class=“inline”>

<tbody><tr class="row0">
	<th class="col0 leftalign"> Parameter                      </th><th class="col1 leftalign"> Default         </th><th class="col2 leftalign"> Description    </th>
</tr>
<tr class="row1">
	<td class="col0 leftalign"> <code><em>&lt;number&gt;</em>x<em>&lt;number&gt;</em></code>  </td><td class="col1"> <code>120x120</code> </td><td class="col2"> 设置缩略图大小, 除非设定了crop选项,会保持缩略图长宽比.</td>
</tr>
<tr class="row2">
	<td class="col0 leftalign"> <code><em>&lt;number&gt;</em>X<em>&lt;number&gt;</em></code>  </td><td class="col1"> <code>800X600</code> </td><td class="col2"> 设置<code>direct</code>模式下链接到的图片大小,会保持长宽比. 注意是大写 <code>X</code>.</td>
</tr>
<tr class="row3">
	<td class="col0 leftalign"> <code><em>&lt;number&gt;</em></code>               </td><td class="col1 leftalign"> <code>5</code>           </td><td class="col2"> 每行gallery表里可显示的图片数目. 如果指定为0不使用表格,所有缩略图顺序排列 </td>
</tr>
<tr class="row4">
	<td class="col0 leftalign"> <code>=<em>&lt;number&gt;</em></code>              </td><td class="col1 leftalign"> <code>=0</code>          </td><td class="col2"> 限制显示给定数目的图片. <code>0</code>代表所有. </td>
</tr>
<tr class="row5">
	<td class="col0 leftalign"> <code>+<em>&lt;number&gt;</em></code>              </td><td class="col1 leftalign"> <code>+0</code>          </td><td class="col2"> 跳过显示前面的number张图片. 和上面的选项一起很有用.</td>
</tr>
<tr class="row6">
	<td class="col0 leftalign"> <code>~<em>&lt;number&gt;</em></code>              </td><td class="col1 leftalign"> <code>~0</code>          </td><td class="col2"> Add a pagination for the thumbnails displaying the number of given thumbnails per page. <code>0</code> disables pagination. Pagination is added through JavaScript - when no JavaScript is available all thumbnails are displayed </td>
</tr>
<tr class="row7">
	<td class="col0 leftalign"> <code>cache</code>                      </td><td class="col1 leftalign"> enabled         </td><td class="col2"> Usually the output of the created gallery is cached. When the images in your selected namespace change, you have to manually force an update of the gallery page's <a href="http://www.unixtech.org/caching" class="wikilink2" title="caching" rel="nofollow">cache</a>. To disable the cache for the page showing the gallery, set <code>nocache</code> as option. </td>
</tr>
<tr class="row8">
	<td class="col0 leftalign"> <code>crop</code>                       </td><td class="col1 leftalign"> disabled        </td><td class="col2"> 使用给定的缩略图大小,不保持长宽比,裁剪多出部分 </td>
</tr>
<tr class="row9">
	<td class="col0 leftalign"> <code>direct</code>                     </td><td class="col1 leftalign"> disabled        </td><td class="col2"> 缩略图链接到给定大小的图片而不是图片描述页 </td>
</tr>
<tr class="row10">
	<td class="col0 leftalign"> <code>lightbox</code>                   </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Show images in a fancy JavaScript modal browsing window, see below for details. Setting this option automatically implies the <code>direct</code> mode </td>
</tr>
<tr class="row11">
	<td class="col0 leftalign"> <code>reverse</code>                    </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Reverse the order of the displayed images </td>
</tr>
<tr class="row12">
	<td class="col0 leftalign"> <code>recursive</code>                  </td><td class="col1 leftalign"> enabled         </td><td class="col2"> Find images in the given namespace and all sub namespaces </td>
</tr>
<tr class="row13">
	<td class="col0 leftalign"> <code>random</code>                     </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Sort images randomly. You might want to use <code>nocache</code> as well </td>
</tr>
<tr class="row14">
	<td class="col0 leftalign"> <code>modsort</code>                    </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Sort images by file modification date </td>
</tr>
<tr class="row15">
	<td class="col0 leftalign"> <code>datesort</code>                   </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Sort images by EXIF date </td>
</tr>
<tr class="row16">
	<td class="col0 leftalign"> <code>titlesort</code>                  </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Sort images by EXIF title </td>
</tr>
<tr class="row17">
	<td class="col0 leftalign"> <code>showname</code>                   </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Show filename below thumbnails </td>
</tr>
<tr class="row18">
	<td class="col0 leftalign"> <code>showtitle</code>                  </td><td class="col1 leftalign"> disabled        </td><td class="col2"> Show the EXIF tag <code>Headline</code> as title below thumbnails </td>
</tr>
<tr class="row19">
	<td class="col0 leftalign"> anything containing a <code>*</code>    </td><td class="col1"> jpg,gif,png images </td><td class="col2"> This can be used to filter the list of files found in the given namespace. <code>*</code> work as simple wildcard symbol. </td>
</tr>

</tbody></table> </markdown>

关于lightbox

基于https://github.com/splitbrain/prettyphoto/tree/merged,源自PrettyPhoto

tagentry – 编辑框下显示tag列表

tagentry – 编辑框下显示tag列表

tagentry用于在编辑框下面列出所有的tag,并带有复选框。

bug修补:

  • tag列表无法显示。
./action.php.old  2009-09-18 13:32:00.000000000 +0400
+++ ./action.php	2013-05-30 12:29:47.000000000 +0400
@@ -55,7 +55,7 @@
       $pos = $event->data->findElementByAttribute('type','submit');
       if(!$pos) return; // no button -> source view mode
       #echo "DEBUG: <pre>".print_r($event->data,true).'</pre>';
-      if (   !empty($event->data->_hidden['prefix'])
+      if (   empty($event->data->_hidden['prefix'])
           || !empty($event->data->_hidden['suffix'])) return;
       if ($event->data->findElementByType('wikitext')===false) return;
     }elseif(!$event->data['writable']){
@@ -72,7 +72,7 @@
     }
 
     if ($this->getConf('tagsrc') == 'All tags' && $thlp) {
-      $alltags=$this->_gettags($thlp);
+      $alltags=array_map('trim', idx_getIndex('subject', '_w'));
     } else {
       $alltags=$this->_getpages($tagns);
     }
  • 不兼容ACE编辑器。

尚无方案。