사용자 도구

사이트 도구


wiki:plugins

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

the box contents
the box contents

a caption

title

the box contents

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:
    1. content background
    2. title background
    3. outer box background
    4. 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.

Title

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. :-)

plugin:folded

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;
    }

<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>

AliceBobAliceAliceBobBobAuthentication RequestAuthentication ResponseAnother authentication Requestanother authentication Response

<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>

My super titleMy super headerMy super titleDebianUbuntuLinux MintKubuntuLubuntuKDE NeonLMDESolydXKSteamOSRaspbian with a very long nameRaspmbc=> OSMCRaspyfi=> VolumioShortlegendfigure 1My super footer

<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>

rootright_1.1right_1.2right_2left_1left_2left_3.1left_3.2

gh Plugin - Embed files from a GitHub repository

{{gh>https://github.com/splitbrain/dokuwiki-plugin-gh/blob/master/syntax.php 5-10}}
syntax.php
 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
 * @author  Andreas Gohr <andi@splitbrain.org>
 */
class syntax_plugin_gh extends DokuWiki_Syntax_Plugin
{

위의 구문은 GitHub의 이 플러그인 저장소에서 파일의 5~10번째 줄을 임베드합니다 syntax.php. 줄 번호를 생략하여 전체 파일을 임베드할 수 있습니다.

구문 강조는 파일 확장자에 따라 수행됩니다.

{{gh>https://github.com/zasfe/Labs/blob/a52e6bec9ca6288455ae14c7bbe743295a3e74f9/tomcat/archive_tomcat_log.sh#L1-L17}}
tomcat/archive_tomcat_log.sh#L1-L17
#!/bin/bash
# - tomcat log archive
 
folder_tomcat_logs="/usr/local/tomcat/logs"
folder_backup="/data/tomcat8_log/"
 
# 3 Days old file move
find ${folder_tomcat_logs} -maxdepth 1 -type f -name "catalina*.out-*" -mtime +3 -exec mv {} ${folder_backup} \;
 
# 30 Days old file move
find ${folder_tomcat_logs} -maxdepth 1 -type f -name "*" -mtime +30 -exec mv {} ${folder_backup} \;
 
# 60 Days old file compressed
cd ${folder_backup}
find ${folder_backup} -maxdepth 1 -type f -name "*" -and ! -name "*.gz" -mtime +60 -exec gzip -9 {} \;
 
exit 0
1)
like tables, lists, new paragraphs, included files, etc.
wiki/plugins.txt · 마지막으로 수정됨: 2024/08/06 23:48 저자 zasfe

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki