Project

General

Profile

Actions

TraditionalChineseWikiFormatting » History » Revision 1

Revision 1/2 | Next »
Ben Huang, 2014-10-21 02:19


文字格式設定

連結

Redmine 連結

在任何可以使用文字格式設定的地方,Redmine 都允許在資源(問題、變更集、 Wiki 頁面...)間建立超連結。

  • 連結至一個問題: #1 (顯示 #1, 若該問題已結束,則會使用刪除線來顯示連結)
  • 連結至一個問題的筆記: #124-6, 或 #124#note-6
  • 連結至一個變更集: r758 (顯示 r758)
  • 連結至一個使用非數字雜湊碼的變更集: commit:c6f4d0fd (顯示 c6f4d0fd).

Wiki 連結:

  • [[Guide]] 顯示一個頁面名稱為 'Guide' 的連結: Guide
  • [[Guide|User manual]] 使用不同的文字來顯示相同頁面的連結: User manual
  • [[Guide#User-guide|User guide]] 使用不同的文字來顯示相同頁面中某個標題的連結: User guide

您也可以連結至其他專案的 Wiki 頁面(使用專案的代碼):

  • [[sandbox:some page]] 顯示 Sanbox 專案 wiki 頁面的一個名為 'Some page' 的連結
  • [[sandbox:]] 顯示 Sandbox 專案 wiki 首頁的連結

當頁面不存在的時候, Wiki 連結會以紅色的方式顯示,例如: Nonexistent page.

連結至其他資源:

  • 文件:
    • document#17 (連結到編號為 17 的文件)
    • document:Greetings (連結至標題為 "Greetings" 的文件)
    • document:"Some document" (文件標題包含空白字元時,可以使用雙引號來標示)
    • sandbox:document:"Some document" (連結至 "sandbox" 專案中,標題為 "Some document" 的文件)
  • 版本:
    • version#3 (連結至編號為 3 的版本)
    • version:1.0.0 (連結至名稱為 "1.0.0" 的版本)
    • version:"1.0 beta 2" (版本名稱包含空白字元時,可以使用雙引號來標示)
    • sandbox:version:1.0.0 (連結至 "sandbox" 專案中,名稱為 "1.0.0" 的版本)
  • 附加檔案:
    • attachment:file.zip (連結至目前物件中,名稱為 file.zip 的附加檔案)
    • attachment:"some file.zip" (檔案名稱包含空白字元時,可以使用雙引號來標示)
    • 目前, 僅提供參考到目前物件中的附加檔案 (若您正位於一個問題中,僅可參考位於此問題中的附加檔案)
  • 變更集:
    • r758 (連結至一個變更集)
    • commit:c6f4d0fd (連結至一個使用非數字雜湊的變更集)
    • svn1|r758 (連結至指定儲存機制中的變更集,用於使用多個儲存機制的專案)
    • commit:hg|c6f4d0fd (連結至指定儲存機制中,使用非數字雜湊的變更集)
    • sandbox:r758 (連結至其他專案的變更集)
    • sandbox:commit:c6f4d0fd (連結至其他專案中,使用非數字雜湊的變更集)
  • 儲存機制中之檔案:
    • source:some/file (連結至專案儲存機制中,位於 /some/file 的檔案)
    • source:some/file@52 (連結至此檔案的 52 版次)
    • source:some/file#L120 (連結至此檔案的第 120 行)
    • source:some/file@52#L120 (連結至此檔案的 52 版次中的第 120 行)
    • source:"some file@52#L120" (當 URL 包含空白字元時,可以使用雙引號來標示)
      (連結至指定儲存機制中的此檔案,用於專案使用多個儲存機制時之情況)
    • source:repo_identifier|some/file (連結至其他儲存機制中的檔案,用於使用多個儲存機制的專案)
    • source:"repo_identifier|some file" (連結至其他儲存機制中的檔案,有空白字元的檔名)
    • export:some/file (強制下載此檔案)
  • 論壇:
    • forum#2 (連結至編號為 2 的論壇)
    • forum:Discussion (連結至名稱為 "Discussion" 的論壇)
    • forum:"Help and more" (當論壇名稱包含空白字元時,可以使用雙引號來標示)
  • 論壇訊息:
    • message#1218 (連結至編號為 1218 的訊息)
  • 新聞項目:
    • news#1 (連結至編號為 1 的新聞項目)
    • news:Greetings (連結至名稱為 "Greetings" 的新聞項目)
    • news:"eCookbook first release !" (當新聞項目名稱包含空白字元時,可以使用雙引號來標示)
  • 專案:
    • project#3 (連結至編號為 3 的專案)
    • project:someproject (連結至名稱為 "someproject" 的專案)
    • project:"Multiple words project" (當專案名稱包含空白字元時,可以使用雙引號來標示)

逸出字元:

  • 您可以在文字的前面加上驚嘆號 (!) 來避免該文字被剖析成 Remine 連結

外部連結

HTTP 連結與電子郵件地址會自動被轉換成可點擊的連結:

HTTP 連結也可以使用不同的文字來顯示:

  • "Redmine web site":http://www.redmine.org -- 使用不同文字的外部連結(標準的 textile 語法): Redmine web site
  • !http://www.redmine.org/attachments/7069/Redmine_logo.png(Redmine web site)!:http://www.redmine.org -- 顯示一個帶有標題並連結至 URL 的外部影像:

Redmine web site

電子郵件地址

電子郵件地址被自動轉為可點擊的連結:

  • "Email someone":mailto:someone@foo.bar -- 以不同文字顯示的電子郵件連結: Email someone

更複雜的電子郵件指令可以被加入到電子郵件連結。可以定義一個預設的主旨,預設的內文和 CC 資訊。請注意,在這些欄位中的任何空白字元需要替換為 %20。

  • "Email webmaster and admin":mailto:webmaster@foo.bar?cc=admin@foo.bar -- Email 給 webmaster, CC 給 admin: Email webmaster and admin
  • "Email someone for help":mailto:someone@foo.bar?subject=Website%20Help -- 帶有主旨 "Website Help" 的電子郵件連結: Email someone for help
  • "Email someone for help":mailto:someone@foo.bar?subject=Website%20Help&body=My%20problem%20is%20 -- 帶有主旨 "Website Help" 和預設內文的電子郵件連結: Email someone for help

文字格式設定

對於像是標題、粗體字、表格、清單等項目, Redmine 支援使用 Textile 語法 http://redcloth.org/hobix.com/textile/ 關於使用這些格式化功能的說明資訊。下面包含了一些使用範例,但格式化引擎的處理能力遠多於這些簡單的使用範例。

首字母縮寫字

JPL(Jean-Philippe Lang)

顯示:

JPL

字型樣式

* *bold*
* _italic_
* *_bold italic_*
* +underline+
* -strike-through-
* Plain ^superscript^
* Plain ~subscript~
* @inline monospace@
* normal *bold* _italic_ normal;E=mc ^2^
* normal<notextile></notextile>*bold*<notextile></notextile>_italic_<notextile></notextile>normal;E=mc<notextile></notextile>^2^
* Escaping: <notextile>*bold* _italic_ @inlinemono@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Alternative using HTML-codes: &#42;bold&#42; &#95;italic&#95; &#64;inlinemono&#64;
* <pre>*some lines*      some "link":http://www.redmine.org</pre>
* <pre><notextile></notextile>*some lines*      some "link":http://www.redmine.org</pre>

顯示:

  • bold
  • italic
  • bold italic
  • underline
  • strike-through
  • Plain superscript
  • Plain subscript
  • inline monospace
  • normal bold italic normal;E=mc 2
  • normalbolditalicnormal;E=mc2
  • Escaping: *bold* _italic_ @inlinemono@       Alternative using HTML-codes: *bold* _italic_ @inlinemono@
  • *some lines*      some "link":http://www.redmine.org
  • some lines      some link

顏色

* %{color:red}red% %{color:green}green% %{color:yellow}yellow% %{color:#82B6E1}blue'ish%
* %{color:red}red%<notextile></notextile>%{color:green}green%<notextile></notextile>%{color:yellow}yellow%<notextile></notextile>%{color:#82B6E1}blue'ish%
* %{background:lightgreen}Lightgreen Background% %{background:yellow}Yellow Background%
* %{background:lightgreen}Lightgreen Background%<notextile></notextile>%{background:yellow}Yellow Background%

顯示:

  • red green yellow blue'ish
  • redgreenyellowblue'ish
  • Lightgreen Background Yellow Background
  • Lightgreen BackgroundYellow Background

Inline 影像

  • !image_url! 顯示位於 image_url 的影像(textile syntax)
  • !>image_url! 向右浮動的影像
  • !image_url(Image title)! 顯示具有 alt/title 屬性的影像
  • !image_url!:URL 顯示位於 image_url 的影像,並加入 URL 連結

如果您有影像檔附加到您的 wiki 頁面,可以使用它的檔案名稱來 inline 顯示: !attached_image.png!

您也可以套用 CSS 樣式到影像,與套用樣式到 SPAN 相同。程式碼 !{width: 100%}attached_image.png! 將影像的大小調整為父元素的寬度。

標題

h1. Heading

h2. Subheading

h3. Subheading

Redmine 為每一種標題指定一個 HTML 錨點 (anchor) ,因此您可使用 "#Heading"、"#Subheading" 等方式連結至這些標題。

段落

p. left aligned

  p(. left ident 1em

    p((. left ident 2em
    as well as for following lines

                                                                                   p>. right aligned

                                                                        p)))>. right ident 3em

                           p=. This is centered paragraph.

水平線

----

顯示:


預定義格式

若要逸出 wiki 語法

 <pre> *您的文字將不會變成粗體字* </pre> 

顯示:

 *您的文字將不會變成粗體字* 

引用文字

使用 bq. 開始一個引文段落:

bq. Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
To go live, all you need to add is a database and a web server.

顯示:

Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
To go live, all you need to add is a database and a web server.

您也可以在每一行的開頭使用 >,然後堆疊它們進行巢狀的引用:

>> Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
>> To go live, all you need to add is a database and a web server.
> Great!

顯示:

Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
To go live, all you need to add is a database and a web server.

Great!

項目清單

* Item 1
* Item 2
** Item 21
** Item 22
* Item 3

顯示:

  • Item 1
  • Item 2
    • Item 21
    • Item 22
  • Item 3

編號清單

# Item 1
# Item 2
# Item 3
## Item 3.1
## Item 3.2

顯示:

  1. Item 1
  2. Item 2
  3. Item 3
    1. Item 3.1
    2. Item 3.2

表格

|_.UserID      |_.Name          |_.Group     |_. attribute list   |
|Starting with | a              |   simple   |row                 |
|\3=.IT                                      |<. align left       |
|1             |Artur Pirozhkov |/2.Users    |>. align right      |
|2             |Vasya Rogov     |=. center   |
|3             |John Smith      |Admin
                                 (root)      |^. valign top       |
|4             |-               |Nobody
                                 (anonymous) |~. valign bottom    |

顯示 (所有多個空白字元將被取代為一個空白):

UserID Name Group attribute list
Starting with a simple row
IT align left
1 Artur Pirozhkov Users align right
2 Vasya Rogov center
3 John Smith Admin
(root)
valign top
4 - Nobody
(anonymous)
valign bottom

如果您要在你表格中(例如,wiki 連結)包含管線字元(|),您必須防止 textile 解譯它們:

Input Output
<notextile>|</notextile> |

目錄

{{toc}} => 靠左對齊目錄
{{>toc}} => 靠右對齊目錄

請記得,toc 標記的上一行和下一行必須是空白行,而且它的前後不能有其它文字。

範例:


h1. headLineOne

h2. something

{{toc}}

h2. something more

巨集

Redmine 包含一個巨集系統,允許您加入自訂函數,以在格式化文字中插入動態內容。您可以學習編寫您自己的巨集,在 RedmineMacros 已包含幾個內建巨集:

hello_world
Sample macro.
macro_list
Displays a list of all available macros, including description if available.
child_pages
Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:

{{child_pages}} -- can be used from a wiki page only
{{child_pages(depth=2)}} -- display 2 levels nesting only
{{child_pages(Foo)}} -- lists all children of page Foo
{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo
include
Includes a wiki page. Examples:

{{include(Foo)}}
{{include(projectname:Foo)}} -- to include a page of a specific project wiki
collapse
Inserts of collapsed block of text. Examples:

{{collapse
This is a block of text that is collapsed by default.
It can be expanded by clicking a link.
}}

{{collapse(View details...)
With custom link text.
}}
thumbnail
Displays a clickable thumbnail of an attached image.
Default size is 200 pixels. Examples:

{{thumbnail(image.png)}}
{{thumbnail(image.png, size=300, title=Thumbnail)}} -- with custom title and size
issue
Displays an issue link including additional information. Examples:

{{issue(123)}}                              -- Issue #123: Enhance macro capabilities
{{issue(123, project=true)}}                -- Andromeda - Issue #123: Enhance macro capabilities
{{issue(123, tracker=false)}}               -- #123: Enhance macro capabilities
{{issue(123, subject=false, project=true)}} -- Andromeda - Issue #123
sample_macro
Sample macro

程式碼高亮度顯示

程式碼高亮度顯示依賴 CodeRay Ruby 所編寫的。它目前支援 C, C++, CSS, Delphi, Diff, Groovy, HTML, Java, Javascript, JSON, Nitro-XHTML, PHP, Python, RHTML, Ruby, Scheme, SQL, XML 和 YAML 程式碼。

您可以在您的 wiki 頁面中高亮度顯示程式碼,使用以下的語法:

<pre><code class="ruby">
  Place your code here.
</code></pre>

範例:

# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end

  def salute
    puts "Hello #{@name}!" 
  end
end

Textile 格式化

Redmine 支援 textile 格式化。詳細資訊請參閱 Textile syntax

額外支援的 textiles:
  • %{background:lightgreen}綠色背景% 顯示 綠色背景

Updated by Ben Huang over 9 years ago · 1 revisions