postsvg 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +105 -0
  3. data/CLAUDE.md +173 -0
  4. data/Gemfile +2 -3
  5. data/README.adoc +456 -179
  6. data/Rakefile +100 -0
  7. data/TODO.roadmap/00-architecture.md +139 -0
  8. data/TODO.roadmap/01-autoload-migration.md +39 -0
  9. data/TODO.roadmap/02-isolate-dormant-code.md +51 -0
  10. data/TODO.roadmap/03-domain-model.md +66 -0
  11. data/TODO.roadmap/04-lexer.md +40 -0
  12. data/TODO.roadmap/05-parser.md +43 -0
  13. data/TODO.roadmap/06-graphics-state.md +45 -0
  14. data/TODO.roadmap/07-matrix-and-color.md +37 -0
  15. data/TODO.roadmap/08-svg-builder.md +51 -0
  16. data/TODO.roadmap/09-renderer.md +52 -0
  17. data/TODO.roadmap/10-visitor.md +58 -0
  18. data/TODO.roadmap/11-operator-coverage.md +103 -0
  19. data/TODO.roadmap/12-svg-domain.md +62 -0
  20. data/TODO.roadmap/13-translation-handlers.md +69 -0
  21. data/TODO.roadmap/14-ps-serializer.md +49 -0
  22. data/TODO.roadmap/15-cli-and-public-api.md +47 -0
  23. data/TODO.roadmap/16-specs.md +84 -0
  24. data/TODO.roadmap/17-docs-sync.md +47 -0
  25. data/TODO.roadmap/18-performance-and-determinism.md +47 -0
  26. data/TODO.roadmap/19-error-model.md +45 -0
  27. data/TODO.roadmap/20-font-and-text.md +46 -0
  28. data/TODO.roadmap/21-images.md +45 -0
  29. data/TODO.roadmap/22-forms-and-resources.md +25 -0
  30. data/TODO.roadmap/23-level2-level3.md +52 -0
  31. data/TODO.roadmap/24-ci-and-release.md +42 -0
  32. data/TODO.roadmap/README.md +77 -0
  33. data/docs/.gitignore +29 -0
  34. data/docs/CHANGELOG.md +114 -0
  35. data/docs/COMPLETE_DOCUMENTATION_STATUS.md +376 -0
  36. data/docs/DEPLOYMENT.md +456 -0
  37. data/docs/DEPLOYMENT_INSTRUCTIONS.md +229 -0
  38. data/docs/DOCUMENTATION_PLAN.md +425 -0
  39. data/docs/FINAL_SUMMARY.md +657 -0
  40. data/docs/Gemfile +15 -0
  41. data/docs/README.md +327 -0
  42. data/docs/_config.yml +99 -0
  43. data/docs/advanced-topics.adoc +370 -0
  44. data/docs/api-reference/colors.adoc +705 -0
  45. data/docs/api-reference/converter.adoc +699 -0
  46. data/docs/api-reference/execution-context.adoc +1210 -0
  47. data/docs/api-reference/graphics-state.adoc +1070 -0
  48. data/docs/api-reference/interpreter.adoc +810 -0
  49. data/docs/api-reference/matrix.adoc +1179 -0
  50. data/docs/api-reference/path-builder.adoc +1284 -0
  51. data/docs/api-reference/postsvg-module.adoc +388 -0
  52. data/docs/api-reference/svg-generator.adoc +891 -0
  53. data/docs/api-reference/tokenizer.adoc +925 -0
  54. data/docs/api-reference.adoc +221 -0
  55. data/docs/architecture/command-registry.adoc +1191 -0
  56. data/docs/architecture/conversion-pipeline.adoc +746 -0
  57. data/docs/architecture/design-decisions.adoc +999 -0
  58. data/docs/architecture/generator-stage.adoc +1115 -0
  59. data/docs/architecture/graphics-state-model.adoc +1089 -0
  60. data/docs/architecture/interpreter-stage.adoc +1125 -0
  61. data/docs/architecture/parser-stage.adoc +1051 -0
  62. data/docs/architecture.adoc +354 -0
  63. data/docs/cli-reference/batch-command.adoc +616 -0
  64. data/docs/cli-reference/check-command.adoc +677 -0
  65. data/docs/cli-reference/cli-options.adoc +802 -0
  66. data/docs/cli-reference/convert-command.adoc +462 -0
  67. data/docs/cli-reference/version-command.adoc +296 -0
  68. data/docs/cli-reference.adoc +317 -0
  69. data/docs/concepts/conversion-pipeline.adoc +903 -0
  70. data/docs/concepts/coordinate-systems.adoc +836 -0
  71. data/docs/concepts/graphics-state.adoc +861 -0
  72. data/docs/concepts/path-operations.adoc +1076 -0
  73. data/docs/concepts/postscript-language.adoc +859 -0
  74. data/docs/concepts/svg-generation.adoc +937 -0
  75. data/docs/concepts.adoc +198 -0
  76. data/docs/contributing.adoc +443 -0
  77. data/docs/development.adoc +420 -0
  78. data/docs/faq.adoc +493 -0
  79. data/docs/getting-started/basic-usage.adoc +538 -0
  80. data/docs/getting-started/common-workflows.adoc +577 -0
  81. data/docs/getting-started/first-conversion.adoc +492 -0
  82. data/docs/getting-started/installation.adoc +534 -0
  83. data/docs/getting-started.adoc +94 -0
  84. data/docs/index.adoc +248 -0
  85. data/docs/optimization.adoc +196 -0
  86. data/docs/ps2svg_compatibility.adoc +149 -0
  87. data/docs/quick-reference.adoc +453 -0
  88. data/docs/sitemap.adoc +337 -0
  89. data/docs/troubleshooting.adoc +486 -0
  90. data/docs/validation.adoc +772 -0
  91. data/exe/postsvg +1 -0
  92. data/lib/postsvg/cli.rb +104 -57
  93. data/lib/postsvg/color.rb +132 -0
  94. data/lib/postsvg/errors.rb +68 -3
  95. data/lib/postsvg/format_number.rb +22 -0
  96. data/lib/postsvg/graphics_context.rb +80 -0
  97. data/lib/postsvg/graphics_stack.rb +43 -0
  98. data/lib/postsvg/model/literals/array.rb +41 -0
  99. data/lib/postsvg/model/literals/dictionary.rb +34 -0
  100. data/lib/postsvg/model/literals/hex.rb +37 -0
  101. data/lib/postsvg/model/literals/name.rb +40 -0
  102. data/lib/postsvg/model/literals/number.rb +36 -0
  103. data/lib/postsvg/model/literals/procedure.rb +41 -0
  104. data/lib/postsvg/model/literals/string.rb +30 -0
  105. data/lib/postsvg/model/literals.rb +19 -0
  106. data/lib/postsvg/model/operator.rb +58 -0
  107. data/lib/postsvg/model/operators/arithmetic.rb +264 -0
  108. data/lib/postsvg/model/operators/boolean.rb +182 -0
  109. data/lib/postsvg/model/operators/color.rb +74 -0
  110. data/lib/postsvg/model/operators/container.rb +186 -0
  111. data/lib/postsvg/model/operators/control_flow.rb +119 -0
  112. data/lib/postsvg/model/operators/device.rb +21 -0
  113. data/lib/postsvg/model/operators/dictionary.rb +118 -0
  114. data/lib/postsvg/model/operators/font.rb +121 -0
  115. data/lib/postsvg/model/operators/graphics_state.rb +84 -0
  116. data/lib/postsvg/model/operators/painting.rb +29 -0
  117. data/lib/postsvg/model/operators/path.rb +169 -0
  118. data/lib/postsvg/model/operators/stack.rb +72 -0
  119. data/lib/postsvg/model/operators/transformations.rb +103 -0
  120. data/lib/postsvg/model/operators.rb +89 -0
  121. data/lib/postsvg/model/program.rb +68 -0
  122. data/lib/postsvg/model/token.rb +43 -0
  123. data/lib/postsvg/model.rb +17 -0
  124. data/lib/postsvg/options.rb +29 -0
  125. data/lib/postsvg/renderer.rb +85 -0
  126. data/lib/postsvg/serializer.rb +325 -0
  127. data/lib/postsvg/source/ast_builder.rb +308 -0
  128. data/lib/postsvg/source/lexer.rb +322 -0
  129. data/lib/postsvg/source/operand_stack.rb +55 -0
  130. data/lib/postsvg/source.rb +21 -0
  131. data/lib/postsvg/svg/attribute_parser.rb +45 -0
  132. data/lib/postsvg/svg/clip_path_registry.rb +44 -0
  133. data/lib/postsvg/svg/document.rb +22 -0
  134. data/lib/postsvg/svg/element.rb +84 -0
  135. data/lib/postsvg/svg/elements/circle.rb +36 -0
  136. data/lib/postsvg/svg/elements/clip_path.rb +26 -0
  137. data/lib/postsvg/svg/elements/defs.rb +24 -0
  138. data/lib/postsvg/svg/elements/ellipse.rb +38 -0
  139. data/lib/postsvg/svg/elements/group.rb +37 -0
  140. data/lib/postsvg/svg/elements/image.rb +35 -0
  141. data/lib/postsvg/svg/elements/line.rb +36 -0
  142. data/lib/postsvg/svg/elements/path.rb +32 -0
  143. data/lib/postsvg/svg/elements/polygon.rb +12 -0
  144. data/lib/postsvg/svg/elements/polyline.rb +32 -0
  145. data/lib/postsvg/svg/elements/rect.rb +44 -0
  146. data/lib/postsvg/svg/elements/svg.rb +39 -0
  147. data/lib/postsvg/svg/elements/text.rb +42 -0
  148. data/lib/postsvg/svg/elements.rb +31 -0
  149. data/lib/postsvg/svg/paint.rb +34 -0
  150. data/lib/postsvg/svg/parser.rb +39 -0
  151. data/lib/postsvg/svg/path_data/command.rb +27 -0
  152. data/lib/postsvg/svg/path_data/parser.rb +82 -0
  153. data/lib/postsvg/svg/path_data.rb +17 -0
  154. data/lib/postsvg/svg/stroke.rb +31 -0
  155. data/lib/postsvg/svg/transform_list.rb +59 -0
  156. data/lib/postsvg/svg.rb +22 -0
  157. data/lib/postsvg/svg_builder.rb +249 -0
  158. data/lib/postsvg/translation/arc_converter.rb +86 -0
  159. data/lib/postsvg/translation/bounding_box.rb +59 -0
  160. data/lib/postsvg/translation/context.rb +34 -0
  161. data/lib/postsvg/translation/handler_registry.rb +38 -0
  162. data/lib/postsvg/translation/handlers/circle_handler.rb +28 -0
  163. data/lib/postsvg/translation/handlers/clip_path_handler.rb +13 -0
  164. data/lib/postsvg/translation/handlers/defs_handler.rb +15 -0
  165. data/lib/postsvg/translation/handlers/ellipse_handler.rb +31 -0
  166. data/lib/postsvg/translation/handlers/group_handler.rb +21 -0
  167. data/lib/postsvg/translation/handlers/image_handler.rb +20 -0
  168. data/lib/postsvg/translation/handlers/line_handler.rb +23 -0
  169. data/lib/postsvg/translation/handlers/open_handler.rb +18 -0
  170. data/lib/postsvg/translation/handlers/path_handler.rb +356 -0
  171. data/lib/postsvg/translation/handlers/polygon_handler.rb +33 -0
  172. data/lib/postsvg/translation/handlers/polyline_handler.rb +31 -0
  173. data/lib/postsvg/translation/handlers/rect_handler.rb +27 -0
  174. data/lib/postsvg/translation/handlers/shared.rb +110 -0
  175. data/lib/postsvg/translation/handlers/svg_handler.rb +25 -0
  176. data/lib/postsvg/translation/handlers/text_handler.rb +56 -0
  177. data/lib/postsvg/translation/handlers.rb +25 -0
  178. data/lib/postsvg/translation/ps_renderer.rb +105 -0
  179. data/lib/postsvg/translation/record_emitter.rb +35 -0
  180. data/lib/postsvg/translation.rb +17 -0
  181. data/lib/postsvg/version.rb +1 -1
  182. data/lib/postsvg/visitors/ps_visitor/arithmetic.rb +125 -0
  183. data/lib/postsvg/visitors/ps_visitor/boolean.rb +105 -0
  184. data/lib/postsvg/visitors/ps_visitor/color.rb +53 -0
  185. data/lib/postsvg/visitors/ps_visitor/common.rb +66 -0
  186. data/lib/postsvg/visitors/ps_visitor/container.rb +164 -0
  187. data/lib/postsvg/visitors/ps_visitor/control_flow.rb +110 -0
  188. data/lib/postsvg/visitors/ps_visitor/device.rb +20 -0
  189. data/lib/postsvg/visitors/ps_visitor/dictionary.rb +89 -0
  190. data/lib/postsvg/visitors/ps_visitor/font.rb +93 -0
  191. data/lib/postsvg/visitors/ps_visitor/graphics_state.rb +55 -0
  192. data/lib/postsvg/visitors/ps_visitor/painting.rb +90 -0
  193. data/lib/postsvg/visitors/ps_visitor/path.rb +112 -0
  194. data/lib/postsvg/visitors/ps_visitor/stack.rb +47 -0
  195. data/lib/postsvg/visitors/ps_visitor/transformations.rb +101 -0
  196. data/lib/postsvg/visitors/ps_visitor.rb +208 -0
  197. data/lib/postsvg/visitors.rb +9 -0
  198. data/lib/postsvg.rb +93 -59
  199. data/lychee.toml +86 -0
  200. metadata +216 -11
  201. data/postsvg.gemspec +0 -38
