Help:简易时间线语法
维基 |
简易时间线的
简介[编辑]
<timeline>
腳本
</timeline>
简易时间线就
可 支持 字 型 [编辑]
This documentation is originally a wikified version of the original EasyTimeline documentation.
可用 命令 [编辑]
- 总体
布 局 :ImageSize(图像尺寸 )、PlotArea(图形区 )、Colors(颜色)、BackgroundColors(背景 颜色)、AlignBars(條 塊 位置 ) 日 期 与 时期的 解 释和表 达:DateFormat(日 期 格式 )、Period(时段)、ScaleMajor(主要 刻 度 )、ScaleMinor(次 要 刻 度 )、TimeAxis(时间轴)事件 、时段和 描述文 本 :PlotData(图像数 据 )、TextData(文字数 据 )如何 定 制 、划分、并且命名 一组事件和时段:BarData()、Legend(图例)、DrawLines(绘图线)多 次 出 现的脚本 代 码的简写:Define(定 义)
一般 语法规则[编辑]
命令 [编辑]
DateFormat = dd/mm/yyyy
Color Jp = value:red legend:Japan
PlotData = fontsize:XS width:20 bar:Japan from:start till:19/02/1945 color:JT bar:Japan from:19/02/1945 till:14/03/1945 color:AI
注 释[编辑]
- #
号 后 文字 就是一 行 注 释 介 于#>和 <#之 间的文字 也是注 释。用 这种方式 标记,可 使用 多 行来 书写注 释。
Dateformat = dd/mm/yyyy # European date format Period = from:01/09/1939 till:02/09/1945 #> 该图表 将 表 现二 战的整 个历史 。 <#
属性 [编辑]
AlignBars = justify Color SB = value:rgb(0.8,0,0.7) legend:Sea_Battles
参 数 和 数 据 项[编辑]
#在 该例子 中将 分 别画出 红蓝两条系列 , #但 在 每 一系列中将有一段使用绿色描绘以标示战争时期。 PlotData = color:red fontsize:S #默 认值 bar:USSR from:1919 till:1922 text:Lenin # 红条 bar:USSR from:1922 till:1953 text:Stalin # 红条 bar:USSR from:1939 till:1945 text:WWII color:green # 绿条 bar:USSR from:1953 till:1964 text:Krushchev # 红条 color:blue #改 变默认颜色 bar:US from:1913 till:1921 text:Wilson # 蓝条 bar:US from:1917 till:1918 text:WWI color:green # 绿条 bar:US from:1921 till:1923 text:Harding # 蓝条 #> 此多行 注 释并不 终止PlotData命令 ,即 使 前 一行并未以空格开头。<# bar:US from:1923 till:1929 text:Coolidge # 蓝条 TextData = # 此处PlotData命令 结束 tabs:...etc
特殊 字 符 [编辑]
- #、#>、<#(
井 号 、井 号 +大 于号、小 于号+井 号 ):参 见Comments - ~(
波浪 线)在 文字 中 :换行 - ^
在 文字 中 :缩进 - _(
下 划线)在 文字 中 :空 格 - $(
美 元 符号 )用 在任 何 用 户自定 义常量 前
命令 参考 [编辑]
一些命令的某些属性是互斥的。(应用时再
AlignBars[编辑]
- early(
默 认) 第 一条放置在图表最左(或 最上 )的 位置 ('粘 贴'到 轴上),在 最 后 一条与图表的右(或 下 )边之间留出 空白 。- late
与 early相反 ,最 后 一条尽可能地放置在图表的右(或 下 )边,在 轴线(图表的 左 /上 边)与 第 一条之间留出空白。- justify
第 一条和最后一条放置得尽可能分开,图表的 两边都 不 留 空白 。当 只 有 一 条 存在 时,justify就表示 "居中 "。
TimeAxis = | orientation:horizontal | orientation:vertical | ||||
Alignbars = |
||||||
BackgroundColors[编辑]
这个
- canvas (
可 选) - 为全
部 图像指定 背景 颜色。 - bars (
可 选) - 为
所有 bars指定 背景 颜色。
BackgroundColors = bars:darkgrey BackgroundColors = canvas:lightgrey bars:darkgrey BackgroundColors = canvas:lightgrey
BarData[编辑]
这是
对于
- 这将简化对显
示 数 据 的 重 新 布置 ; - PlotData
中 指定 的 条 块名字 将 和 此列表 比 对,从而减少输入错误的 可能 。
- bar
定 义了条 块的识别号 ,其他的 命令 (特 别是PlotData)将 使用 该识别作为对其之引用 。它也是 坐 标轴上 显示的 标签,除 非 设置了 text属性 。bar识别号 不可 包含 空 格 :使用 下 划线代替 ,它们将 被 自 动转换为空 格 。- text (
可 选) 指定 显示于坐标轴上 的 标签,以取代 条 块识别号。参 见text input。该文本 可 以包含 一 个内部 链接(参 见注 释1)。- link (
可 选) 指定 一 个链接 (URL)。参 见注 释1。坐 标轴上 的 标签即 显示为一个超链接。
要 么使用 link属性 、要 么在text属性 中 使用 内部 链接,二 者 不能 并用。
BarData = bar:Japan bar:US text:"美国 " #将 PlotData数 据 定位 到 条 块“US”但 显示为“美国 ” bar:China text:[[中国 ]] # “中国 ”标签将 指向 维基百科 中 的 中国 条目
bar:US text:[[United_States]] bar:US text:"United States" link:http://www.wikipedia.org/wiki/United_States bar:United_States link:http://www.wikipedia.org/wiki/United_States
Colors[编辑]
这个
- id
- 其它
命令 将 使用 这个id来 指定 文 本 、栏或背景 的 颜色。 - value
- 实际颜色
定 义。颜色值可用 下 述 任 一 种方式 表示 :
- 预定义颜
色 值,有 32种预定 义的颜色名称 是 公 认的(参 见Ploticus color page,在 这里定 义了这些颜色值)。 - rgb (红,绿,蓝):
指定 3个介于0(最小 )和 1(最大 )之 间的数字 - hsv (
色 调,饱和度 ,值):指定 3个介于0和 1之 间的数字 - gray (值):
指定 一 个介于0 (黑 )和 1 (白 )
- 预定义颜
- legend (
可 选) 指定 图例中 对于使用 该种颜色的 项目的 文字 说明,如果该属性 被 忽 略 ,图例中 则不显示任 何 文 本 。参 见Text Input以获得 详细规则。
Example:
Colors = id:war value:red legend:War Period id:peace value:blue legend:Peace Time id:treaty value:rgb(0.6,0,0.6) id:lightgrey value:gray(0.9) id:darkgrey value:gray(0.1)
DateFormat[编辑]
这个
- dd/mm/yyyy
日 期 解 释为日 /月 /年 注意 : 这种格式 只 允 许用于01/01/1800以后的 日 期 - mm/dd/yyyy
日 期 解 释为月 /日 /年 注意 : 这种格式 只 允 许用于01/01/1800以后的 日 期 - yyyy
- 这种
格式 使用 从 -9999到 +9999的 整数
DateFormat = mm/dd/yyy
Define[编辑]
这一个命令允许定义本文常数,
Define $broad = width:30 Define $narrow = width:10 Define $bardefaults = $broad fontsize:S
DrawLines[编辑]
Some timelines extend over several clearly distinct periods. A line demarcating these periods may serve as a visual aid.
Lines specified here will be drawn over the whole width/length of the chart (depending on the orientation defined by TimeAxis).
- at
- Specify the date/year where the line should be drawn, in compliance with the specified DateFormat.
- color
- Specify the color in which the line should drawn.
- Note: The color id specified should be defined first with command Colors.
Example:
LineData= at:start color:red at:end color:red at:07/12/1941 color:red
ImageSize (必选)[编辑]
This command defines the overall size of the final image. Specify values in absolute measurements.
- width
- Width of final image: maximum is 1600 pixels
- height
- Height of final image: maximum is 1200 pixels
Example:
ImageSize = width:800 height:600
Legend[编辑]
A legend will only be shown when this command is present. There are several ways to define the appearance and position of the legend. Some attributes are mutually exclusive (see below).
- orientation (O)
- Specify hor[izontal] or ver[tical] (default).
- Restriction: orientation = 'horizontal' and position = 'right' are mutually exclusive
- position (O)
- Defines placement of the legend relative to the chart area. Specify top, bottom (default) or right.
- Restriction: orientation = 'horizontal' and position = 'right' are mutually exclusive
- columns (O)
- Specify 1, 2, 3 or 4. When this attribute is omitted the number of columns is determined as follows:
- Orientation horizontal : Attribute columns does not apply here. All entries will be on the same line.
- Orientation vertical :
- Position right : All entries will be in one column
- Position top or bottom : The number of columns depends on the number of entries to be shown:
1-5 entries: 1 column, 6-10 entries: 2 columns, 11 or more entries: 3 columns.
Tip: you may consider omitting the following parameters at first, and only add them when defaults settings are not satisfactory.
- columnwidth (O)
- Defines the distance between columns. You can specify an absolute distance or a relative distance (as percentage of the page width).
- Restriction: this parameter is ignored when columns = 1 is defined or implied.
- left (O)
- Defines the distance between the left side of the legend and the left side of the page. You can specify an absolute distance or a relative distance (as percentage of the page width).
- top (O)
- Defines the distance between the top of the legend and the bottom of the page. You can specify an absolute distance or a relative distance (as percentage of the page height).
Examples:
Legend = orientation:vertical position:bottom columns:3 columnwidth:140 Legend = orientation:horizontal position:bottom Legend = left:100 top:120 columns:3
Period (必选)[编辑]
Defines the time period that will be displayed in the chart. Both parameters are mandatory. Specify dates in compliance with specified DateFormat.
- from
- Timeline starts here. The specified value can be referenced as start in commands like PlotData and TextData.
- till
- Time ends here. The specified value can be referenced as end in other commands.
Example:
Period = from:01/09/1939 till:02/09/1945
PlotArea (必选)[编辑]
- width
- 以绝对或
相 对测量来 指定 数 值。 - height
- 以绝对或
相 对测量 来 指定 数 值。 - left
- 图像
左 边和图形区 左 边的空白 余 量 。以绝对或相 对测量 来 指定 数 值。 - bottom
- 图像
底 边和图形区 底 边的空白 余 量 。以绝对或相 对测量 来 指定 数 值。
PlotArea = width:640 height:420 left:160 bottom:120 PlotArea = width:80% height:70% left:20% bottom:20%
PlotData[编辑]
For texts which are not related to a certain period or date/year or which require extensive formatting use command TextData.
Attributes text, at, from and till always apply only to the line on which they occur. All other attributes, when not combined with one these four, act as default for the remainder of the command block or until a new default is specified, and may be overruled for a single line. See Parameters vs Data Items for more info and an example.
图形
位置 属性 - 栏相关属
性 文字 属性 - 标记
属性
位置 属性 [编辑]
- at
- Specifies at which date/year a text should be positioned. Depending on attribute align the text either starts, ends or is centered at this position. Use date/year format as specified in DateFormat or specify start or end which refers to time frame defined by command Period.
- NB: This attribute can not be combined with attributes from or till.
- from
- Specifies at which date/year a bar should start. Use date/year format as specified in DateFormat or specify start which refers to time frame defined by command Period.
- NB: This attribute should be used in combination with attribute till and can not be combined with attribute at.
- till
- Specifies at which date/year a bar should end. Use date/year format as specified in DateFormat or specify end which refers to time frame defined by command Period.
- NB: This attribute should be used in combination with attribute from and can not be combined with attribute at.
- shift
- Specifies a horizontal and vertical displacement in absolute measurements for a text. This allows:
- Texts to be shifted to avoid overlaps
- Placement of text beside a bar, instead of on top of it.
Examples:
PlotData= bar:Japan from:start till:19/02/1945 color:JT bar:Japan from:19/02/1945 till:14/03/1945 color:AI bar:Japan from:02/09/1945 till:end color:AO at:07/12/1941 shift:(0,-15) text:"<-- WW2 reaches Asia"
栏相关属性 [编辑]
- bar
- Specifies to which bar all other attributes apply.
- When command BarData has not been used, bars will be drawn in the order in which they occur in any PlotData data block. The id specified here will also be the text presented along the axis, next to the bar.
- When command BarData has been used, bars will presented in the order specified there, also the bar id specified here will be validated against that list. Also the text presented along the axis will depend on the definition in BarData.
- color
指定 栏应该被绘制的 颜色。- The color id specified should be defined first with command Colors.
- width
- Specifies the width of the bar in absolute or relative measurements.
BarData= id:US text:United States id:SB text:Sea Battles Colors= id:US value:blue legend:United_States id:SB value:rgb(0.8,0,0.7) legend:Sea_Battles PlotData= width=0.3 # see note 1 bar:SB from:07/08/1942 till:09/02/1943 text:Guadalcanal color:SB # see note 2 bar:US from:start till:end color:US # see note 3 bar:Midway from:start till:end color:US # see note 4 bar:US at:07/12/1941 text:7/12 Pearl Harbour # see note 5
Notes:
- this line establishes a default bar width for the remainder of the data block
- this line specifies a bar to be drawn and a text to placed on it at the same time
- bar US will be drawn before bar SB, even when specified after it, because command BarData determines the sequence
- bar Midway will be rejected because it is not declared with command BarData
- the last line will not result in a bar being plotted, it merely specifies on which bar the text should be placed
文字 属性 [编辑]
- text
- Defines a text that should be plotted on or near a bar. The anchor position can be defined either explicitly with attribute at, or implicitly with attributes from and till. In the latter case the text will be positioned in the middle of the defined bar segment. See also Text Input for rules
- The text may include embedded links (see Notes 1 & 2) for use in clickable maps.
- textcolor (O)
- Defines the color of the text. The color id specified should be defined first with command Colors. When not specified color black will be assumed.
- fontsize (O)
- Specify a point size between 6 and 30, or (preferably) one of tags XS, S (default), M, L or XL. See Font Support for more details.
- align (O)
- Specify center (default), left or right.
- link (O)
- Specify a web link (see Note 1) (URL) for use in clickable maps. The text will be shown as a blue clickable link.
Notes
- Either use attribute link, or an embedded link in attribute text, not both.
- On PNG images only one clickable link will be shown per text segment (text with line breaks (~) constitutes several segments).
Example:
PlotData= bar:US at:07/12/1941 align:left textcolor:black fontsize:XS text:7/12 [[Pearl Harbour]]
produces the same result as:
PlotData= bar:US at:07/12/1941 align:left textcolor:black fontsize:XS text:"7/12 Pearl Harbour" link:http://www.wikipedia.org/wiki/Pearl_Harbour
标记属性 [编辑]
- mark
- Places a marker in a bar at the specified position. Specify as mark:(symbol, color). The only value for symbol supported to date is line. The color id specified should be defined first with command Colors. When not specified color black will be assumed.
Example:
PlotData= bar:test width:15 color:red from:1900 till:2000 at:1990 mark:(line,white)
will be shown as:
ScaleMajor[编辑]
This command divides the timeline into smaller periods, either
- Graphically, through thin vertical or horizontal lines in the chart
- Textually, through stubs in the time axis, below or to the left of the chart
- Both graphically and textually
Note: the orientation of the lines and/or placement of the stubs depends on the orientation of the TimeAxis.
- gridcolor (O)
- Defines the color for the grid lines. When this attribute is omitted no grid lines will be drawn.
- Note: The color id specified should be defined first with command Colors.
- unit (O)
- Specifies the unit by which the grid spacing is incremented. Specify day, month or year (default).
- Note: When DateFormat yyyy is specified, only unit year is allowed.
- increment (O)
- Specifies the numbers of units by which the grid spacing is incremented. Default is 1.
- start (O)
- Specifies where the first grid line and/or stub should be displayed. Defaults to start of defined Period.
Examples:
ScaleMajor = gridcolor:red start:1940 ScaleMajor = gridcolor:red unit:month increment:3 start:01/09/1939
ScaleMinor[编辑]
This command defines a further subdivision of the timescale. See ScaleMajor for syntax .
Example:
ScaleMajor = grid:red unit:year increment:1 start:01/01/1940 ScaleMinor = grid:blue unit:month increment:3 start:01/10/1939
TextData[编辑]
Used to define a text block that can be positioned anywhere on the chart.
- text
- The actual text. See also Text Input for rules. The text may include embedded links (see Notes 1 & 2).
- pos
- Defines the top-left corner of the text block in absolute or relative measurements. Define as pos:(x,y).
- link (O)
- Specify a web link (see Note 1) (URL) for use in clickable maps. The label along the axis will be shown as a blue clickable link.
- textcolor (O)
- Defines the color of the text. The color id specified should be defined first using Colors. When not specified, the color is black.
- fontsize (O)
- Specify a point size between 6 and 30, or (preferably) one of tags XS, S (default), M, L or XL (see Font Support for more details).
- tabs (O)
- Defines position and alignment for tab character: ^ (caret). Specify multiple tab settings as tabs: (x1-a1,x2-a2,x3-a3, etc..) where
- xn is the horizontal displacement in absolute measurements from the left side of the text
- an is the alignment for the text segment (specify center, left or right)
- lineheight (O)
- Defines spacing between consecutive lines in absolute measurements. Specify a value up to 40 pixels or 0.4in. When not specified a default lineheight will be based on the font size currently in use.
Notes:
- Either use attribute link, or an embedded link in attribute text, not both.
- On PNG images only one clickable link will be shown per text segment (text with tabs (^) constitutes several segments).
Example:
TextData = pos:(20,67) textcolor:black fontsize:S tabs:(10-right,14-left,50-left,90-left,230-left) text:^1^1940^27/9^Germany,Italy and Japan sign [[Tripartite Pact]] text:^10^1944^1-22/7^Bretton Woods 44 nations establish text:^^^^^IMF and World Bank
will be shown as:
TimeAxis[编辑]
Defines the orientation of the time axis, and textual representation of stubs along that axis.
- format (O)
- Specify in which format dates should be presented along the time axis.
- Currently only format yyyy (default) is supported. More formats may follow.
- orientation (O)
- Specify hor[izontal] (default) or ver[tical].
Example:
TimeAxis = orientation:horizontal format:yyyy
Presets[编辑]
At the moment two presets are available:
- Preset = TimeVertical_OneBar_UnitYear
- Preset = TimeHorizontal_AutoPlaceBars_UnitYear
Not clear if whether there is documentation about them.
输入规则[编辑]
尺寸 和 位置 比例 [编辑]
Absolute measures may be used for specifying sizes, positions and position shifts, measured in pixels.
Example:
PlotArea = width:800 height:600 left:50 bottom:50
Relative measures may be used for specifying sizes and positions. Specify a number between 0 and 100, immediately followed by a % (percentage) sign. For horizontal measurements the percentage is related to image width, for vertical measurements to image height.
The first coordinate is horizontal from left to right, the second is vertically upward.
Example:
PlotArea = width:80% height:80% left:10% bottom:5%
文字 输入[编辑]
Text input is subject to a few rules:
1 No unicode is allowed yet. See also font support.
2 When text should contain spaces, either specify these by using underscores or place the text between double quotes.
- Exception: when the text attribute is the last attribute on a line, spaces are allowed (no confusion will arise where the text stops and the next attribute starts, that is—to be precise—when no colons occur in the text).
Example: (the following are all equivalent)
BarData = text:Japanese_mandate_since_1914 bar:Marshalls BarData = text:"Japanese mandate since 1914" bar:Marshalls BarData = bar:Marshalls text:Japanese mandate since 1914
3 In data lines following command TextData two characters have special meaning:
- ~ (tilde) means line break
- ^ (caret) means tab
Example showing line breaks:
TextData = .. text:Generated for Wikipedia~Version 1.1 - 2 Januari 2004 # will be shown as: # # Generated for Wikipedia # Version 1.1 - 2 Januari 2004
Example showing tabs:
TextData = tabs:(4-right,12-right,14-left,34-left) text:^1^1940^27/9^Berlin Ger,It,Jap sign Tripartite Pact text:^10^1944^1-22/7^Bretton Woods 44 nations establish text:^^^^^IMF and World Bank # will be shown as: # # 1 27/9 Berlin Ger,It,Jap sign Tripartite Pact # 10 1-22/7 Bretton Woods 44 nations establish # IMF and World Bank
可 点 击的图[编辑]
Both output formats available in MediaWiki, i.e. PNG and SVG, can contain clickable links. Texts shown in blue, and bars, may then be clicked, to surf to another web page.
Links can be specified with commands BarData, PlotData and TextData, either with attribute link, or as embedded links, via attribute text.
嵌入 式 链接[编辑]
Embedded links are links that are (part of a) displayable text, specified with attribute text. Their counterpart are explicit links (URL only) which are defined with attribute link.
Both type of links can be specified with commands BarData, PlotData and TextData and are used for clickable maps.
In embedded links, internal link style is as usual, interwiki link style does not work, external link style is as usual with single brackets, but here with a pipe instead of a space. Blank spaces and underscores in the url should be written as %20.
Examples:
text:example [[Help:Link]] internal link
will be shown as:
text:[[Help:Link|Link]]
will be shown as:
text:[http://en.wikipedia.org/wiki/Rembrandt|Rembrandt van Rijn] paints Night Watch
will be shown as:
Attempt to use interwiki link style:
text:[[en:Main_Page]]
and similar with nl: and m: give:
The third one to Meta-Wikipedia works properly, except from Meta itself, the other links work like Main_Page (internal page, the prefix is ignored) or e.g. //zh.wikipedia.org/w/Main_Page (gives File not found), depending on the URL of the referring page (e.g. different for a preview page and a diff page).
EasyTimeline code with a template parameter is not allowed[编辑]
|