Wiki用関数の書き方
{{wiki.tree{path: "/User:nagtos/備忘録",depth: 3};}}
のように書く。
引数は {} で囲む
() で囲むのは、文中での{{}}挿入の時は、やってはいけないらしい。
関数によるかもしれない(詳細がわからなかった)。
引数は 引数名: で書き,で区切る
:の後は必ず半角スペースを入れること
参考になるページ
- https://success.mindtouch.com/Documentation/Scripting/Wiki_Functions#wiki.toc%28path.2C_depth%29_:_xml
- http://success.mindtouch.com/Documentation/Scripting/01_Getting_Started_DekiScript/Basic_Dynamic_Controls
日本語サイトはほとんどない(検索するだけ徒労)。
Wiki用関数リファレンスの一部和訳
個人的に使わない関数
用途不明なものも含む。
- wiki.anypage(query, seconds, max, linkonly, titlestyle) : xml
- ページのリストをランダム表示する?
- wiki.api(source, nilOnError) : xml
- 何らかのAPIを使う?
- wiki.comments(path, recurse, user, max, offset) : list
- 指定したページのコメントを表示
- wiki.contributors(path, max, recent, exclude) : xml
- 指定したページで活発な投稿者を表示
- wiki.inclusions(templates) : list
- 使用できるテンプレートのリストを表示?
- wiki.language(path) : str
- ページの使用言語を表示?
- wiki.localize(resourceName, resourceParameters) : xml
- ローカライズ関連?
- wiki.getfile(fileid) : map
- 添付ファイル関連?
- wiki.getsearch(query, max, sortBy, constraint, offset) : list
- 検索関連?
ページのパスにタイトルを追加
wiki.appendpath(path, title) : str
引数
- path
- str
- (optional) wiki page path (default: current page)
- recurse
- bool
- (optional) retrieve comments from descendant pages as well (default: false)
- user
- any
- (optional) filter by poster user id or name (default: all)
- max
- num
- (optional) maximum number of comments to return (default: 100)
- offset
- num
- (optional) number of comments to skip (default: 0)
使用例
{{wiki.comments{path: "レベルデザイン/ミッション一覧", max: 5};}}
新しいページを作成するボタンを挿入
wiki.create(label, path, template, button, title, args) : xml
引数
- label
- str
- (optional) label for edit link or button (default: "New page")
- path
- str
- (optional) path to parent page for new page (default: current page)
- template
- str
- (optional) template to use to populate new page (default: system default)
- button
- bool
- (optional) show as button (default: true)
- title
- str
- (optional) new title for page (default: "Page Title")
- args
- map
- (optional) request arguments to pass to new page (default: nil)
使用例
{{wiki.create{};}}
指定した単語が存在するページの一覧を表示
wiki.directory(query) : xml
引数
- query
- str
- (optional) search query (default: all pages in main namespace)
使用例
{{wiki.directory{query: "トリガ"};}}
エディタを開くボタンを挿入
wiki.edit(label, path, section, button, template, args) : xml
引数
- label
- str
- (optional) label for edit link or button (default: "Edit page")
- path
- str
- (optional) path of page to edit (default: current page)
- section
- str
- (optional) name of section to edit (default: edit entire page)
- button
- bool
- (optional) show as button (default: true)
- template
- str
- (optional) template to use to populate new page (default: system default)
- args
- map
- (optional) request arguments to pass to page (default: nil)
使用例
{{wiki.edit{};}}
ボタンは出るが、エディタが出ない。
firefoxとchromeの両方で、エディタが出なかった。
ページの状態をオブジェクトを取得
wiki.getpage(page, redirect) : map
引数
- page
- any
- wiki page path or id
- redirect
- bool
- (optional) follow redirects (default: true)
使用例
{{wiki.getpage{page: "レベルデザイン"};}}
タグの詳細を取得
wiki.gettag(tag) : map
引数
- tag
- str
- tag name
使用例
{{wiki.gettag{tag: "リファレンス"};}}
ユーザーの状態を取得
wiki.getuser(user) : map
引数
- user
- any
- user name or id
使用例
{{wiki.getuser{user: "nagtos"};}}
他の言語で記述されたページのバージョンを表示
wiki.languages(languages) : xml
引数
- languages
- map
- Language to title map of all page versions written in other languages
ページへのハイパーリンクを挿入
wiki.link(page, text, title, target, redirect) : xml
引数
- page
- any
- wiki page path or id
- text
- any
- (optional) link contents; can be text, an image, or another document (default: page title)
- title
- str
- (optional) link hover title (default: none)
- target
- str
- (optional) link target (default: none)
- redirect
- bool
- (optional) follow redirects (default: true)
指定ページの全体または一部を取り込む
wiki.page(path, section, revision, show, heading, nilIfMissing) : xml
wiki.page はコンテンツのみで、ページのスタイルは含まれません。
引数
- path
- str
- wiki page path
- section
- str
- (optional) section to include on wiki page (default: full page)
- revision
- num
- (optional) page revision to use: 0 is the head revision, > 0 stands for a specific revision (e.g. 1 is the first revision), < 0 is revision relative to head revision (e.g. -1 is the previous revision) (default: head revision)
- show
- bool
- (optional) show page/section title of included page (default: false) *requires heading parameter below to be explicitly set
- heading
- num
- (optional) set page/section title heading and adjust all sub-headings accordingly; the adjustment is applied even when the page/section heading is not shown (range: 0-5, where 0 is 'Title' style, 1 is 'Heading 1', and so forth; default: keep original headings)
- nilIfMissing
- bool
- (optional) return nil if page/section is not found (default: return link to missing page/section)
使用例
{{wiki.page{path: "User:nagtos/備忘録", section: "Subversion"};}}
指定されたWikiページが存在しているか
wiki.pageexists(path) : bool
引数
- path
- str
- wiki page path
使用例
{{wiki.pageexists{path: "レベルデザイン/未解決事項"};}}
指定したページで、指定ユーザーが持っている権限を表示
wiki.pagepermissions(page, user) : map
引数
- page
- any
- (optional) wiki page path or id (default: current page)
- user
- any
- (optional) user name or id (default: current user)
使用例
{{wiki.pagepermissions{page: "レベルデザイン/ミッション一覧", user: "nagtos"};}}
人気のあるページのリストを表示
wiki.popular(max) : xml
引数
- max
- num
- (optional) max number of pages (default: 10)
使用例
{{wiki.popular{max: 5};}}
ページ階層の最近の変更に基づいてタイムスタンプを計算
wiki.recentchangestimestamp(path, pages, tags, comments, files) : str
引数
- pages
- bool
- (optional) include page changes (default: true)
- tags
- bool
- (optional) include tag changes (default: true)
- comments
- bool
- (optional) include comment changes (default: true)
- files
- bool
- (optional) include file changes (default: true)
使用例
{{wiki.recentchangestimestamp{};}}
ページやファイルを検索
wiki.search(query, max, sortBy, constraint, offset) : xml
引数
- query
- str
- search query
- max
- num
- (optional) max results (default: 10)
- sortBy
- str
- (optional) sort field (one of "score", "title", "date", "size", "wordcount", "rating.score", "rating.count"; use "-title" for reverse order; default: "score")
- constraint
- str
- (optional) additional search constraint (default: "")
- offset
- num
- (optional) number of results to skip (default: 0)
使用例
{{wiki.search{query: "トリガ", max: 5, sortBy: "title"};}}
テンプレートページを起動
wiki.template(path, args, target, conflict) : xml
引数
- args
- any
- (optional) template arguments (default: nil)
- target
- str
- (optional) alternative body target (default: nil)
- conflict
- str
- (optional) conflict resolution if target already exists (one of "ignore", "replace", or "append"; default: "ignore")
指定ページの全体または一部のテキストを取得
wiki.text(path, section, revision, nilIfMissing) : str
引数
- path
- str
- wiki page path
- section
- str
- (optional) section to include on wiki page (default: nil)
- revision
- num
- (optional) page revision to use: 0 is the head revision, > 0 stands for a specific revision (e.g. 1 is the first revision), < 0 is revision relative to head revision (e.g. -1 is the previous revision) (default: head revision)
- nilIfMissing
- bool
- (optional) return nil if page/section is not found (default: return name of missing page/section)
使用例
{{wiki.text{path: "User:nagtos/備忘録", section: "Subversion"};}}
指定ページの目次を表示
wiki.toc(path, depth) : xml
引数
- path
- str
- (optional) wiki page path
- depth
- num
- (optional) heading depth for table of contents (default: all)
使用例
{{wiki.toc{path: "レベルデザイン", depth: 1};}}
指定ページから始まるページの階層リストを表示
wiki.tree(path, depth, reverse) : xml
引数
- path
- str
- (optional) wiki page path
- depth
- num
- (optional) nesting depth for retrieving child pages (default: all)
- reverse
- bool
- (optional) 階層を逆順表示
使用例
{{wiki.tree{path: "レベルデザイン/ミッション一覧", depth: 1, reverse: true};}}
指定したページの完全なURIを取得
wiki.uri(path, query) : str
引数
- path
- 文字列
- Wikiのページパス
- query
- 文字列
- 省略可
- セクション名
使用例
{{wiki.uri{path: page.path, query: "wiki.uri(path, query) : str"};}}
Wikiの現バージョン番号を取得
{{wiki.version}}
引数
無し
使用例
{{wiki.version}}