w2tags 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- 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/README.rdoc
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
= W2TAGS
|
2
|
+
=== Run on MRI Ruby : 1.8.x / 1.9.x
|
3
|
+
|
4
|
+
C:\>w2tags -irb
|
5
|
+
ARGV : -irb
|
6
|
+
|
7
|
+
Your W2Tags instance object stored in WH...
|
8
|
+
Ex: puts WH.parse_line("#content\n %span Hello")
|
9
|
+
Shortcut command => wh("#content\n %span Hello")
|
10
|
+
|
11
|
+
irb(main):001:0> wh(<<END)
|
12
|
+
irb(main):002:0" #wow
|
13
|
+
irb(main):003:0" #kereen
|
14
|
+
irb(main):004:0" %span Hello World
|
15
|
+
irb(main):005:0" END
|
16
|
+
=>C:/mingw/lib/ruby/gems/1.9.1/gems/w2tags-0.9.1/hot/html.hot
|
17
|
+
<div id="wow">
|
18
|
+
<div id="kereen">
|
19
|
+
<span>Hello World</span>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
=> nil
|
23
|
+
irb(main):006:0>
|
24
|
+
|
25
|
+
== DESCRIPTION:
|
26
|
+
|
27
|
+
W2Tags is the way to tags, a short cut / macros. When it do, it use some patern
|
28
|
+
define in HOT file to produce tags from minimal code to become full fledge tags.
|
29
|
+
|
30
|
+
== FEATURES
|
31
|
+
|
32
|
+
Before it release it use some patern, but I reliaze, today web development have
|
33
|
+
some popular patern in view engine, so I change the patern. Now syntax mimics HAML
|
34
|
+
to easy transisition, and proven to be useable and best.
|
35
|
+
|
36
|
+
Extended Syntax are the remain patern before I choose HAML-like syntax like
|
37
|
+
"^" - NextTag (next tag will be use after using a tag like "ul" next tag "li"),
|
38
|
+
Redefinition NextTag command using "~^", define variable "&var=",
|
39
|
+
define uniq variable "@var=", Key-Variable
|
40
|
+
|
41
|
+
"$:","*:" for attribute NAME,
|
42
|
+
"$#","*#" for attribute ID,
|
43
|
+
"$.","*." for attribute CLASS,
|
44
|
+
"$@","*@" for custome attribute,
|
45
|
+
"$$" for all Key-Variable.
|
46
|
+
|
47
|
+
This Constanta will be ready every time it parse the W2TAGS HOT (% / -).
|
48
|
+
|
49
|
+
HOT file is the powerfull features in w2tags, it contains some patern that you can
|
50
|
+
call it later using command "%" or "-", it contains one or more line of html/w2tags/hot
|
51
|
+
command, if you detect in you source that not DRY you can migrate the patern to HOT
|
52
|
+
files and you can call it later
|
53
|
+
|
54
|
+
The rest of the command you can see in each RDOC Documentation or by reading
|
55
|
+
the source of W2Tags::Parser or see in Test folder,
|
56
|
+
So you can code less typing.
|
57
|
+
|
58
|
+
== PROBLEMS:
|
59
|
+
|
60
|
+
=== Demo files
|
61
|
+
|
62
|
+
Some of Demo not yet convert to new patern so please not to tray it, I'll do it
|
63
|
+
if I have some time to do it.
|
64
|
+
|
65
|
+
=== Auto closing for Code
|
66
|
+
|
67
|
+
Closing tags for HAML code like:
|
68
|
+
|
69
|
+
- if <condition>
|
70
|
+
|
71
|
+
does not have automatically close so you must closing it your self with
|
72
|
+
|
73
|
+
- end
|
74
|
+
|
75
|
+
for w2erb, the HOT have definition for autoclosing and the help from
|
76
|
+
method on parser "shortcut_exec(regex)", now it can auto intelligent
|
77
|
+
closing
|
78
|
+
|
79
|
+
-if index>100
|
80
|
+
.bigger bigger than 100
|
81
|
+
-elsif index>50
|
82
|
+
.bigger bigger than 50 but less than 100
|
83
|
+
-else
|
84
|
+
.less less than 50
|
85
|
+
|
86
|
+
.common
|
87
|
+
Common Tag
|
88
|
+
|
89
|
+
work around to have a closing code, you can use feature to save some patern
|
90
|
+
in a hot file and use it in your code, example: "common.hot"
|
91
|
+
|
92
|
+
>>_if
|
93
|
+
- if $*
|
94
|
+
<</
|
95
|
+
- end
|
96
|
+
|
97
|
+
and use it in your code:
|
98
|
+
|
99
|
+
-if <condition>
|
100
|
+
|
101
|
+
and it do automatic closing
|
102
|
+
|
103
|
+
|
104
|
+
== SYNOPSIS:
|
105
|
+
|
106
|
+
=== HAML Like Syntax
|
107
|
+
|
108
|
+
just use it like haml basic, and if alredy comfort with that syntax you
|
109
|
+
can extend the syntax and combine it with patern definition created in hot
|
110
|
+
file or you can create your own hot file.
|
111
|
+
|
112
|
+
==== Example 1 - HAML:
|
113
|
+
|
114
|
+
#content
|
115
|
+
%h1 menu
|
116
|
+
%ul
|
117
|
+
%li menu 1
|
118
|
+
%li menu 2
|
119
|
+
|
120
|
+
will produce
|
121
|
+
|
122
|
+
<div id="content">
|
123
|
+
<h1>menu</h1>
|
124
|
+
<ul>
|
125
|
+
<li>menu 1</li>
|
126
|
+
<li>menu 2</li>
|
127
|
+
</ul>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
Extended syntax that produce the same result
|
131
|
+
|
132
|
+
#content
|
133
|
+
%h1 menu
|
134
|
+
%ul
|
135
|
+
^ menu 1; menu 2
|
136
|
+
|
137
|
+
or if the patern is so common, it can be save in a hot file
|
138
|
+
and use it as hot command. Example: inside "common.hot"
|
139
|
+
|
140
|
+
>>_ul
|
141
|
+
%ul
|
142
|
+
^$*
|
143
|
+
|
144
|
+
and code in source:
|
145
|
+
|
146
|
+
!hot!common
|
147
|
+
#content
|
148
|
+
%h1 menu
|
149
|
+
-ul menu 1; menu 2
|
150
|
+
|
151
|
+
==== Example 2 - Form input
|
152
|
+
|
153
|
+
HAML format:
|
154
|
+
|
155
|
+
%h1 New user
|
156
|
+
|
157
|
+
= error_messages_for :user
|
158
|
+
|
159
|
+
-form_for @user do |f|
|
160
|
+
%p
|
161
|
+
%b Name
|
162
|
+
%br
|
163
|
+
= f.text_field :name
|
164
|
+
%p
|
165
|
+
%b Email
|
166
|
+
%br
|
167
|
+
= f.text_field :email
|
168
|
+
%p
|
169
|
+
%b Last login
|
170
|
+
%br
|
171
|
+
= f.datetime_select :last_login
|
172
|
+
|
173
|
+
%p
|
174
|
+
= f.submit "Create"
|
175
|
+
= link_to 'Back', users_path
|
176
|
+
|
177
|
+
You can see that it not DRY, some patern will go to HOT files "rails_basic.hot"
|
178
|
+
|
179
|
+
>>_input
|
180
|
+
%p
|
181
|
+
%b $0.capitalize.gsub('_',' ')-
|
182
|
+
%br
|
183
|
+
= f.text_field :$0
|
184
|
+
|
185
|
+
>>_submit
|
186
|
+
!/
|
187
|
+
%p
|
188
|
+
= f.submit "$0"
|
189
|
+
|
190
|
+
and code in source:
|
191
|
+
|
192
|
+
!hot!rails_basic
|
193
|
+
%h1 New user
|
194
|
+
|
195
|
+
= error_messages_for :user
|
196
|
+
|
197
|
+
-form_for @user do |f|
|
198
|
+
-input name;email;last_login
|
199
|
+
-submit Create
|
200
|
+
|
201
|
+
= link_to 'Back', users_path
|
202
|
+
|
203
|
+
== REQUIREMENTS:
|
204
|
+
|
205
|
+
no requirement for now, since it use only regular expression to do
|
206
|
+
parsing.
|
207
|
+
|
208
|
+
== INSTALL:
|
209
|
+
|
210
|
+
sudo gem install w2tags
|
211
|
+
|
212
|
+
=== COMMAND LINE
|
213
|
+
|
214
|
+
get it from commandline "w2tags"
|
215
|
+
|
216
|
+
How to WaytoTags:
|
217
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
218
|
+
syntax:
|
219
|
+
w2tags [*.w2htm] [-a] [-d:*opt*]
|
220
|
+
OR
|
221
|
+
w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
222
|
+
|
223
|
+
example:
|
224
|
+
1. w2tags -a #=> translate all file with ext: w2htm
|
225
|
+
2. w2tags *.w2xml -a #=> translate all file with ext: w2xml
|
226
|
+
3. w2tags file1.w2htm #=> translate a file
|
227
|
+
4. w2tags file1.w2htm -b #=> translate a file with no initialize/finalize
|
228
|
+
5. w2tags file1.w2htm -d:parser #=> translate with debug parser
|
229
|
+
6. w2tags file1.w2htm -d:constanta #=> translate with debug constanta
|
230
|
+
7. w2tags file1.w2htm -d:stack #=> translate with debug stack indentation
|
231
|
+
8. w2tags -irb #=> Start IRB with WH as instance object of W2Tags
|
232
|
+
9. w2tags -rails #=> Copy w2scaffold Rails and set environment.rb
|
233
|
+
|
234
|
+
Enjoy...
|
235
|
+
|
236
|
+
=== RAILS HOOK
|
237
|
+
|
238
|
+
add inside file "config/environment.rb" in the bottom:
|
239
|
+
|
240
|
+
require 'w2tags'
|
241
|
+
require 'w2tags/rails_hook'
|
242
|
+
|
243
|
+
You can automatically add by using commandline "w2tags -rails"
|
244
|
+
|
245
|
+
=== MERB HOOK
|
246
|
+
|
247
|
+
add inside file "config/init.rb" in the bottom:
|
248
|
+
|
249
|
+
require 'w2tags'
|
250
|
+
require 'w2tags/merb_hook'
|
251
|
+
|
252
|
+
=== SINATRA HOOK
|
253
|
+
|
254
|
+
sinatra usualy consist only one file "main.rb", so just add below sinatra require:
|
255
|
+
|
256
|
+
require 'w2tags'
|
257
|
+
require 'w2tags/sinatra_hook'
|
258
|
+
|
259
|
+
== LICENSE:
|
260
|
+
|
261
|
+
Copyright (c) 2008 - 2009 Widi Harsojo
|
262
|
+
|
263
|
+
Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html]
|
264
|
+
(see COPYING for details) or the MIT License .
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
3
|
+
# are where the options are used.
|
4
|
+
|
5
|
+
load 'tasks/setup.rb'
|
6
|
+
|
7
|
+
ensure_in_path 'lib'
|
8
|
+
require 'w2tags'
|
9
|
+
|
10
|
+
task :default => 'spec:run'
|
11
|
+
|
12
|
+
PROJ.name = 'w2tags'
|
13
|
+
PROJ.authors = 'widi harsojo'
|
14
|
+
PROJ.email = 'wharsojo@gmail.com'
|
15
|
+
PROJ.url = 'w2tags.rubyforge.org'
|
16
|
+
PROJ.rubyforge.name = 'w2tags'
|
17
|
+
|
18
|
+
PROJ.rdoc.opts << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
19
|
+
PROJ.rdoc.opts << '--charset' << 'utf-8' << '--all'
|
20
|
+
|
21
|
+
PROJ.spec.opts << '--color'
|
22
|
+
|
23
|
+
# EOF
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.1
|
data/bin/w2tags
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# The command line W2tags parser.
|
3
|
+
# How to WaytoTags:
|
4
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
# syntax:
|
6
|
+
# w2tags [*.w2htm] [-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: w2htm
|
12
|
+
# 2. w2tags *.w2xml -a #=> translate all file with ext: w2xml
|
13
|
+
# 3. w2tags file1.w2htm #=> translate a file
|
14
|
+
# 4. w2tags file1.w2htm -b #=> translate a file with no initialize/finalize
|
15
|
+
# 5. w2tags file1.w2htm -d:parser #=> translate with debug parser
|
16
|
+
# 6. w2tags file1.w2htm -d:constanta #=> translate with debug constanta
|
17
|
+
# 7. w2tags file1.w2htm -d:stack #=> translate with debug stack indentation
|
18
|
+
# 8. w2tags -irb #=> Start IRB with WT as instant object of W2Tags
|
19
|
+
#
|
20
|
+
# Enjoy...
|
21
|
+
|
22
|
+
require File.expand_path(
|
23
|
+
File.join(File.dirname(__FILE__),%w[.. lib w2tags]))
|
24
|
+
wpath= File.dirname(__FILE__).gsub(/bin$/,'')
|
25
|
+
def howto_w2tags
|
26
|
+
puts <<END
|
27
|
+
|
28
|
+
How to WaytoTags:
|
29
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
30
|
+
syntax:
|
31
|
+
w2tags [*.w2htm] [-a] [-d:*opt*]
|
32
|
+
OR
|
33
|
+
w2tags [file1,file2,file3] [-b] [-d:*opt*]
|
34
|
+
|
35
|
+
example:
|
36
|
+
1. w2tags -a #=> translate all file with ext: w2htm
|
37
|
+
2. w2tags *.w2xml -a #=> translate all file with ext: w2xml
|
38
|
+
3. w2tags file1.w2htm #=> translate a file
|
39
|
+
4. w2tags file1.w2htm -b #=> translate a file with no initialize/finalize
|
40
|
+
5. w2tags file1.w2htm -d:parser #=> translate with debug parser
|
41
|
+
6. w2tags file1.w2htm -d:constanta #=> translate with debug constanta
|
42
|
+
7. w2tags file1.w2htm -d:stack #=> translate with debug stack indentation
|
43
|
+
8. w2tags -irb #=> Start IRB with WH as instance object of W2Tags
|
44
|
+
9. w2tags -rails #=> Copy w2scaffold Rails and set environment.rb
|
45
|
+
|
46
|
+
Enjoy...
|
47
|
+
END
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
arg = ARGV
|
52
|
+
if arg.size>0
|
53
|
+
arg = ['w2htm'] + arg if arg.size==1 && arg[0]=='-a'
|
54
|
+
puts 'ARGV : '+arg.join(" ")
|
55
|
+
puts arg[1]
|
56
|
+
|
57
|
+
WH = W2Tags::Parser.new
|
58
|
+
|
59
|
+
x = arg.select {|s|s[0,3]=='-d:'}
|
60
|
+
#WH.dbg[:stack] = (x.size==0)
|
61
|
+
x.each do |s|
|
62
|
+
WH.dbg[:parse] = true if s=='-d:parser'
|
63
|
+
WH.dbg[:stack] = true if s=='-d:stack'
|
64
|
+
WH.dbg[:constanta] = true if s=='-d:constanta'
|
65
|
+
WH.dbg[:show_hot] = true if s=='-d:show_hot'
|
66
|
+
end
|
67
|
+
|
68
|
+
if arg[0]=='-irb'
|
69
|
+
ARGV.shift
|
70
|
+
|
71
|
+
class Object
|
72
|
+
def wh(str)
|
73
|
+
puts WH.parse_line(str)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
require 'irb'
|
78
|
+
puts "Your W2Tags instance object stored in WH..."
|
79
|
+
puts 'Ex: puts WH.parse_line "#content\\n %span Hello"'
|
80
|
+
puts 'Shortcut wh() => puts WH.parse_line()'
|
81
|
+
puts ''
|
82
|
+
|
83
|
+
IRB.start
|
84
|
+
elsif arg[0]=='-rails'
|
85
|
+
if !File.exist?('vendor/plugins')
|
86
|
+
puts 'No Folder: vendor/plugins...'
|
87
|
+
elsif !File.exist?('config/environment.rb')
|
88
|
+
puts 'No File: config/environment.rb...'
|
89
|
+
else
|
90
|
+
ttl_copy = 0
|
91
|
+
require 'fileutils'
|
92
|
+
Dir[wpath + "plugins/**/*"].each do |fl|
|
93
|
+
if !File.directory?(fl)
|
94
|
+
path= fl.gsub(/.*\/plugins\//,'vendor/plugins/')
|
95
|
+
dir = File.dirname(path)
|
96
|
+
FileUtils.mkdir_p(dir) if !File.exist?(dir)
|
97
|
+
if !File.exist?(path)
|
98
|
+
ttl_copy += 1
|
99
|
+
puts "Copy w2tags plugins for rails..." if ttl_copy==1
|
100
|
+
puts "=> #{fl.gsub(/.*\/w2tags\//,'')}"
|
101
|
+
File.open(path, 'wb') { |file| file.write(File.read(fl)) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
ttl_copy = 0
|
106
|
+
Dir[wpath + "hot/rails/**/*"].each do |fl|
|
107
|
+
path= fl.gsub(/.*\/rails\//,'')
|
108
|
+
if !File.exist?(path)
|
109
|
+
ttl_copy += 1
|
110
|
+
puts "Copy w2tags HOT files..." if ttl_copy==1
|
111
|
+
puts "=> #{path}"
|
112
|
+
File.open(path, 'wb') { |file| file.write(File.read(fl)) }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
content = File.read('config/environment.rb')
|
116
|
+
ori= content.length
|
117
|
+
content << "\nrequire 'w2tags'" if /\n *require *\'w2tags\'/ !~ content
|
118
|
+
content << "\nrequire 'w2tags/rails_hook'" if /\n *require *\'w2tags\/rails_hook\'/ !~ content
|
119
|
+
if ori != content.length
|
120
|
+
puts 'Update config/environment.rb...'
|
121
|
+
File.open('config/environment.rb', 'wb') { |file| file.write(content) }
|
122
|
+
end
|
123
|
+
puts(<<END)
|
124
|
+
|
125
|
+
FINISH W2TAGS for RAILS...
|
126
|
+
You can try w2scaffold:
|
127
|
+
|
128
|
+
script/generate w2scaffold post title:string body:text published:boolean
|
129
|
+
rake db:migrate
|
130
|
+
script/server
|
131
|
+
|
132
|
+
END
|
133
|
+
end
|
134
|
+
else
|
135
|
+
case arg[1]
|
136
|
+
when '-a' ;WH.parse_files(Dir["*.#{arg[0]}*"])
|
137
|
+
when '-b' ;WH.parse_files(arg[0].split(','),false)
|
138
|
+
else ;WH.parse_files(arg[0].split(','))
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else
|
142
|
+
howto_w2tags
|
143
|
+
end
|
data/doc/ERB.HOT.rdoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
= ERB HOT
|
2
|
+
definition for file with extention of ".erb", this template is use on some of the
|
3
|
+
well know frame work.
|
4
|
+
|
5
|
+
== DEFINED COMMAND
|
6
|
+
|
7
|
+
=== INITIALIZE & FINALLIZE
|
8
|
+
this command are use on (appended) so user who use it frequently can define
|
9
|
+
any kind of element / tags for the beginning / ending document.
|
10
|
+
|
11
|
+
%initialize
|
12
|
+
not use but you can define it again
|
13
|
+
|
14
|
+
%finallize
|
15
|
+
use for extract all end of tags, it use command ",/"
|
16
|
+
|
17
|
+
=== INCLUDE ANOTHER HOT FILES
|
18
|
+
for merb application, I define 2 short cut of how you can use another hot file:
|
19
|
+
|
20
|
+
-merb_table (it will include: erb_merb, erb_table, erb_jquery)
|
21
|
+
it use when you define html for listing data, usually for method of "index"
|
22
|
+
|
23
|
+
-merb_form (it will include: erb_merb, erb_form, erb_jquery)
|
24
|
+
it use when you define html for fill in form, usually for method of
|
25
|
+
"new", or "edit".
|
26
|
+
|
27
|
+
=== AUTOCLOSE with -END
|
28
|
+
these definition are auto close with "-end".
|
29
|
+
|
30
|
+
-if
|
31
|
+
-elsif
|
32
|
+
-else
|
33
|
+
ex:###############################################
|
34
|
+
-if @page.page_count>1 && !@page.first_page?
|
35
|
+
%a.first_page{href="?page=1"} First
|
36
|
+
-else
|
37
|
+
%span.first_page First
|
38
|
+
|
39
|
+
##################################################
|
40
|
+
<% if @page.page_count>1 && !@page.first_page? %>
|
41
|
+
<a class="first_page" href="?page=1">First</a>
|
42
|
+
<% else %>
|
43
|
+
<span class="first_page">First</span>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
|
47
|
+
-for
|
48
|
+
-each
|
49
|
+
-times
|
50
|
+
ex:###############################################
|
51
|
+
-times pgt;pg1 = pg1 + 1
|
52
|
+
-if pg1 == @page.current_page
|
53
|
+
%span.current_page <%= pg1 %>
|
54
|
+
-else
|
55
|
+
%a.page_index{href="?page=<%= pg1 %>"} <%= pg1 %>
|
56
|
+
|
57
|
+
##################################################
|
58
|
+
<% pgt.times do pg1 = pg1 + 1 %>
|
59
|
+
<% if pg1 == @page.current_page %>
|
60
|
+
<span class="current_page"><%= pg1 %></span>
|
61
|
+
<% else %>
|
62
|
+
<a class="page_index" href="?page=<%= pg1 %>"><%= pg1 %></a>
|
63
|
+
<% end %>
|
64
|
+
|
65
|
+
<% end %>
|
66
|
+
|
67
|
+
=== COMMAND
|
68
|
+
|
69
|
+
-end
|
70
|
+
-
|
71
|
+
ex:###############################################
|
72
|
+
- page = 25
|
73
|
+
##################################################
|
74
|
+
<% page = 25 %>
|
75
|
+
|
76
|
+
=== EXPAND TAGS
|
77
|
+
|
78
|
+
%br
|
79
|
+
%hr
|
80
|
+
%img
|
81
|
+
%img=
|
82
|
+
|
data/doc/FAQ.rdoc
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
= Frequently Asked Questions
|
2
|
+
|
3
|
+
== W2TAGS
|
4
|
+
|
5
|
+
=== How do I put a punctuation mark after an element, like:
|
6
|
+
|
7
|
+
I Like <strong class="bold"><i class="italic">cake</i></strong>!
|
8
|
+
|
9
|
+
I Like (%strong.bold (%i.italic cake%)%)!
|
10
|
+
|
11
|
+
=== I have Patern in HOT with define close and autoclosing (!/) at first line. How do I use it, since patern write after define close.
|
12
|
+
|
13
|
+
If you have "ul_li" patern ( below ), it can't be use since define closing ( <</ )
|
14
|
+
immediately push to stack after "ul_li" patern called, and then perser will loop inside
|
15
|
+
"ul_li" patern line by line, it counter the first line to popup all the stack where
|
16
|
+
indentation is the same or wider, and it means current patern have same indentations.
|
17
|
+
|
18
|
+
>>ul_li
|
19
|
+
!/
|
20
|
+
<div>
|
21
|
+
%ul
|
22
|
+
^$*
|
23
|
+
<</
|
24
|
+
</div>
|
25
|
+
|
26
|
+
to get work-around of this situations, you define two patern like this:
|
27
|
+
|
28
|
+
>>ul_li
|
29
|
+
!/
|
30
|
+
<div>
|
31
|
+
%ul
|
32
|
+
^$*
|
33
|
+
%end_div
|
34
|
+
|
35
|
+
>>end_div
|
36
|
+
<</
|
37
|
+
</div>
|
38
|
+
|
39
|
+
the last line in "ul_li" patern, will call %end_div and it will push define closing
|
40
|
+
to stack "end".
|
41
|
+
|
42
|
+
In README.txt if patern change to have auto closing ( !/ ), the change are:
|
43
|
+
|
44
|
+
>>if
|
45
|
+
!/
|
46
|
+
- if $*
|
47
|
+
%end_if
|
48
|
+
|
49
|
+
>>end_if
|
50
|
+
<</
|
51
|
+
- end
|
52
|
+
|
53
|
+
=== Why you not implement > and < (Remove White Spaces)
|
54
|
+
|
55
|
+
Not implement it, since focus on how to make it DRY in w2tags.
|
56
|
+
|
57
|
+
HAML style
|
58
|
+
|
59
|
+
%ul.tabSet
|
60
|
+
%li.tabs.off<
|
61
|
+
%a Overview
|
62
|
+
%li.tabs.off<
|
63
|
+
%a 200 calories
|
64
|
+
|
65
|
+
W2TAGS style
|
66
|
+
|
67
|
+
%ul.tabSet
|
68
|
+
~^ <li class="tabs off"><a href="#">$0</a></li>
|
69
|
+
^ Overview;200 calories
|
70
|
+
|
71
|
+
=== Can it source have multiple w2tags command in one line
|
72
|
+
|
73
|
+
Yes it can!, just make HOT a patern like this:
|
74
|
+
|
75
|
+
>>_w
|
76
|
+
$0
|
77
|
+
|
78
|
+
-w %li inli;: input
|
79
|
+
|
80
|
+
<li>inli</li>
|
81
|
+
<input value="input"/>
|