@@ -0,0 +1,296 @@
1
+ = version Command
2
+ :page-nav_order: 4
3
+ :page-parent: CLI Reference
4
+
5
+ == Purpose
6
+
7
+ The `version` command displays the current version of Postsvg installed on your system. This is useful for troubleshooting, verifying installations, and ensuring compatibility.
8
+
9
+ == References
10
+
11
+ * link:../index.adoc[Documentation Home]
12
+ * link:../cli-reference.adoc[CLI Reference Overview]
13
+ * link:convert-command.adoc[convert Command]
14
+ * link:../getting-started/installation.adoc[Installation Guide]
15
+
16
+ == Concepts
17
+
18
+ **Semantic Versioning**:: Version numbering scheme (MAJOR.MINOR.PATCH) used by Postsvg.
19
+
20
+ **Gem Version**:: The version of the Postsvg gem installed via RubyGems.
21
+
22
+ ## Command Syntax
23
+
24
+ [source,sh]
25
+ ----
26
+ postsvg version <1>
27
+ ----
28
+ <1> Display Postsvg version number
29
+
30
+ **Arguments:** None
31
+
32
+ **Options:** None
33
+
34
+ **Exit Code:** Always `0` (success)
35
+
36
+ **Source:**
37
+ [`lib/postsvg/cli.rb:145-148`](../../lib/postsvg/cli.rb:145)
38
+
39
+ == Basic Usage
40
+
41
+ === Display Version
42
+
43
+ [source,sh]
44
+ ----
45
+ $ postsvg version
46
+ postsvg version 0.1.0
47
+ ----
48
+
49
+ .Check version after installation
50
+ [example]
51
+ ====
52
+ [source,sh]
53
+ ----
54
+ # After installing
55
+ $ gem install postsvg
56
+
57
+ # Verify installation
58
+ $ postsvg version
59
+ postsvg version 0.1.0
60
+
61
+ # Confirm command is accessible
62
+ $ which postsvg
63
+ /usr/local/lib/ruby/gems/3.2.0/bin/postsvg
64
+ ----
65
+ ====
66
+
67
+ == Version Information
68
+
69
+ === Version Number Format
70
+
71
+ Postsvg follows Semantic Versioning (SemVer):
72
+
73
+ [source]
74
+ ----
75
+ MAJOR.MINOR.PATCH
76
+ │ │ │
77
+ │ │ └─ Bug fixes
78
+ │ └─ New features (backwards compatible)
79
+ └─ Breaking changes
80
+ ----
81
+
82
+ **Example Versions:**
83
+ * `0.1.0` - Initial release
84
+ * `0.1.1` - Bug fix release
85
+ * `0.2.0` - New feature release
86
+ * `1.0.0` - First stable release
87
+
88
+ === Version Checking in Scripts
89
+
90
+ [source,sh]
91
+ ----
92
+ #!/bin/bash
93
+ # check-version.sh
94
+
95
+ VERSION=$(postsvg version | cut -d' ' -f3)
96
+ REQUIRED="0.1.0"
97
+
98
+ if [ "$VERSION" != "$REQUIRED" ]; then
99
+ echo "Warning: Expected version $REQUIRED, found $VERSION"
100
+ exit 1
101
+ fi
102
+
103
+ echo "✓ Correct version installed"
104
+ ----
105
+
106
+ .Minimum version check
107
+ [example]
108
+ ====
109
+ [source,sh]
110
+ ----
111
+ #!/bin/bash
112
+ # require-minimum-version.sh
113
+
114
+ VERSION=$(postsvg version | awk '{print $3}')
115
+ MAJOR=$(echo $VERSION | cut -d. -f1)
116
+ MINOR=$(echo $VERSION | cut -d. -f2)
117
+
118
+ if [ $MAJOR -eq 0 ] && [ $MINOR -lt 1 ]; then
119
+ echo "Error: Postsvg 0.1.0 or higher required"
120
+ echo "Found: $VERSION"
121
+ exit 1
122
+ fi
123
+
124
+ echo "✓ Version check passed: $VERSION"
125
+ ----
126
+ ====
127
+
128
+ ## Troubleshooting
129
+
130
+ === Command Not Found
131
+
132
+ **Problem:**
133
+ [source]
134
+ ----
135
+ $ postsvg version
136
+ bash: postsvg: command not found
137
+ ----
138
+
139
+ **Solutions:**
140
+
141
+ 1. **Check if gem is installed:**
142
+ [source,sh]
143
+ ----
144
+ gem list postsvg
145
+ ----
146
+
147
+ 2. **Install if missing:**
148
+ [source,sh]
149
+ ----
150
+ gem install postsvg
151
+ ----
152
+
153
+ 3. **Add to PATH:**
154
+ [source,sh]
155
+ ----
156
+ export PATH="$PATH:$(gem environment gemdir)/bin"
157
+ ----
158
+
159
+ === Wrong Version
160
+
161
+ **Problem:**
162
+ Need different version than installed.
163
+
164
+ **Solutions:**
165
+
166
+ 1. **Check installed versions:**
167
+ [source,sh]
168
+ ----
169
+ gem list postsvg
170
+ ----
171
+
172
+ 2. **Install specific version:**
173
+ [source,sh]
174
+ ----
175
+ gem install postsvg -v '0.2.0'
176
+ ----
177
+
178
+ 3. **Update to latest:**
179
+ [source,sh]
180
+ ----
181
+ gem update postsvg
182
+ ----
183
+
184
+ 4. **Uninstall old versions:**
185
+ [source,sh]
186
+ ----
187
+ gem uninstall postsvg --version '0.1.0'
188
+ ----
189
+
190
+ == Usage Examples
191
+
192
+ === System Information Script
193
+
194
+ [source,sh]
195
+ ----
196
+ #!/bin/bash
197
+ # system-info.sh
198
+
199
+ echo "System Information for Postsvg"
200
+ echo "=============================="
201
+ echo "Postsvg version: $(postsvg version | awk '{print $3}')"
202
+ echo "Ruby version: $(ruby -v)"
203
+ echo "Gem directory: $(gem environment gemdir)"
204
+ echo "Install location: $(which postsvg)"
205
+ echo "=============================="
206
+ ----
207
+
208
+ === Compatibility Check
209
+
210
+ [source,sh]
211
+ ----
212
+ #!/bin/bash
213
+ # compat-check.sh
214
+
215
+ PS_VERSION=$(postsvg version | awk '{print $3}')
216
+ RUBY_VERSION=$(ruby -e 'puts RUBY_VERSION')
217
+
218
+ echo "Environment Check:"
219
+ echo " Postsvg: $PS_VERSION"
220
+ echo " Ruby: $RUBY_VERSION"
221
+
222
+ # Check Ruby version >= 2.7
223
+ RUBY_MAJOR=$(echo $RUBY_VERSION | cut -d. -f1)
224
+ RUBY_MINOR=$(echo $RUBY_VERSION | cut -d. -f2)
225
+
226
+ if [ $RUBY_MAJOR -lt 2 ] || ([ $RUBY_MAJOR -eq 2 ] && [ $RUBY_MINOR -lt 7 ]); then
227
+ echo "✗ Ruby 2.7 or higher required"
228
+ exit 1
229
+ fi
230
+
231
+ echo "✓ Environment compatible"
232
+ ----
233
+
234
+ === Version in Help
235
+
236
+ The version is also shown in help output:
237
+
238
+ [source,sh]
239
+ ----
240
+ $ postsvg help
241
+ Commands:
242
+ postsvg batch INPUT_DIR [OUTPUT_DIR] # Convert all PS/EPS files in a directory
243
+ postsvg check FILES # Validate PostScript/EPS files
244
+ postsvg convert INPUT [OUTPUT] # Convert PostScript/EPS file to SVG
245
+ postsvg help [COMMAND] # Describe available commands...
246
+ postsvg version # Show version
247
+
248
+ $ postsvg --version
249
+ postsvg version 0.1.0
250
+ ----
251
+
252
+ == Related Information
253
+
254
+ === Gem Information
255
+
256
+ Get more details about the Postsvg gem:
257
+
258
+ [source,sh]
259
+ ----
260
+ # Gem info
261
+ $ gem info postsvg
262
+
263
+ # All versions installed
264
+ $ gem list postsvg
265
+
266
+ # Gem specification
267
+ $ gem specification postsvg
268
+
269
+ # Gem dependencies
270
+ $ gem dependency postsvg
271
+ ----
272
+
273
+ === Version in Ruby Code
274
+
275
+ Access version programmatically:
276
+
277
+ [source,ruby]
278
+ ----
279
+ require 'postsvg'
280
+
281
+ puts Postsvg::VERSION
282
+ # Output: 0.1.0
283
+ ----
284
+
285
+ ## Next Steps
286
+
287
+ * Return to link:../index.adoc[Documentation Home]
288
+ * Review link:convert-command.adoc[convert command]
289
+ * See link:batch-command.adoc[batch command]
290
+ * Check link:check-command.adoc[check command]
291
+
292
+ == Bibliography
293
+
294
+ * link:../getting-started/installation.adoc[Installation Guide]
295
+ * link:https://semver.org/[Semantic Versioning Specification]
296
+ * link:https://rubygems.org/gems/postsvg[Postsvg on RubyGems]
@@ -0,0 +1,317 @@
1
+ = CLI Reference
2
+ :page-nav_order: 5
3
+
4
+ == Purpose
5
+
6
+ This section provides comprehensive documentation for the Postsvg command-line interface. Learn how to use the `postsvg` command for file conversion, batch processing, and validation.
7
+
8
+ == References
9
+
10
+ * link:index.adoc[Documentation Home]
11
+ * link:getting-started.adoc[Getting Started Guide]
12
+ * link:api-reference.adoc[API Reference]
13
+ * link:validation.adoc[Validation System]
14
+
15
+ == Concepts
16
+
17
+ **CLI Command**:: A command-line tool that performs PostScript to SVG conversion without writing Ruby code.
18
+
19
+ **Subcommands**:: Different operations available through the CLI: convert, batch, check, version.
20
+
21
+ **Options**:: Flags that modify the behavior of CLI commands (e.g., `--strict`, `--verbose`).
22
+
23
+ **Exit Codes**:: Return values indicating success (0) or failure (1) for scripting and automation.
24
+
25
+ == CLI Reference Topics
26
+
27
+ link:cli-reference/convert-command.adoc[**convert Command**]::
28
+ Convert a single PostScript or EPS file to SVG format.
29
+
30
+ link:cli-reference/batch-command.adoc[**batch Command**]::
31
+ Convert all PS/EPS files in a directory to SVG format.
32
+
33
+ link:cli-reference/check-command.adoc[**check Command**]::
34
+ Validate PostScript/EPS files with multiple validation levels and output formats.
35
+
36
+ link:cli-reference/version-command.adoc[**version Command**]::
37
+ Display the Postsvg version number.
38
+
39
+ link:cli-reference/cli-options.adoc[**CLI Options Reference**]::
40
+ Complete reference for all CLI options and flags.
41
+
42
+ == Quick Reference
43
+
44
+ === Installation Verification
45
+
46
+ [source,sh]
47
+ ----
48
+ # Check installation
49
+ postsvg version
50
+
51
+ # Get help
52
+ postsvg help
53
+ postsvg help convert
54
+ postsvg help batch
55
+ postsvg help check
56
+ ----
57
+
58
+ === Convert Command
59
+
60
+ [source,sh]
61
+ ----
62
+ # Convert to file
63
+ postsvg convert input.eps output.svg
64
+
65
+ # Convert to stdout
66
+ postsvg convert input.ps
67
+
68
+ # Convert with strict mode
69
+ postsvg convert --strict input.eps output.svg
70
+ ----
71
+
72
+ === Batch Command
73
+
74
+ [source,sh]
75
+ ----
76
+ # Convert all files in directory
77
+ postsvg batch ps_files/
78
+
79
+ # Convert to different directory
80
+ postsvg batch ps_files/ svg_files/
81
+
82
+ # Batch with strict mode
83
+ postsvg batch --strict ps_files/ svg_files/
84
+ ----
85
+
86
+ === Check Command
87
+
88
+ [source,sh]
89
+ ----
90
+ # Basic validation
91
+ postsvg check document.ps
92
+
93
+ # Validation with specific level
94
+ postsvg check --level=syntax document.ps
95
+ postsvg check --level=semantic document.ps
96
+ postsvg check --level=full document.ps
97
+
98
+ # Multiple files
99
+ postsvg check file1.ps file2.eps file3.ps
100
+
101
+ # JSON output for CI/CD
102
+ postsvg check --format=json --no-color document.ps
103
+
104
+ # Fail fast on first error
105
+ postsvg check --fail-fast *.ps
106
+
107
+ # Validate EPS version
108
+ postsvg check --eps-version=3.0 diagram.eps
109
+ ----
110
+
111
+ == Common Usage Patterns
112
+
113
+ === Basic Workflow
114
+
115
+ [source,sh]
116
+ ----
117
+ # 1. Validate the file
118
+ postsvg check document.ps
119
+
120
+ # 2. Convert if valid
121
+ postsvg convert document.ps document.svg
122
+ ----
123
+
124
+ === Batch Processing
125
+
126
+ [source,sh]
127
+ ----
128
+ # Process entire directory
129
+ postsvg batch input/ output/
130
+
131
+ # Check status
132
+ echo $? # 0 = success, 1 = failure
133
+ ----
134
+
135
+ === CI/CD Integration
136
+
137
+ [source,sh]
138
+ ----
139
+ #!/bin/bash
140
+ # Validation script for CI/CD
141
+
142
+ # Validate all PostScript files
143
+ postsvg check --format=json --no-color \
144
+ --level=full --fail-fast *.ps
145
+
146
+ # Exit with validation status
147
+ exit $?
148
+ ----
149
+
150
+ === Scripted Conversion
151
+
152
+ [source,sh]
153
+ ----
154
+ #!/bin/bash
155
+ # Convert all EPS files to SVG
156
+
157
+ for file in *.eps; do
158
+ basename="${file%.eps}"
159
+ postsvg convert "$file" "${basename}.svg"
160
+
161
+ if [ $? -eq 0 ]; then
162
+ echo "✓ Converted $file"
163
+ else
164
+ echo "✗ Failed $file"
165
+ fi
166
+ done
167
+ ----
168
+
169
+ == Exit Codes
170
+
171
+ All Postsvg commands use standard Unix exit codes:
172
+
173
+ [cols="1,4"]
174
+ |===
175
+ | Code | Meaning
176
+
177
+ | `0`
178
+ | Success - operation completed without errors
179
+
180
+ | `1`
181
+ | Failure - operation failed or validation errors found
182
+ |===
183
+
184
+ .Using exit codes in scripts
185
+ [example]
186
+ ====
187
+ [source,sh]
188
+ ----
189
+ postsvg check document.ps
190
+ if [ $? -eq 0 ]; then
191
+ echo "File is valid"
192
+ postsvg convert document.ps document.svg
193
+ else
194
+ echo "File has errors"
195
+ exit 1
196
+ fi
197
+ ----
198
+ ====
199
+
200
+ == Output Formats
201
+
202
+ === Convert Command Output
203
+
204
+ **To file:**
205
+ [source,sh]
206
+ ----
207
+ $ postsvg convert input.eps output.svg
208
+ Successfully converted input.eps to output.svg
209
+ ----
210
+
211
+ **To stdout:**
212
+ [source,sh]
213
+ ----
214
+ $ postsvg convert input.ps
215
+ <svg xmlns="http://www.w3.org/2000/svg"...>
216
+ ...
217
+ </svg>
218
+ ----
219
+
220
+ === Check Command Output
221
+
222
+ **Text format (default):**
223
+ [source,sh]
224
+ ----
225
+ $ postsvg check document.ps
226
+ ✓ document.ps - Valid PostScript file
227
+ File type: PostScript
228
+ Validation level: semantic
229
+ No errors found
230
+ ----
231
+
232
+ **JSON format:**
233
+ [source,sh]
234
+ ----
235
+ $ postsvg check --format=json document.ps
236
+ {
237
+ "filename": "document.ps",
238
+ "valid": true,
239
+ "file_type": "PostScript",
240
+ "errors": [],
241
+ "warnings": [],
242
+ "info": []
243
+ }
244
+ ----
245
+
246
+ **YAML format:**
247
+ [source,sh]
248
+ ----
249
+ $ postsvg check --format=yaml document.ps
250
+ ---
251
+ filename: document.ps
252
+ valid: true
253
+ file_type: PostScript
254
+ errors: []
255
+ warnings: []
256
+ info: []
257
+ ----
258
+
259
+ === Batch Command Output
260
+
261
+ [source,sh]
262
+ ----
263
+ $ postsvg batch ps_files/ svg_files/
264
+ Found 3 file(s) to convert
265
+ ✓ ps_files/file1.ps → svg_files/file1.svg
266
+ ✓ ps_files/file2.eps → svg_files/file2.svg
267
+ ✗ ps_files/file3.ps: Conversion error: Invalid syntax
268
+ ----
269
+
270
+ == Environment Variables
271
+
272
+ Postsvg respects standard Ruby environment variables:
273
+
274
+ **RUBY_VERSION**:: Minimum Ruby 2.7 required
275
+ **RUBYOPT**:: Ruby interpreter options
276
+ **GEM_HOME**:: Gem installation directory
277
+
278
+ == Troubleshooting
279
+
280
+ **Command not found:**
281
+ [source,sh]
282
+ ----
283
+ # Ensure gem bin directory is in PATH
284
+ gem environment
285
+ export PATH="$PATH:$(gem environment gemdir)/bin"
286
+ ----
287
+
288
+ **Permission denied:**
289
+ [source,sh]
290
+ ----
291
+ # Make executable
292
+ chmod +x $(which postsvg)
293
+ ----
294
+
295
+ **Wrong version:**
296
+ [source,sh]
297
+ ----
298
+ # Update to latest
299
+ gem update postsvg
300
+
301
+ # Or specify version
302
+ gem install postsvg -v '0.1.0'
303
+ ----
304
+
305
+ == Next Steps
306
+
307
+ * Review link:cli-reference/convert-command.adoc[convert command] details
308
+ * Explore link:cli-reference/check-command.adoc[check command] for validation
309
+ * See link:validation.adoc[Validation System] for quality checks
310
+ * Check link:getting-started/common-workflows.adoc[Common Workflows] for examples
311
+
312
+ == Bibliography
313
+
314
+ * link:cli-reference/convert-command.adoc[Convert Command Documentation]
315
+ * link:cli-reference/batch-command.adoc[Batch Command Documentation]
316
+ * link:cli-reference/check-command.adoc[Check Command Documentation]
317
+ * link:https://github.com/erikhuda/thor[Thor CLI Framework]