PDV2SVG - off line version
This perl script converts a Wiki source with {{plan de voies}} templates to an SVG image. For the detail of {{plan de voies}} templates, see [[Projet:Ferrovipédia/Plan_de_voies]] in French Wikipedia or [[Template:Å´Æ»ÇÛÀþ¿Þ/doc]] in Japanese Wikipedia. For updates of this script, see http://kiritachinoboru.tripod.com/pdv2svg_en.html.
You need Perl (version 5.8 or later) to use this script.
Files
- pdv2svg.pl : the main script.
- pdvdata.pl : data used in the script.
- README_en.html : documentation in English - this file
- README_jp.html : documentation in Japanese(euc-jp)
- Chatelet.txt : example of source text.
- Chatelet.svg : example of output.
- all.svg : list of all supported icons.
Usage
Options
- -a
- Include definitions of all symbols.
- -c CREATOR
- Embed the creator information in the SVG file.
- -d SYMBOL
- Include definitions of specified symbol(s). To specify plural symbols, separate them with commas. Use -a or -d option to edit the SVG file manually after generating them.
- -h
- help.
- -i FILE
- Specify the source file. The default is the standard input (STDIN).
- -o FILE
- Specify the output file. The default is the standard output (STDIN).
- -s SCALE
- pixels per icons. The default is 30.
- -t TITLE
- title of the SVG file.
- -v
- verbose mode
- -A
- "abbreviation" mode (see below).
- -C
- color mode. Some icons (eg. platforms) are displayed with colors.
Examples
./pdv2svg -i Chatelet.txt -o Chatelet.svg -c Matsukaze -t "Gare de Chatelet - Les Halles"
Convert the rail track map described in Chatelet.txt to an SVG file named Chatelet.svg. The creator is Matsukaze, and the title is "Gare de Chatelet - Les Halles".
./pdv2svg -i Chatelet.txt -o Chatelet.svg -d "BV,T1" -s 50
Convert Chatelet.txt to Chatelet.svg, with definitions of symbols BV (station building) and T1 (portal of tunnel). The scale is 50px per icon.
./bs2svg -a -i /dev/null -o sample.svg
Generate a blank SVG file with definitions of all symbols. Use this to edit the SVG file manually.
Abbreviation mode
If you execute the script with -A option, each lines of the source are considered as elements of {{plan de voies}} templates. You can also use abbreviations of names of some icons as follows.
- "" => "0"
- "-" => "voie"
- "!" => "Vvoie"
- "/" => "Mvoie"
- "\" => "Dvoie"
- "," => "courbebg"
- "." => "courbebd"
- "`" => "courbehg"
- "'" => "courbehd"
- "-," => "bifbg"
- "-." => "bifbd"
- "-`" => "bifhg"
- "-'" => "bifhd"
- ".`" => "bifg"
- "'" => "bifd"
- "Q" => "quai"
- "<-" => "sensg"
- "->" => "sensd"
- "<>" => "sens2"
For example, the following source generates the same SVG file as Chatelet.svg.
,|->|- |- |- |-.|- |- |- |- |->|- |- |- |- |- |->|'
| | | | | |\ | |Q |Q |Q |Q |Q | | | | |
| | | |, |- |- |-`|- |- |->|- |- |- |-,|- |->|-
- |->|-.|-'|- |- |- |-,|- |- |->|- |- |-'|- |-,|->|'
| | |\ | | |/ | |Q |Q |Q |Q |Q | |/ | | |
| | | |.`|-'|- |- |- |- |<>|- |- |,'| | | |
| | |/ | | | | |Q |Q |Q |Q |Q | |\ | | |
- |<-|-'| .| | |, |- |- |- |<-|- |- |-.|- |-`|<-|'
| | | | `|-'|- |-,|- |- |<-|- |- |- |-`|- |<-|-
| | | | | |/ | |Q |Q |Q |Q |Q | | | | |
, |<-|- |- |- |-'|- |- |- |- |<-|- |- |- |- |- |<-|'
Licence
GPL version3
(original text) or version 2
(original text
).
Bugs or Specifications
- All texts in the track diagram are ignored.
- If you convert a Wiki source that contains {{plan de voies partiel}} template, the corresponding image (and those correspond to following lines if you use rowspan) is moved from the proper position. To correct this, edit the SVG file manually as follows.
Move the part between <g> and </g> 5 colums right and 1 row up.
<!-- row 5 -->
<!-- This row is generated by "partial" template -->
<g transform="translate(5,-1)">
<use xlink:href="#M" x="6" y="4" width="2" height="2" />
<use xlink:href="#Q" x="8" y="4" width="2" height="2" />
<use xlink:href="#Q" x="9" y="4" width="2" height="2" />
<use xlink:href="#Q" x="10" y="4" width="2" height="2" />
<use xlink:href="#M" x="11" y="4" width="2" height="2" />
</g>
Attention
If your Wiki source is not your own work and the arrangement of icons has enough originality, the SVG file may be considerd as a derivation of the original source and a subject of copyright. In such case, if you want to release the file (eg. upload to Wikimedia Commons), you must take an appropriate procedure required by the licence of the source (eg. GFDL).
Aknowledgements
This script uses icons (in public domain) made by Benji in French Wikipedia/Wikimedia Commons.