indoctrinatr-tools 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.arcconfig +3 -3
  3. data/.rubocop.yml +3 -0
  4. data/.rvmrc +1 -1
  5. data/.travis.yml +2 -2
  6. data/README.md +12 -3
  7. data/bin/indoctrinatr +40 -10
  8. data/features/demo.feature +7 -7
  9. data/features/doc_keepauxfiles.feature +13 -0
  10. data/features/documentation.feature +13 -4
  11. data/features/fieldnames_pdf.feature +9 -0
  12. data/features/fieldnames_pdf_auxfiles.feature +10 -0
  13. data/features/parse.feature +1 -1
  14. data/features/pdf.feature +2 -1
  15. data/features/pdf_keepauxfiles.feature +11 -0
  16. data/features/version.feature +1 -1
  17. data/features/workflow.feature +1 -0
  18. data/indoctrinatr-tools.gemspec +10 -10
  19. data/lib/indoctrinatr/templates/configuration.yaml +11 -3
  20. data/lib/indoctrinatr/templates/documentation/dkd-image-tools.sty +72 -0
  21. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation-content.tex.erb +17 -12
  22. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation.tex.erb +8 -0
  23. data/lib/indoctrinatr/templates/template.tex.erb +10 -3
  24. data/lib/indoctrinatr/tools/configuration_extractor.rb +1 -1
  25. data/lib/indoctrinatr/tools/content_for_tex_files.rb +36 -0
  26. data/lib/indoctrinatr/tools/default_values.rb +3 -28
  27. data/lib/indoctrinatr/tools/field_name_values.rb +57 -0
  28. data/lib/indoctrinatr/tools/pdf_generator.rb +36 -0
  29. data/lib/indoctrinatr/tools/template_documentation_content.rb +26 -16
  30. data/lib/indoctrinatr/tools/template_documentation_helpers.rb +13 -0
  31. data/lib/indoctrinatr/tools/template_documentation_source_file.rb +12 -12
  32. data/lib/indoctrinatr/tools/template_pack_configuration.rb +1 -1
  33. data/lib/indoctrinatr/tools/template_pack_default_values_compiler.rb +12 -4
  34. data/lib/indoctrinatr/tools/template_pack_default_values_parser.rb +4 -0
  35. data/lib/indoctrinatr/tools/template_pack_documentation.rb +32 -11
  36. data/lib/indoctrinatr/tools/template_pack_error_checker.rb +104 -0
  37. data/lib/indoctrinatr/tools/template_pack_fieldnames_creator.rb +79 -0
  38. data/lib/indoctrinatr/tools/template_pack_helpers.rb +34 -4
  39. data/lib/indoctrinatr/tools/template_pack_scaffold.rb +2 -2
  40. data/lib/indoctrinatr/tools/version.rb +1 -1
  41. data/lib/redcloth_latex_formatter_patch/patch.rb +2 -1
  42. data/spec/indoctrinatr/templates/configuration_file_spec.rb +1 -1
  43. data/spec/indoctrinatr/templates/tex_file_spec.rb +1 -1
  44. data/spec/indoctrinatr/tools/version_spec.rb +1 -1
  45. metadata +33 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0fe5d601575b7ece3e77dc6b7dde2b31a291c46
4
- data.tar.gz: 80e84638993fb7a8a771d3fa2c7c7bfad4317242
3
+ metadata.gz: 946f82d2025797573ceeedd251de1548a4a098b1
4
+ data.tar.gz: c1fb29ef98597a90ae8068c93f6aab58aac47f20
5
5
  SHA512:
