Project

General

Profile

SimplifiedChineseWikiFormatting » History » Version 17

Charles Sun, 2018-06-08 05:17

1 8 Charles Sun
h1. Textile 格式化
2 1 justim chan
3
4 8 Charles Sun
以下是 *Textile* 的格式化信息. 有关 *Markdown* 的格式化信息请参见 [[RedmineTextFormattingMarkdown]].
5
有关当前Textile支持的限制,请参见 #6269, #10078 (Definition Lists).
6
7
{{>TOC}}
8
9 3 justim chan
h2. 链接
10
11
h3. Redmine 链接
12
13 8 Charles Sun
{{include(RedmineTextFormattingRedmineLinksSimplifiedChinese)}}
14 3 justim chan
15
h3. 外部链接
16
17 9 Charles Sun
URL地址(http, https, ftp 和 ftps)可以被自动转换成可点击的链接: 
18
* *http://www.redmine.org* -- 外部链接至redmine官网: http://www.redmine.org
19 3 justim chan
20 9 Charles Sun
URL地址也可以使用不同的文本来显示:
21 10 Charles Sun
* *"Redmine官网":http://www.redmine.org* -- 以不同的文本显示Redmine官网的外部链接:"Redmine官网":http://www.redmine.org
22 1 justim chan
* *!http://www.redmine.org/attachments/7069/Redmine_logo.png(Redmine web site)!:http://www.redmine.org* -- 用带标题的外部图片来表示一个外部链接:
23
24
p=. !http://www.redmine.org/attachments/7069/Redmine_logo.png(Redmine web site)!:http://www.redmine.org
25 9 Charles Sun
26
链接的 UNC 路径中可使用文件 URI :
27
* *"\\server\share$":file://///server/share%24* -- 使用文件 URI 的 UNC 路径: "\\server\share$":file://///server/share%24
28
你需要对特殊字符做 "URL 编码":http://www.w3schools.com/tags/ref_urlencode.asp,比如: 空格, $, á, é, í, ó, ú, 等等。
29
30 3 justim chan
31
h3. Email地址
32
33
Email地址能够被自动转换成可点击的链接:
34
35 11 Charles Sun
* *someone@foo.bar* -- 链接到一个email地址: someone@foo.bar
36 12 Charles Sun
* *"Email someone":mailto:someone@foo.bar* -- 用不同的文本显示Email链接: "Email someone":mailto:someone@foo.bar
37 3 justim chan
38 1 justim chan
还可以将更加复杂的指令添加到Email链接中。可以设置默认的主题、正文和抄送地址。但请注意,这些字段里的空格都要编码成%20(详细可参考URL编码)。
39 11 Charles Sun
* *"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
40
* *"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
41
* *"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
42 3 justim chan
43 4 chigeon null
h2. 文本格式
44 6 chigeon null
45
对于像是标题、粗体、表格、列表等文字格式, Redmine 支持使用 "Textile":http://en.wikipedia.org/wiki/Textile_%28markup_language%29 语法。 可以到 http://redcloth.org/hobix.com/textile/ 查找关于使用这些特性的信息。下面将展示其中的一些常用的语法。
46
47 13 Charles Sun
h3. 缩写
48
49
<pre>
50
JPL(Jean-Philippe Lang)
51
</pre>
52
53
显示:
54
55
JPL(Jean-Philippe Lang)
56
57 6 chigeon null
h3. 字体风格
58
59
<pre><code>* *粗体*
60
* _斜体_
61
* *_粗体 斜体_*
62
* +下划线+
63
* -中划线-
64
* 文字 ^上标^
65
* 文字 ~下标~
66
* @inline monospace@
67
* <notextile>正常字体 *粗体* _斜体_ 正常字体;E=mc ^2^</notextile>
68
* <notextile>正常字体<notextile></notextile>*粗体*<notextile></notextile>_斜体_<notextile></notextile>正常字体;E=mc<notextile></notextile>^2^</notextile>
69
* <notextile>转义: <notextile>*粗体* _斜体_ @inlinemono(等宽字体)@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  或者使用 HTML 代码:&#42;粗体&#42; &#95;斜体&#95; &#64;inlinemono(等宽字体)&#64;</notextile>
70
* <notextile><pre>*一些文字*      "一个链接":http://www.redmine.org</pre></notextile>
71
* <notextile><pre><notextile></notextile>*一些文字*      "一个链接":http://www.redmine.org</pre></notextile>
72
</code></pre>
73
74
显示为:
75
76
 * *粗体*
77
 * _斜体_
78
 * *_粗体 斜体_*
79
 * +下划线+
80
 * -中划线-
81
 * 文字 ^上标^
82
 * 文字 ~下标~
83
 * @inline monospace(等宽字体)@
