inversion 1.3.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Examples.md +134 -0
  4. data/GettingStarted.md +50 -0
  5. data/Guide.md +14 -0
  6. data/{History.rdoc → History.md} +59 -43
  7. data/{README.rdoc → README.md} +43 -34
  8. data/Tags.md +555 -0
  9. data/bin/inversion +4 -8
  10. data/lib/inversion/cli/api.rb +75 -0
  11. data/lib/inversion/cli/tagtokens.rb +34 -0
  12. data/lib/inversion/cli/tree.rb +70 -0
  13. data/lib/inversion/cli.rb +406 -0
  14. data/lib/inversion/exceptions.rb +0 -1
  15. data/lib/inversion/mixins.rb +10 -11
  16. data/lib/inversion/parser.rb +5 -6
  17. data/lib/inversion/refinements.rb +18 -0
  18. data/lib/inversion/renderstate.rb +24 -25
  19. data/lib/inversion/sinatra.rb +0 -1
  20. data/lib/inversion/template/attrtag.rb +7 -5
  21. data/lib/inversion/template/begintag.rb +0 -1
  22. data/lib/inversion/template/calltag.rb +0 -1
  23. data/lib/inversion/template/codetag.rb +37 -28
  24. data/lib/inversion/template/commenttag.rb +0 -1
  25. data/lib/inversion/template/configtag.rb +3 -4
  26. data/lib/inversion/template/containertag.rb +1 -2
  27. data/lib/inversion/template/defaulttag.rb +1 -2
  28. data/lib/inversion/template/elsetag.rb +0 -1
  29. data/lib/inversion/template/elsiftag.rb +0 -1
  30. data/lib/inversion/template/endtag.rb +2 -3
  31. data/lib/inversion/template/escapetag.rb +1 -2
  32. data/lib/inversion/template/fortag.rb +2 -3
  33. data/lib/inversion/template/fragmenttag.rb +1 -2
  34. data/lib/inversion/template/iftag.rb +3 -1
  35. data/lib/inversion/template/importtag.rb +2 -3
  36. data/lib/inversion/template/includetag.rb +1 -2
  37. data/lib/inversion/template/node.rb +4 -5
  38. data/lib/inversion/template/pptag.rb +1 -2
  39. data/lib/inversion/template/publishtag.rb +2 -3
  40. data/lib/inversion/template/rescuetag.rb +1 -2
  41. data/lib/inversion/template/subscribetag.rb +3 -4
  42. data/lib/inversion/template/tag.rb +3 -4
  43. data/lib/inversion/template/textnode.rb +1 -2
  44. data/lib/inversion/template/timedeltatag.rb +1 -2
  45. data/lib/inversion/template/unlesstag.rb +0 -1
  46. data/lib/inversion/template/uriencodetag.rb +1 -2
  47. data/lib/inversion/template/yieldtag.rb +0 -1
  48. data/lib/inversion/template.rb +18 -22
  49. data/lib/inversion/tilt.rb +1 -2
  50. data/lib/inversion.rb +2 -3
  51. data/lib/roda/plugins/inversion.rb +225 -0
  52. data/spec/helpers.rb +19 -13
  53. data/spec/inversion/mixins_spec.rb +1 -1
  54. data/spec/inversion/parser_spec.rb +1 -1
  55. data/spec/inversion/refinements_spec.rb +22 -0
  56. data/spec/inversion/renderstate_spec.rb +1 -1
  57. data/spec/inversion/sinatra_spec.rb +1 -1
  58. data/spec/inversion/template/attrtag_spec.rb +1 -1
  59. data/spec/inversion/template/begintag_spec.rb +1 -1
  60. data/spec/inversion/template/calltag_spec.rb +1 -1
  61. data/spec/inversion/template/codetag_spec.rb +24 -1
  62. data/spec/inversion/template/commenttag_spec.rb +1 -1
  63. data/spec/inversion/template/configtag_spec.rb +1 -1
  64. data/spec/inversion/template/containertag_spec.rb +1 -1
  65. data/spec/inversion/template/defaulttag_spec.rb +1 -1
  66. data/spec/inversion/template/elsetag_spec.rb +1 -1
  67. data/spec/inversion/template/elsiftag_spec.rb +1 -1
  68. data/spec/inversion/template/endtag_spec.rb +1 -1
  69. data/spec/inversion/template/escapetag_spec.rb +1 -1
  70. data/spec/inversion/template/fortag_spec.rb +1 -1
  71. data/spec/inversion/template/fragmenttag_spec.rb +1 -1
  72. data/spec/inversion/template/iftag_spec.rb +1 -1
  73. data/spec/inversion/template/importtag_spec.rb +1 -1
  74. data/spec/inversion/template/includetag_spec.rb +1 -1
  75. data/spec/inversion/template/node_spec.rb +1 -1
  76. data/spec/inversion/template/pptag_spec.rb +1 -1
  77. data/spec/inversion/template/publishtag_spec.rb +1 -1
  78. data/spec/inversion/template/rescuetag_spec.rb +1 -1
  79. data/spec/inversion/template/subscribetag_spec.rb +1 -1
  80. data/spec/inversion/template/tag_spec.rb +1 -1
  81. data/spec/inversion/template/textnode_spec.rb +1 -1
  82. data/spec/inversion/template/timedeltatag_spec.rb +1 -1
  83. data/spec/inversion/template/unlesstag_spec.rb +1 -1
  84. data/spec/inversion/template/uriencodetag_spec.rb +1 -1
  85. data/spec/inversion/template/yieldtag_spec.rb +1 -1
  86. data/spec/inversion/template_spec.rb +1 -1
  87. data/spec/inversion/tilt_spec.rb +1 -1
  88. data/spec/inversion_spec.rb +1 -1
  89. data/spec/roda/plugins/inversion_spec.rb +91 -0
  90. data.tar.gz.sig +0 -0
  91. metadata +90 -58
  92. metadata.gz.sig +0 -0
  93. data/Examples.rdoc +0 -134
  94. data/GettingStarted.rdoc +0 -44
  95. data/Guide.rdoc +0 -47
  96. data/Manifest.txt +0 -86
  97. data/Rakefile +0 -7
  98. data/Tags.rdoc +0 -560
  99. data/lib/inversion/command.rb +0 -278
  100. data/lib/inversion/monkeypatches.rb +0 -21
  101. data/spec/inversion/monkeypatches_spec.rb +0 -25
