Python@TW: 會眾| IRC| Planet| 郵件列表| 聯絡我們

巨集

在wiki頁面嵌入巨集,以引入系統功能。試著編輯最新更動系統資訊,就知道是怎麼回事了。

更多的標記資訊請參照說明/編輯頁面

搜尋巨集

目前MoinMoin使用的新搜尋引擎,提供支援複雜型態的互動式搜尋,以及嵌入頁面的搜尋巨集。詳細說明請參照說明/搜尋本站

巨集

功能

範例

[[AdvancedSearch]]


於頁面中嵌入「進階搜尋」對話框

請見尋找頁面

[[TitleSearch]]


於頁面中嵌入「搜尋頁面標題」對話框

請見尋找頁面

[[FullSearch]]


於頁面中嵌入「全文檢索」對話框

請見尋找頁面

[[FullSearch()]]


列出內容包含此頁面標題(頁面名稱)的所有頁面,其作用與點選頁面標題連結相同。

請見CategoryCategory

[[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])]]


列出同屬於父頁面的頁面

See HelpOnMacros/MailTo

[[Navigation(slideshow)]]


嵌入簡報功能表

請見說明/簡報

[[Navigation(slides)]]


嵌入首頁/上頁/下頁/末頁連結

請見說明/簡報

[[AttachInfo]]


displays number of attachments for current page

See HelpOnActions/AttachFile

[[AttachInfo(page)]]


displays number of attachments for page

See HelpOnActions/AttachFile

[[AttachList]]


列出本頁附件

See HelpOnActions/AttachFile

[[AttachList(page)]]


列出指定頁面的附件

See HelpOnActions/AttachFile

系統資訊

巨集

功能

範例

[[InterWiki]]


列出所有已知Wiki站際的站名(InterWiki names)

Wiki站際

[[SystemInfo]]


關於wiki系統、python直譯器及主機系統的資訊。

系統資訊

[[PageCount(exists)]]


顯示本站頁面數量。若加上參數exists,將只計算存在的面頁數量。

共16922頁

[[PageSize]]


列出所有頁面的容量

請見頁面大小

[[StatsChart(type)]]


顯示統計圖表 (目前項目有︰點擊次數、頁面大小及瀏覽器)

請見事件統計與其子頁面

[[SystemAdmin]]


給系統管理員的資訊

必須有管理權限

[[EditedSystemPages]]


列出修改過的系統頁面

  1. BadContent
  2. FrontPage
  3. WikiSandBox
  4. Wiki沙盤

其它

巨集

功能

範例

[[ImageLink(image,target[,width=width[,height=height]][,alt=alttag])]]


本巨集用來製作圖形連結。圖形參數可以用附件或URL;連結參數可為URL或wiki頁面;額外參數則用來調整圖形大小。若無連結參數,則連結將指向圖形本身。

See HelpOnMacros/ImageLink

[[Icon(image)]]


顯示系統圖示

請見說明/瀏覽本站

[[UserPreferences]]


嵌入「使用者設定」對話框

請見說明/使用者設定

[[UserPreferences(createonly)]]


嵌入「使用者註冊」對話框

[[BR]]


插入換行符號

1st line
2nd line

[[RandomQuote(pagename)]]


Select a random quote from the given page, or from FortuneCookies if ommitted

Hint: Edit the FortuneCookies page to display randomly selected wisdom here.

[[Include(HelloWorld[,"heading"[,level]])]]


引入另一頁面內容

詳情請見HelpOnMacros/Include

[[FootNote(text)]]


加入腳注1。無巨集參數時,將於書寫處嵌入腳注列表。

請見底下範例

[[Date(timestamp)]]


依系統設定格式顯示日期。

2024-03-29

[[DateTime(timestamp)]]


依系統設定格式顯示日期時間2

2024-03-29 04:01:22

[[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 "[你不能閱讀 FooBar]"

[[TeudView]]


useful for intranet developer wikis, a means to view pydoc documentation, formatted via a XSLT stylesheet

See http://twistedmatrix.com/wiki/python/TeudProject

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

See HelpOnMacros/MonthCalendar

  1. 不可以wiki標記修飾腳注文字 (1)

  2. 參數「timestamp」可為空白(顯示當下日期時間),從1970年至今秒數(unix timestamp),或者w3C 時間格式(如2002-01-23T12:34:56)。請參考RFC822第五節。 (2)

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

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:

   1 Dependencies = []
   2 def execute(macro, args):
   3     return macro.formatter.text("I got these args from a macro %s: %s" %
   4     (str(macro), args))