84
 * 正常字体 *粗体* _斜体_ 正常字体;E=mc ^2^
85
 * 正常字体<notextile></notextile>*粗体*<notextile></notextile>_斜体_<notextile></notextile>正常字体;E=mc<notextile></notextile>^2^
86
 * 转义: <notextile>*粗体* _斜体_ @inlinemono(等宽字体)@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 或者用 HTML 代码替代: &#42;粗体&#42; &#95;斜体&#95; &#64;inlinemono(等宽字体)&#64;
87
 * <pre>*一些文字*      "一个链接":http://www.redmine.org</pre>
88
 * <pre><notextile></notextile>*一些文字*      "一个链接":http://www.redmine.org</pre>
89
90
h3. 加入色彩
91
92
<pre><code><notextile>* %{color:red}红色% %{color:green}绿色% %{color:yellow}黄色% %{color:#82B6E1}蓝色%
93
* %{color:red}红色%<notextile></notextile>%{color:green}绿色%<notextile></notextile>%{color:yellow}黄色%<notextile></notextile>%{color:#82B6E1}蓝色%
94
* %{background:lightgreen}淡绿背景% %{background:yellow}黄色背景%
95
* %{background:lightgreen}淡绿背景%<notextile></notextile>%{background:yellow}黄色背景%
96
</notextile></code></pre>
97
98
显示为:
99
100
 * %{color:red}红色% %{color:green}绿色% %{color:yellow}黄色% %{color:#82B6E1}蓝色%
101
 * %{color:red}红色%<notextile></notextile>%{color:green}绿色%<notextile></notextile>%{color:yellow}黄色%<notextile></notextile>%{color:#82B6E1}蓝色%
102
 * %{background:lightgreen}淡绿背景% %{background:yellow}黄色背景%
103
 * %{background:lightgreen}淡绿背景%<notextile></notextile>%{background:yellow}黄色背景%
104
105
h3. 内嵌图片
106
107
* *!;image_url!;* 显示位于“image_url”路径的图片
108
* *!;>image_url!;* 使图片在页面右侧显示
109
* *!;image_url(图片名称)!;* 改变图片显示的名称为“图片名称”
110
* *!;image_url!;:URL* 显示位于“image_url”路径的图片, 并给图片加上超链接“URL”
111
112
你可以上传图片附件到 wiki 页面,然后使用它的文件名作为路径: *!;已上传的图片.png!;*
113 13 Charles Sun
114
你也可以对图片应用CSS风格。代码 *&#33;{width: 100%}attached_image.png&#33;* 使图片调整为父元素的宽度。
115 6 chigeon null
116
h3. 标题
117
118
<pre><code>h1. 一级标题
119
120
h2. 二级标题
121
122
h3. 三级标题
123
</code></pre>
124
125
你可以使用“#一级标题”、“#二级标题”等等来链接到这些标题
126
127
h3. 段落
128
129
<pre><code>p. 向左对齐
130
131
  p(. 向右缩进一个字母的距离
132
133
    p((. 向右缩进两个字母的距离
134
    (也会对这一行以及接下来的每一行起到作用)
135
136
                                                                                   p>. 向右对齐
137
138
                                                                        p)))>. 向右缩进三个字母的距离
139
140
                           p=. 这一行位于中央
141
</code></pre>
142
143
h3. 水平分割线
144
145
@----@
146
显示为:
147
148
----
149
150
h3. 抑制保留字符
151
152
<pre> <pre> *这里的文字不会被加粗* </pre> </pre>
153
显示为:
154
155
<pre> *这里的文字不会被加粗* </pre>
156
157
h3. 块引用
158
159
在段落前加上 *bq.*:
160
161
<pre><code>bq. Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。
162
基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。
163
</code></pre>
164
165
显示为:
166
167
bq. Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。
168
基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。
169
170
你也可以在每一行开头加上“>”来实现引用,并且可以叠加“>”作为二级引用:
171
172
<pre>
173
>> Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。
174
>> 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。
175
> 很不错!
176
</pre>
177
178
显示为:
179
180
>> Rails 是应用了 MVC 设计模式的全栈型框架,用于开发数据库支持的 Web 应用程序。
181
>> 基于 Rails 进行项目开发,需要你准备的只是一个数据库和一个 Web 服务器。
182
> 很不错!
183
184
h3. 无序列表
185
186
<pre>
187
* 条目 1
188
* 条目 2
189
** 条目 21
190
** 条目 22
191
* 条目 3
192
</pre>
193
194
显示为:
195
196
* 条目 1
197
* 条目 2
198
** 条目 21
199
** 条目 22
200
* 条目 3
201
202
h3. 有序列表
203
204
<pre>
205
# 条目 1
206
# 条目 2
207
# 条目 3
208
## 条目 3.1
209
## 条目 3.2
210
</pre>
211
212
显示为:
213
214
# 条目 1
215
# 条目 2
216
# 条目 3
217
## 条目 3.1
218
## 条目 3.2
219
220
h3. 表格
221
222
<pre>
223
|_.UserID      |_.Name          |_.Group     |_. attribute list   |
224
|Starting with | a              |   simple   |row                 |
225
|\3=.IT                                      |<. align left       |
226
|1             |Artur Pirozhkov |/2.Users    |>. align right      |
227
|2             |Vasya Rogov     |=. center   |
228
|3             |John Smith      |Admin
229
                                 (root)      |^. valign top       |
230
|4             |-               |Nobody
231
                                 (anonymous) |~. valign bottom    |
232
</pre>
233
234
显示为:
235
(多个空格会被 Textile 识别为一个空格)
236
237
|_.UserID      |_.Name          |_.Group     |_. attribute list   |
238
|Starting with | a              |   simple   |row                 |
239
|\3=.IT                                      |<. align left       |
240
|1             |Artur Pirozhkov |/2.Users    |>. align right      |
241
|2             |Vasya Rogov     |=. center   |
242
|3             |John Smith      |Admin
243
                                 (root)      |^. valign top       |
244
|4             |-               |Nobody
245
                                 (anonymous) |~. valign bottom    |
246
247 7 chigeon null
要在表格中使用“|”字符(比如 Wiki 链接),你需要使用下面示例中用到的格式,以防止“|”被 Textile 识别为列分割符。
248 6 chigeon null
249
|_.输入 |_. 输出|
250
|*<notextile><notextile>|</notextile></notextile>*|<notextile>|</notextile>|
251
252 14 Charles Sun
如果要规定表格的宽度,你需要在表格定义前写入 *table{width:100%}.* :
253
254
<pre>
255
table{width:100%}.
256
| This table will use
257
all horizontal space |
258
</pre>
259
260
本例中表格将扩展到整个页面的宽度 ...
261
262
table{width:100%}.
263
| This table will use
264
all horizontal space |
265
266
... 与标准宽度的对比:
267
268
| This table will use
269
only the required space |
270
271 15 Charles Sun
h3. 目录
272
273
<pre><code>{{toc}} => 左对齐目录
274
{{>toc}} => 右对齐目录
275
</code></pre>
276
277
请记住,toc标签要求上下各孔一行,并且前后没有其它文字。
278
279
例子:
280
281
<pre><code>
282
h1. headLineOne
283
284
h2. something
285
286
{{toc}}
287
288
h2. something more
289
</code></pre>
290
291 6 chigeon null
h2. 代码高亮显示
292
293
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。
294
295
使用下面的格式来实现代码高亮显示:
296
297
<pre><code><pre><code class="ruby">
298
  这里写 Ruby 代码
299
</code></pre>
300
</code></pre>
301
302
示例:
303
304
<pre><code class="ruby">
305
# The Greeter class
306
class Greeter
307
  def initialize(name)
308
    @name = name.capitalize
309
  end
310
 
311
  def salute
312
    puts "Hello #{@name}!"
313
  end
314 1 justim chan
end
315
</code></pre>
316 16 Charles Sun
317
318
h2. 使用 CSS 修饰文本
319
320
Textile 能使用 CSS 修饰文本,如下例:
321
322
<pre>
323
Three primary colors of light are %{color: #f00}red%, %{color: #0f0}green% and %{color: #00f}blue%.
324
325
p{border: solid 1px #000; padding: 0.5em;}. The quick brown fox jumps over the lazy dog.
326
327
table{width: 100%}.
328
|={width: 30%; background-color: #aaf;}. column 1 |={width: 70%}. column 2 |
329
</pre>
330
331
显示为:
332
333
Three primary colors of light are %{color: #f00}red%, %{color: #0f0}green% and %{color: #00f}blue%.
334
335
p{border: solid 1px #000; padding: 0.5em;}. The quick brown fox jumps over the lazy dog.
336
337
table{width: 100%}.
338
|={width: 30%; background-color: #aaf;}. column 1 |={width: 70%}. column 2 |
339
340
h3. 可用的 CSS 属性
341
342
Redmine 可使用下列属性。因为安全原因,其它属性不能使用(见 r2192)。
343
344
* background
345
* background-*
346
* border
347
* border-*
348
* color
349
* float
350
* font
351
* font-*
352
* height
353
* margin
354
* margin-*
355
* max-height
356
* max-width
357
* min-height
358
* min-width
359
* padding
360
* padding-*
361
* text
362
* text-*
363
* width
364 17 Charles Sun
365
h2. 翻译
366
367
本译文可能滞后于原文的更新。如有必要,请参阅原文:
368
[[RedmineTextFormattingTextile|English]]