w2tags 0.9.3 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -340
- data/LICENSE +6 -6
- data/MIT-LICENSE +18 -18
- data/Manifest.txt +28 -25
- data/README.rdoc +27 -21
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/w2tags +173 -143
- data/doc/History.rdoc +88 -0
- data/hot/erb.hot +18 -156
- data/hot/erb_base.hot +164 -0
- data/hot/html.hot +30 -31
- data/hot/rails/scaffold.hot +15 -15
- data/hot/vm.hot +8 -8
- data/hot/vm2.hot +34 -34
- data/hot/vm_crud.hot +34 -34
- data/hot/vm_popup.hot +74 -74
- data/lib/tags2w.rb +263 -0
- data/lib/w2tags/block/block_hot.rb +37 -0
- data/lib/w2tags/block/plain_text.rb +57 -57
- data/lib/w2tags/block/remark.rb +37 -37
- data/lib/w2tags/block/sass.rb +68 -66
- data/lib/w2tags/merb_hook.rb +15 -15
- data/lib/w2tags/parser.rb +17 -8
- data/lib/w2tags/rails_hook.rb +15 -15
- data/lib/w2tags/sinatra_hook.rb +74 -50
- data/lib/w2tags.rb +100 -100
- data/plugins/{/w2tags/ → w2tags}/README +2 -2
- data/plugins/{/w2tags//generators//w2scaffold/ → w2tags/generators/w2scaffold}/USAGE +29 -29
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/controller.rb +85 -85
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/functional_test.rb +45 -45
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/helper.rb +2 -2
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/helper_test.rb +4 -4
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/layout.html.erb +17 -17
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/style.css +54 -54
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_edit.html.erb +17 -17
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_edit.html.w2erb +16 -16
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_index.html.erb +23 -23
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_index.html.w2erb +13 -13
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_new.html.erb +16 -16
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_new.html.w2erb +15 -15
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_show.html.erb +9 -9
- data/plugins/{/w2tags//generators//w2scaffold//templates/ → w2tags/generators/w2scaffold/templates}/view_show.html.w2erb +8 -8
- data/plugins/{/w2tags//generators//w2scaffold/ → w2tags/generators/w2scaffold}/w2scaffold_generator.rb +106 -106
- data/plugins/{/w2tags/ → w2tags}/install.rb +0 -0
- data/tasks/ann.rake +81 -81
- data/tasks/bones.rake +21 -21
- data/tasks/gem.rake +126 -126
- data/tasks/git.rake +41 -41
- data/tasks/manifest.rake +49 -49
- data/tasks/notes.rake +28 -28
- data/tasks/post_load.rake +39 -39
- data/tasks/rdoc.rake +51 -51
- data/tasks/rubyforge.rake +57 -57
- data/tasks/setup.rb +268 -268
- data/tasks/spec.rake +55 -55
- data/tasks/svn.rake +48 -48
- data/tasks/test.rake +38 -38
- data/test/vars.hot +30 -30
- data/test/w2tags_basic_usability.rb +187 -187
- data/test/w2tags_enlightning.rb +42 -42
- data/test/w2tags_hot.rb +85 -85
- data/test/w2tags_hot_var.rb +115 -115
- metadata +28 -30
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
= License Terms
|
2
|
-
|
3
|
-
Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
|
4
|
-
{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by Widi Harsojo.
|
5
|
-
|
6
|
-
Please email wharsojo[mailto:wharsojo@gmail.com] with any questions.
|
1
|
+
= License Terms
|
2
|
+
|
3
|
+
Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
|
4
|
+
{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by Widi Harsojo.
|
5
|
+
|
6
|
+
Please email wharsojo[mailto:wharsojo@gmail.com] with any questions.
|
data/MIT-LICENSE
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
Copyright (c) 2008-2009 Widi Harsojo
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to
|
5
|
-
deal in the Software without restriction, including without limitation the
|
6
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2008-2009 Widi Harsojo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
5
|
+
deal in the Software without restriction, including without limitation the
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
CHANGED
@@ -12,15 +12,18 @@ doc/HAML.rdoc
|
|
12
12
|
doc/History.rdoc
|
13
13
|
doc/HOT.rdoc
|
14
14
|
bin/w2tags
|
15
|
+
lib/tags2w.rb
|
15
16
|
lib/w2tags.rb
|
16
17
|
lib/w2tags/parser.rb
|
17
18
|
lib/w2tags/merb_hook.rb
|
18
19
|
lib/w2tags/rails_hook.rb
|
19
|
-
lib/w2tags/sinatra_hook.rb
|
20
|
-
lib/w2tags/block/
|
21
|
-
lib/w2tags/block/
|
20
|
+
lib/w2tags/sinatra_hook.rb
|
21
|
+
lib/w2tags/block/block_hot.rb
|
22
|
+
lib/w2tags/block/plain_text.rb
|
23
|
+
lib/w2tags/block/remark.rb
|
22
24
|
lib/w2tags/block/sass.rb
|
23
25
|
hot/erb.hot
|
26
|
+
hot/erb_base.hot
|
24
27
|
hot/erb_form.hot
|
25
28
|
hot/erb_head.hot
|
26
29
|
hot/erb_jquery.hot
|
@@ -71,25 +74,25 @@ test/feature.hot
|
|
71
74
|
test/tricky.hot
|
72
75
|
test/vars.hot
|
73
76
|
plugins
|
74
|
-
plugins
|
75
|
-
plugins
|
76
|
-
plugins
|
77
|
-
plugins
|
78
|
-
plugins
|
79
|
-
plugins
|
80
|
-
plugins
|
81
|
-
plugins
|
82
|
-
plugins
|
83
|
-
plugins
|
84
|
-
plugins
|
85
|
-
plugins
|
86
|
-
plugins
|
87
|
-
plugins
|
88
|
-
plugins
|
89
|
-
plugins
|
90
|
-
plugins
|
91
|
-
plugins
|
92
|
-
plugins
|
93
|
-
plugins
|
94
|
-
plugins
|
95
|
-
plugins
|
77
|
+
plugins/w2tags
|
78
|
+
plugins/w2tags/generators
|
79
|
+
plugins/w2tags/install.rb
|
80
|
+
plugins/w2tags/README
|
81
|
+
plugins/w2tags/generators/w2scaffold
|
82
|
+
plugins/w2tags/generators/w2scaffold/templates
|
83
|
+
plugins/w2tags/generators/w2scaffold/USAGE
|
84
|
+
plugins/w2tags/generators/w2scaffold/w2scaffold_generator.rb
|
85
|
+
plugins/w2tags/generators/w2scaffold/templates/controller.rb
|
86
|
+
plugins/w2tags/generators/w2scaffold/templates/functional_test.rb
|
87
|
+
plugins/w2tags/generators/w2scaffold/templates/helper.rb
|
88
|
+
plugins/w2tags/generators/w2scaffold/templates/helper_test.rb
|
89
|
+
plugins/w2tags/generators/w2scaffold/templates/layout.html.erb
|
90
|
+
plugins/w2tags/generators/w2scaffold/templates/style.css
|
91
|
+
plugins/w2tags/generators/w2scaffold/templates/view_edit.html.erb
|
92
|
+
plugins/w2tags/generators/w2scaffold/templates/view_edit.html.w2erb
|
93
|
+
plugins/w2tags/generators/w2scaffold/templates/view_index.html.erb
|
94
|
+
plugins/w2tags/generators/w2scaffold/templates/view_index.html.w2erb
|
95
|
+
plugins/w2tags/generators/w2scaffold/templates/view_new.html.erb
|
96
|
+
plugins/w2tags/generators/w2scaffold/templates/view_new.html.w2erb
|
97
|
+
plugins/w2tags/generators/w2scaffold/templates/view_show.html.erb
|
98
|
+
plugins/w2tags/generators/w2scaffold/templates/view_show.html.w2erb
|
data/README.rdoc
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
= W2TAGS
|
2
|
-
=== Run on MRI Ruby : 1.8.
|
2
|
+
=== Run on MRI Ruby : 1.8.6 / 1.9.x
|
3
3
|
|
4
|
-
|
4
|
+
me@ubuntu:~$ sudo gem install wharsojo-w2tags
|
5
|
+
|
6
|
+
me@ubuntu:~$ w2tags -irb
|
5
7
|
ARGV : -irb
|
6
8
|
|
7
9
|
Your W2Tags instance object stored in WH...
|
8
10
|
Ex: puts WH.parse_line("#content\n %span Hello")
|
9
11
|
Shortcut command => wh("#content\n %span Hello")
|
10
12
|
|
11
|
-
irb(main):001:0> wh
|
13
|
+
irb(main):001:0> wh <<END
|
12
14
|
irb(main):002:0" #wow
|
13
|
-
irb(main):003:0"
|
14
|
-
irb(main):004:0"
|
15
|
+
irb(main):003:0" #kereen
|
16
|
+
irb(main):004:0" . Hello World
|
15
17
|
irb(main):005:0" END
|
16
|
-
|
18
|
+
=>/usr/lib/ruby/gems/1.8/gems/wharsojo-w2tags-0.9.49/hot/erb.hot
|
17
19
|
<div id="wow">
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
<div id="kereen">
|
21
|
+
<div>Hello World</div>
|
22
|
+
</div>
|
21
23
|
</div>
|
22
24
|
=> nil
|
23
25
|
irb(main):006:0>
|
24
|
-
|
26
|
+
|
25
27
|
== DESCRIPTION:
|
26
28
|
|
27
29
|
W2Tags is the way to tags, a short cut / macros. When it do, it use some patern
|
@@ -202,8 +204,11 @@ and code in source:
|
|
202
204
|
|
203
205
|
== REQUIREMENTS:
|
204
206
|
|
205
|
-
no requirement for
|
206
|
-
parsing.
|
207
|
+
no requirement for w2tags (the parser), since it use only regular expression
|
208
|
+
to do parsing.
|
209
|
+
|
210
|
+
converting .erb or .html need hpricot engine to do search tags (see below
|
211
|
+
on command no.10)
|
207
212
|
|
208
213
|
== INSTALL:
|
209
214
|
|
@@ -216,21 +221,22 @@ get it from commandline "w2tags"
|
|
216
221
|
How to WaytoTags:
|
217
222
|
~~~~~~~~~~~~~~~~~~~~~~~
|
218
223
|
syntax:
|
219
|
-
w2tags [*.
|
224
|
+
w2tags [*.w2erb] [-a] [-d:*opt*]
|
220
225
|
OR
|
221
226
|
w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
222
227
|
|
223
228
|
example:
|
224
|
-
1. w2tags -a #=> translate all file with ext:
|
225
|
-
2. w2tags *.
|
226
|
-
3. w2tags file1.
|
227
|
-
4. w2tags file1.
|
228
|
-
5. w2tags file1.
|
229
|
-
6. w2tags file1.
|
230
|
-
7. w2tags file1.
|
229
|
+
1. w2tags -a #=> translate all file with ext: w2erb
|
230
|
+
2. w2tags *.w2erb -a #=> translate all file with ext: w2erb
|
231
|
+
3. w2tags file1.w2erb #=> translate a file
|
232
|
+
4. w2tags file1.w2erb -b #=> translate a file with no initialize/finalize
|
233
|
+
5. w2tags file1.w2erb -d:parser #=> translate with debug parser
|
234
|
+
6. w2tags file1.w2erb -d:constanta #=> translate with debug constanta
|
235
|
+
7. w2tags file1.w2erb -d:stack #=> translate with debug stack indentation
|
231
236
|
8. w2tags -irb #=> Start IRB with WH as instance object of W2Tags
|
232
237
|
9. w2tags -rails #=> Copy w2scaffold Rails and set environment.rb
|
233
|
-
|
238
|
+
10. w2tags -tags2w #=> Parsing erb to w2tags
|
239
|
+
|
234
240
|
Enjoy...
|
235
241
|
|
236
242
|
=== RAILS HOOK
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ task :default => 'spec:run'
|
|
12
12
|
PROJ.name = 'w2tags'
|
13
13
|
PROJ.authors = 'widi harsojo'
|
14
14
|
PROJ.email = 'wharsojo@gmail.com'
|
15
|
-
PROJ.url = 'w2tags.rubyforge.org'
|
15
|
+
PROJ.url = 'http://w2tags.rubyforge.org'
|
16
16
|
PROJ.rubyforge.name = 'w2tags'
|
17
17
|
|
18
18
|
PROJ.rdoc.opts << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4.2
|
data/bin/w2tags
CHANGED
@@ -1,143 +1,173 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# The command line W2tags parser.
|
3
|
-
# How to WaytoTags:
|
4
|
-
# ~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
-
# syntax:
|
6
|
-
# w2tags [*.
|
7
|
-
# OR
|
8
|
-
# w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
9
|
-
#
|
10
|
-
# example:
|
11
|
-
# 1. w2tags -a #=> translate all file with ext:
|
12
|
-
# 2. w2tags *.
|
13
|
-
# 3. w2tags file1.
|
14
|
-
# 4. w2tags file1.
|
15
|
-
# 5. w2tags file1.
|
16
|
-
# 6. w2tags file1.
|
17
|
-
# 7. w2tags file1.
|
18
|
-
# 8. w2tags -irb #=> Start IRB with WT as instant object of W2Tags
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
w2tags [
|
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
|
-
WH.dbg[:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
puts
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
content
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# The command line W2tags parser.
|
3
|
+
# How to WaytoTags:
|
4
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
# syntax:
|
6
|
+
# w2tags [*.w2erb] [-a] [-d:*opt*]
|
7
|
+
# OR
|
8
|
+
# w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
9
|
+
#
|
10
|
+
# example:
|
11
|
+
# 1. w2tags -a #=> translate all file with ext: w2erb
|
12
|
+
# 2. w2tags *.w2erb -a #=> translate all file with ext: w2erb
|
13
|
+
# 3. w2tags file1.w2erb #=> translate a file
|
14
|
+
# 4. w2tags file1.w2erb -b #=> translate a file with no initialize/finalize
|
15
|
+
# 5. w2tags file1.w2erb -d:parser #=> translate with debug parser
|
16
|
+
# 6. w2tags file1.w2erb -d:constanta #=> translate with debug constanta
|
17
|
+
# 7. w2tags file1.w2erb -d:stack #=> translate with debug stack indentation
|
18
|
+
# 8. w2tags -irb #=> Start IRB with WT as instant object of W2Tags
|
19
|
+
# 9. w2tags -rails #=> Copy w2scaffold Rails and set environment.rb
|
20
|
+
# 10. w2tags -tags2w #=> Parsing erb to w2tags
|
21
|
+
#
|
22
|
+
# Enjoy...
|
23
|
+
|
24
|
+
require File.expand_path(
|
25
|
+
File.join(File.dirname(__FILE__),%w[.. lib w2tags]))
|
26
|
+
wpath= File.dirname(__FILE__).gsub(/bin$/,'')
|
27
|
+
def howto_w2tags
|
28
|
+
puts <<END
|
29
|
+
|
30
|
+
How to WaytoTags:
|
31
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
32
|
+
syntax:
|
33
|
+
w2tags [*.w2erb] [-a] [-d:*opt*]
|
34
|
+
OR
|
35
|
+
w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
36
|
+
|
37
|
+
example:
|
38
|
+
1. w2tags -a #=> translate all file with ext: w2erb
|
39
|
+
2. w2tags *.w2erb -a #=> translate all file with ext: w2erb
|
40
|
+
3. w2tags file1.w2erb #=> translate a file
|
41
|
+
4. w2tags file1.w2erb -b #=> translate a file with no initialize/finalize
|
42
|
+
5. w2tags file1.w2erb -d:parser #=> translate with debug parser
|
43
|
+
6. w2tags file1.w2erb -d:constanta #=> translate with debug constanta
|
44
|
+
7. w2tags file1.w2erb -d:stack #=> translate with debug stack indentation
|
45
|
+
8. w2tags -irb #=> Start IRB with WH as instance object of W2Tags
|
46
|
+
9. w2tags -rails #=> Copy w2scaffold Rails and set environment.rb
|
47
|
+
10.w2tags -tags2w #=> Parsing erb to w2tags
|
48
|
+
|
49
|
+
Enjoy...
|
50
|
+
END
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
arg = ARGV
|
55
|
+
if arg.size>0
|
56
|
+
arg = ['w2erb'] + arg if arg.size==1 && arg[0]=='-a'
|
57
|
+
puts 'ARGV : '+arg.join(" ")
|
58
|
+
puts arg[1]
|
59
|
+
|
60
|
+
WH = W2Tags::Parser.new
|
61
|
+
|
62
|
+
x = arg.select {|s|s[0,3]=='-d:'}
|
63
|
+
#WH.dbg[:stack] = (x.size==0)
|
64
|
+
x.each do |s|
|
65
|
+
WH.dbg[:parse] = true if s=='-d:parser'
|
66
|
+
WH.dbg[:stack] = true if s=='-d:stack'
|
67
|
+
WH.dbg[:constanta] = true if s=='-d:constanta'
|
68
|
+
WH.dbg[:show_hot] = true if s=='-d:show_hot'
|
69
|
+
end
|
70
|
+
|
71
|
+
if arg[0]=='-irb'
|
72
|
+
ARGV.shift
|
73
|
+
|
74
|
+
class Object
|
75
|
+
def wh(str)
|
76
|
+
puts WH.parse_line(str)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
require 'irb'
|
81
|
+
puts "Your W2Tags instance object stored in WH..."
|
82
|
+
puts 'Ex: puts WH.parse_line "#content\\n %span Hello"'
|
83
|
+
puts 'Shortcut wh() => puts WH.parse_line()'
|
84
|
+
puts ''
|
85
|
+
|
86
|
+
IRB.start
|
87
|
+
elsif arg[0]=='-rails'
|
88
|
+
if !File.exist?('vendor/plugins')
|
89
|
+
puts 'No Folder: vendor/plugins...'
|
90
|
+
elsif !File.exist?('config/environment.rb')
|
91
|
+
puts 'No File: config/environment.rb...'
|
92
|
+
else
|
93
|
+
ttl_copy = 0
|
94
|
+
require 'fileutils'
|
95
|
+
Dir[wpath + "plugins/**/*"].each do |fl|
|
96
|
+
if !File.directory?(fl)
|
97
|
+
path= fl.gsub(/.*\/plugins\//,'vendor/plugins/')
|
98
|
+
dir = File.dirname(path)
|
99
|
+
FileUtils.mkdir_p(dir) if !File.exist?(dir)
|
100
|
+
if !File.exist?(path)
|
101
|
+
ttl_copy += 1
|
102
|
+
puts "Copy w2tags plugins for rails..." if ttl_copy==1
|
103
|
+
puts "=> #{fl.gsub(/.*\/w2tags\//,'')}"
|
104
|
+
File.open(path, 'wb') { |file| file.write(File.read(fl)) }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
ttl_copy = 0
|
109
|
+
Dir[wpath + "hot/rails/**/*"].each do |fl|
|
110
|
+
path= fl.gsub(/.*\/rails\//,'')
|
111
|
+
if !File.exist?(path)
|
112
|
+
ttl_copy += 1
|
113
|
+
puts "Copy w2tags HOT files..." if ttl_copy==1
|
114
|
+
puts "=> #{path}"
|
115
|
+
File.open(path, 'wb') { |file| file.write(File.read(fl)) }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
content = File.read('config/environment.rb')
|
119
|
+
ori= content.length
|
120
|
+
content << "\nrequire 'w2tags'" if /\n *require *\'w2tags\'/ !~ content
|
121
|
+
content << "\nrequire 'w2tags/rails_hook'" if /\n *require *\'w2tags\/rails_hook\'/ !~ content
|
122
|
+
if ori != content.length
|
123
|
+
puts 'Update config/environment.rb...'
|
124
|
+
File.open('config/environment.rb', 'wb') { |file| file.write(content) }
|
125
|
+
end
|
126
|
+
puts(<<END)
|
127
|
+
|
128
|
+
FINISH W2TAGS for RAILS...
|
129
|
+
You can try w2scaffold:
|
130
|
+
|
131
|
+
script/generate w2scaffold post title:string body:text published:boolean
|
132
|
+
rake db:migrate
|
133
|
+
script/server
|
134
|
+
|
135
|
+
END
|
136
|
+
end
|
137
|
+
elsif arg[0]=='-tags2w'
|
138
|
+
require 'tags2w'
|
139
|
+
t2t = MakeTag.new
|
140
|
+
t2w = Tags2w.new
|
141
|
+
fls = Dir['./**/views/**/*.erb']
|
142
|
+
fls = Dir['./**/*.erb'] if fls==[]
|
143
|
+
|
144
|
+
fls.each do |f|
|
145
|
+
puts f
|
146
|
+
lines= IO.read(f).delete("\r").split("\n")
|
147
|
+
t2t.make_it(lines)
|
148
|
+
if arg[1]=='-debug'
|
149
|
+
File.open(f.gsub('.erb','.w1erb'),'w') do |wr|
|
150
|
+
wr << lines.join("\n")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
#hp = Hpricot(lines.join("\n"))
|
154
|
+
hp =Hpricot::XML(lines.join("\n"))
|
155
|
+
t2w.start(hp).line_code
|
156
|
+
File.open(f.gsub('.erb','.w2erb'),'w') do |wr|
|
157
|
+
wr << t2w.result.join("\n")
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else
|
161
|
+
case arg[1]
|
162
|
+
when '-a' ;
|
163
|
+
fls = Dir["./**/views/**/#{arg[0]}"]
|
164
|
+
fls = Dir["./**/#{arg[0]}"] if fls==[]
|
165
|
+
#WH.parse_files(Dir["*.#{arg[0]}*"])
|
166
|
+
WH.parse_files(fls)
|
167
|
+
when '-b' ;WH.parse_files(arg[0].split(','),false)
|
168
|
+
else ;WH.parse_files(arg[0].split(','))
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else
|
172
|
+
howto_w2tags
|
173
|
+
end
|
data/doc/History.rdoc
CHANGED
@@ -2,6 +2,94 @@
|
|
2
2
|
|
3
3
|
Below is a complete listing of changes for each revision of W2TAGS.
|
4
4
|
|
5
|
+
== 0.9.5
|
6
|
+
|
7
|
+
=== Command line
|
8
|
+
|
9
|
+
Help Information change from w2html to w2erb, for params like
|
10
|
+
|
11
|
+
w2tags *.w2erb -a
|
12
|
+
|
13
|
+
it will parse all w2tags type 'erb' from folder view or if not found,
|
14
|
+
it will parse from current folder down to child folder
|
15
|
+
|
16
|
+
=== tags2w
|
17
|
+
|
18
|
+
using index (not find_index), for compactible with ruby version 1.8.6
|
19
|
+
|
20
|
+
=== Parser
|
21
|
+
|
22
|
+
Include Source now doesn't have default ext (.w2ex), for easy maintenace
|
23
|
+
of source code.
|
24
|
+
|
25
|
+
!inc!partial.w2erb
|
26
|
+
|
27
|
+
Remember command / Next command have multi class for parameters convert
|
28
|
+
to multiple line
|
29
|
+
|
30
|
+
%table
|
31
|
+
%tr
|
32
|
+
^.c;.r No;Info
|
33
|
+
|
34
|
+
<table>
|
35
|
+
<tr>
|
36
|
+
<td class="c">No</td>
|
37
|
+
<td class="r">Info</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
=== Add Condition Hook for Sinatra 0.9.2
|
42
|
+
|
43
|
+
Since sinatra change again method of "lookup_template", the Hook must add another
|
44
|
+
condition Hook.
|
45
|
+
Sinatra Hook update, it a same behaviour with Rails
|
46
|
+
|
47
|
+
=== block_hot
|
48
|
+
|
49
|
+
add a block for hot so you can put your hot block inside your code (embed) mean
|
50
|
+
that you hot is only for this code only
|
51
|
+
|
52
|
+
=== tags2w
|
53
|
+
|
54
|
+
Fix: html - erb with ruby sanitize code: "<%- -%>"
|
55
|
+
|
56
|
+
=== HOT files
|
57
|
+
|
58
|
+
==== erb.hot
|
59
|
+
|
60
|
+
add tag "%comment" since reverse erb to w2tags (tags2w) use this tag and it must
|
61
|
+
be play nice (no parsing inside it).
|
62
|
+
|
63
|
+
change form_tag, form_to, using block var
|
64
|
+
|
65
|
+
== 0.9.4
|
66
|
+
|
67
|
+
=== Tags To W (Reverse parse to w2tags)
|
68
|
+
|
69
|
+
Implement Reverse parse to w2tags, it use Hpricot::XML and it cover standard
|
70
|
+
or basic reverse parse, for css and block of js not include (one day hack).
|
71
|
+
|
72
|
+
=== HOT files
|
73
|
+
|
74
|
+
==== erb.hot
|
75
|
+
|
76
|
+
add condition for unless
|
77
|
+
|
78
|
+
==== html.hot
|
79
|
+
|
80
|
+
Fix old template for "initialize"
|
81
|
+
|
82
|
+
=== Parser
|
83
|
+
|
84
|
+
==== Update Debug parser
|
85
|
+
|
86
|
+
debug parser for uniq Var update to standarize with others -d:parser
|
87
|
+
|
88
|
+
==== Update Regex for "reHot"
|
89
|
+
|
90
|
+
to cover inline w2tags, if inline w2tags include all Key-Variable it fail
|
91
|
+
since "reHot" use greedy regex, now fix with non greedy.
|
92
|
+
|
5
93
|
== 0.9.3
|
6
94
|
|
7
95
|
=== Pass test on Linux Ubuntu 8.10 and win32
|