-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgenerator.inx
100 lines (74 loc) · 4.19 KB
/
generator.inx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="UTF-8"?>
<!-- inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension" -->
<inkscape-extension>
<_name>Generator</_name>
<id>github.galou.inkscape_generator</id>
<dependency type="executable" location="inx">generator.py</dependency>
<param name="tab" type="notebook">
<page name="tabA" _gui-text="Configuration">
<param name="var-type" type="optiongroup" _gui-text="Collect values by:">
<option value="column">column position</option>
<option value="name">column name</option>
</param>
<separator/>
<label>Extra textual values to be replaced:</label>
<param name="extra-vars" type="string" gui-text=" "></param>
<separator />
<param name="data-file" type="string" _gui-text="Data file:"></param>
<!-- Buggy with inkscape 3bc2e81 -->
<!-- <param name="data-file" type="path" mode="file" filetypes="csv,*" gui-text="Data file:"></param> -->
<label>The data file must be a CSV with comma separated columns</label>
<separator />
<param name="format" type="optiongroup" appearance="combo" _gui-text="Export format:">
<option>PDF</option>
<option>SVG</option>
<option>PS</option>
<option>EPS</option>
<option>PNG</option>
<!-- <option>JPG</option> -->
</param>
<param name="dpi" type="float" max="1000000.0" value="96" gui-text="DPI (for PNG):"></param>
<param name="output-pattern" type="string" _gui-text="Output pattern:">$HOME/generator-output/%VAR_1%.pdf</param>
<param name="preview" type="boolean" gui-text="Preview (make and show one register)"></param>
</page>
<page name="tabB" _gui-text="Help, drawing replacement">
<label xml:space="preserve">
How vars are replaced?
There are three places were replacement occur.
1. Replacement in the drawing
The replacer will walk through each data column, line-by-line, and will try to replace the %VAR_#% in the SVG by the column value.
If you select "column position", # is the column number.
If you select "column name", # is the column name, defined in the first line.
2. Replacement in "Configuration" tab, "extra textual values to be replaced"
cf. tab "Help, extra values"
3. Inclusion or deletion of special layers
cf. tab "Help, layers"
</label>
</page>
<page name="tabC" _gui-text="Help, extra values">
<label xml:space="preserve">
2. Replacement in "Configuration" tab, "extra textual values to be replaced"
You can replace other text paterns, like element values with this configuration. On the second field, add all extra text to be replaced in a line separated by "|", pointing to the replacer column with "=>" (name or number depending on the configuration choice). Do not use spaces if that is not part of the blocks!
For example, we can make the red and green colors as variables to be replaced by some other colors form the database at the columns "secure color" and "sector color":
#ff0000=>secure_color|#00ff00=>sector_color
All pure red and pure green elements will have new colors for each data line.
</label>
</page>
<page name="tabD" _gui-text="Help, layers">
<label xml:space="preserve">
3. Inclusion or deletion of special layers
Layers can be given two special names %IF_#% or %UNLESS_#% (cf. tab "Help, drawing replacement" for the signification of #). A layer with name %IF_#% will be included in the output document if the entry corresponding to column # is not empty and if it is neither "0", nor "false", nor "no". A layer with name %UNLESS_#% will be included if the entry is empty or if it is "0", "false", or "no". In both cases, the layer visibility will be set to true. Extra text after the second "%" in the layer name will be ignored, so that you can use the same condition for two layers with different labels, what is compulsory.
If you are not sure about the usable variables, run it on preview mode and the replaceable texts wil be showed to you.
</label>
</page>
</param>
<effect needs-live-preview="false">
<object-type>all</object-type>
<effects-menu>
<submenu _name="Export"/>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">generator.py</command>
</script>
</inkscape-extension>