w2tags 0.9.3
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.
- data/COPYING +340 -0
- data/LICENSE +6 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +95 -0
- data/README.rdoc +264 -0
- data/Rakefile +23 -0
- data/VERSION +1 -0
- data/bin/w2tags +143 -0
- data/doc/ERB.HOT.rdoc +82 -0
- data/doc/FAQ.rdoc +81 -0
- data/doc/HAML.rdoc +310 -0
- data/doc/HOT.rdoc +137 -0
- data/doc/History.rdoc +757 -0
- data/doc/W2TAGS.rdoc +150 -0
- data/example/common.hot +11 -0
- data/example/from_readme.erb +78 -0
- data/example/from_readme.w2erb +64 -0
- data/example/from_w2tags.erb +32 -0
- data/example/from_w2tags.w2erb +32 -0
- data/example/rails_basic.hot +10 -0
- data/hot/erb.hot +156 -0
- data/hot/erb_form.hot +42 -0
- data/hot/erb_head.hot +15 -0
- data/hot/erb_jquery.hot +8 -0
- data/hot/erb_merb.hot +12 -0
- data/hot/erb_table.hot +43 -0
- data/hot/html.hot +31 -0
- data/hot/jquery.hot +88 -0
- data/hot/nvelocity.hot +23 -0
- data/hot/rails/sc_zebra.hot +10 -0
- data/hot/rails/scaffold.hot +15 -0
- data/hot/vm.hot +9 -0
- data/hot/vm2.hot +34 -0
- data/hot/vm_crud.hot +34 -0
- data/hot/vm_popup.hot +74 -0
- data/hot/xul.hot +114 -0
- data/lib/w2tags/block/plain_text.rb +57 -0
- data/lib/w2tags/block/remark.rb +37 -0
- data/lib/w2tags/block/sass.rb +66 -0
- data/lib/w2tags/merb_hook.rb +15 -0
- data/lib/w2tags/parser.rb +975 -0
- data/lib/w2tags/rails_hook.rb +15 -0
- data/lib/w2tags/sinatra_hook.rb +50 -0
- data/lib/w2tags.rb +100 -0
- data/plugins//w2tags//README +2 -0
- data/plugins//w2tags//generators//w2scaffold//USAGE +29 -0
- data/plugins//w2tags//generators//w2scaffold//templates//controller.rb +85 -0
- data/plugins//w2tags//generators//w2scaffold//templates//functional_test.rb +45 -0
- data/plugins//w2tags//generators//w2scaffold//templates//helper.rb +2 -0
- data/plugins//w2tags//generators//w2scaffold//templates//helper_test.rb +4 -0
- data/plugins//w2tags//generators//w2scaffold//templates//layout.html.erb +17 -0
- data/plugins//w2tags//generators//w2scaffold//templates//style.css +54 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_edit.html.erb +18 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_edit.html.w2erb +17 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_index.html.erb +24 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_index.html.w2erb +14 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_new.html.erb +17 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_new.html.w2erb +16 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_show.html.erb +10 -0
- data/plugins//w2tags//generators//w2scaffold//templates//view_show.html.w2erb +9 -0
- data/plugins//w2tags//generators//w2scaffold//w2scaffold_generator.rb +106 -0
- data/plugins//w2tags//install.rb +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/w2tags_spec.rb +8 -0
- data/tasks/ann.rake +81 -0
- data/tasks/bones.rake +21 -0
- data/tasks/gem.rake +126 -0
- data/tasks/git.rake +41 -0
- data/tasks/manifest.rake +49 -0
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +268 -0
- data/tasks/spec.rake +55 -0
- data/tasks/svn.rake +48 -0
- data/tasks/test.rake +38 -0
- data/test/enlightning.hot +3 -0
- data/test/feature.hot +28 -0
- data/test/parser_test.rb +203 -0
- data/test/tricky.hot +8 -0
- data/test/vars.hot +30 -0
- data/test/w2tags_basic_usability.rb +187 -0
- data/test/w2tags_enlightning.rb +42 -0
- data/test/w2tags_form.rb +32 -0
- data/test/w2tags_hot.rb +85 -0
- data/test/w2tags_hot_var.rb +115 -0
- data/test/w2tags_no_parsing.rb +37 -0
- metadata +163 -0
data/doc/History.rdoc
ADDED
@@ -0,0 +1,757 @@
|
|
1
|
+
= Change Log
|
2
|
+
|
3
|
+
Below is a complete listing of changes for each revision of W2TAGS.
|
4
|
+
|
5
|
+
== 0.9.3
|
6
|
+
|
7
|
+
=== Pass test on Linux Ubuntu 8.10 and win32
|
8
|
+
|
9
|
+
test for 57 assertions on:
|
10
|
+
|
11
|
+
Linux Ubuntu 8.10 Ruby 1.8.x
|
12
|
+
Win32 Ruby 1.9.1
|
13
|
+
|
14
|
+
=== Fix Compatible between ruby 1.8.x and 1.9.1
|
15
|
+
|
16
|
+
"test var"[-1] # only work on ruby 1.9.1
|
17
|
+
"test var"[-1,1] # worked!
|
18
|
+
|
19
|
+
=== Split Code to new file for w2tags Block not parsing
|
20
|
+
|
21
|
+
When I need to implement Sass Parser on w2tags Block not parsing
|
22
|
+
its best way to seperate to new file for (plain_text, remark, sass).
|
23
|
+
|
24
|
+
=== Implement Simple Sass Parser
|
25
|
+
|
26
|
+
Its my need for simple Sass Parser, focus on DRY up the Sass code,
|
27
|
+
calculation color, global variable not implement.
|
28
|
+
|
29
|
+
=== update erb.hot
|
30
|
+
|
31
|
+
now you can make "a href" more readable with var in Key-Variable
|
32
|
+
|
33
|
+
OLD:
|
34
|
+
~~~~
|
35
|
+
>>_a
|
36
|
+
%a$${href="#"} $*
|
37
|
+
|
38
|
+
NEW:
|
39
|
+
~~~~~
|
40
|
+
>>_a
|
41
|
+
%a$${href="*&"} $*
|
42
|
+
|
43
|
+
-a&/ Home => <a href="/">Home</a>
|
44
|
+
-a&/post/edit Edit => <a href="/post/edit">Edit</a>
|
45
|
+
|
46
|
+
== 0.9.1
|
47
|
+
|
48
|
+
=== Run on IRB
|
49
|
+
|
50
|
+
C:\>w2tags -irb
|
51
|
+
ARGV : -irb
|
52
|
+
|
53
|
+
Your W2Tags instance object stored in WH...
|
54
|
+
Ex: puts WH.parse_line("#content\n %span Hello")
|
55
|
+
Shortcut command => wh("#content\n %span Hello")
|
56
|
+
|
57
|
+
irb(main):001:0> wh(<<END)
|
58
|
+
irb(main):002:0" #wow
|
59
|
+
irb(main):003:0" #kereen
|
60
|
+
irb(main):004:0" %span Hello World
|
61
|
+
irb(main):005:0" END
|
62
|
+
=>C:/mingw/lib/ruby/gems/1.9.1/gems/w2tags-0.9.1/hot/html.hot
|
63
|
+
<div id="wow">
|
64
|
+
<div id="kereen">
|
65
|
+
<span>Hello World</span>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
=> nil
|
69
|
+
irb(main):006:0>
|
70
|
+
|
71
|
+
=== Changes in parser
|
72
|
+
|
73
|
+
==== Add InLine Parsing (%tag text%)
|
74
|
+
|
75
|
+
that's the first question came in FAQ on HAML, and I think this
|
76
|
+
implementation fit in my brain and it cover the Key-Variable too.
|
77
|
+
Lets see some example from minimal inline to inline with Key-Variable:
|
78
|
+
|
79
|
+
I Like (%b cake%)!
|
80
|
+
I Like (%span.b cake%)!
|
81
|
+
I Like (%strong.bold{banana="boys"} a(%i.italic cake%)%)!
|
82
|
+
|
83
|
+
I Like <b>cake</b>!
|
84
|
+
I Like <span class="b">cake</span>!
|
85
|
+
I Like <strong class="bold" banana="boys">a<i class="italic">cake</i></strong>!
|
86
|
+
|
87
|
+
==== Var $$ in HOT now implement full Key-Variable
|
88
|
+
|
89
|
+
==== Var \*all\* in HOT now implement full Attribute from Key-Variable
|
90
|
+
|
91
|
+
==== List Var-Constanta available in HOT
|
92
|
+
|
93
|
+
this is list Var-Constanta in HOT with value
|
94
|
+
|
95
|
+
Example:
|
96
|
+
|
97
|
+
%div&joel:name#id.class{op="atribute"}== info
|
98
|
+
|
99
|
+
$$ => full Key-Variable ( :name#id.class{op="atribute"}== )
|
100
|
+
$& => Variable for HOT ( &joel )
|
101
|
+
$: => name-Variable ( :name )
|
102
|
+
$# => id-Variable ( #id )
|
103
|
+
$. => class-Variable ( .class )
|
104
|
+
$@ => attribute-Variable ( {op="atribute"} )
|
105
|
+
*& => Variable for HOT ( joel )
|
106
|
+
*: => name-Variable ( name )
|
107
|
+
*# => id-Variable ( id )
|
108
|
+
*. => class-Variable ( class )
|
109
|
+
*@ => class-Variable ( op="atribute" )
|
110
|
+
*att* => attribute-Variable ( op="atribute" )
|
111
|
+
*all* => all-Variable ( name="name" id="id" class="class" op="atribute" )
|
112
|
+
*name* => name-Variable ( name="name" )
|
113
|
+
*id* => id-Variable ( id="id" )
|
114
|
+
*class*=> class-Variable ( class="class" )
|
115
|
+
|
116
|
+
==== Add Debug:Parser for some Block
|
117
|
+
|
118
|
+
Now Block of Plain-Text, Remark, and line of Plain-Text will show on Debug:Parser
|
119
|
+
|
120
|
+
==== Add Key-Variable "$&", and "*&" (method nameidclass_var)
|
121
|
+
|
122
|
+
this Variable use only on HOT, the purpose is sometime when it need DRY-ing tags
|
123
|
+
(like input), it need more params ( > 1 ) but since the design decission of w2tags
|
124
|
+
if params only 1 ($0), it repeatable but it more than that it not repeatable.
|
125
|
+
Syntax:
|
126
|
+
|
127
|
+
Ex:
|
128
|
+
%li&joel:on#soft.ware list
|
129
|
+
|
130
|
+
==== Change in Parsing Key-Variable (method nameidclass_var)
|
131
|
+
|
132
|
+
Key-Variable are attribute attach to tag like :name, #id and .class and now
|
133
|
+
you can assign that id without value
|
134
|
+
|
135
|
+
%input:address#.light/ ### or ####
|
136
|
+
:address#.light/
|
137
|
+
:#.light/
|
138
|
+
|
139
|
+
<input name="address" class="light"/>
|
140
|
+
<input name="address" class="light"/>
|
141
|
+
<input class="light"/>
|
142
|
+
|
143
|
+
|
144
|
+
this behaviour is need-it to overcome :name have a value of .class
|
145
|
+
|
146
|
+
:user.address#.light/
|
147
|
+
|
148
|
+
<input name="user.address" class="light"/>
|
149
|
+
|
150
|
+
==== HOT parser should not parse modifier of the next-tag "~^"
|
151
|
+
|
152
|
+
Modifier of the next-tag "~^" some time include internal var, Key-var
|
153
|
+
and if the modifier inside HOI it shuld not be parse.
|
154
|
+
|
155
|
+
==== Change Var "&tag" to "$tag"
|
156
|
+
|
157
|
+
Var Available when parsing HOT and it not intended to use on script, it use
|
158
|
+
only in HOT so, it should be as internal var ( prefix with "$" or "*" )
|
159
|
+
|
160
|
+
==== Removing char now using delete method
|
161
|
+
|
162
|
+
Ex:
|
163
|
+
":this#line\r\n".delete("\n")
|
164
|
+
|
165
|
+
==== Remove #comment legacy code
|
166
|
+
|
167
|
+
|
168
|
+
==== Change in Plain-Text
|
169
|
+
|
170
|
+
line start of Plain-Text (block will not be parse) now removed if no text
|
171
|
+
inside the command
|
172
|
+
|
173
|
+
#content
|
174
|
+
-!
|
175
|
+
#this is text only
|
176
|
+
|
177
|
+
<div id="content">
|
178
|
+
#this is text only
|
179
|
+
</div>
|
180
|
+
|
181
|
+
#content
|
182
|
+
-! wow
|
183
|
+
#this is text only
|
184
|
+
|
185
|
+
<div id="content">
|
186
|
+
wow
|
187
|
+
#this is text only
|
188
|
+
</div>
|
189
|
+
|
190
|
+
== 0.9.0
|
191
|
+
|
192
|
+
Leap Frog Update since it take dozen update to cover some of the quirk
|
193
|
+
found after testing the parser with combination and some of the design
|
194
|
+
(redesign) w2tags to make it much natural if I see it again.
|
195
|
+
|
196
|
+
=== Add TEST
|
197
|
+
|
198
|
+
now you can test the parser, it will grow when I have time to add to it or you can
|
199
|
+
email me for some test / change test that produce valid / error test to me.
|
200
|
+
|
201
|
+
=== Rename HTM.HOT to HTML.HOT
|
202
|
+
|
203
|
+
I think its natural...
|
204
|
+
|
205
|
+
=== Changes in sinatra_hook
|
206
|
+
|
207
|
+
remove checking for PLANFORM (due bug in sinatra but now fix)
|
208
|
+
|
209
|
+
=== Changes in parser
|
210
|
+
|
211
|
+
==== Change Variable to make it easy see patern
|
212
|
+
|
213
|
+
REMOVE REMAIN / ADD
|
214
|
+
@mem_var['*opt*'] @mem_var['$$'] :name#id.class{attr="optional"}
|
215
|
+
@mem_var['$@'] {attr="optional"}
|
216
|
+
@mem_var['*@'] attr="optional"
|
217
|
+
|
218
|
+
==== HOT now implement full key-attribute
|
219
|
+
|
220
|
+
%li:name#id.class{oth="attribute"} html
|
221
|
+
|
222
|
+
-li:name#id.class{oth="attribute"} html
|
223
|
+
|
224
|
+
==== @doc_out - line RIGHTSTRIPED
|
225
|
+
|
226
|
+
to make it standard for writing test
|
227
|
+
|
228
|
+
==== change behaviour parse_line()
|
229
|
+
|
230
|
+
old:parse_line(row,init=nil)
|
231
|
+
new:parse_line(row,init=true)
|
232
|
+
|
233
|
+
and debug parsing = false since focus now for the test, for
|
234
|
+
running on irb you just do:
|
235
|
+
|
236
|
+
W2TAGS = W2Tags::Parser.new
|
237
|
+
W2TAGS.dbg[:parse] = true
|
238
|
+
|
239
|
+
==== add parser for shortcut input (just like div)
|
240
|
+
|
241
|
+
since the implementation for name is there and usable for form and the form it self
|
242
|
+
commonly consist many of input tag, and inside that have attribute name, why not
|
243
|
+
implement it...
|
244
|
+
|
245
|
+
:test#wow.kereen{mak="nyos"} test
|
246
|
+
|
247
|
+
<input name="test" id="wow" class="kereen" mak="nyos">test</input>
|
248
|
+
|
249
|
+
==== update implementation of parse_set_var() / uniq var
|
250
|
+
|
251
|
+
now it will show the natural string of uniq value
|
252
|
+
|
253
|
+
@myvar=one;two;three
|
254
|
+
@myvar=five;one;two
|
255
|
+
%ul
|
256
|
+
^ @myvar!
|
257
|
+
|
258
|
+
<ul>
|
259
|
+
<li>one</li>
|
260
|
+
<li>two</li>
|
261
|
+
<li>three</li>
|
262
|
+
<li>five</li>
|
263
|
+
</ul>
|
264
|
+
|
265
|
+
==== rename method from "inside_rmk()" to "inside_remark()"
|
266
|
+
|
267
|
+
==== update regex and implementation of parse_set_mem()
|
268
|
+
|
269
|
+
old:/([ \t]*~\^)([^`\n]+)(`|\n)/
|
270
|
+
new:/([ \t]*~\^)([^\n]+)(\n)/
|
271
|
+
|
272
|
+
no need to add params for re-define shortcut
|
273
|
+
|
274
|
+
Ex:
|
275
|
+
|
276
|
+
~^%li.wclass
|
277
|
+
|
278
|
+
Produce:
|
279
|
+
|
280
|
+
@mem_tag["^"] = "%li.wclass $0\n"
|
281
|
+
|
282
|
+
==== update regex and implementation of parse_get_mem()
|
283
|
+
|
284
|
+
old:get_mem(/([\^])([^ ]+)\{([^\}]*)\}([^`\n]*)(`|\n)/) ? true : \
|
285
|
+
old:get_mem(/([\^])([^ ]+)([^`\n]*)(`|\n)/)
|
286
|
+
new:get_mem(/([\^])([^ ]* )([^\n]*)(\n)/)
|
287
|
+
|
288
|
+
now you can have :name #id or .class after shortcut (remember! must be w/o spaces)
|
289
|
+
|
290
|
+
Ex:
|
291
|
+
|
292
|
+
%ul
|
293
|
+
^.wc withclass
|
294
|
+
|
295
|
+
<ul>
|
296
|
+
<li class="wc">withclass</li>
|
297
|
+
</ul>
|
298
|
+
|
299
|
+
=== Add W2TAGS.rdoc
|
300
|
+
|
301
|
+
this guide are for explain commands found in W2TAGS and show some code-snipets
|
302
|
+
and some of pre-define patern and behaviour of each commands.
|
303
|
+
|
304
|
+
=== Changes in HOT.rdoc
|
305
|
+
|
306
|
+
Add information for new feature and change behaviour for:
|
307
|
+
|
308
|
+
New Features:
|
309
|
+
=$0 to =$9 Ruby Code
|
310
|
+
==$0 to ==$9 Ruby String Code
|
311
|
+
|
312
|
+
Change bahaviour of Variable interpolation
|
313
|
+
|
314
|
+
|
315
|
+
=== Changes in README.rdoc
|
316
|
+
|
317
|
+
Fix Sample Code
|
318
|
+
|
319
|
+
=== Undocumented VAR now documented
|
320
|
+
|
321
|
+
@mem_var['$me'] my nick name
|
322
|
+
@mem_var['$basepath'] current path
|
323
|
+
|
324
|
+
== 0.8.6
|
325
|
+
|
326
|
+
=== Changes in sinatra_hook.rb
|
327
|
+
|
328
|
+
Hook for Sinatra < 0.9.x and Sinatra > 0.9.x
|
329
|
+
|
330
|
+
=== Changes in htm.hot
|
331
|
+
|
332
|
+
swap / switch code between:
|
333
|
+
>>js >>_js
|
334
|
+
>>css >>_css
|
335
|
+
|
336
|
+
=== Changes in parser
|
337
|
+
|
338
|
+
==== update regex for merge_hot (!hot!)
|
339
|
+
|
340
|
+
Search folder are: running-ruby-script, source-w2tags, library-w2tags
|
341
|
+
|
342
|
+
==== update regex for merge_w2x (!inc!)
|
343
|
+
|
344
|
+
Compatible running on Win32 or Linux, not yet test on Mac. when the source w2tags
|
345
|
+
code in win32 and open in Linux, there been conflict on line-end since in Linux
|
346
|
+
source code from win32 not translate properly (need manually remove the CR)
|
347
|
+
|
348
|
+
== 0.8.5
|
349
|
+
|
350
|
+
=== Changes in htm.hot
|
351
|
+
|
352
|
+
params value always be trim/strip, no need to interpolation the "dollar",so you
|
353
|
+
can code like this:
|
354
|
+
|
355
|
+
-js jquery;jquery.listen
|
356
|
+
|
357
|
+
<script type="text/javascript" src="jquery.js" > </script>
|
358
|
+
<script type="text/javascript" src="jquery.listen.js" > </script>
|
359
|
+
|
360
|
+
>>_css
|
361
|
+
old: <link rel="stylesheet" href=" :strip$0.css" type="text/css" media="screen, projection" />
|
362
|
+
new: <link rel="stylesheet" href="$0.css" type="text/css" media="screen, projection" />
|
363
|
+
|
364
|
+
>>_js
|
365
|
+
old: <script type="text/javascript" src=" :strip$0.js" > </script>
|
366
|
+
new: <script type="text/javascript" src="$0.js" > </script>
|
367
|
+
|
368
|
+
=== Changes in erb.hot
|
369
|
+
|
370
|
+
>>_each2
|
371
|
+
old: $0.each_with_index do |r,i|
|
372
|
+
new: $0.each_with_index do |$1|
|
373
|
+
|
374
|
+
>>_eachs
|
375
|
+
new: $0.sort.each do |$1|
|
376
|
+
|
377
|
+
>>_a
|
378
|
+
new: %a{href="#"}$$ $*
|
379
|
+
|
380
|
+
>>_a2
|
381
|
+
new: %a{href="<%= $1 %>"}$$ $0
|
382
|
+
|
383
|
+
=== Changes in parser
|
384
|
+
|
385
|
+
==== update regex for !inc!
|
386
|
+
|
387
|
+
now you can specify path for include source
|
388
|
+
|
389
|
+
ex:
|
390
|
+
!inc!../partial/paginate
|
391
|
+
|
392
|
+
old: /!inc![ ]?([\w.]+)([`\n])/
|
393
|
+
new: /!inc![ ]?([\/\w._]s+)([`\n])/
|
394
|
+
|
395
|
+
==== update inline doc
|
396
|
+
|
397
|
+
add and update inline doc, some of the documentation need correct documentation
|
398
|
+
and I need feedback to get proper inline documentation
|
399
|
+
|
400
|
+
==== property "ext"
|
401
|
+
|
402
|
+
for testing, it will auto loading HOT files and default ext is "htm", and
|
403
|
+
now you can change the ext and auto loading will perform correctly.
|
404
|
+
|
405
|
+
==== lookup auto loading HOT changes (merge_tags)
|
406
|
+
|
407
|
+
now it will search in current folder if it not found it will search to gems
|
408
|
+
folder of w2tags/hot.
|
409
|
+
|
410
|
+
==== w2tags command last params with char "<"
|
411
|
+
|
412
|
+
now it support end of tag not automatically close when last params with char "<"
|
413
|
+
|
414
|
+
%div my div<
|
415
|
+
%div other div
|
416
|
+
|
417
|
+
<div>mydiv
|
418
|
+
<div>other div</div>
|
419
|
+
</div>
|
420
|
+
|
421
|
+
==== parse_set_var
|
422
|
+
|
423
|
+
value will be trim down
|
424
|
+
|
425
|
+
&var= value
|
426
|
+
@var= value2
|
427
|
+
%div &var!
|
428
|
+
%div @var!
|
429
|
+
|
430
|
+
<div>value</div>
|
431
|
+
<div>value2</div>
|
432
|
+
|
433
|
+
==== get_dollar / fix auto repeat line
|
434
|
+
|
435
|
+
change behaviour "auto repeat" line
|
436
|
+
|
437
|
+
>>_li
|
438
|
+
%li ~:capitalize$0
|
439
|
+
|
440
|
+
%ul
|
441
|
+
-li one;two
|
442
|
+
|
443
|
+
<ul>
|
444
|
+
<li>One</li>
|
445
|
+
<li>Two</li>
|
446
|
+
</ul>
|
447
|
+
|
448
|
+
==== Change Regex for get_dollar (default value)
|
449
|
+
|
450
|
+
old: Regexp.new('~([^~]+)~\\'+x)
|
451
|
+
new: Regexp.new('~:([^$]+)\\'+x)
|
452
|
+
|
453
|
+
=== Change Variable for name, id, class ( *: , *# , *. )
|
454
|
+
|
455
|
+
when you put command like:
|
456
|
+
|
457
|
+
%div:name#id.class myhtml
|
458
|
+
|
459
|
+
it will be save in these variable
|
460
|
+
|
461
|
+
@mem_var['$:'] = ":name"
|
462
|
+
@mem_var['*:'] = "name"
|
463
|
+
@mem_var['$#'] = "#id"
|
464
|
+
@mem_var['*#'] = "id"
|
465
|
+
@mem_var['$.'] = ".class"
|
466
|
+
@mem_var['*.'] = "class"
|
467
|
+
|
468
|
+
== 0.8.4
|
469
|
+
|
470
|
+
=== Sinatra Hook
|
471
|
+
last commit not include
|
472
|
+
|
473
|
+
=== Changes in parser
|
474
|
+
|
475
|
+
==== Now Parser can be test in IRB
|
476
|
+
|
477
|
+
irb -rubygems -rw2tags
|
478
|
+
> p=W2Tags::Parser.new
|
479
|
+
|
480
|
+
> p.parse_line '%h1 title'
|
481
|
+
=> [<h1>title</h1>\n]
|
482
|
+
|
483
|
+
> p.parse_line '%h1#main{op="head"} title'
|
484
|
+
=> [<h1>title</h1>\n, <h1 id="main" op="head">title</h1>\n]
|
485
|
+
|
486
|
+
==== Add Default Value for ~def_value~*var*
|
487
|
+
|
488
|
+
inside hot you can make a default value for predefine var. Ex:
|
489
|
+
|
490
|
+
>>_li
|
491
|
+
%li{~name="widi"~*att*}
|
492
|
+
|
493
|
+
%li line 1
|
494
|
+
%li{name="arie"} line 2
|
495
|
+
|
496
|
+
<li name="widi">line 1</li>
|
497
|
+
<li name="arie">line 2</li>
|
498
|
+
|
499
|
+
predefine var effected are:
|
500
|
+
|
501
|
+
*att*, *all*, *opt*, *id*, *name*, *class*, *code*
|
502
|
+
|
503
|
+
==== Change Regex for HOT
|
504
|
+
|
505
|
+
1. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)()~([^\n]*)\n/
|
506
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+)~([^\n]*)\n/
|
507
|
+
2. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)\{([^\}]*)\}~([^!=])/
|
508
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+\{[^\}]*\})~([^!=]*)\n/
|
509
|
+
|
510
|
+
==== Change Regex for get_dollar (default value)
|
511
|
+
|
512
|
+
old: Regexp.new('~([\w]*)~\\'+x)
|
513
|
+
new: Regexp.new('~([^~]+)~\\'+x)
|
514
|
+
|
515
|
+
==== Parser for :name#id.clas now include {attribut} and new var
|
516
|
+
parsing in w2tags and hot for {attribute} merge into method "idclass_var"
|
517
|
+
so it must change hot regex with the same params regex ($1,$2,$3)
|
518
|
+
|
519
|
+
variable *opt* is the same with $$
|
520
|
+
|
521
|
+
==== Syntax patern for Shortcut HOT is the same with w2tags command
|
522
|
+
|
523
|
+
ex: below an example shortcut HOT "-button" and how you write in source-code
|
524
|
+
|
525
|
+
### in HOT ###
|
526
|
+
>>_button
|
527
|
+
%button$${*att* ~label="$0"~}/
|
528
|
+
|
529
|
+
### command in source: ###
|
530
|
+
-button{disabled="true"} Red
|
531
|
+
-button{disabled="true" label="Red"}
|
532
|
+
%button{disabled="true" label="Red"}/
|
533
|
+
|
534
|
+
-button:def#key.hlite{disabled="true" num="1"} Red
|
535
|
+
|
536
|
+
### result ###
|
537
|
+
<button disabled="true" label="Red"/>
|
538
|
+
<button disabled="true" label="Red"/>
|
539
|
+
<button disabled="true" label="Red"/>
|
540
|
+
<button name="def" id="key" class="hlite" disabled="true" num="1" label="Red"/>
|
541
|
+
|
542
|
+
== 0.8.3
|
543
|
+
|
544
|
+
=== Sinatra Hook
|
545
|
+
|
546
|
+
if your framework is Sinatra, now it have "hook" on it.
|
547
|
+
I'm forking blog "Scanty" create by "Adam Wiggins"
|
548
|
+
and this is how I do it in Scanty ("main.rb"):
|
549
|
+
|
550
|
+
require 'rubygems'
|
551
|
+
require 'sinatra'
|
552
|
+
require 'w2tags'
|
553
|
+
require 'w2tags/sinatra_hook'
|
554
|
+
|
555
|
+
=== Changes in parser
|
556
|
+
|
557
|
+
==== all debug are off
|
558
|
+
|
559
|
+
before that debug stack is on, and it slowdown parsing inside rails / merb / sinatra
|
560
|
+
|
561
|
+
==== W2TAGS inline now have option for not inline
|
562
|
+
|
563
|
+
if the last char of params have a char "\"
|
564
|
+
|
565
|
+
%p inline
|
566
|
+
some_chars
|
567
|
+
%p not inline\
|
568
|
+
some_chars
|
569
|
+
|
570
|
+
will result in
|
571
|
+
|
572
|
+
<p>inline</p>
|
573
|
+
some_chars
|
574
|
+
<p>not inline
|
575
|
+
some_chars
|
576
|
+
</p>
|
577
|
+
|
578
|
+
==== Change Regex for Parameters
|
579
|
+
|
580
|
+
1. optional
|
581
|
+
old: Regexp.new('\|([^$|\n]*)\\'+x+'([^\|\n]*)\|') # ex: |..$1..|
|
582
|
+
new: Regexp.new('~([^$|\n]*)\\' +x+'([^\|\n]*)~') # ex: ~..$1..~
|
583
|
+
2. default
|
584
|
+
old: Regexp.new('\|([\w]*)\|\\'+x) # ex: |..|$1
|
585
|
+
new: Regexp.new('~([\w]*)~\\' +x) # ex: ~..~$1
|
586
|
+
|
587
|
+
==== Fix autoclosing not working if it inside another W2TAGS
|
588
|
+
|
589
|
+
the enhance of "Function HOT". It will scan the last line of the result
|
590
|
+
if it find <% end %> it wwill check that now processing %w[else elsif]
|
591
|
+
end remove the <% end %>. Remember, it need define in HOT:
|
592
|
+
|
593
|
+
>>_if
|
594
|
+
>>_else
|
595
|
+
>>_elsif
|
596
|
+
>>_end
|
597
|
+
|
598
|
+
you can check into "erb.hot"
|
599
|
+
|
600
|
+
=== Changes in HOT
|
601
|
+
|
602
|
+
==== erb.hot
|
603
|
+
|
604
|
+
old: >>_each ### become ###
|
605
|
+
new: >>_each2
|
606
|
+
|
607
|
+
new: >>_each
|
608
|
+
!/
|
609
|
+
$0.each do |$1|
|
610
|
+
-end
|
611
|
+
|
612
|
+
==== htm.hot
|
613
|
+
|
614
|
+
>>_utf-8, >>_feed
|
615
|
+
|
616
|
+
== 0.8.2
|
617
|
+
|
618
|
+
=== HOT for erb restructure
|
619
|
+
|
620
|
+
now erb have 5 sub hot you can include in.
|
621
|
+
|
622
|
+
=== Change Regex for W2TAGS
|
623
|
+
|
624
|
+
1. old: /(%)([!]?[ \t\w:]+\{[^\}]*\}[#.=]?[^!]*)!([^`\n]*)([`\n])/
|
625
|
+
new: /^[ \t]*(%)([!]?[ \t\w:]+\{[^\}]*\}[#.=]?[^!]*)!([^\n]*)([\n])/
|
626
|
+
2. old: /(%)([!]?[ \t\w:]+[#.=]?[^!]*)!([^`\n]*)([`\n])/
|
627
|
+
new: /^[ \t]*(%)([!]?[ \t\w:]+[#.=]?[^!]*)!([^\n]*)([\n])/
|
628
|
+
|
629
|
+
=== Change Regex for HOT
|
630
|
+
|
631
|
+
1. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)~([^\n]*)\n()/
|
632
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+)()~([^\n]*)\n/
|
633
|
+
2. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)\{([^\}]*)\}([^!=])/
|
634
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+)\{([^\}]*)\}~([^!=])/
|
635
|
+
|
636
|
+
=== Change Next-Tags(W2TAGS)
|
637
|
+
|
638
|
+
old => new:
|
639
|
+
|
640
|
+
'html' = '%!head!' => "%head $*\n"
|
641
|
+
'head' = '%!body!' => "%body $*\n"
|
642
|
+
'ol' = '%!li!$0' => "%li $0\n"
|
643
|
+
'ul' = '%!li!$0' => "%li $0\n"
|
644
|
+
'dl' = '%!dt!$0' => "%dt $0\n"
|
645
|
+
'dt' = '%!dd!$0' => "%dd $0\n"
|
646
|
+
'dd' = '%!dt!$0' => "%dt $0\n"
|
647
|
+
'select'= '%!option{value="$0" $1}!' => "%option $0\n"
|
648
|
+
'form' = '%!input$0!/' => "%input$0!/\n"
|
649
|
+
'table' = '%!th!$0' => "%th $0\n"
|
650
|
+
'tr' = ? '%!th!$0' : '%!td!$0' => ? "%th $0\n" : "%td $0\n"
|
651
|
+
|
652
|
+
=== Change Variable for code
|
653
|
+
|
654
|
+
old: %code%
|
655
|
+
new: *code*
|
656
|
+
|
657
|
+
=== fix regex for different OS
|
658
|
+
|
659
|
+
=== debug for constanta now behave like debug for hot
|
660
|
+
|
661
|
+
=== auto-close when indent is less then
|
662
|
+
|
663
|
+
now if you put line text (not a W2TAGS command) and the identation is less then prev,
|
664
|
+
it will auto-close the tags.
|
665
|
+
|
666
|
+
=== end tags change
|
667
|
+
|
668
|
+
old: ./ (dot represent how many end tags from buffer to be pull out)
|
669
|
+
new: ~/ (tilde represent how many end tags from buffer to be pull out)
|
670
|
+
|
671
|
+
== 0.8.1
|
672
|
+
|
673
|
+
=== Add more example
|
674
|
+
|
675
|
+
if you have any example and want to contribute to the world, Please email me to:
|
676
|
+
widi harsojo, wharsojo@gmail.com
|
677
|
+
|
678
|
+
=== Debug constanta now print after write ouput
|
679
|
+
|
680
|
+
this behaviour is the same for Debuging HOT.
|
681
|
+
|
682
|
+
Change format of debuging in -d:parser, for HOT will print "<< -H-O-T-"
|
683
|
+
|
684
|
+
=== Line empty will be gone
|
685
|
+
|
686
|
+
but if you want to preserve the line, you must put in inside <i>-!</i> block
|
687
|
+
so it will not be parse and if you want remove the indentation ex:
|
688
|
+
need for <b>pre</b>-tags, you must put in inside <i>-!!</i> block
|
689
|
+
|
690
|
+
=== Change Regex for HOT
|
691
|
+
|
692
|
+
1. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)~([^\n]*)\n()/
|
693
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+)()~([^\n]*)\n/
|
694
|
+
2. old: /(%)([!]?[ \t\$\w\-\/:#.%=]+)\{([^\}]*)\}([^!=])/
|
695
|
+
new: /(%)([!]?[ \t\$\w\-\/:#.%=]+)\{([^\}]*)\}~([^!=])/
|
696
|
+
|
697
|
+
=== Change Regex for shortcut_exec
|
698
|
+
|
699
|
+
old: /(^[\t ]*)-([\w\-\/:#.%=]*) ([^\n]+)\n/
|
700
|
+
new: /(^[\t ]*)-([\w\-\/:#.%=]*) *([^\n]*)\n/
|
701
|
+
|
702
|
+
=== Change Regex for shortcut_equal
|
703
|
+
|
704
|
+
old: /(^[\t ]*)=([\w\-\/:#.%=]*) ([^\n]+)\n/
|
705
|
+
new: /(^[\t ]*)=([\w\-\/:#.%=]*) *([^\n]*)\n/
|
706
|
+
|
707
|
+
=== Change Regex for get_hot_simple
|
708
|
+
|
709
|
+
1. old: /^[\t ]*(%)([\$\w:#.=]+\{[^\}]*\}[#.=]?[^! ]* )([^\n]*)\n/
|
710
|
+
new: /^[\t ]*(%)([\$\w\-:#.=]+\{[^\}]*\}[#.=]?[^~! ]* )([^\n]*)\n/
|
711
|
+
2. old: /^[\t ]*(%)([\$\w:#.=]+\{[^\}]*\}[#.=]?[^! ]*)()\n/
|
712
|
+
new: /^[\t ]*(%)([\$\w\-:#.=]+\{[^\}]*\}[#.=]?[^~! ]*)()\n/
|
713
|
+
|
714
|
+
=== Change Variable for name, id, class
|
715
|
+
|
716
|
+
when you put command like:
|
717
|
+
|
718
|
+
%div:name#id.class myhtml
|
719
|
+
|
720
|
+
this command will parse and put-it in those variable below,
|
721
|
+
and this variable is use on HOT
|
722
|
+
|
723
|
+
old: %all% - %opt% - %id% - %name% - %class%
|
724
|
+
new: *all* - *opt* - *id* - *name* - *class*
|
725
|
+
|
726
|
+
=== Change Regex for Parameters
|
727
|
+
|
728
|
+
1. optional
|
729
|
+
old: Regexp.new('\[([^\$]*)\\'+x+'([^\]]*)\]') # ex: [..$1..]
|
730
|
+
new: Regexp.new('\|([^$|\n]*)\\'+x+'([^\|\n]*)\|') # ex: |..$1..|
|
731
|
+
2. default
|
732
|
+
old: Regexp.new('\[([^\$]*)\\'+x) # ex: [..$1
|
733
|
+
new: Regexp.new('\|([\w]*)\|\\'+x) # ex: |..|$1
|
734
|
+
3. interpolation
|
735
|
+
old: Regexp.new(':([\w]+)\\'+x)
|
736
|
+
new: Regexp.new(':([^$]+)\\'+x) #exe methh: :upcase:$1
|
737
|
+
|
738
|
+
x is for Parameters ex: $0, $1..$9
|
739
|
+
.. meaning you can put char on it.
|
740
|
+
|
741
|
+
=== Change Assign Variable
|
742
|
+
|
743
|
+
Change in Assign Variable inside source code, but using it in HOT is the same
|
744
|
+
|
745
|
+
1. assign on normal variable
|
746
|
+
old ex: &myvar!value
|
747
|
+
new ex: &myvar=value
|
748
|
+
/^[ \t]*(&[\w]+)=([^\n]+)([\n])/
|
749
|
+
|
750
|
+
2. assign on unique variable
|
751
|
+
old ex: @myvar!value1;value2
|
752
|
+
new ex: @myvar=value1;value2
|
753
|
+
/^[ \t]*(@[\w]+)=([^\n]+)([\n])/
|
754
|
+
|
755
|
+
== 0.8.0
|
756
|
+
|
757
|
+
* Initial public release.
|