Project

General

Profile

SimplifiedChineseWikiFormatting » History » Revision 16

Revision 15 (Charles Sun, 2018-06-08 05:08) → Revision 16/18 (Charles Sun, 2018-06-08 05:14)

h1. Textile 格式化 


 以下是 *Textile* 的格式化信息. 有关 *Markdown* 的格式化信息请参见 [[RedmineTextFormattingMarkdown]]. 
 有关当前Textile支持的限制,请参见 #6269, #10078 (Definition Lists). 

 {{>TOC}} 

 h2. 链接 

 h3. Redmine 链接 

 {{include(RedmineTextFormattingRedmineLinksSimplifiedChinese)}} 

 h3. 外部链接 

 URL地址(http, https, ftp 和 ftps)可以被自动转换成可点击的链接:  
 * *http://www.redmine.org* -- 外部链接至redmine官网: http://www.redmine.org 

 URL地址也可以使用不同的文本来显示: 
 * *"Redmine官网":http://www.redmine.org* -- 以不同的文本显示Redmine官网的外部链接:"Redmine官网":http://www.redmine.org 
 * *!http://www.redmine.org/attachments/7069/Redmine_logo.png(Redmine web site)!:http://www.redmine.org* -- 用带标题的外部图片来表示一个外部链接: 

 p=. !http://www.redmine.org/attachments/7069/Redmine_logo.png(Redmine web site)!:http://www.redmine.org 

 链接的 UNC 路径中可使用文件 URI : 
 * *"\\server\share$":file://///server/share%24* -- 使用文件 URI 的 UNC 路径: "\\server\share$":file://///server/share%24 
 你需要对特殊字符做 "URL 编码":http://www.w3schools.com/tags/ref_urlencode.asp,比如: 空格, $, á, é, í, ó, ú, 等等。 


 h3. Email地址 

 Email地址能够被自动转换成可点击的链接: 

 * *someone@foo.bar* -- 链接到一个email地址: someone@foo.bar 
 * *"Email someone":mailto:someone@foo.bar* -- 用不同的文本显示Email链接: "Email someone":mailto:someone@foo.bar 

 还可以将更加复杂的指令添加到Email链接中。可以设置默认的主题、正文和抄送地址。但请注意,这些字段里的空格都要编码成%20(详细可参考URL编码)。 
 * *"Email webmaster and admin":mailto:webmaster@foo.bar?cc=admin@foo.bar* -- Email给webmaster,抄送给admin: "Email webmaster and admin":mailto:webmaster@foo.bar?cc=admin@foo.bar 
 * *"Email someone for help":mailto:someone@foo.bar?subject=Website%20Help* -- 主题为"Website Help"的Email链接: "Email someone for help":mailto:someone@foo.bar?subject=Website%20Help 
 * *"Email someone for help":mailto:someone@foo.bar?subject=Website%20Help&body=My%20problem%20is%20* -- 主题为"Website Help",缺省正文为"My problem is "的Email链接: "Email someone for help":mailto:someone@foo.bar?subject=Website%20Help&body=My%20problem%20is%20 

 h2. 文本格式 

 对于像是标题、粗体、表格、列表等文字格式, Redmine 支持使用 "Textile":http://en.wikipedia.org/wiki/Textile_%28markup_language%29 语法。 可以到 http://redcloth.org/hobix.com/textile/ 查找关于使用这些特性的信息。下面将展示其中的一些常用的语法。 

 h3. 缩写 

 <pre> 
 JPL(Jean-Philippe Lang) 
 </pre> 

 显示: 

 JPL(Jean-Philippe Lang) 

 h3. 字体风格 

 <pre><code>* *粗体* 
 * _斜体_ 
 * *_粗体 斜体_* 
 * +下划线+ 
 * -中划线- 
 * 文字 ^上标^ 
 * 文字 ~下标~ 
 * @inline monospace@ 
 * <notextile>正常字体 *粗体* _斜体_ 正常字体;E=mc ^2^</notextile> 
 * <notextile>正常字体<notextile></notextile>*粗体*<notextile></notextile>_斜体_<notextile></notextile>正常字体;E=mc<notextile></notextile>^2^</notextile> 
 * <notextile>转义: <notextile>*粗体* _斜体_ @inlinemono(等宽字体)@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    或者使用 HTML 代码:&#42;粗体&#42; &#95;斜体&#95; &#64;inlinemono(等宽字体)&#64;</notextile> 
 * <notextile><pre>*一些文字*        "一个链接":http://www.redmine.org</pre></notextile> 
 * <notextile><pre><notextile></notextile>*一些文字*        "一个链接":http://www.redmine.org</pre></notextile> 
 </code></pre> 

 显示为: 

  * *粗体* 
  * _斜体_ 
  * *_粗体 斜体_* 
  * +下划线+ 
  * -中划线- 
  * 文字 ^上标^ 
  * 文字 ~下标~ 
  * @inline monospace(等宽字体)@ 
  * 正常字体 *粗体* _斜体_ 正常字体;E=mc ^2^ 
  * 正常字体<notextile></notextile>*粗体*<notextile></notextile>_斜体_<notextile></notextile>正常字体;E=mc<notextile></notextile>^2^ 
  * 转义: <notextile>*粗体* _斜体_ @inlinemono(等宽字体)@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 或者用 HTML 代码替代: &#42;粗体&#42; &#95;斜体&#95; &#64;inlinemono(等宽字体)&#64; 
  * <pre>*一些文字*        "一个链接":http://www.redmine.org</pre> 
  * <pre><notextile></notextile>*一些文字*        "一个链接":http://www.redmine.org</pre> 

 h3. 加入色彩 

 <pre><code><notextile>* %{color:red}红色% %{color:green}绿色% %{color:yellow}黄色% %{color:#82B6E1}蓝色% 
 * %{color:red}红色%<notextile></notextile>%{color:green}绿色%<notextile></notextile>%{color:yellow}黄色%<notextile></notextile>%{color:#82B6E1}蓝色% 
 * %{background:lightgreen}淡绿背景% %{background:yellow}黄色背景% 
 * %{background:lightgreen}淡绿背景%<notextile></notextile>%{background:yellow}黄色背景% 
 </notextile></code></pre> 

 显示为: 

  * %{color:red}红色% %{color:green}绿色% %{color:yellow}黄色% %{color:#82B6E1}蓝色% 
  * %{color:red}红色%<notextile></notextile>%{color:green}绿色%<notextile></notextile>%{color:yellow}黄色%<notextile></notextile>%{color:#82B6E1}蓝色% 
  * %{background:lightgreen}淡绿背景% %{background:yellow}黄色背景% 
  * %{background:lightgreen}淡绿背景%<notextile></notextile>%{background:yellow}黄色背景% 

 h3. 内嵌图片 

 * *!;image_url!;* 显示位于“image_url”路径的图片 
 * *!;>image_url!;* 使图片在页面右侧显示 
 * *!;image_url(图片名称)!;* 改变图片显示的名称为“图片名称” 
 * *!;image_url!;:URL* 显示位于“image_url”路径的图片, 并给图片加上超链接“URL” 

 你可以上传图片附件到 wiki 页面,然后使用它的文件名作为路径: *!;已上传的图片.png!;* 

 你也可以对图片应用CSS风格。代码 *&#33;{width: 100%}attached_image.png&#33;* 使图片调整为父元素的宽度。 

 h3. 标题 

 <pre><code>h1. 一级标题 

 h2. 二级标题 

 h3. 三级标题 
 </code></pre> 

 你可以使用“#一级标题”、“#二级标题”等等来链接到这些标题 

 h3. 段落 

 <pre><code>p. 向左对齐 

   p(. 向右缩进一个字母的距离 

     p((. 向右缩进两个字母的距离 
     (也会对这一行以及接下来的每一行起到作用) 

                                                                                    p>. 向右对齐 

                                                                         p)))>. 向右缩进三个字母的距离 

                            p=. 这一行位于中央 
 </code></pre> 

 h3. 水平分割线 

 @----@ 
 显示为: 

 ---- 

 h3. 抑制保留字符 

 <pre> <pre> *这里的文字不会被加粗* </pre> </pre> 
 显示为: 

 <pre> *这里的文字不会被加粗* </pre> 

 h3. 块引用 

 在段落前加上 *bq.*: 

 <pre><code>bq. Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。 
 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。 
 </code></pre> 

 显示为: 

 bq. Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。 
 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。 

 你也可以在每一行开头加上“>”来实现引用,并且可以叠加“>”作为二级引用: 

 <pre> 
 >> Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。 
 >> 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。 
 > 很不错! 
 </pre> 

 显示为: 

 >> Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。 
 >> 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。 
 > 很不错! 

 h3. 无序列表 

 <pre> 
 * 条目 1 
 * 条目 2 
 ** 条目 21 
 ** 条目 22 
 * 条目 3 
 </pre> 

 显示为: 

 * 条目 1 
 * 条目 2 
 ** 条目 21 
 ** 条目 22 
 * 条目 3 

 h3. 有序列表 

 <pre> 
 # 条目 1 
 # 条目 2 
 # 条目 3 
 ## 条目 3.1 
 ## 条目 3.2 
 </pre> 

 显示为: 

 # 条目 1 
 # 条目 2 
 # 条目 3 
 ## 条目 3.1 
 ## 条目 3.2 

 h3. 表格 

 <pre> 
 |_.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      | 
 </pre> 

 显示为: 
 (多个空格会被 Textile 识别为一个空格) 

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

 要在表格中使用“|”字符(比如 Wiki 链接),你需要使用下面示例中用到的格式,以防止“|”被 Textile 识别为列分割符。 

 |_.输入 |_. 输出| 
 |*<notextile><notextile>|</notextile></notextile>*|<notextile>|</notextile>| 

 如果要规定表格的宽度,你需要在表格定义前写入 *table{width:100%}.* : 

 <pre> 
 table{width:100%}. 
 | This table will use 
 all horizontal space | 
 </pre> 

 本例中表格将扩展到整个页面的宽度 ... 

 table{width:100%}. 
 | This table will use 
 all horizontal space | 

 ... 与标准宽度的对比: 

 | This table will use 
 only the required space | 

 h3. 目录 

 <pre><code>{{toc}} => 左对齐目录 
 {{>toc}} => 右对齐目录 
 </code></pre> 

 请记住,toc标签要求上下各孔一行,并且前后没有其它文字。 

 例子: 

 <pre><code> 
 h1. headLineOne 

 h2. something 

 {{toc}} 

 h2. something more 
 </code></pre> 

 



 h2. 代码高亮显示 

 Redmine 应用的代码高亮显示依赖于 "CodeRay":http://coderay.rubychan.de/ 。CodeRay 是完全用 Ruby 语言写的快速代码高亮库,现在支持的语言包括 C、C++、CSS、Delphi、Diff、Groovy、HTML、Java、Javascript、JSON、Nitro-XHTML、PHP、Python、RHTML、Ruby、Scheme、SQL、XML 和 YAML。 

 使用下面的格式来实现代码高亮显示: 

 <pre><code><pre><code class="ruby"> 
   这里写 Ruby 代码 
 </code></pre> 
 </code></pre> 

 示例: 

 <pre><code class="ruby"> 
 # The Greeter class 
 class Greeter 
   def initialize(name) 
     @name = name.capitalize 
   end 
 
   def salute 
     puts "Hello #{@name}!" 
   end 
 end 
 </code></pre> 


 h2. 使用 CSS 修饰文本 

 Textile 能使用 CSS 修饰文本,如下例: 

 <pre> 
 Three primary colors of light are %{color: #f00}red%, %{color: #0f0}green% and %{color: #00f}blue%. 

 p{border: solid 1px #000; padding: 0.5em;}. The quick brown fox jumps over the lazy dog. 

 table{width: 100%}. 
 |={width: 30%; background-color: #aaf;}. column 1 |={width: 70%}. column 2 | 
 </pre> 

 显示为: 

 Three primary colors of light are %{color: #f00}red%, %{color: #0f0}green% and %{color: #00f}blue%. 

 p{border: solid 1px #000; padding: 0.5em;}. The quick brown fox jumps over the lazy dog. 

 table{width: 100%}. 
 |={width: 30%; background-color: #aaf;}. column 1 |={width: 70%}. column 2 | 

 h3. 可用的 CSS 属性 

 Redmine 可使用下列属性。因为安全原因,其它属性不能使用(见 r2192)。 

 * background 
 * background-* 
 * border 
 * border-* 
 * color 
 * float 
 * font 
 * font-* 
 * height 
 * margin 
 * margin-* 
 * max-height 
 * max-width 
 * min-height 
 * min-width 
 * padding 
 * padding-* 
 * text 
 * text-* 
 * width