목차
plugins
incloud plugin Syntax
{{page>wiki:syntax#Tables}} will include the section about tables of the syntax page.
{{namespace>project_foo}} will include all pages in the project_foo namespace.
{{page>blog:mypage&tags&comments}} will include the page blog:mypage and show the tags from the tag plugin and the number of comments from the discussion plugin. Both plugins need to be installed for this example.
{{tagtopic>testtag}} will include all pages with the tag testtag, the tag plugin needs to be installed for this example.
Syntax
The plugin offers four syntaxes, {{page>...}} , {{section>...}} , {{namespace>...}} and {{tagtopic>...}}.
Section is aimed more at including sections, page at including whole pages and namespace at including whole namespaces. Tagtopic includes all pages with a tagtopic tag.
{{page>[id]&[flags]}}
{{section>[id]#[section]&[flags]}}
{{namespace>[namespace]#[section]&[flags]}}
{{tagtopic>[tag]&[flags]}}
| [id] | page ID of the page to include; some macros are possible; shortcuts are resolved (:, ., ..) | required |
|---|---|---|
| [section] | limits the included page to a specific section and its subsections | optional; default is the whole page , this can be used with namespace (if matches) |
| [tag] | include pages with tag topic tag, requires tag | required |
| [flags] | flags delimited by &, see flags | optional |
Configuration and Flags
The plugin can be configured in the DokuWiki configuration manager available in the admin menu. These settings also affect the blog plugin which uses the include plugin to generate the blog page. For most settings there are flags that allow to override the setting. Some features are only available as flag.
| Configuration option | Flags | Description |
|---|---|---|
noheader | noheader/ (show)header | Don't display the header of the inserted section |
firstseconly | firstsec(tion)only/ fullpage | Display only the first section of the included page |
readmore | readmore/noreadmore | Show “read more” link in case of firstsection only |
showtaglogos | - | Show/hide an image for the first tag (if the page has tags) |
showfooter | footer/nofooter | Show/hide page footer below the included page |
showlink | link/nolink | Makes the first headline of a included page/section a link to the included page/section |
showpermalink | permalink/ nopermalink | Show/hide a permalink to the included page in the page footer |
showdate | date/nodate | Show/hide creation date of the page in the page footer |
showmdate | mdate/nomdate | Show/hide modification date of the page in the page footer |
showuser | user/nouser | Show/hide user name of the page creator in the page footer |
showcomments | comments/nocomments | Show/hide number of comments in the page footer (requires the discussion plugin) |
showlinkbacks | linkbacks/nolinkbacks | Show/hide number of linkbacks in the page footer (requires the linkback or backlinks plugin) |
showtags | tags/notags | Show/hide tags in the page footer (requires the tag plugin) |
showeditbtn | editbtn or editbutton/noeditbtn or noeditbutton | Show/hide edit buttons (section edit buttons, edit button below the included page) |
doredirect | redirect/noredirect | Redirect back to original page after an edit |
usernamespace | - | Namespace for user pages (see showuser configuration) (default user) |
doindent | indent/noindent | Indent included pages relative to the section of the page they get included in |
linkonly | linkonly/nolinkonly or include_content | Display only a link instead of the whole page content |
title | title/notitle | Show the title instead of the page id |
pageexists | pageexists/ nopageexists | Only list page ids of existing pages (see existlink) |
| - | existlink | Display a link and do so only if page page-id exists (combination of linkonly and pageexists) |
parlink | parlink/noparlink | (Don't) put the link into a paragraph environment (for inline lists) |
order | order=OPTION | Ordering criteria for namespace includes, possible options: page ID (id), title (title), date created (created), date modified (modified), indexmenu sort order (indexmenu), custom sort order using the {{include_n>[number]}} on the pages that are included similar to the indexmenu tags (custom). |
rsort | rsort/sort | Reverse the sort order in namespace includes. |
depth | depth=DEPTH | The maximum depth of subnamespaces of which pages are included in namespace includes, default is 1 for only the specified namespace, 0 is for unlimited depth. |
| - | inline | Don't close/open sections when including a page. This flag should be used when the include syntax is used inside other syntax elements like lists or tables or inside other plugin syntax. |
| - | beforeeach=ENTITY/ aftereach=ENTITY | Display an entity before/after each included page. The entity is printed outside the section/include environment, this is mainly for adding custom HTML code (when the text isn't recognized as entity it is directly displayed but escaped so you can't directly use HTML code here). |
safeindex | - | Don't index metadata of included pages that are non-public. This can cause problems with other plugins that use the metadata index and can be safely disabled in wikis where the permissions of the included pages match the permissions of the parent pages. |
| - | exclude=/REGEX/ | Regular expression to exclude certain pages, will match on full page ID. E.g. to exclude ns:page_name use /ns:page_name/ as value. Use a regex tester to debug complicated patterns. |
Examples:
{{page>concept&firstseconly&footer}}
{{page>mypage&noindent}}
{{namespace>myns&order=modified}}
{{namespace>myns&exclude=/myns:subns:.+|myns:page/}}
Macros
Simple macros are possible to serve a page on a per user or per date base. These are:
| @USER@ | username |
|---|---|
| @NAME@ | full name of user |
| @GROUP@ | first group the user belongs to |
| @YEAR@ | 4-digit year |
| @MONTH@ | 2-digit month |
| @WEEK@ | 2-digit ISO week number |
| @DAY@ | 2-digit day |
| @DATE<expr>@ | use a calculated date instead of today in date macros |
<expr> in @DATE<expr>@ can be one of:
| PYEAR | previous year |
|---|---|
| NYEAR | next year |
| PMONTH | previous month |
| NMONTH | next month |
| PWEEK | previous week |
| NWEEK | next week |
| YESTERDAY | yesterday's date |
| TOMORROW | tomorrow's date |
Examples:
{{page>@MONTH@:@DAY@:birthdays}}
includes the page birthdays in namespace <month>:<day>: eg. 10:15: birthdays for the 15th of october.
{{page>@USER@:message}}
includes the page message from the namespace <user> of the logged in user
{{page>foo@DATENWEEK@@YEAR@:@WEEK@}}
includes the page <weekno> from the namespace foo<year> with next week's date e.g. foo2012:01 for the 27th of december 2011
Box plugin Syntax
A simple box:
<box> the box contents </box>
Some more complex boxes
<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
a caption
title
caption
The full syntax:
<box width classes colours | title text> contents text </box>
- width — any legal CSS width value
- classes — any number of classes which use the styles in your template or the plugin's own stylesheet to determine the look of the box. The box plugins comes with the following classes already defined:
- round — box will have rounded corners
- blue — blue colour scheme
- red — red colour scheme
- green — green colour scheme
- orange — orange colour scheme
- left — float the box left within the wiki page
- right — float the box right within the wiki page
if no classes are specified the default styles will be used, that is square corners in a colour scheme based on the default DokuWiki colour scheme.
- colours — 1-4 colours in CSS hex or RGB notation, e.g.
#F00 #fcab94 rgb(255,255,0). The colours are applied in order to:- content background
- title background
- outer box background
- borders
if less than four colours are specified, the first colour is used for the missing colours.
- title text — text (including DokuWiki markup) displayed above the box contents, with distinct style.
- caption text — text (no markup allowed) displayed below the box contents, with distinct style.
The opening <box … > including the title must all appear on one line. The box contents can appear over as many lines as are needed.
See the plugin in action here. The sample page shows all the'styles available with the plugin.
folded
Inline:
This is example ++text | with some of it only shown when you unfold it++. And after that the text just continues to flow in the same paragraph.
This is example text . And after that the text just continues to flow in the same paragraph.
Block:
This is example text. ++++ Title |
| This table | is only shown | when you unfold the block |
{{page>some other wiki page&inline}}
++++
This is example text.
This is example title text.
| Inline | Block | |
|---|---|---|
| Syntax | ++title| formatted text ++ | ++++title| any content ++++ |
| HTML | <span> tag | <div> tag |
| Can contain formatting | | |
| Can contain block elements1) | — | |
| Can be used within a paragraph, table, list, etc. | | — |
select
<select Example> wiki:plugins|Plugin Top plugin:select|Select plugin </select>
<select Example> wiki:plugins|Plugin Top wiki:manual_update|수동 업데이트 방법 wiki:plugins#select|Select plugin </select>
SyntaxHighlighter4 plugin
https://github.com/crazy-max/dokuwiki-plugin-syntaxhighlighter4
Example
<sxh php; first-line: 89; highlight: [106,107]; title: New title attribute in action>
/**
* Render xhtml output or metadata
*
* @param string $mode Renderer mode (supported modes: xhtml)
* @param Doku_Renderer $renderer The renderer
* @param array $data The data from the handler() function
* @return bool If rendering was successful.
*/
public function render($mode, Doku_Renderer &$renderer, $data) {
if($mode != 'xhtml') return false;
if (count($data) != 3) {
return true;
}
list($syntax, $attr, $content) = $data;
if ($syntax == 'sxh') {
$title = $this->procTitle($attr);
$highlight = $this->procHighlight($attr);
$renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>';
} else {
$renderer->file($content);
}
return true;
}
</sxh>
/**
* Render xhtml output or metadata
*
* @param string $mode Renderer mode (supported modes: xhtml)
* @param Doku_Renderer $renderer The renderer
* @param array $data The data from the handler() function
* @return bool If rendering was successful.
*/
public function render($mode, Doku_Renderer &$renderer, $data) {
if($mode != 'xhtml') return false;
if (count($data) != 3) {
return true;
}
list($syntax, $attr, $content) = $data;
if ($syntax == 'sxh') {
$title = $this->procTitle($attr);
$highlight = $this->procHighlight($attr);
$renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>';
} else {
$renderer->file($content);
}
return true;
}
- 옵션 : https://github.com/syntaxhighlighter/syntaxhighlighter/wiki/Configuration#per-element-configuration
- autoLinks: (Default true) URL을 클릭하면 이동할 수 있도록 수정
- className: (Default null)
- firstLine: (Default 1) 시작 번호
- gutter: (Default true) 줄번호 표시 유무
- highlight: (Default null) 강자할 문법 설정
- htmlScript: (Default false)
- smartTabs: (Default true)
- tabSize: (Default 4)
<sxh php; highlight: [11-15]>
/**
* [Custom event handler which performs action]
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function handle_metaheader(Doku_Event &$event, $param) {
// Add SyntaxHighlighter theme.
$event->data['link'][] = array('rel' => 'stylesheet',
'type' => 'text/css',
'href' => DOKU_BASE . 'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
);
// Register SyntaxHighlighter javascript.
$event->data["script"][] = array("type" => "text/javascript",
"src" => DOKU_BASE . "lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js",
"_data" => ""
);
}
</sxh>
/**
* [Custom event handler which performs action]
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function handle_metaheader(Doku_Event &$event, $param) {
// Add SyntaxHighlighter theme.
$event->data['link'][] = array('rel' => 'stylesheet',
'type' => 'text/css',
'href' => DOKU_BASE . 'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
);
// Register SyntaxHighlighter javascript.
$event->data["script"][] = array("type" => "text/javascript",
"src" => DOKU_BASE . "lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js",
"_data" => ""
);
}
Page Redirect Plugin Syntax
~~REDIRECT>namespace:page~~ ~~REDIRECT>http://example.com~~
plantumlparser Plugin
https://www.dokuwiki.org/plugin:plantumlparser
<uml> Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response </uml>
<uml> @startmindmap caption figure 1 title My super title * <&flag>Debian ** <&globe>Ubuntu *** Linux Mint *** Kubuntu *** Lubuntu *** KDE Neon ** <&graph>LMDE ** <&pulse>SolydXK ** <&people>SteamOS ** <&star>Raspbian with a very long name *** <s>Raspmbc</s> => OSMC *** <s>Raspyfi</s> => Volumio header My super header endheader center footer My super footer legend right Short legend endlegend @endmindmap </uml>
<uml> @startmindmap + root **:right_1.1 right_1.2; ++ right_2 left side -- left_1 -- left_2 **:left_3.1 left_3.2; @endmindmap </uml>
gh Plugin - Embed files from a GitHub repository
{{gh>https://github.com/splitbrain/dokuwiki-plugin-gh/blob/master/syntax.php 5-10}}
https://github.com/splitbrain/dokuwiki-plugin-gh/blob/master/syntax.php 5-10
위의 구문은 GitHub의 이 플러그인 저장소에서 파일의 5~10번째 줄을 임베드합니다 syntax.php. 줄 번호를 생략하여 전체 파일을 임베드할 수 있습니다.
구문 강조는 파일 확장자에 따라 수행됩니다.
{{gh>https://github.com/zasfe/Labs/blob/a52e6bec9ca6288455ae14c7bbe743295a3e74f9/tomcat/archive_tomcat_log.sh#L1-L17}}
TemplatePageName Plugin
-
- https://www.dokuwiki.org/namespace_templates 기본 템플릿 기능을 개선하는 플러그
이 플러그인은 네임스페이스 템플릿(스캐폴딩)의 이름을 변경하여 템플릿 사용을 개선합니다.
위키 사용자는 일반 편집기를 통해 네임스페이스에 c_template 및 i_template 위키 페이지를 추가할 수 있습니다. DokuWiki는 이 페이지들을 새로 생성되는 페이지의 템플릿으로 사용합니다.
DokuWiki는 기본적으로 템플릿 페이지 이름인 _template과 __template을 사용하지만, 이 플러그인은 이를 다음과 같이 변경합니다.
- c_template(현재 네임스페이스의 새 페이지에 대한 템플릿)
- 및 i_template(상위 네임스페이스에서 상속된 템플릿)
Replacement patterns
Inside of the file, you may also use some replacement patterns to make the template a little more dynamic.
| @ID@ | full ID of the page |
|---|---|
| @NS@ | namespace of the page |
| @CURNS@ | last part of the namespace of the page |
| @!CURNS@ | same as above but with the first character uppercased |
| @!!CURNS@ | same as above but with the first character of all words uppercased |
| @!CURNS!@ | same as above but with all characters uppercased |
| @PAGE@ | page name (ID without namespace and underscores replaced by spaces) |
| @!PAGE@ | same as above but with the first character uppercased |
| @!!PAGE@ | same as above but with the first character of all words uppercased |
| @!PAGE!@ | same as above but with all characters uppercased |
| @FILE@ | page name (ID without namespace, underscores kept as is) |
| @!FILE@ | same as above but with the first character uppercased |
| @!FILE!@ | same as above but with all characters uppercased |
| @USER@ | ID of user who is creating the page |
| @NAME@ | name of user who is creating the page |
| @MAIL@ | mail address of user who is creating the page |
| @DATE@ | date and time when edit session started |
| %a %d-%m-%y etc. | e.g. Thu 06-12-12. strftime placeholders are replaced by page creation time |