@@ -1,12 +1,19 @@
1
- = inversion
1
+ # inversion
2
2
 
3
- home:: https://hg.sr.ht/~ged/Inversion
4
- code:: https://hg.sr.ht/~ged/Inversion/browse
5
- github:: https://github.com/ged/inversion
6
- docs:: http://deveiate.org/code/Inversion
3
+ home
4
+ : https://hg.sr.ht/~ged/Inversion
7
5
 
6
+ code
7
+ : https://hg.sr.ht/~ged/Inversion/browse
8
8
 
9
- == Description
9
+ github
10
+ : https://github.com/ged/inversion
11
+
12
+ docs
13
+ : http://deveiate.org/code/inversion
14
+
15
+
16
+ ## Description
10
17
 
11
18
  Inversion is a templating system for Ruby. It uses the "Inversion of Control"
12
19
  principle to decouple the contents and structure of templates from the code
@@ -14,7 +21,7 @@ that uses them, making it easier to separate concerns, keep your tests simple,
14
21
  and avoid polluting scopes with ephemeral data.
15
22
 
16
23
 
17
- === Details
24
+ ### Details
18
25
 
19
26
  Inversion, like most other templating systems, works by giving you a way of
20
27
  defining the static parts of your output, and then letting you combine that at
@@ -22,12 +29,12 @@ a later point with the dynamic parts:
22
29
 
23
30
  Create the template and use it to render an exciting message:
24
31
 
25
- tmpl = Inversion::Template.new( "Hello, <?attr name ?>!" )
26
- tmpl.name = "World"
27
- puts tmpl.render
32
+ tmpl = Inversion::Template.new( "Hello, <?attr name ?>!" )
33
+ tmpl.name = "World"
34
+ puts tmpl.render
28
35
 
29
- The <tt><?attr name ?></tt> tag defines the _name_ accessor on the template
30
- object, the value of which is substituted for any occurrences of +name+ in the
36
+ The `<?attr name ?>` tag defines the _name_ accessor on the template
37
+ object, the value of which is substituted for any occurrences of `name` in the
31
38
  template:
32
39
 
33
40
  Hello, World!
@@ -45,15 +52,15 @@ You can also interact with the values set in the template:
45
52
 
46
53
  Name: <?attr employee.full_name ?>
47
54
 
48
- This will call the +#full_name+ method on whatever is set as the +employee+
55
+ This will call the #full_name method on whatever is set as the `employee`
49
56
  attribute when rendered, and the result will take the place of the tag.
