Help:简易时间线语法
维库,知识与思想的自由文库
|
简易时间线的特性就是从wiki文本中产生一个嵌入式图像。这个图像可以是一个一维的图表(水平或垂直),或者是二维的图表。名为“简易时间线”就表示可以用水平或垂直的方向作为时间刻度,用另一个方向来表示其它参数,但是它们也可能是其他不同的形式。
[编辑] 简介只要脚本介于两个专用标签之间就可以产生图像时间线: 简易时间线就会被调用生成一个PNG格式图像和一个链接映射(可选项)。 注意:即使“简易时间线”的创造是为了简单方便,但是制作一个复杂的时间线表依然不是一件轻松的事情。一个简单的时间线可以花费半个小时来完成(如果有一个合适的例子用来作为基础可以节省更多时间)大型的时间线可能要花费几个小时来创作并且修改。然而,对于现有无论多复杂的时间线进行增加或者更正都是直接快捷的,甚至是对于没有接触过这些语法的使用者。 若有问题请联络简易时间线的作者。 [编辑] 可用命令脚本命令定义:
下述命令是必选的:ImageSize(图像尺寸)、PlotArea(图形区)、Period(时段)和TimeAxis(时间轴)。下述命令至少要选一个:PlotData(图形数据)和/或 TextData(文字数据),它们都可以重复多次。所有其它命令都是可选的。 大小写:命令及其属性都能接受大写、小写以及混合拼写。请在使用时保持一致以利于维持可读性,例如对于命令使用混合拼写,而所有属性使用小写。 [编辑] 一般语法规则脚本可包含命令和注释。每个命令都有一个或多个属性。 [编辑] 命令命令应该从行首开始。 有些命令带有多行的数据和/或选项。 这些另外的行应该以至少一个空格或完整的空行开始。 (下面示范相关的数据行) 根据命令的类型,它可表示为以下的多种形式之一: 命令 = 属性(或多个属性) 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 [编辑] 参数和数据项大部分命令只接受在同一行指定的属性。 数据块: 有一些命令、像是BarData、PlotData、TextData、Colors认为一个数据块是由一个或多个数据行组成。数据行应该以一个或多个空格开始,遇到以非空字符开始的行就认为数据块已结束(例外:应忽略空行,它们可能用来对同一个块中相关的数据行进行分组)。 数据块内的属性按照概念可分成参数和数据项。数据块可同时包含参数和数据项。 数据项:在数据行属性中,text、from、till和at仅在它们所出现的行起作用。 参数:在数据行属性中,像是color和fontsize,根据上下文的不同会有不同的含义。如果它们出现在没有数据项的行中,它们将为后面的数据行设定新的默认属性。如果它们出现的行中同时也有数据项,那么它们只能在此行起作用,取代前面设定的默认属性。 例如: # 在该例子中将分别画出红蓝两条系列, # 但在每一系列中将有一段使用绿色描绘以标示战争时期。 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 [编辑] 特殊字符
[编辑] 命令参考每一个命令都列出了有效的属性,一些命令或属性是可选的[表示为(可选)]。 一些命令的某些属性是互斥的。(应用时再解释) [编辑] AlignBars条块(Bar)总是以相同的距离绘制。 这个命令用来说明是否条块应该排列得尽可能分开,或者保留空白在图表的左(或上)边与第一条之间,还是保留空白在图表的右(或下)边与最后一栏之间。
例如:
[编辑] BackgroundColors这个命令允许指定图表不同部分的背景颜色。 任何颜色id的指定在首次使用时都应该先进行定义Colors.
例如: BackgroundColors = bars:darkgrey BackgroundColors = canvas:lightgrey bars:darkgrey BackgroundColors = canvas:lightgrey [编辑] BarData这是一个可选命令,它可以调整哪些条块将被显示、以何种顺序显示。如果它被省略,栏将按照它在PlotData命令中的出现的顺序进行绘制。 对于使用许多条的复合时间线,推荐使用这个命令:
注释
示例 BarData = bar:Japan bar:US text:"美国" # 将PlotData数据定位到条块“US”但显示为“美国” bar:China text:[[中国]] # “中国”标签将指向维基百科中的中国条目 以下代码产生同样的输出(只列出PlotData的改变): 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来调用颜色。 这个命令可指定一个或多个的颜色定义,每一个都必须位于独立的缩进行。
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这个命令定义了在其它命令中出现的日期应该如何解释。 有效的日期格式:
例如: DateFormat = mm/dd/yyy [编辑] Define这一个命令允许定义本文常数,例如,为在多个时间段出现的部分脚本代码定义速记。本文常数应该总是以一个$(美元符号)开始。 例如: Define $broad = width:30 Define $narrow = width:10 Define $bardefaults = $broad fontsize:S [编辑] DrawLinesSome 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).
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.
Example: ImageSize = width:800 height:600 [编辑] LegendA 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).
Tip: you may consider omitting the following parameters at first, and only add them when defaults settings are not satisfactory.
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.
Example: Period = from:01/09/1939 till:02/09/1945 [编辑] PlotArea (必选)
例如: 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. 图形区有许多的属性,其中有些时互斥的。这些属性可被分为以下几种:
[编辑] 位置属性
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" [编辑] 栏相关属性
例如: 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:
[编辑] 文字属性
Notes
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 [编辑] 标记属性
Example: PlotData= bar:test width:15 color:red from:1900 till:2000 at:1990 mark:(line,white) will be shown as: [编辑] ScaleMajorThis command divides the timeline into smaller periods, either
Note: the orientation of the lines and/or placement of the stubs depends on the orientation of the TimeAxis.
Examples: ScaleMajor = gridcolor:red start:1940 ScaleMajor = gridcolor:red unit:month increment:3 start:01/09/1939 [编辑] ScaleMinorThis 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 [编辑] TextDataUsed to define a text block that can be positioned anywhere on the chart.
Notes:
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: [编辑] TimeAxisDefines the orientation of the time axis, and textual representation of stubs along that axis.
Example: TimeAxis = orientation:horizontal format:yyyy [编辑] PresetsAt the moment two presets are available:
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.
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:
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. http://www.wikilib.com.cn/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). [编辑] 可支持字型No unicode is allowed yet. No font type can be specified yet. Five font tags are predefined which will render at slightly different sizes in PNG and SVG images to produce optimal readability for both platforms. It is advised to use these tags instead of numbers whenever possible. They are: XS=eXtra Small, S=Small (default), M=Medium, L=Large, XL=eXtra large
This documentation is originally a wikified version of the original EasyTimeline documentation. [编辑] EasyTimeline code with a template parameter is not allowed | |||||||||||||||||

