6
- metadata.gz: ddff4b9e60e6b0ae25345c6365268966942ff1461949b306b1db036cb30cbefd74e4cf62ef2f8aaaf0b167def2963b038c7df57f2a382e7b1b87d8dcd994901c
7
- data.tar.gz: 45a39be9f0bf9d8b4e743944317b45fa56e621b6cd35c9bcc07588aae5a51949a2b35c11b4f2b9524e0c8fd002c4d5ace58759abc37ef7dfb3e3ad069017078c
6
+ metadata.gz: 89779066419330bf6d47c20f06aa496bb60a08d1f7d5c53134a13fa565aaa3624468ba2f51698b61c0c1f36c4ca8c0eec3518820c1d11a472d4702dd284f32eb
7
+ data.tar.gz: 643cb0340284d5d995f1b2d58de983ed2d11b3fb2f82a8f8b65d6673bf2cf0761036cd9a73428c55278747aea39161b6e0307e30cd31f6b6b97bc52ac3804751
data/.arcconfig CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "phabricator.uri": "https://phabricator.dkd.de/",
3
- "project.name": "INDOCTRINATRTOOLS",
3
+ "project.name": "indoctrinatr-tools",
4
+ "repository.callsign": "INDOCTRINATRTOOLS",
4
5
  "arc.feature.start.default": "development",
5
6
  "arc.land.onto.default": "development",
6
7
  "history.immutable": true,
7
- "base": "git:merge-base(development),arc:upstream",
8
- "load": []
8
+ "base": "git:merge-base(development),arc:upstream"
9
9
  }
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ Exclude:
3
+ - tmp/**/*
1
4
  Metrics/LineLength:
2
5
  Max: 240
3
6
  Style/MethodDefParentheses:
data/.rvmrc CHANGED
@@ -1,4 +1,4 @@
1
- rvm use 2.1
1
+ rvm use 2.1.9
2
2
 
3
3
  alias brake='bundle exec'
4
4
  alias rubocop='bundle exec rubocop'
data/.travis.yml CHANGED
@@ -1,15 +1,15 @@
1
1
  sudo: true
2
2
  language: ruby
3
3
  rvm:
4
+ - '2.3'
4
5
  - '2.2'
5
6
  - '2.1'
6
- - '2.0'
7
7
  cache:
8
8
  - bundler
9
9
  - apt
10
10
  before_install:
11
11
  - sudo apt-get update && sudo wget https://github.com/scottkosty/install-tl-ubuntu/raw/master/install-tl-ubuntu && sudo chmod +x ./install-tl-ubuntu && sudo ./install-tl-ubuntu
12
- - gem install bundler -v 1.10.6
12
+ - gem install bundler -v 1.12.3
13
13
  script:
14
14
  - bundle exec indoctrinatr demo
15
15
  - bundle exec rake test_with_coveralls