50
57
 
51
- Inversion also comes with {a collection of other tags}[rdoc-ref:Tags] that
58
+ Inversion also comes with [a collection of other tags](rdoc-ref:Tags) that
52
59
  provide flow control, exception-handling, etc.
53
60
 
54
61
  Here's a slightly more complex example: Say we have a layout template that
55
62
  contains all the boilerplate, navigation, etc. for the site, and then an
56
- <code><?attr body ?></code> somewhere in the content area for the content specific to
63
+ `<?attr body ?>` somewhere in the content area for the content specific to
57
64
  each view:
58
65
 
59
66
  layout = Inversion::Template.load( 'templates/layout.tmpl' )
@@ -70,8 +77,8 @@ Then there's a view template that displays a bulleted list of article titles:
70
77
  </section>
71
78
 
72
79
  Loading this template results in a Ruby object whose API contains one method:
73
- +#articles+. To render the view, we just call that accessor with instances of
74
- an +Article+ domain class we defined elsewhere, and then drop the +alist+
80
+ `#articles`. To render the view, we just call that accessor with instances of
81
+ an `Article` domain class we defined elsewhere, and then drop the `alist`
75
82
  template into the layout and render them:
76
83
 
77
84
  alist = Inversion::Template.load( 'templates/alist.tmpl' )
@@ -80,8 +87,8 @@ template into the layout and render them:
80
87
  layout.body = alist
81
88
  puts layout.render
82
89
 
83
- The +for+ tag in the alist will iterate over the enumerable Articles and
84
- generate an +<li>+ for each one. The resulting template object will be set as
90
+ The `for` tag in the alist will iterate over the enumerable Articles and
91
+ generate an `<li>` for each one. The resulting template object will be set as
85
92
  the body of the layout template, and stringified when the enclosing template
86
93
  is rendered. Templates can be nested this way as deeply as you like.
87
94
 
@@ -89,43 +96,45 @@ For detailed tag documentation and examples, start with the Inversion::Template
89
96
  class in the API documentation.
90
97
 
91
98
 
92
- == References
99
+ ## References
93
100
 
94
- * {Inversion of Control}[http://en.wikipedia.org/wiki/Inversion_of_control]
95
- * {Passive View}[http://martinfowler.com/eaaDev/PassiveScreen.html]
96
- * {Supervising Controller}[http://martinfowler.com/eaaDev/SupervisingPresenter.html]
101
+ * Inversion of Control - https://en.wikipedia.org/wiki/Inversion_of_control
102
+ * Passive View - https://martinfowler.com/eaaDev/PassiveScreen.html
103
+ * Supervising Controller - https://martinfowler.com/eaaDev/SupervisingPresenter.html
97
104
 
98
105
 
99
- == Installation
106
+ ## Installation
100
107
 
101
108
  gem install inversion
102
109
 
103
110
 
104
- == Contributing
111
+ ## Contributing
105
112
 
106
113
  You can check out the current development source
107
- {with Mercurial}[http://repo.deveiate.org/Inversion], or if you prefer Git, via the
108
- project's {Github mirror}[https://github.com/ged/Inversion].
114
+ [with Mercurial](https://hg.sr.ht/~ged/Inversion), or if you prefer Git, via the
115
+ project's [Github mirror](https://github.com/ged/Inversion).
109
116
 
110
117
  You can submit bug reports, suggestions, and read more about future plans at
111
- {the project page}[http://deveiate.org/projects/Inversion].
118
+ [the project page](https://hg.sr.ht/~ged/Inversion).
112
119
 
113
120
  After checking out the source, run:
114
121
 
115
- $ rake newb
122
+ $ gem install -Ng
123
+ $ rake setup
124
+
125
+ This task will install any missing dependencies and do any necessary developer
126
+ setup.
116
127
 
117
- This task will install any missing dependencies, run the tests/specs,
118
- and generate the API documentation.
119
128
 
120
- == Authors
129
+ ## Authors
121
130
 
122
131
  * Michael Granger <ged@faeriemud.org>
123
132
  * Mahlon E. Smith <mahlon@martini.nu>
124
133
 
125
134
 
126
- == License
135
+ ## License
127
136
 
128
- Copyright © 2011-2020, Michael Granger and Mahlon E. Smith
137
+ Copyright © 2011-2022, Michael Granger and Mahlon E. Smith
129
138
  All rights reserved.
130
139
 
131
140
  Redistribution and use in source and binary forms, with or without