巨集
在wiki頁面嵌入巨集,以引入系統功能。試著編輯最新更動或系統資訊,就知道是怎麼回事了。
更多的標記資訊請參照說明/編輯頁面。
搜尋巨集
目前MoinMoin使用的新搜尋引擎,提供支援複雜型態的互動式搜尋,以及嵌入頁面的搜尋巨集。詳細說明請參照說明/搜尋本站。
巨集 |
功能 |
範例 |
<<AdvancedSearch>> |
||
|
於頁面中嵌入「進階搜尋」對話框 |
請見尋找頁面 |
<<TitleSearch>> |
||
|
於頁面中嵌入「搜尋頁面標題」對話框 |
請見尋找頁面 |
<<FullSearch>> |
||
|
於頁面中嵌入「全文檢索」對話框 |
請見尋找頁面 |
<<FullSearch()>> |
||
|
列出內容包含此頁面標題(頁面名稱)的所有頁面,其作用與點選頁面標題連結相同。 |
|
<<FullSearch(text)>> |
||
|
列出內容包含檢索詞的所有頁面 |
Search for powered: |
<<FullSearchCached(text)>> |
||
|
功能同FullSearch巨集,並將搜尋結果放入快取,下次執行時直接讀入快取資料。當您覺得速度比即時性(up-to-date)重要,就用它吧! |
Search for powered: |
<<GoTo>> |
||
|
於頁面中嵌入「跳至此頁」對話框 |
請見尋找頁面 |
<<PageList(Help)>> |
||
|
列出標題(名稱)包含檢索詞的所有頁面 |
請見說明/索引 |
導覽
巨集 |
功能 |
範例 |
<<RecentChanges>> |
||
|
列出最近更動過的頁面 |
請見最新更動 |
<<TitleIndex>> |
||
|
列出所有頁面標題 |
請見標題索引 |
<<WordIndex>> |
||
|
列出所有頁面標題中詞彙(如 WikiName 包含兩個詞彙 Wiki 和 Name) |
請見詞彙索引 |
<<WantedPages>> |
||
|
列出被連結但還不存在的頁面 |
請見未定義頁 |
<<OrphanedPages>> |
||
|
列出沒有被其它頁面連結的頁面 |
請見孤立頁面 |
<<AbandonedPages>> |
||
|
列出很久沒有變動的頁面 |
請見遺棄頁面 |
<<RandomPage>> |
||
|
隨機嵌入一個頁面連結 |
|
<<RandomPage(#)>> |
||
|
隨機嵌入指定數量的頁面連結 |
兩個隨機頁面: |
<<TableOfContents([maxdepth])>> |
||
|
顯示內容目錄,可限制顯示的層數。 |
見本頁頁首 |
<<Anchor(anchorname)>> |
||
|
在指定位置插入錨點 |
#here |
<<Navigation(children[,maxdepth])>> |
||
|
列出所有子頁面 |
請見本頁頁首 |
<<Navigation(siblings[,maxdepth])>> |
||
|
列出同屬於父頁面的頁面 |
|
<<Navigation(slideshow)>> |
||
|
嵌入簡報功能表 |
請見說明/簡報 |
<<Navigation(slides)>> |
||
|
嵌入首頁/上頁/下頁/末頁連結 |
請見說明/簡報 |
<<AttachInfo>> |
||
|
displays number of attachments for current page |
|
<<AttachInfo(page)>> |
||
|
displays number of attachments for page |
|
<<AttachList>> |
||
|
列出本頁附件 |
|
<<AttachList(page)>> |
||
|
列出指定頁面的附件 |
系統資訊
巨集 |
功能 |
範例 |
<<InterWiki>> |
||
|
列出所有已知Wiki站際的站名(InterWiki names) |
|
<<SystemInfo>> |
||
|
關於wiki系統、python直譯器及主機系統的資訊。 |
|
<<PageCount(exists)>> |
||
|
顯示本站頁面數量。若加上參數exists,將只計算存在的面頁數量。 |
共1928頁 |
<<PageSize>> |
||
|
列出所有頁面的容量 |
請見頁面大小 |
<<StatsChart(type)>> |
||
|
顯示統計圖表 (目前項目有︰點擊次數、頁面大小及瀏覽器) |
請見事件統計與其子頁面 |
<<SystemAdmin>> |
||
|
給系統管理員的資訊 |
必須有管理權限 |
<<EditedSystemPages>> |
||
|
列出修改過的系統頁面 |
|
其它
巨集 |
功能 |
範例 |
<<ImageLink(image,target[,width=width[,height=height]][,alt=alttag])>> |
||
|
本巨集用來製作圖形連結。圖形參數可以用附件或URL;連結參數可為URL或wiki頁面;額外參數則用來調整圖形大小。若無連結參數,則連結將指向圖形本身。 |
|
<<Icon(image)>> |
||
|
顯示系統圖示 |
請見說明/瀏覽本站 |
<<UserPreferences>> |
||
|
嵌入「使用者設定」對話框 |
請見說明/使用者設定 |
<<UserPreferences(createonly)>> |
||
|
嵌入「使用者註冊」對話框 |
|
<<BR>> |
||
|
插入換行符號 |
1st line |
<<RandomQuote(pagename)>> |
||
|
Select a random quote from the given page, or from FortuneCookies if ommitted |
Hint: Set your pages language with #language en processing instruction. See also HelpOnLanguages. |
<<Include(HelloWorld[,"heading"[,level]])>> |
||
|
引入另一頁面內容 |
|
<<FootNote(text)>> |
||
|
加入腳注1。無巨集參數時,將於書寫處嵌入腳注列表。 |
請見底下範例 |
<<Date(timestamp)>> |
||
|
依系統設定格式顯示日期。 |
2024-11-08 |
<<DateTime(timestamp)>> |
||
|
依系統設定格式顯示日期時間2。 |
2024-11-08 12:26:04 |
<<GetText(text)>> |
||
|
讀取I18N文字(主要用於說明頁面) |
"EditText"被翻譯為「EditText」 |
<<GetText2(,message,argument1,argument2,...)>> |
||
|
loads I18N texts (mainly intended for use on Help pages or in generated output on wiki pages) and replaces %s in the message by the arguments. The first character of the argument is used as the separator (in this example: a comma). You can escape the separator by using a backslash. |
"<<GetText2(,[You may not read %s],FooBar)>>" yields "[You may not read FooBar]" |
<<TeudView>> |
||
|
useful for intranet developer wikis, a means to view pydoc documentation, formatted via a XSLT stylesheet |
|
<<MailTo(email)>> |
||
|
防止垃圾郵件的Email表示法 |
詳情請見 HelpOnMacros/MailTo |
<<NewPage(PageTemplate,ButtonLabel,[ParentPage,@ME,@SELF] [,NameTemplate])>> |
||
|
Allow the user to create (sub-) pages easily, using the page PageTemplateas the template for the new page and the string NameTemplate as a template for the name.3 @ME is used if you want the page created below the users homepage. @SELF is used to create a subpage below the page where it is called from. |
|
<<GetVal(NeatSnippets,regards)>> |
||
|
Retrieve dictionary entries from dict pages. |
If you have a page called GermanDict which contains the entry Test, you should see the translation here: |
<<MonthCalendar(,,12)>> |
||
|
Displays a Calendar and creates link for entries to each day on subpages |
不可以wiki標記修飾腳注文字 (1)
參數「timestamp」可為空白(顯示當下日期時間),從1970年至今秒數(unix timestamp),或者w3C 時間格式(如2002-01-23T12:34:56)。請參考RFC822第五節。 (2)
NameTemplate is formatted with time.strftime(), with the exception of %s which is replaced by the input into the edit box (which is only shown if necessary). If NameTemplate is not specified or empty, it defaults to %s. (3)
動手寫巨集
Create a python file called MacroName.py located in your data/plugin/macro directory. Ensure it has a single method called execute(macro, arguments), which is the entry-point.
macro is an instance of class Macro, and also evaluates to a string of the macroname.
arguments is an arbitrary argument string you can pass in with parameters to your macro.
All Macro instances have a request member through which you can access the form parameters and other information related to user interaction.
execute() should use the formatter to construct valid markup for the current target format. In most cases this is HTML, so writing a macro which returns HTML will work in most cases but fail when formats like XML or text/plain are requested.
For example, your wiki page has the following line on it:
<<MacroName(arg1,arg2,arg3)>>
You could write a MacroName.py file like this:
Add an entry into Dependencies if the output from your macro should not be cached. This is important if the macro output could change from one moment to another, for example if your macro searches in wiki pages which may be being edited by other users, or loads information from an external database whose contents may change. Currently the value of any entry does not matter and may be considered a short description for 'why results from this macro should not be cached', but please look at the entries used in other macros for values which may be suitable.