data/README.md CHANGED
@@ -11,9 +11,9 @@ Rubygem: [![Gem Version](https://badge.fury.io/rb/indoctrinatr-tools.svg)](http:
11
11
  1. Install XeTeX:
12
12
 
13
13
  Mac OS X: [MacTeX](https://tug.org/mactex/)
14
-
14
+
15
15
  Debian/Ubuntu:
16
-
16
+
17
17
  ```shell
18
18
  apt-get install texlive texlive-xetex texlive-latex-extra texlive-generic-extra
19
19
  ```
@@ -27,7 +27,9 @@ Rubygem: [![Gem Version](https://badge.fury.io/rb/indoctrinatr-tools.svg)](http:
27
27
 
28
28
  ### LaTeX Requirements
29
29
 
30
+ * `latexmk`
30
31
  * for the template documentation
32
+ * Tested against TeX Live 2014
31
33
  * `dirtree`
32
34
  * `datetime2`
33
35
 
@@ -40,13 +42,19 @@ Command | Description
40
42
  `indoctrinatr new project_name` | Creates a scaffold for a new Template Pack
41
43
  `indoctrinatr parse project_name` | Parses a XeTex file with ERB and default values
42
44
  `indoctrinatr pdf project_name` | Compiles PDF with default values
45
+ `indoctrinatr pdf_with_field_names project_name` | Generates PDF with the field names as values
43
46
  `indoctrinatr doc project_name` | Creates a technical documentation of your template pack
47
+ `indoctrinatr check project_name` | Analyzes your Template Pack for errors
44
48
  `indoctrinatr pack project_name` | Creates a Template Pack from a given project folder
45
49
  `indoctrinatr demo` | Creates, parses, and compiles a demo project
46
50
  `indoctrinatr workflow` | Displays a suggested workflow
47
51
  `indoctrinatr bashcompletion` | Displays instructions for bash completion
48
52
  `indoctrinatr zshcompletion` | Displays instructions for zsh completion
49
53
 
54
+ The commands `pdf`, `pdf_with_field_names` and `doc` have a `keep-aux-files` option. This is helpful if you run in into LaTeX errors, want to inspect the .log file and run LaTeX for yourself again.
55
+
56
+ The command `doc` does not overwrite existing examples. This means that you can customize the examples that are appended in the documentation.
57
+
50
58
  ## Build
51
59
 
52
60
  If you want to build the Rubygem yourself, run `rake build` to build and `rake install` to build and install the Indoctrinatr Tools gem.
@@ -60,6 +68,7 @@ What you think of Indoctrinatr and Indoctrinatr Tools? Drop us a line (<opensour
60
68
  We are also looking forward to your [GitHub Pull Requests](https://help.github.com/articles/using-pull-requests/).
61
69
 
62
70
  Manual testing: After cloning the repo, run `bundle exec bin/indoctrinatr` inside the directory for testing your own development changes.
71
+ Automatic testing: run `rake test_with_coveralls`
63
72
 
64
73
  ## License
65
74
 
@@ -69,6 +78,6 @@ Indoctrinatr and Indoctrinatr Tools are licensed under the terms and conditions
69
78
 
70
79
  [![dkd](assets/images/dkd_logo.png)](https://dkd.de/)
71
80
 
72
- * Luka Lüdicke
81
+ * Luka Lüdicke (development)
73
82
  * Nicolai Reuschling (development)
74
83
  * Søren Schaffstein (idea, product management)
data/bin/indoctrinatr CHANGED
@@ -7,7 +7,9 @@ require 'indoctrinatr/tools/template_pack_scaffold'
7
7
  require 'indoctrinatr/tools/template_pack_packer'
8
8
  require 'indoctrinatr/tools/template_pack_default_values_parser'
9
9
  require 'indoctrinatr/tools/template_pack_default_values_compiler'
10
+ require 'indoctrinatr/tools/template_pack_fieldnames_creator'
10
11
  require 'indoctrinatr/tools/template_pack_documentation'
12
+ require 'indoctrinatr/tools/template_pack_error_checker'
11
13
 
12
14
  include GLI::App
13
15
  include Indoctrinatr::Tools
@@ -39,7 +41,10 @@ command :workflow do |c|
39
41
  4. Run in shell: indoctrinatr pdf demo
40
42
  Compiles PDF from demo_with_default_values.tex
41
43
 
42
- 5. Run in shell: indoctrinatr pack demo
44
+ 5. Run in shell: indoctrinatr check demo
45
+ Analyzes your Template Pack for potential errors
46
+
47
+ 6. Run in shell: indoctrinatr pack demo
43
48
  Creates demo.zip with all required file for upload to Indoctrinatr server
44
49
 
45
50
  '
@@ -49,7 +54,7 @@ end
49
54
  desc 'Create, compile and pack a demo project'
50
55
  command :demo do |c|
51
56
  c.action do
52
- Indoctrinatr::Tools::TemplatePackDemo.new('demo').call
57
+ TemplatePackDemo.new('demo').call
53
58
  end
54
59
  end
55
60
 
@@ -58,7 +63,7 @@ arg_name 'template-pack-name'
58
63
  command :new do |c|
59
64
  c.action do |_, _, args|
60
65
  template_pack_name = args.join '_'
61
- Indoctrinatr::Tools::TemplatePackScaffold.new(template_pack_name).call
66
+ TemplatePackScaffold.new(template_pack_name).call
62
67
  end
63
68
  end
64
69
 
@@ -67,28 +72,53 @@ arg_name 'template_pack_name'
67
72
  command :parse do |c|
68
73
  c.action do |_, _, args|
69
74
  template_pack_name = args.join '_'
70
- Indoctrinatr::Tools::TemplatePackDefaultValuesParser.new(template_pack_name).call
75
+ TemplatePackDefaultValuesParser.new(template_pack_name).call
71
76
  end
72
77
  end
73
78
 
74
79
  desc 'Compile PDF with default values'
75
80
  arg_name 'template_pack_name'
76
81
  command :pdf do |c|
77
- c.action do |_, _, args|
82
+ c.desc 'Keep generated aux files'
83
+ c.switch [:'keep-aux-files']
84
+ c.action do |_, options, args|
78
85
  template_pack_name = args.join '_'
86
+ keep_aux_files = options[:'keep-aux-files']
79
87
  TemplatePackDefaultValuesParser.new(template_pack_name).call
80
- Indoctrinatr::Tools::TemplatePackDefaultValuesCompiler.new(template_pack_name).call
88
+ TemplatePackDefaultValuesCompiler.new(template_pack_name, keep_aux_files).call
89
+ end
90
+ end
91
+
92
+ desc 'Compile PDF with Variable Names as values'
93
+ arg_name 'template_pack_name'
94
+ command :pdf_with_field_names do |c|
95
+ c.desc 'Keep generated aux files'
96
+ c.switch [:'keep-aux-files']
97
+ c.action do |_, options, args|
98
+ template_pack_name = args.join '_'
99
+ keep_aux_files = options[:'keep-aux-files']
100
+ TemplatePackFieldnamesCreator.new(template_pack_name, keep_aux_files).call
81
101
  end
82
102
  end
83
103
 
84
104
  desc 'Create a documentation from a given source folder'
85
105
  arg_name 'template_pack_name'
86
106
  command :doc do |c|
107
+ c.desc 'Keep generated aux files'
108
+ c.switch [:'keep-aux-files']
109
+ c.action do |_, options, args|
110
+ template_pack_name = args.join '_'
111
+ keep_aux_files = options[:'keep-aux-files']
112
+ TemplatePackDocumentation.new(template_pack_name, keep_aux_files).call
113
+ end
114
+ end
115
+
116
+ desc 'Check for errors in the given source folder'
117
+ arg_name 'template_pack_name'
118
+ command :check do |c|
87
119
  c.action do |_, _, args|
88
120
  template_pack_name = args.join '_'
89
- TemplatePackDefaultValuesParser.new(template_pack_name).call # hierarchy - these files are needed. Unfortunately GLI::App does not offer to run other commands
90
- TemplatePackDefaultValuesCompiler.new(template_pack_name).call
91
- Indoctrinatr::Tools::TemplatePackDocumentation.new(template_pack_name).call
121
+ TemplatePackErrorChecker.new(template_pack_name).call
92
122
  end
93
123
  end
94
124
 
@@ -97,7 +127,7 @@ arg_name 'template_pack_name'
97
127
  command :pack do |c|
98
128
  c.action do |_, _, args|
99
129
  template_pack_name = args.join '_'
100
- Indoctrinatr::Tools::TemplatePackPacker.new(template_pack_name).call
130
+ TemplatePackPacker.new(template_pack_name).call
101
131
  end
102
132
  end
103
133
 
@@ -5,13 +5,13 @@ Feature: Running the "demo" command
5
5
 
6
6
  Scenario:
7
7
  When I successfully run `indoctrinatr demo`
8
- Then a file named "demo_with_default_values.pdf" should exist
8
+ Then a file named "demo/doc/demo_technical_documentation.pdf" should exist
9
9
  And a directory named "demo" should exist
10
10
  And a directory named "demo/assets" should exist
11
11
  And the following files should exist:
12
- | demo/configuration.yaml |
13
- | demo/demo.tex.erb |
14
- | demo/demo_with_default_values.tex |
15
- | demo/demo_technical_documentation.pdf |
16
- | demo_with_default_values.pdf |
17
- | demo.zip |
12
+ | demo/configuration.yaml |
13
+ | demo/demo.tex.erb |
14
+ | demo/doc/examples/demo_with_default_values.tex |
15
+ | demo/doc/examples/demo_with_default_values.pdf |
16
+ | demo/doc/demo_technical_documentation.pdf |
17
+ | demo.zip |
@@ -0,0 +1,13 @@
1
+ Feature: Running the 'doc' command with keepauxfiles
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 40 seconds
5
+
6
+ Scenario: creating documentation for given project
7
+ Given I do not have a 'demo' project
8
+ When I successfully run `indoctrinatr new demo`
9
+ And I successfully run `indoctrinatr doc demo --keep-aux-files`
10
+ Then the output should match /A documentation for 'demo' has been successfully generated/
11
+ Then a file named "demo/doc/demo_technical_documentation.pdf" should exist
12
+ And a file named "demo/doc/indoctrinatr-technical-documentation.log" should exist
13
+ And a file named "demo/doc/indoctrinatr-technical-documentation.tex" should exist
@@ -1,11 +1,20 @@
1
1
  Feature: Running the 'doc' command
2
2
 
3
3
  Background:
4
- Given the default aruba exit timeout is 20 seconds
5
-
6
- Scenario: creating documentation for given project
4
+ Given the default aruba exit timeout is 40 seconds
7
5
  Given I do not have a 'demo' project
8
6
  When I successfully run `indoctrinatr new demo`
7
+
8
+ Scenario: creating documentation for given project
9
+ And I successfully run `indoctrinatr doc demo`
10
+ Then the output should match /Example with field names has been automatically generated for the documentation/
11
+ Then the output should match /A documentation for 'demo' has been successfully generated/
12
+ Then a file named "demo/doc/demo_technical_documentation.pdf" should exist
13
+
14
+ Scenario: creating the documentation without overwriting a FieldNames PDF example
15
+ And I successfully run `indoctrinatr pdf_with_field_names demo`
16
+ Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
9
17
  And I successfully run `indoctrinatr doc demo`
18
+ Then the output should not match /Example with field names has been automatically generated for the documentation/
10
19
  Then the output should match /A documentation for 'demo' has been successfully generated/
11
- Then a file named "demo/demo_technical_documentation.pdf" should exist
20
+ Then a file named "demo/doc/demo_technical_documentation.pdf" should exist
@@ -0,0 +1,9 @@
1
+ Feature: Running the 'pdf_with_field_names' command
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 20 seconds
5
+
6
+ Scenario: for a given 'demo' project
7
+ Given I have an Indoctrinatr project 'demo'
8
+ And I run `indoctrinatr pdf_with_field_names demo`
9
+ Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
@@ -0,0 +1,10 @@
1
+ Feature: Running the 'pdf_with_field_names' command with keepauxfiles
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 20 seconds
5
+
6
+ Scenario: for a given 'demo' project
7
+ Given I have an Indoctrinatr project 'demo'
8
+ And I run `indoctrinatr pdf_with_field_names demo --keep-aux-files`
9
+ Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
10
+ And a file named "demo/doc/examples/demo_with_fieldname_values.log" should exist
@@ -3,4 +3,4 @@ Feature: Running the 'parse' command
3
3
  Scenario: for a given 'demo' project
4
4
  Given I have an Indoctrinatr project 'demo'
5
5
  When I successfully run `indoctrinatr parse demo`
6
- Then a file named "demo/demo_with_default_values.tex" should exist
6
+ Then a file named "demo/doc/examples/demo_with_default_values.tex" should exist
data/features/pdf.feature CHANGED
@@ -7,4 +7,5 @@ Feature: Running the 'pdf' command
7
7
  Given I have an Indoctrinatr project 'demo'
8
8
  When I successfully run `indoctrinatr parse demo`
9
9
  And I run `indoctrinatr pdf demo`
10
- Then a file named "demo_with_default_values.pdf" should exist
10
+ Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
11
+ # there is not (an easy) way to use the current timestamp. Therefore the template for the 'new' command should not be static
@@ -0,0 +1,11 @@
1
+ Feature: Running the 'pdf' command with keepauxfiles option
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 20 seconds
5
+
6
+ Scenario: for a given 'demo' project
7
+ Given I have an Indoctrinatr project 'demo'
8
+ And I run `indoctrinatr pdf demo --keep-aux-files`
9
+ Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
10
+ And a file named "demo/doc/examples/demo_with_default_values.log" should exist
11
+ # there is not (an easy) way to use the current timestamp. Therefore the template for the 'new' command should not be static
@@ -2,4 +2,4 @@ Feature: Running the "version" command
2
2
 
3
3
  Scenario:
4
4
  When I successfully run `indoctrinatr version`
5
- Then the output should contain "0.11.0"
5
+ Then the output should contain "0.12.0"
@@ -5,4 +5,5 @@ Feature: Running the "workflow" command
5
5
  Then the output should contain "new"
6
6
  Then the output should contain "parse"
7
7
  Then the output should contain "pdf"
8
+ Then the output should contain "check"
8
9
  Then the output should contain "pack"
@@ -6,9 +6,9 @@ require 'indoctrinatr/tools/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'indoctrinatr-tools'
8
8
  spec.version = Indoctrinatr::Tools::VERSION
9
- spec.authors = ['Nicolai Reuschling']
10
- spec.email = ['nicolai.reuschling@dkd.de']
11
- spec.summary = 'indoctrinatr-tools provides a set of command line tools for Indoctrinatr (an Open Source Software project by dkd Internet Service GmbH, Frankfurt am Main, Germany.)'
9
+ spec.authors = ['Nicolai Reuschling', 'Luka Lüdicke']
10
+ spec.email = ['nicolai.reuschling@dkd.de', 'luka.luedicke@dkd.de']
11
+ spec.summary = 'indoctrinatr-tools provides a set of command line tools for Indoctrinatr (an Open Source Software project by dkd Internet Service GmbH, Frankfurt am Main, Germany).'
12
12
  # spec.description = %q{TODO: Write a longer description. Optional.}
13
13
  spec.homepage = ''
14
14
  spec.license = 'MIT'
@@ -20,12 +20,12 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1.9'
24
- spec.add_development_dependency 'rake', '~> 10.4'
25
- spec.add_development_dependency 'rspec', '~> 3.3'
26
- spec.add_development_dependency 'cucumber', '~> 2.0'
23
+ spec.add_development_dependency 'bundler', '~> 1.12'
24
+ spec.add_development_dependency 'rake', '~> 11.1'
25
+ spec.add_development_dependency 'rspec', '~> 3.4'
26
+ spec.add_development_dependency 'cucumber', '~> 2.3'
27
27
  spec.add_development_dependency 'aruba', '~> 0.9'
28
- spec.add_development_dependency 'rubocop', '~> 0.33'
28
+ spec.add_development_dependency 'rubocop', '~> 0.40'
29
29
  spec.add_development_dependency 'pry', '~> 0.10'
30
30
  spec.add_development_dependency 'coveralls', '~> 0.8'
31
31
 
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency 'rubyzip', '~> 1.1'
34
34
  spec.add_dependency 'erubis', '~> 2.7'
35
35
  spec.add_dependency 'to_latex', '~> 0.5'
36
- spec.add_dependency 'RedCloth', '~> 4.2'
36
+ spec.add_dependency 'RedCloth', '~> 4.3'
37
37
 
38
- spec.requirements << 'xelatex'
38
+ spec.requirements << 'LaTeX development enviroment'
39
39
  end
@@ -1,17 +1,25 @@
1
1
  template_name: Hello World Template
2
- textual_description: "This is your first Indoctrinatr template.
2
+ textual_description: |
3
+ This is your first _Indoctrinatr_ template. You can use _Textile_ syntax here to *highlight* important information.
3
4
 
4
- Edit is as you like. Read more at https://github.com/dkd/indoctrinatr."
5
+ Edit this template as you like. Read more at https://github.com/dkd/indoctrinatr.
5
6
  fields:
6
7
  -
7
8
  name: variable1
9
+ label: Who is it?
8
10
  presentation: text
9
11
  default_value: "World"
10
12
  description: "The first variable"
13
+ -
14
+ name: date
15
+ label: Date
16
+ presentation: date
17
+ default_value: '#{Time.now.year}-#{Time.now.month}-#{Time.now.day}'
11
18
  -
12
19
  name: variable2
20
+ label: Type of World
21
+ required: "true"
13
22
  presentation: dropdown
14
23
  default_value: "not enough"
15
24
  available_options: "not enough, beautiful, your oyster, a template"
16
25
  description: "The second variable. The description name can be very long and should adequately describe what the variable is for etc. pp."
17
- required: "true"
@@ -0,0 +1,72 @@
1
+ % Author Søren Schaffstein
2
+ % package "dkd-image-tools"
3
+ % this package provides some image handling tools to make handling of images easier
4
+
5
+ % include required libraries (tikz, xstring, xparse, graphicx)
6
+
7
+ %use "graphicx" for including images
8
+ \usepackage{graphicx}
9
+
10
+
11
+ % use "tikz" package for drawing
12
+ \usepackage{tikz}
13
+
14
+
15
+ % use "xparse" package to allow command definitions with mutliple optional arguments
16
+ \usepackage{xparse}
17
+
18
+
19
+ % use "xstring" package to allow string comparisons
20
+ \usepackage{xstring}
21
+
22
+
23
+
24
+ % creates a placeholder for images with the given dimensions and name
25
+ % usage: \imagePlaceholder{<width>}{<height>}{<image name>}[<message>]
26
+ % usage example: \imagePlaceholder{\textwidth}{120mm}{sunset.jpg}[Image not found:]
27
+ \DeclareDocumentCommand{\imagePlaceholder}{ m m m O{} }{%
28
+ \begin{tikzpicture}[x=#1, y=#2]
29
+ \draw (0,0) rectangle (1,1);
30
+ \draw[color=light-gray] (0,0) -- (1,1);
31
+ \draw[color=light-gray] (0,1) -- (1,0);
32
+ \node at (0.5, 0.7) {\Large\texttt{#4}};
33
+ \node at (0.5, 0.5) {\Large\texttt{#3}};
34
+ \end{tikzpicture}
35
+ }
36
+
37
+
38
+ % defines an image placement command that checks if the file exists and places a placeholder if not
39
+ % usage: \placeImage{<image name>}[<width>]
40
+ % usage example: \placeImage{sunset.png}[0.5\textwidth]
41
+ \DeclareDocumentCommand{\placeImage}{ m O{\textwidth} }{%
42
+ % check if filename is not blank (don't return anything if filename is blank)
43
+ \IfStrEq{#1}{}{}{%
44
+ \IfFileExists{#1}{%
45
+ \includegraphics[width=#2]{images/#1}
46
+ }{%
47
+ \imagePlaceholder{#2}{#2}{#1}[Image not found:]
48
+ }
49
+ }
50
+ }
51
+
52
+
53
+
54
+ % defines a figure placement command that checks if the file exists and places a placeholder if not
55
+ % usage: \placeFigure{<image name>}[<caption>][<figure label>][<width>]
56
+ % usage example: \placeFigure{sunset.png}[This is a beautiful sunset!][fig:sun][0.5\textwidth]
57
+ \DeclareDocumentCommand{\placeFigure}{ m O{} O{} O{\textwidth} }{%
58
+ % check if filename is not blank (don't return anything if filename is blank)
59
+ \IfStrEq{#1}{}{}{%
60
+ \begin{figure}[htbp]
61
+ \placeImage{#1}[#4]
62
+ % place caption if one was given
63
+ \IfStrEq{#2}{}{}{%
64
+ \caption{#2}
65
+ }
66
+ % place a label if one was given
67
+ \IfStrEq{#3}{}{}{%
68
+ \label{#3}
69
+ }
70
+ \end{figure}
71
+ }
72
+ }