Help:Extensions

From Metabolomics.JP
(Redirected from Doc:Extensions)
Jump to: navigation, search

The list of original commands implemented on the Metabolomics.jp server.


Contents

Tags

<wbr>

Output <wbr> of HTML

Parser Functions

  • Arguments written without default values are required.

data structure

{{#car:str|separator=' '(space)}}

car in Lisp
e.g. {{#car:a;b;c;d;e|;}} => a

{{#cdr:str|separator=' '(space)}}

cdr in Lisp
e.g. {{#cdr:a;b;c;d;e|;}} => b;c;d;e

{{#cadr:str|separator=' '(space)}}

cadr in Lisp
e.g. {{#cadr:a;b;c;d;e|;}} => b

{{#cddr:str|separator=' '(space)}}

cddr in Lisp
e.g. {{#cddr:a;b;c;d;e|;}} => c;d;e

{{#caddr:str|separator=' '(space)}}

caddr in Lisp
e.g. {{#caddr:a;b;c;d;e|;}} => c

{{#cdddr:str|separator=' '(space)}}

cdddr in Lisp
e.g. {{#cdddr:a;b;c;d;e|;}} => d;e

{{#nth:str| num |separator=' '(space)}}

nth in Lisp
e.g. {{#nth:a;b;c;d;e|3|;}} => c

{{#max:num1|num2|...|numN}}

一番大きな値を返します。数字以外が入っていた場合は-1を返します。
e.g. {{#max:5|10|2|24|4|1|12}} => 24

{{#min:num1|num2|...|numN}}

一番小さな値を返します。数字以外が入っていた場合は-1を返します。
e.g. {{#min:5|10|2|24|4|1|12}} => 0

{{#and:list1|list2}}

Returns intersection of two (return-code separated) lists.
e.g.
{{#and:1
2
4|1
3
4}} => 1 4

{{#or:list1|list2}}

Returns union of two (return-code separated) lists.
e.g.
{{#or:1
2
4|1
3
4}} => 1 2 3 4

{{#def:arg|val}}

Define a variable valid only inside the page.
e.g. {{#def:i|1}} => i=1

{{#var:arg}}

Get variable value
e.g. {{#var:i}} => 1

{{#choose:line1 \n line2 \n lin3...|string}}

最初の引数から、stringにマッチする行だけを返します.
e.g. {{#choose:abc1
def2
1234|1}} => abc1

1234


string functions

{{#substring:str|start=0|end=0}}

Returns a substring. Japanese ok.
e.g. {{#substring:Hello world|1}} => "ello world"
e.g. {{#substring:Hello world|1|4}} => "ell"

{{#trim:str}}

Remove white space before and after str. (Deletes \n, \r, \t, \v, \0)
e.g. {{#trim:abc(\n)}} => abc

{{#trimex:str}}

str中のタブと改行を全て削除します。
e.g. {{#trimex:a bc def(\n)}} => abcdef

{{#length:str}}

Returns the length. Japanese ok.
e.g. {{#length:Hello world}} => 11

{{#count:str|pattern}}

Returns the occurrence of pattern. Japanese ok.
e.g. {{#count:abcabcabca|a}} => 4

{{#indexOf:str|pattern=' '(space)|offset=0}}

Returns the first matching index of the pattern. To specify a space, use &#160;.
e.g. {{#indexOf:Hello world|wor}} = 6
e.g. {{#indexOf:Hello world}} = 5

{{#lastIndexOf:str|pattern=' '(space)}}

Returns the last matching index of the pattern. To specify a space, use &#160;.
e.g. {{#lastIndexOf:abc abc abc|abc}} = 8
e.g. {{#lastIndexOf:abc abc abc}} = 7

{{#isdigit: str|yes|no}}

Returns yes if str is digit, otherwise no.
e.g. {{#isdigit:1234567890|This is digit|This is not digit}} => This is digit
e.g. {{#isdigit:123abc456|This is not alphanumeric|This is alphanumeric}} => This is alphanumeric

{{#isalnum:str|yes|no}}

Returns yes if str is alphanumeric, otherwise no.
e.g. {{#isalnum:123abc456|This is alphanumeric|This is not alphanumeric}} => This is alphanumeric
e.g. {{#isalnum:*123abc456*|This is alphanumeric|This is not alphanumeric}} => This is not alphanumeric

{{#replace:str|pattern1|pattern2}}

Replace all occurrences of 'pattern1' into 'pattern2'. To specify a space and vertical bar, use & #160; and & #124;, respectively.
e.g. {{#replace:abcdefghi|def|123}} => abc123ghi
e.g. {{#replace:a b c d|&#160;|1}} => a1b1c1d

{{#cr:}}

:Return code
e.g. {{#cr:}} =>

(return)

{{#bar:}}

Vertical bar
e.g. {{#bar:}} => |

{{#forcedBR:str|width=25}}

Insert<wbr>every width characters.
e.g. {{#forcedBR:123456789012345678901234567890123456789012345678901234567890|10}} => 123456789012345678901234567890123456789012345678901234567890

{{#encode:str}}

渡された文字列内の記号を%と二桁の数値に変換します。
e.g. {{#encode:a%b#c!d=e}} => %61%25%62%23%63%21%64%3D%65

{{#decode:str}}

で変換された文字列を元に戻します。
e.g. {{#decode:%61%25%62%23%63%21%64%3D%65}} => a%b#c!d=e

{{#createstring:str|num}}

strをnum回 繰り返した文字列を返します。
e.g. {{#createstring:abc|3}} => abcabcabc

{{#upcase:str}}

strを全て大文字に変えます。
e.g. {{#upcase:abc}} => ABC

{{#downcase:str}}

strを全て小文字に変えます。
e.g. {{#downcase:ABC}} => abc


flow and IO controls

{{#repeat:template|argc|argl|separator="\n"|prefix=''|postfix=''}}

Repeatedly call the template of argc arguments until the argument list argl depletes. The argl is separated by separator.
To use a space for separator, use &#160;. The vertical bar | cannot be used.
e.g. {{#repeat:template|3|a,b,c,d,e,f,g,h,i|,}} => {{template|a|b|c}}{{template|d|e|f}}{{template|g|h|i}}

{{#repeatnum:template|argc|argl|separator="\n"}}

Repeatedly call the template of argc arguments until the argument list argl depletes. The argl is separated by separator.
To use a space for separator, use &#160;. The vertical bar | cannot be used.
{{#repeat:}}との相違点は、展開時にテンプレート引数の頭に「n=」と番号付けされること。
e.g. {{#repeatnum:template|3|a,b,c,d,e,f,g,h,i|,}} => {{template|1=a|2=b|3=c}}{{template|1=d|2=e|3=f}}{{template|1=g|2=h|3=i}}

{{#map:template|argc|argv1|argv2|...|argvN}}

repeatと同じ機能ですが、こちらは引数を'|'区切りで渡します。
e.g. {{#repeat:template|3|a|b|c|d|e|f|g|h|i}} => {{template|a|b|c}}{{template|d|e|f}}{{template|g|h|i}}

{{#ifexistfile:path}}

Returns the link to the file which exists under path from DOCUMENT_ROOT
e.g. {{#ifexistfile:/index.html}} => index.html

{{#ifexists:page}}

Checks whether the specified page exists. Different from the original 'ifexist' command, it does not check the visible contents in the page.
e.g. {{#ifexists:Image:KOX00002.png|true|false}} => true

{{#javaWithParam:classname|archive|codebase=.|width=100|height=100|parameter=''}}

Returns HTML code to show the java applet. Parameters can be delimited by ';'.
e.g. {{#javaWithParam:Main.class|Main.jar|.|100|100|data=123;id=java}} =>
<object codebase="." code="Main.class" archive="Main.jar" width="100" height="100">
<param name="data" value="123">
<param name="id" value="java">
</object>

{{#lua:program|arg}}

Execute lua program. Arg is accessible with stdin. No io, debug, package, os classes.
e.g. {{#lua:print(stdin)|abc}} => abc


{{#get:name}}

Returns the data sent by get/post.
e.g. {{#get:data}} => abcdef

{{#formtag:str|arg|between}}

Returns HTML tag with arg, and with between string. It accepts only "form, textarea, select, option, optgroup, fieldset, legend, label, input".
The form can perform post method only.
e.g. {{#formtag:input|type="submit"}} => <input type="submit">
e.g. {{#formtag:form|action="-"|...}} => <form action="-" method="post">...</form>

2008/12/4 {{#tag:}}から{{#formtag:}}に変更しました。

{{#graph:type|size=[Width]x[Height];margin=[left=40],[right=20],[top=40],[bottom=40];title=[title];legend=[Left]x[Top];label=[label1],[label2],...;[data1]=[n1-1],[n1-2],...;[data2]=[n2-1],[n2-2],...;...}}

Generate graph by jpgraph.

type 
pie, pie3d, line, hvar, hgbar, vbar, vgbar.
margin 
マージン指定。省略可能。
legend 
position in the range 0<=x<1. (Left upper corner is 0 and right lower corner is 1.)
label 
labels for x-axis
data 
name = comma separated values



e.g.{{#graph:vbar|size=300x300;title=test;legend=0x0;label=a,b,c,d,e,f,g;data1=10,34,20,10,33,23,40}} =>

Database searches

{{#searchLine: str |namespace='Main'|pagename=''}}

Output all matching lines from page pagename in namespace.
Title head and tail, any single character and multiple characters can be specified by ^ and $, _ and %, respectively.
Resulting lines has &&pagename at the beginning of the line.
The search is against the wiki source code in edit mode and is case sensitive.
e.g. {{#searchLine:sandbox|Main|Sandbox}} =>

{{#searchLineReg: str |namespace='Main'|pagename=''}}

searchLineと同じ機能ですが、こちらは正規表現が使えます。また、何もヒットしなかった場合はstrをそのまま返します。
e.g. {{#searchlinereg:http:.*/|Main}} =>

{{#searchLineNot: str |namespace='Main'|pagename=''}}

使い方はsearchLineと同じでstrが存在しないページのタイトルを返します。
e.g. {{#searchlinenot:Extension|Help}} => &&CheckReference

&&PKS &&Pictures &&Reference


{{#searchTitle: str |namespace='Main'}}

Output all matching titles of pages in namespace.
Title head and tail, any single character and multiple characters can be specified by ^ and $, _ and %, respectively.
The search is case sensitive.
e.g. {{#searchTitle:Sandbox.|Main}} => Sandbox/abbrev

Sandbox/orderList Sandbox00 Sandbox000 Sandbox0000 Sandbox0001 Sandbox0002 Sandbox001 Sandbox11 Sandbox111 Sandbox123 Sandbox13 Sandbox15 Sandbox2 Sandbox3 Sandbox33 Sandbox34 Sandbox4 Sandbox40 Sandbox5 Sandbox51 Sandbox52 Sandbox6 Sandbox7 Sandbox80 Sandbox88 Sandbox90 Sandbox91 Sandbox92 Sandbox93 Sandbox94 Sandbox95 Sandbox96 Sandbox98 Sandbox99 SandboxS Sandbox_JDXCompress

2008/12/4 like検索からregexp検索に変更しました。正規表現の対応は以下の通りです。
| → ~
ex. abc(d1|d2)ef[123]g → abc(d1~d2)ef<123>g

{{#countLine: str |namespace='Main'|pagename=''}}

:Count all matching lines from page pagename in namespace.
Title head and tail, any single character and multiple characters can be specified by ^ and $, _ and %, respectively.
The search is against the wiki source code in edit mode and is case sensitive.
e.g. {{#countLine:FL1}} => 0

{{#countTitle: str |namespace='Main'}}

Count all matching titles of pages in namespace.
Title head and tail, any single character and multiple characters can be specified by ^ and $, _ and %, respectively.
The search is case sensitive.
e.g. {{#countTitle:FL1}} => 690

MOL data

{{#formula:id=''}}obsolete

Output formula of the MOL file corresponding to the page title.
By specifying id, the target MOL file(s) can be changed. "&&MOL filename&&" will be appended to the returned results.
You can use restricted regular expressions (^$*.[] only) in specifying id.

e.g. {{#formula:FL1A19}} => {{#formula:FL1A19}}

{{#avemass:id=''}}obsolete

Output average mass of the MOL file corresponding to the page title. The usage of id is the same as {{#formula:}}.
e.g. {{#avemass:FL1A19}} => {{#avemass:FL1A19}}

{{#extmass:id=''}}obsolete

Output exact mass of the MOL file corresponding to the page title. The usage of id is the same as{{#formula:}}.
e.g. {{#extmass:FL1A19}} => {{#extmass:FL1A19}}

{{#smiles:id=''}}obsolete

Output SMILES of the MOL file corresponding to the page title. The usage of id is the same as{{#formula:}}.
e.g. {{#smiles:FL1A19}} => {{#smiles:FL1A19}}

Misc

{{#clink: pagename}}

Obtain the list of pages linked to the Category page.

{{#getenv: 変数名}}

環境変数の値を取得します。現在は「lang」のみ使用可能です。


Meta Extensions

{{#jdxfilepath:filename}}

ファイル名前空間のファイルのDocumentRootからのパスを取得します。
e.g. {{#jdxfilepath:Salviae miltiorhizae LC-MS.gz}} => /mediawiki/images/0/09/Salviae_miltiorhizae_LC-MS.gz

{{#jdxfilesize:filename}}

ファイル名前空間のgz圧縮されたファイルのファイルサイズを取得します。
e.g. {{#jdxfilesize:Salviae miltiorhizae LC-MS.gz}} => 6085097



Parse Extensions

Volatile page [[Volatile:pagename|arg1|arg2|...|linkname]]

A page in the Volatile namespace is not cached and is always dynamically generated. A volatile page has the same format as MediaWiki's 'template' and is internal-linked from other pages with arguments.
The given arguments will replace {{{X}}} contents in the target volatile page. Their correspondence is {{{1}}}=arg1, {{{2}}}=arg2 and so on. You may specify argument name {{{ID}}} as[[Volatile:pagename|ID=arg1|linkname]].

Persist Page {{#persist:pagename|button_title|template name|number of args|args|separator=;|recursive=false}}

A page in the Persist namespace is always dynamically generated. The page itself has no content. recursiveはfalseを指定すると、テンプレートを一度だけ展開します。trueを指定すると展開できなくなるまで展開し続けます。


Special Pages

RemoteSearch

使い方はsearchLineとsearchTitleと同じです。ただ名前空間の指定に$egRemoteSearchURLで指定した識別名を追加するだけです。次の例はlipidbank.jp/wiki/上のCategory名前空間にあるLBをページ名に含むページのリストを取得しています。

-== LocalSettings.php ==-
$egRemoteSearchURL = array(
  'lipidbank' -> 'lipidbank.jp/wiki/',
);
-== mediawikiページ上 ==-
{{#searchtitle:LB|lipidbank:Category}}
-== 結果 ==-


YankRemoteImage

使い方は画像表示と同じです。ただ先頭に$egYankRemoteURLで指定した識別名を追加するだけです。次の例はlipidbank.jp/wiki/上にあるLBF09000OX05.pngの画像を呼び出しています。

-== LocalSettings.php ==-
$egYankRemoteURL = array(
  'lipidbank' -> 'lipidbank.jp/wiki/',
);
-== mediawikiページ上 ==-
[[lipidbank:File:LBF09000OX05.png]]
-== 結果 ==-

Others

Search

Modification of search function
  • case independent
  • '_' matches any letter
  • '%' matches any string

Existing Extensions Installed

CategoryTree

Extension:CategoryTree

ParserFunctions

Extension:ParserFunctions
Help

Variables

Extension:Varibles

Original Extensions

Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox