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/hot/jquery.hot
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
>>css
|
2
|
+
-css css/$0
|
3
|
+
|
4
|
+
>>js
|
5
|
+
-js js/$0
|
6
|
+
|
7
|
+
>>csq
|
8
|
+
%css jquery.$0
|
9
|
+
|
10
|
+
>>jq
|
11
|
+
%js jquery.:strip$0
|
12
|
+
|
13
|
+
>>$pluginWindow
|
14
|
+
%css common
|
15
|
+
%csq jqModal
|
16
|
+
%js jquery
|
17
|
+
%jq dimensions;center;jqModal;jqDnR
|
18
|
+
%$ready
|
19
|
+
%$initWindow
|
20
|
+
|
21
|
+
>>_ready
|
22
|
+
%$ready
|
23
|
+
|
24
|
+
>>$ready
|
25
|
+
<!-- need closing tags! -->
|
26
|
+
<script type="text/javascript">
|
27
|
+
$(function() {
|
28
|
+
%$ready_end
|
29
|
+
|
30
|
+
>>$ready_end
|
31
|
+
<</
|
32
|
+
});
|
33
|
+
</script>
|
34
|
+
|
35
|
+
>>$initWindow
|
36
|
+
-!
|
37
|
+
function bindWindow(id_win,id_trigger) {
|
38
|
+
$(id_win+" .jqmClosed").click(function(){
|
39
|
+
$(id_win+" .jqmClose" ).click();
|
40
|
+
});
|
41
|
+
|
42
|
+
$(id_win)
|
43
|
+
.center()
|
44
|
+
.jqDrag('.jqDrag')
|
45
|
+
.jqResize('.jqResize')
|
46
|
+
.jqm({
|
47
|
+
overlay: 0,
|
48
|
+
modal: false,
|
49
|
+
trigger: id_trigger,
|
50
|
+
onShow: function(h) {
|
51
|
+
h.w.css('opacity',0.92).slideDown('fast');
|
52
|
+
},
|
53
|
+
onHide: function(h) {
|
54
|
+
h.w.slideUp("slow",function() { if(h.o) h.o.remove(); });
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
>>$bindWindow
|
60
|
+
-!
|
61
|
+
bindWindow("*opt*","$0")
|
62
|
+
|
63
|
+
>>$defineWindow
|
64
|
+
%div
|
65
|
+
%div*opt*.jqmNotice
|
66
|
+
%img.jqmClose{alt="close" src="icon/close_icon.png"}/
|
67
|
+
%div.jqmnTitle.jqDrag %h1!$0
|
68
|
+
%div.jqmnContent
|
69
|
+
$1
|
70
|
+
%img.jqResize{alt="resize" src="icon/resize.gif"}/
|
71
|
+
!/
|
72
|
+
|
73
|
+
>>click
|
74
|
+
<a *all* href="#">$0</a><br/>
|
75
|
+
|
76
|
+
>>ul
|
77
|
+
%treesub $*
|
78
|
+
|
79
|
+
>>treesub
|
80
|
+
%ul$0
|
81
|
+
<!-- tagsnext: treeitem or <li> ... </li> -->
|
82
|
+
!~
|
83
|
+
%!treeitem $*
|
84
|
+
|
85
|
+
>>treeitem
|
86
|
+
<li> <img src="icon/[folder$1.gif"/>$0 <!-- need closing tags! -->
|
87
|
+
<</
|
88
|
+
</li>
|
data/hot/nvelocity.hot
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
>>js_link
|
2
|
+
<script type="text/javascript" src="$siteRoot/Content/js/$0.js" > </script>
|
3
|
+
|
4
|
+
>>jq_link
|
5
|
+
%js_link jquery.$0
|
6
|
+
|
7
|
+
>>css_link
|
8
|
+
<link rel="stylesheet" href="$siteRoot/Content/css/$0.css" type="text/css" media="screen, projection" />
|
9
|
+
|
10
|
+
>>csq_link
|
11
|
+
%css_link jquery.$0
|
12
|
+
|
13
|
+
>>tr_td
|
14
|
+
-#
|
15
|
+
command in &opt!*opt* is to set var next tag with current attribute name,id,class
|
16
|
+
but calling this patern need to supply any attribute of name,id,class
|
17
|
+
ex: %tr_td.lst col1;col2
|
18
|
+
%tr
|
19
|
+
&opt!*opt*
|
20
|
+
^{$*}
|
21
|
+
!/
|
22
|
+
!~
|
23
|
+
%td&opt! $0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
>>_th
|
2
|
+
%th <b>$0.capitalize.gsub('_',' ')~</b>
|
3
|
+
|
4
|
+
>>_td
|
5
|
+
%td$$ h &rec!.$0
|
6
|
+
|
7
|
+
>>_td_link_crud
|
8
|
+
~^ %td link_to $0
|
9
|
+
^= "Show", &rec!
|
10
|
+
^= "Edit", edit_&rec!_path(&rec!)
|
11
|
+
^= "Destroy", &rec!, :confirm => "Are you sure?", :method => :delete
|
12
|
+
|
13
|
+
>>_each_tr
|
14
|
+
-each $*
|
15
|
+
%tr
|
data/hot/vm.hot
ADDED
data/hot/vm2.hot
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
>>css
|
2
|
+
<link rel="stylesheet" href="$siteRoot/Content/css/$0.css" type="text/css" media="screen, projection" />
|
3
|
+
|
4
|
+
>>csq
|
5
|
+
<link rel="stylesheet" href="$siteRoot/Content/css/jquery.$0.css" type="text/css" media="screen, projection" />
|
6
|
+
|
7
|
+
>>js
|
8
|
+
<script type="text/javascript" src="$siteRoot/Content/js/$0.js" > </script>
|
9
|
+
|
10
|
+
>>jq
|
11
|
+
<script type="text/javascript" src="$siteRoot/Content/js/jquery.$0.js" > </script>
|
12
|
+
|
13
|
+
>>_capture
|
14
|
+
#capturefor($0)
|
15
|
+
<</
|
16
|
+
\#end
|
17
|
+
|
18
|
+
>>_part
|
19
|
+
#parse("$0.vm")
|
20
|
+
|
21
|
+
>>_set
|
22
|
+
#set($0)
|
23
|
+
|
24
|
+
>>_for
|
25
|
+
#foreach($0)
|
26
|
+
<</
|
27
|
+
\#end
|
28
|
+
|
29
|
+
>>_a
|
30
|
+
%a*opt*.h{href="#"} Ajax
|
31
|
+
|
32
|
+
>>_button
|
33
|
+
%input#$#.btncrud{type="button" value="$0"}/
|
34
|
+
|
data/hot/vm_crud.hot
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
>>pagination
|
2
|
+
%partials list.page
|
3
|
+
%br/
|
4
|
+
%br/
|
5
|
+
%table.box_grid
|
6
|
+
%pagination_end~
|
7
|
+
|
8
|
+
>>pagination_end
|
9
|
+
<</
|
10
|
+
!run!
|
11
|
+
%partials list.page
|
12
|
+
<br/>
|
13
|
+
|
14
|
+
>>_th
|
15
|
+
<th class="header" col=$0 sort="#if($col == '$0')$!sort#end">$1<img class="isort" src="$siteRoot/content/img/#if($col == '$0')$isort#else$isortdef#end"/></th>
|
16
|
+
|
17
|
+
>>_td
|
18
|
+
<td><div class="c$0">$1</div></td>
|
19
|
+
|
20
|
+
>>_for_with_no
|
21
|
+
#set($no = $records.FirstItem - 1)
|
22
|
+
#foreach($0)
|
23
|
+
#set($no = $no + 1)
|
24
|
+
<</
|
25
|
+
\#end
|
26
|
+
|
27
|
+
>>partials
|
28
|
+
#parse("partials/$0.vm")
|
29
|
+
|
30
|
+
>>left
|
31
|
+
%div{style="float: left;"}
|
32
|
+
|
33
|
+
>>_input
|
34
|
+
%input:$:#$:{$0}/
|
data/hot/vm_popup.hot
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
>>_defineWindow
|
2
|
+
.popup
|
3
|
+
*opt*.jqmNotice
|
4
|
+
%img.jqmClose{alt="close" src="$siteRoot/content/img/icon/close_icon.png"}/
|
5
|
+
%img.jqResize{alt="resize" src="$siteRoot/content/img/icon/resize.png"}/
|
6
|
+
.jqDrag.jqmnTitle
|
7
|
+
%h1 $0
|
8
|
+
#$#_size.jqmnContent
|
9
|
+
|
10
|
+
>>_popup_base
|
11
|
+
%div
|
12
|
+
$#.jqmNotice{style="width:$0px"}
|
13
|
+
%img.jqmClose{alt="close" src="$siteRoot/content/img/icon/close_icon.png"}/
|
14
|
+
%img.jqResize{alt="resize" src="$siteRoot/content/img/icon/resize.gif"}/
|
15
|
+
.jqDrag.jqmnTitle
|
16
|
+
%h1 $2
|
17
|
+
.jqmnContent
|
18
|
+
|
19
|
+
>>_popup_crud
|
20
|
+
-popup_base#dlg_crud $0;$!title2 - CRUD [<span class="popup_t"></span>]
|
21
|
+
%form.form-crud{method="post" action="crud.rails"}
|
22
|
+
<table>
|
23
|
+
-popup_crud_end
|
24
|
+
|
25
|
+
>>_popup_filter
|
26
|
+
-popup_base#dlg_filter $0;Filter $!title2
|
27
|
+
<table>
|
28
|
+
-popup_filter_end
|
29
|
+
|
30
|
+
>>_popup_crud_end
|
31
|
+
<</
|
32
|
+
</table>
|
33
|
+
<input class="btncrud save" type="submit" name="submit" value="SAVE"/>
|
34
|
+
<input class="h btncrud update" type="submit" name="submit" value="UPDATE"/>
|
35
|
+
<input class="btncrud delete" type="submit" name="submit" value="DELETE"/>
|
36
|
+
<input class="btncrud jqmClose" type="button" value="CLOSE"/>
|
37
|
+
|
38
|
+
>>_popup_filter_end
|
39
|
+
<</
|
40
|
+
<tr>
|
41
|
+
<td colspan=2 align=center>
|
42
|
+
<input class="btncrud filter" type="submit" reset="false" value="FILTER"/>
|
43
|
+
<input class="btncrud jqmClose" type="button" value="CLOSE"/>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
</table>
|
47
|
+
|
48
|
+
>>_input_crud
|
49
|
+
:
|
50
|
+
%input#:gsub('.','_')$0$1{name="$0"}/
|
51
|
+
|
52
|
+
>>_tr_crud
|
53
|
+
%tr
|
54
|
+
%td $0
|
55
|
+
%td*opt* :$1
|
56
|
+
|
57
|
+
>>_tr_crud2
|
58
|
+
%tr
|
59
|
+
%td $0
|
60
|
+
%td*opt*
|
61
|
+
-input_crud $*
|
62
|
+
|
63
|
+
>>_tr_crud0
|
64
|
+
%tr
|
65
|
+
%td $0
|
66
|
+
%td*opt*
|
67
|
+
:
|
68
|
+
|
69
|
+
>>_tr_filter
|
70
|
+
%tr
|
71
|
+
%td $0
|
72
|
+
%td
|
73
|
+
:
|
74
|
+
%input*opt*.fill/
|
data/hot/xul.hot
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
>>initialize
|
2
|
+
|
3
|
+
>>finallize
|
4
|
+
,/
|
5
|
+
|
6
|
+
>>_window
|
7
|
+
<?xml-stylesheet href="~app.css~$1" type="text/css"?>
|
8
|
+
<window
|
9
|
+
title ="~example~$0"
|
10
|
+
xmlns:html="http://www.w3.org/1999/xhtml"
|
11
|
+
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
12
|
+
onload="init();">
|
13
|
+
<script>
|
14
|
+
-!
|
15
|
+
function init(){
|
16
|
+
for (i in wh.init ) { eval(wh.init[i]); }
|
17
|
+
for (i in wh.init2) { eval(wh.init2[i]); }
|
18
|
+
}
|
19
|
+
if(window.wh==undefined){
|
20
|
+
window.wh={};
|
21
|
+
wh.init =[];
|
22
|
+
wh.init2 =[];
|
23
|
+
}
|
24
|
+
</script>
|
25
|
+
<script src="jquery.js"/>
|
26
|
+
<</
|
27
|
+
</window>
|
28
|
+
|
29
|
+
>>_js
|
30
|
+
<script src="$0.js"/>
|
31
|
+
|
32
|
+
>>_script
|
33
|
+
<script><![CDATA[
|
34
|
+
-script_end
|
35
|
+
-!
|
36
|
+
|
37
|
+
>>_script_end
|
38
|
+
<</
|
39
|
+
]]></script>
|
40
|
+
|
41
|
+
>>_hbox
|
42
|
+
%hbox{~flex="1" style="overflow: auto;"~*att*}
|
43
|
+
|
44
|
+
>>_vbox
|
45
|
+
%vbox{~flex="1" style="overflow: auto;"~*att*}
|
46
|
+
|
47
|
+
>>_groupbox
|
48
|
+
%groupbox$${~flex="1"~*att*}
|
49
|
+
%caption{label="$0" style="background:white;"}/
|
50
|
+
<html:div class="div">...</html:div>
|
51
|
+
|
52
|
+
>>_splitter
|
53
|
+
%splitter{collapse="~before~$0"} <grippy/>
|
54
|
+
|
55
|
+
>>_vscroll
|
56
|
+
%arrowscrollbox{orient="vertical" flex="1"}
|
57
|
+
|
58
|
+
>>_hscroll
|
59
|
+
%arrowscrollbox{orient="horizontal" flex="1"}
|
60
|
+
|
61
|
+
>>_menubar
|
62
|
+
%toolbox{flex="1"}
|
63
|
+
%menubar$#-menubar
|
64
|
+
|
65
|
+
>>_menu
|
66
|
+
%menu#:downcase$0-menu{label="$0"}
|
67
|
+
%menupopup#:downcase$0-popup
|
68
|
+
|
69
|
+
>>_menu-
|
70
|
+
%menuseparator/
|
71
|
+
|
72
|
+
>>_menuseparator
|
73
|
+
%menuseparator/
|
74
|
+
|
75
|
+
>>_menuitem
|
76
|
+
%menuitem$${*att* ~label="$0"~}/
|
77
|
+
|
78
|
+
>>_toolbar
|
79
|
+
%toolbox
|
80
|
+
%toolbar$#-toolbar
|
81
|
+
|
82
|
+
>>_toolbarbutton
|
83
|
+
%toolbarbutton$${*att* ~label="$0"~}/
|
84
|
+
|
85
|
+
>>_button
|
86
|
+
%button$${*att* ~label="$0"~}/
|
87
|
+
|
88
|
+
>>_tree
|
89
|
+
%script wh.init.push("wh.treeInit('#tree','$1')")
|
90
|
+
%tree$${*att* flex="1" hidecolumnpicker="true" onselect="wh['$#'].doClick();"}
|
91
|
+
%treecols
|
92
|
+
%treecol{flex="1" primary="true" label="$0"}
|
93
|
+
%treechildren
|
94
|
+
|
95
|
+
>>_treeitms
|
96
|
+
&cls=$.
|
97
|
+
%treeitem$.-root{container="true" open="true"}
|
98
|
+
%treerow
|
99
|
+
%treecell{label="$0"}
|
100
|
+
%treechildren
|
101
|
+
|
102
|
+
>>_treeitem
|
103
|
+
%treeitem$$
|
104
|
+
%treerow
|
105
|
+
%treecell&cls!{*att* label="$0"}
|
106
|
+
|
107
|
+
>>_div
|
108
|
+
<html:div>
|
109
|
+
-div_end
|
110
|
+
|
111
|
+
>>_div_end
|
112
|
+
<</
|
113
|
+
</html:div>
|
114
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module W2Tags
|
2
|
+
module Block
|
3
|
+
module PlainText
|
4
|
+
#when command is "-!", it means that inside these
|
5
|
+
#indentation will not be parsed.
|
6
|
+
# Example:
|
7
|
+
# %head
|
8
|
+
# %script
|
9
|
+
# -!
|
10
|
+
# $(function(){
|
11
|
+
# alert('Hello World');
|
12
|
+
# });
|
13
|
+
def plain_text_skip_initialize()
|
14
|
+
@plt_opt= '' #plaintext option
|
15
|
+
@doc_plt= [] #plaintext buffer
|
16
|
+
@plt = 99 #plaintext indentation
|
17
|
+
end
|
18
|
+
|
19
|
+
def plain_text_skip
|
20
|
+
@rgx = nil
|
21
|
+
@plt_opt = ''
|
22
|
+
if(/(^[\t ]*)(-!+[ ]?)([^\n]*)\n/ =~ @row;@rgx = $~)
|
23
|
+
@row = ''
|
24
|
+
@plt = @spc.size
|
25
|
+
@plt_opt = @rgx[2]
|
26
|
+
@doc_plt = []
|
27
|
+
if @rgx[3].strip != ""
|
28
|
+
if @plt_opt[1,2]=='!!'
|
29
|
+
@doc_plt << " #{@rgx[3].strip}\n"
|
30
|
+
else
|
31
|
+
@doc_plt << "#{@spc} #{@rgx[3].strip}\n"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
elsif @plt != 99
|
35
|
+
if @spc.size<= @plt
|
36
|
+
@doc_out = @doc_out + @doc_plt
|
37
|
+
@plt = 99
|
38
|
+
else
|
39
|
+
plain_text_parser
|
40
|
+
end
|
41
|
+
end
|
42
|
+
@plt!=99
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def plain_text_parser
|
48
|
+
if @plt_opt[1,2]=='!!'
|
49
|
+
@doc_plt << @row[@plt,999].rstrip<<"\n"
|
50
|
+
else
|
51
|
+
@doc_plt << @row.rstrip<<"\n"
|
52
|
+
end
|
53
|
+
@row = ''
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module W2Tags
|
2
|
+
module Block
|
3
|
+
module Remark
|
4
|
+
#when command is "-#", it means that inside these
|
5
|
+
#indentation will not include on the result or it
|
6
|
+
#become some comment.
|
7
|
+
# Example:
|
8
|
+
# -#
|
9
|
+
# THIS COMMENT
|
10
|
+
# WILL NOT SHOW ON RESULT
|
11
|
+
def remark_skip_initialize
|
12
|
+
@rmk = 99 #remark indentation
|
13
|
+
end
|
14
|
+
|
15
|
+
def empty_skip
|
16
|
+
@row.strip == ''
|
17
|
+
end
|
18
|
+
|
19
|
+
def line_skip
|
20
|
+
if /(^[\t ]*)(\\)([^\n]*\n)/ =~ @row #escape for plain text "\- "
|
21
|
+
@row = $1+$3
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def remark_skip
|
26
|
+
if(/(^[\t ]*)(-#)([^\n]*)\n/ =~ @row;@rgx = $~)
|
27
|
+
@rmk = @spc.size #@plt = 99
|
28
|
+
elsif @rmk !=99
|
29
|
+
@rmk = 99 if @spc.size <= @rmk
|
30
|
+
#p "remrk> #{@rgx[3].strip}" if @dbg[:parse]
|
31
|
+
end
|
32
|
+
@row = '' if @rmk!=99
|
33
|
+
@rmk!=99
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module W2Tags
|
2
|
+
module Block
|
3
|
+
module Sass
|
4
|
+
def sass_skip_initialize
|
5
|
+
@doc_sas= [] #sass buffer
|
6
|
+
@key_sas= [] #sass indentation
|
7
|
+
@nms_sas= [0,""]
|
8
|
+
@sas = 99 #sass indentation block
|
9
|
+
end
|
10
|
+
|
11
|
+
def sass_skip
|
12
|
+
@rgx = nil
|
13
|
+
if(/(^[\t ]*)(~~~)\n/ =~ @row;@rgx = $~)
|
14
|
+
@row = ''
|
15
|
+
@sas = @spc.size
|
16
|
+
@doc_sas = [[' '*@sas,"<style>\n"].join]
|
17
|
+
elsif @sas!= 99
|
18
|
+
if @spc.size<= @sas
|
19
|
+
@doc_sas<< "#{' '*@key_sas[-1][0]}}\n"
|
20
|
+
@doc_sas<< @doc_sas[0].gsub("<style>","</style>")
|
21
|
+
@doc_out = @doc_out + @doc_sas
|
22
|
+
@sas = 99
|
23
|
+
elsif @row.strip!=''
|
24
|
+
sass_parser
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@sas!=99
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def sass_parser
|
33
|
+
spc= @spc.size
|
34
|
+
if(/(^[\t ]*)(:[\w\-]+) *\n/ =~ @row;@rgx = $~)
|
35
|
+
@nms_sas= [spc,[$1,$2[1,99],"-"].join]
|
36
|
+
elsif(/(^[\t ]*)(:[\w\-]+) +([^\n]+)\n/ =~ @row;@rgx = $~)
|
37
|
+
nms= @nms_sas[0]!=0 && @nms_sas[0]<spc ? @nms_sas[1] : $1
|
38
|
+
@doc_sas << [nms,$2[1,99],":",$3,";\n"].join
|
39
|
+
else
|
40
|
+
old_spc= nil
|
41
|
+
if @key_sas!=[]
|
42
|
+
old_spc = @key_sas[-1][0]
|
43
|
+
@key_sas = @key_sas.select{|l|l[0]<spc} if spc<= old_spc
|
44
|
+
end
|
45
|
+
@key_sas<< [spc,@row.strip]
|
46
|
+
@doc_sas<< [' '*old_spc, "}\n"].join if old_spc
|
47
|
+
@doc_sas<< [@spc,sass_join,"{\n"].join
|
48
|
+
@nms_sas = [0,""]
|
49
|
+
end
|
50
|
+
@row = ''
|
51
|
+
end
|
52
|
+
|
53
|
+
def sass_join
|
54
|
+
rtn= ''
|
55
|
+
@key_sas.each do |line|
|
56
|
+
rtn = (rtn==''? [''] : rtn.split(',')).collect do |p|
|
57
|
+
line[1].split(',').collect do |x|
|
58
|
+
(x.gsub!(/&/,p) ? x : p+' '+ x).strip
|
59
|
+
end.join(',')
|
60
|
+
end.join(',')
|
61
|
+
end
|
62
|
+
rtn
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Merb::Template
|
2
|
+
if Merb.environment != "development"
|
3
|
+
puts 'W2Tags Only RUN on (Merb.environment == "development")'
|
4
|
+
else
|
5
|
+
puts 'W2Tags Hooked on Merb!'
|
6
|
+
W2TAGS = W2Tags::Parser.new
|
7
|
+
class << self
|
8
|
+
def load_template_io(path)
|
9
|
+
src = path.gsub(/\.erb$/,'.w2erb')
|
10
|
+
W2TAGS.parse_file(src,false,true)
|
11
|
+
File.open(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|