weaver 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/data/weaver/js/inspinia.js +9 -5
- data/exe/weaver +2 -0
- data/lib/weaver/version.rb +1 -1
- data/lib/weaver.rb +448 -56
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae6c5d9dc5321714d7473018da8bc8738d62bee1
|
4
|
+
data.tar.gz: 1e4402daa077db93b77cf933a8b3e482f3041d89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d2fc0027cba08b8400979f2cee102de30f23635bab9a1776163bbcb45c80d71b0f80cf602b87c7fed9232d1ba36a254fad179043107620ad21bf9bb265070c2
|
7
|
+
data.tar.gz: bd9eaf24fe0e0ef30c3ffb3ee416704cbd1a0e248f3204792e4ef9085918f952961ce5084f1fc37d9162a2e02c4c3903a2f37af3ef3135192818803261971764
|
data/data/weaver/js/inspinia.js
CHANGED
@@ -4,7 +4,11 @@
|
|
4
4
|
* version 2.2
|
5
5
|
*
|
6
6
|
*/
|
7
|
-
|
7
|
+
|
8
|
+
String.prototype.replaceAll = function(search, replacement) {
|
9
|
+
var target = this;
|
10
|
+
return target.replace(new RegExp(search, 'g'), replacement);
|
11
|
+
};
|
8
12
|
|
9
13
|
$(document).ready(function () {
|
10
14
|
|
@@ -92,10 +96,10 @@ $(document).ready(function () {
|
|
92
96
|
|
93
97
|
// Append config box / Only for demo purpose
|
94
98
|
// Uncomment on server mode to enable XHR calls
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
});
|
99
|
+
//$.get("skin-config.html", function (data) {
|
100
|
+
// if (!$('body').hasClass('no-skin-config'))
|
101
|
+
// $('body').append(data);
|
102
|
+
//});
|
99
103
|
|
100
104
|
// Minimalize menu
|
101
105
|
$('.navbar-minimalize').click(function () {
|
data/exe/weaver
CHANGED
@@ -7,6 +7,7 @@ class Website < Sinatra::Base
|
|
7
7
|
|
8
8
|
set :static, true # set up static file routing
|
9
9
|
set :public_folder, Gem.datadir("weaver") # set up the static dir (with images/js/css inside)
|
10
|
+
set :bind, '0.0.0.0'
|
10
11
|
|
11
12
|
def getWeavefile(viewname)
|
12
13
|
|
@@ -153,6 +154,7 @@ end
|
|
153
154
|
to_create = "#{args[0]}"
|
154
155
|
FileUtils::mkdir_p "#{to_create}"
|
155
156
|
FileUtils::mkdir_p "#{to_create}/source"
|
157
|
+
FileUtils::mkdir_p "#{to_create}/images"
|
156
158
|
File.write "#{to_create}/Gemfile", gemfile
|
157
159
|
File.write "#{to_create}/source/index.weave", source
|
158
160
|
end
|
data/lib/weaver/version.rb
CHANGED
data/lib/weaver.rb
CHANGED
@@ -128,6 +128,20 @@ module Weaver
|
|
128
128
|
@inner_content << theText
|
129
129
|
end
|
130
130
|
|
131
|
+
def badge(label, options={})
|
132
|
+
options[:type] ||= "plain"
|
133
|
+
|
134
|
+
kind = "label"
|
135
|
+
kind = "badge" if options[:rounded]
|
136
|
+
tag_options = options.clone
|
137
|
+
tag_options[:class] = "#{kind} #{kind}-#{options[:type]}"
|
138
|
+
|
139
|
+
span tag_options do
|
140
|
+
text label
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
|
131
145
|
def link(url, title=nil, &block)
|
132
146
|
if !title
|
133
147
|
title = url
|
@@ -340,17 +354,13 @@ ENDROW
|
|
340
354
|
|
341
355
|
def table(options={}, &block)
|
342
356
|
|
343
|
-
if !@anchors["tables"]
|
344
|
-
@anchors["tables"] = []
|
345
|
-
end
|
346
357
|
|
347
|
-
|
358
|
+
table_name = options[:id] || @page.create_anchor("table")
|
359
|
+
table_style = ""
|
348
360
|
|
349
|
-
|
350
|
-
|
351
|
-
table_name = options[:id]
|
361
|
+
if options[:style] != nil
|
362
|
+
table_style = options[:style]
|
352
363
|
end
|
353
|
-
tableArray << table_name
|
354
364
|
|
355
365
|
classname = "table"
|
356
366
|
|
@@ -385,7 +395,17 @@ ENDROW
|
|
385
395
|
end
|
386
396
|
|
387
397
|
|
388
|
-
method_missing(:table, :class => classname, id: table_name, &block)
|
398
|
+
method_missing(:table, :class => classname, id: table_name, style: table_style, &block)
|
399
|
+
end
|
400
|
+
|
401
|
+
def table_from_source(url, options={}, &block)
|
402
|
+
|
403
|
+
dyn_table = DynamicTable.new(@page, @anchors, url, options, &block)
|
404
|
+
|
405
|
+
text dyn_table.generate_table
|
406
|
+
|
407
|
+
@page.scripts << dyn_table.generate_script
|
408
|
+
|
389
409
|
end
|
390
410
|
|
391
411
|
def table_from_hashes(hashes, options={})
|
@@ -405,15 +425,17 @@ ENDROW
|
|
405
425
|
end
|
406
426
|
end
|
407
427
|
|
408
|
-
|
428
|
+
tbody do
|
409
429
|
|
410
|
-
|
411
|
-
|
412
|
-
|
430
|
+
hashes.each do |hash|
|
431
|
+
|
432
|
+
tr do
|
433
|
+
keys.each do |key, _|
|
434
|
+
td "#{hash[key]}" || " "
|
435
|
+
end
|
413
436
|
end
|
414
437
|
end
|
415
438
|
end
|
416
|
-
|
417
439
|
end
|
418
440
|
end
|
419
441
|
|
@@ -422,6 +444,192 @@ ENDROW
|
|
422
444
|
end
|
423
445
|
end
|
424
446
|
|
447
|
+
class DynamicTableCell < Elements
|
448
|
+
|
449
|
+
def data_button(anIcon, title={}, options={}, &block)
|
450
|
+
options[:icon] = anIcon
|
451
|
+
options[:title] = title
|
452
|
+
options[:data] = "$(this).closest('td').data('object')"
|
453
|
+
_button(options, &block)
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
class DynamicTable
|
458
|
+
|
459
|
+
def initialize(page, anchors, url, options={}, &block)
|
460
|
+
@page = page
|
461
|
+
@anchors = anchors
|
462
|
+
@url = url
|
463
|
+
@options = options
|
464
|
+
@columns = nil
|
465
|
+
|
466
|
+
self.instance_eval(&block) if block
|
467
|
+
|
468
|
+
@options[:id] ||= @page.create_anchor "dyn_table"
|
469
|
+
@table_name = @options[:id]
|
470
|
+
@head_name = "#{@table_name}_head"
|
471
|
+
@body_name = "#{@table_name}_body"
|
472
|
+
|
473
|
+
|
474
|
+
end
|
475
|
+
|
476
|
+
def column(name, options={}, &block)
|
477
|
+
if @columns == nil
|
478
|
+
@columns = []
|
479
|
+
end
|
480
|
+
|
481
|
+
title = options[:title] || name
|
482
|
+
format = nil
|
483
|
+
|
484
|
+
if options[:icon]
|
485
|
+
elem = Elements.new(@page, @anchors)
|
486
|
+
elem.instance_eval do
|
487
|
+
icon options[:icon]
|
488
|
+
text " #{title}"
|
489
|
+
end
|
490
|
+
title = elem.generate
|
491
|
+
end
|
492
|
+
|
493
|
+
if block
|
494
|
+
elem = DynamicTableCell.new(@page, @anchors)
|
495
|
+
elem.instance_eval(&block)
|
496
|
+
format = elem.generate
|
497
|
+
end
|
498
|
+
|
499
|
+
@columns << {name: name, title: title, format: format}
|
500
|
+
|
501
|
+
end
|
502
|
+
|
503
|
+
def generate_table
|
504
|
+
|
505
|
+
table_name = @table_name
|
506
|
+
head_name = @head_name
|
507
|
+
body_name = @body_name
|
508
|
+
options = @options
|
509
|
+
|
510
|
+
columns = @columns || [ {title: "Key"}, {title: "Value"} ]
|
511
|
+
|
512
|
+
elem = Elements.new(@page, @anchors)
|
513
|
+
elem.instance_eval do
|
514
|
+
|
515
|
+
table options do
|
516
|
+
thead id: head_name do
|
517
|
+
columns.each do |column, _|
|
518
|
+
if column.is_a? Hash
|
519
|
+
th column[:title].to_s
|
520
|
+
else
|
521
|
+
th column.to_s
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
tbody id: body_name do
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
elem.generate
|
532
|
+
end
|
533
|
+
|
534
|
+
def generate_script
|
535
|
+
|
536
|
+
<<-DATATABLE_SCRIPT
|
537
|
+
|
538
|
+
function refresh_table_#{@table_name}()
|
539
|
+
{
|
540
|
+
$.get( "#{@url}", function( data )
|
541
|
+
{
|
542
|
+
var data_object = JSON.parse(data);
|
543
|
+
var head = $("##{@head_name}")
|
544
|
+
var body = $("##{@body_name}")
|
545
|
+
|
546
|
+
if($.isPlainObject(data_object))
|
547
|
+
{
|
548
|
+
for (var key in data_object)
|
549
|
+
{
|
550
|
+
var row = $('<tr>');
|
551
|
+
row.append($('<td>').text(key));
|
552
|
+
row.append($('<td>').text(data_object[key]));
|
553
|
+
body.append(row);
|
554
|
+
}
|
555
|
+
}
|
556
|
+
|
557
|
+
if ($.isArray(data_object))
|
558
|
+
{
|
559
|
+
|
560
|
+
var columnData = JSON.parse(#{@columns.to_json.inspect});
|
561
|
+
var columns = {};
|
562
|
+
var columnTitles = [];
|
563
|
+
head.empty();
|
564
|
+
if (#{@columns == nil})
|
565
|
+
{
|
566
|
+
// Set up columns
|
567
|
+
for (var index in data_object)
|
568
|
+
{
|
569
|
+
for (var key in data_object[index])
|
570
|
+
{
|
571
|
+
columns[key] = Object.keys(columns).length;
|
572
|
+
}
|
573
|
+
}
|
574
|
+
for (var key in columns)
|
575
|
+
{
|
576
|
+
columnTitles.push(key);
|
577
|
+
}
|
578
|
+
}
|
579
|
+
else
|
580
|
+
{
|
581
|
+
for (var key in columnData)
|
582
|
+
{
|
583
|
+
columns[columnData[key]["name"]] = Object.keys(columns).length;
|
584
|
+
columnTitles.push(columnData[key]["title"]);
|
585
|
+
}
|
586
|
+
}
|
587
|
+
|
588
|
+
var row = $('<tr>');
|
589
|
+
for (var key in columnTitles)
|
590
|
+
{
|
591
|
+
var columnTitle = $('<th>').html(columnTitles[key]);
|
592
|
+
row.append(columnTitle);
|
593
|
+
}
|
594
|
+
head.append(row);
|
595
|
+
|
596
|
+
for (var index in data_object)
|
597
|
+
{
|
598
|
+
var row = $('<tr>');
|
599
|
+
for (var columnIndex = 0; columnIndex < Object.keys(columns).length; columnIndex++) {
|
600
|
+
var cell_data = data_object[index][ Object.keys(columns)[columnIndex] ];
|
601
|
+
if (columnData && columnData[columnIndex]["format"])
|
602
|
+
{
|
603
|
+
var format = columnData[columnIndex]["format"];
|
604
|
+
var matches = format.match(/###.+?###/g)
|
605
|
+
|
606
|
+
var result = format;
|
607
|
+
for (var matchIndex in matches)
|
608
|
+
{
|
609
|
+
var member_name = matches[matchIndex].match(/[^#]+/)[0];
|
610
|
+
result = result.replaceAll(matches[matchIndex], data_object[index][member_name]);
|
611
|
+
}
|
612
|
+
|
613
|
+
row.append($('<td>').html( result ).data("object", data_object[index]) );
|
614
|
+
}
|
615
|
+
else
|
616
|
+
{
|
617
|
+
row.append($('<td>').text( cell_data ).data("object", data_object[index]) );
|
618
|
+
}
|
619
|
+
}
|
620
|
+
body.append(row);
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
});
|
625
|
+
}
|
626
|
+
|
627
|
+
refresh_table_#{@table_name}();
|
628
|
+
|
629
|
+
DATATABLE_SCRIPT
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
425
633
|
class Action
|
426
634
|
def initialize(page, anchors, &block)
|
427
635
|
@page = page
|
@@ -568,9 +776,24 @@ function #{@actionName}(caller, data) {
|
|
568
776
|
options[:placeholder] ||= ""
|
569
777
|
options[:name] = name
|
570
778
|
|
779
|
+
input_options = {}
|
780
|
+
input_options[:type] = options[:type]
|
781
|
+
input_options[:placeholder] = options[:placeholder]
|
782
|
+
input_options[:id] = textfield_name
|
783
|
+
input_options[:name] = options[:name]
|
784
|
+
input_options[:class] = "form-control"
|
785
|
+
|
786
|
+
if options[:mask]
|
787
|
+
@page.request_css "css/plugins/jasny/jasny-bootstrap.min.css"
|
788
|
+
@page.request_js "js/plugins/jasny/jasny-bootstrap.min.js"
|
789
|
+
|
790
|
+
input_options[:"data-mask"] = options[:mask]
|
791
|
+
|
792
|
+
end
|
793
|
+
|
571
794
|
div :class => "form-group" do
|
572
795
|
label textfield_label
|
573
|
-
input
|
796
|
+
input input_options
|
574
797
|
end
|
575
798
|
|
576
799
|
@scripts << <<-SCRIPT
|
@@ -582,21 +805,37 @@ function #{@actionName}(caller, data) {
|
|
582
805
|
def dropdown(name, dropdown_label, choice_array, options={})
|
583
806
|
select_name = @page.create_anchor "select"
|
584
807
|
|
585
|
-
div :class => "form-group" do
|
586
|
-
label dropdown_label, :class => "control-label"
|
587
808
|
|
588
|
-
|
589
|
-
|
590
|
-
|
809
|
+
options[:class] = "form-control"
|
810
|
+
options[:name] = name
|
811
|
+
options[:id] = select_name
|
812
|
+
options[:placeholder] ||= " "
|
591
813
|
|
592
|
-
|
593
|
-
choice_array.each do |choice|
|
594
|
-
option choice
|
595
|
-
end
|
596
|
-
end
|
597
|
-
end
|
814
|
+
form_options = options.clone
|
598
815
|
|
599
816
|
if options[:multiple]
|
817
|
+
|
818
|
+
if options[:multiple_style] == :chosen
|
819
|
+
@page.request_css "css/plugins/chosen/chosen.css"
|
820
|
+
@page.request_js "js/plugins/chosen/chosen.jquery.js"
|
821
|
+
|
822
|
+
@page.write_script_once <<-SCRIPT
|
823
|
+
var config = {
|
824
|
+
'.chosen-select' : {placeholder_text_multiple: "#{options[:placeholder]}"},
|
825
|
+
'.chosen-select-deselect' : {allow_single_deselect:true},
|
826
|
+
'.chosen-select-no-single' : {disable_search_threshold:10},
|
827
|
+
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
|
828
|
+
'.chosen-select-width' : {width:"95%"}
|
829
|
+
}
|
830
|
+
for (var selector in config) {
|
831
|
+
$(selector).chosen(config[selector]);
|
832
|
+
}
|
833
|
+
SCRIPT
|
834
|
+
|
835
|
+
form_options[:class] = "chosen-select"
|
836
|
+
form_options[:style] = "width: 100%"
|
837
|
+
end
|
838
|
+
|
600
839
|
@scripts << <<-SCRIPT
|
601
840
|
var selections = [];
|
602
841
|
$("##{select_name} option:selected").each(function(i, selected){
|
@@ -604,12 +843,59 @@ function #{@actionName}(caller, data) {
|
|
604
843
|
});
|
605
844
|
object["#{name}"] = selections;
|
606
845
|
SCRIPT
|
846
|
+
|
607
847
|
else
|
608
848
|
@scripts << <<-SCRIPT
|
609
849
|
object["#{name}"] = $( "##{select_name} option:selected" ).text();
|
610
850
|
SCRIPT
|
611
851
|
end
|
612
852
|
|
853
|
+
|
854
|
+
div :class => "form-group" do
|
855
|
+
label dropdown_label, :class => "control-label"
|
856
|
+
|
857
|
+
div :class => "input-group", style: "width: 100%" do
|
858
|
+
|
859
|
+
method_missing :select, form_options do
|
860
|
+
choice_array.each do |choice|
|
861
|
+
option choice
|
862
|
+
end
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
|
868
|
+
end
|
869
|
+
|
870
|
+
def knob(name, options={})
|
871
|
+
|
872
|
+
knob_name = @page.create_anchor "knob"
|
873
|
+
|
874
|
+
@page.request_js "js/plugins/jsKnob/jquery.knob.js"
|
875
|
+
@page.write_script_once <<-SCRIPT
|
876
|
+
$(".dial").knob();
|
877
|
+
SCRIPT
|
878
|
+
|
879
|
+
knob_options = {}
|
880
|
+
|
881
|
+
knob_options[:id] = knob_name
|
882
|
+
knob_options[:type] = "text"
|
883
|
+
knob_options[:value] = options[:value] || "0"
|
884
|
+
knob_options[:class] = "dial"
|
885
|
+
|
886
|
+
options.each do |key,value|
|
887
|
+
knob_options["data-#{key}".to_sym] = value
|
888
|
+
end
|
889
|
+
|
890
|
+
knob_options[:"data-fgColor"] = "#1AB394"
|
891
|
+
knob_options[:"data-width"] = "85"
|
892
|
+
knob_options[:"data-height"] = "85"
|
893
|
+
|
894
|
+
input knob_options
|
895
|
+
|
896
|
+
@scripts << <<-SCRIPT
|
897
|
+
object["#{name}"] = $('##{knob_name}').val();
|
898
|
+
SCRIPT
|
613
899
|
end
|
614
900
|
|
615
901
|
def radio(name, choice_array, options={})
|
@@ -1028,7 +1314,7 @@ $(document).ready(function () {
|
|
1028
1314
|
end
|
1029
1315
|
|
1030
1316
|
class Page
|
1031
|
-
|
1317
|
+
|
1032
1318
|
attr_accessor :scripts
|
1033
1319
|
|
1034
1320
|
def initialize(title, options)
|
@@ -1302,27 +1588,33 @@ $(document).ready(function () {
|
|
1302
1588
|
end
|
1303
1589
|
end
|
1304
1590
|
|
1305
|
-
class
|
1591
|
+
class StructuredPage < Page
|
1592
|
+
|
1306
1593
|
def initialize(title, options)
|
1594
|
+
@rows = []
|
1307
1595
|
super
|
1308
|
-
@menu = Menu.new
|
1309
1596
|
end
|
1310
1597
|
|
1311
|
-
def
|
1312
|
-
|
1598
|
+
def header(&block)
|
1599
|
+
row(class: "wrapper border-bottom white-bg page-heading", &block)
|
1313
1600
|
end
|
1314
1601
|
|
1315
|
-
|
1602
|
+
def row(options={}, &block)
|
1603
|
+
r = Row.new(self, @anchors, options)
|
1604
|
+
r.instance_eval(&block)
|
1605
|
+
@rows << r
|
1606
|
+
end
|
1316
1607
|
|
1608
|
+
end
|
1317
1609
|
|
1318
|
-
class
|
1610
|
+
class NavPage < StructuredPage
|
1319
1611
|
def initialize(title, options)
|
1320
|
-
@rows = []
|
1321
1612
|
super
|
1613
|
+
@menu = Menu.new
|
1322
1614
|
end
|
1323
1615
|
|
1324
|
-
def
|
1325
|
-
|
1616
|
+
def menu(&block)
|
1617
|
+
@menu.instance_eval(&block)
|
1326
1618
|
end
|
1327
1619
|
|
1328
1620
|
def brand(text, link="/")
|
@@ -1330,10 +1622,11 @@ $(document).ready(function () {
|
|
1330
1622
|
@brand_link = link
|
1331
1623
|
end
|
1332
1624
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1625
|
+
end
|
1626
|
+
|
1627
|
+
class SideNavPage < NavPage
|
1628
|
+
def initialize(title, options)
|
1629
|
+
super
|
1337
1630
|
end
|
1338
1631
|
|
1339
1632
|
def generate(level)
|
@@ -1436,25 +1729,9 @@ $(document).ready(function () {
|
|
1436
1729
|
|
1437
1730
|
class TopNavPage < NavPage
|
1438
1731
|
def initialize(title, options)
|
1439
|
-
@rows = []
|
1440
1732
|
super
|
1441
1733
|
end
|
1442
1734
|
|
1443
|
-
def header(&block)
|
1444
|
-
row(class: "wrapper border-bottom white-bg page-heading", &block)
|
1445
|
-
end
|
1446
|
-
|
1447
|
-
def brand(text, link="/")
|
1448
|
-
@brand = text
|
1449
|
-
@brand_link = link
|
1450
|
-
end
|
1451
|
-
|
1452
|
-
def row(options={}, &block)
|
1453
|
-
r = Row.new(self, @anchors, options)
|
1454
|
-
r.instance_eval(&block)
|
1455
|
-
@rows << r
|
1456
|
-
end
|
1457
|
-
|
1458
1735
|
def generate(level)
|
1459
1736
|
rows = @rows.map { |row|
|
1460
1737
|
<<-ENDROW
|
@@ -1568,6 +1845,77 @@ $(document).ready(function () {
|
|
1568
1845
|
end
|
1569
1846
|
end
|
1570
1847
|
|
1848
|
+
class NonNavPage < StructuredPage
|
1849
|
+
def initialize(title, options)
|
1850
|
+
super
|
1851
|
+
end
|
1852
|
+
|
1853
|
+
def generate(level)
|
1854
|
+
rows = @rows.map { |row|
|
1855
|
+
<<-ENDROW
|
1856
|
+
<div class="row #{row.extra_classes}">
|
1857
|
+
#{row.generate}
|
1858
|
+
</div>
|
1859
|
+
ENDROW
|
1860
|
+
}.join
|
1861
|
+
|
1862
|
+
@body_class = "gray-bg"
|
1863
|
+
|
1864
|
+
@content = <<-CONTENT
|
1865
|
+
<div id="wrapper">
|
1866
|
+
<div class="wrapper-content">
|
1867
|
+
<div class="container">
|
1868
|
+
#{rows}
|
1869
|
+
</div>
|
1870
|
+
</div>
|
1871
|
+
</div>
|
1872
|
+
CONTENT
|
1873
|
+
super
|
1874
|
+
end
|
1875
|
+
end
|
1876
|
+
|
1877
|
+
class RawPage < Page
|
1878
|
+
def initialize(title, options)
|
1879
|
+
@element = Elements.new(self, {})
|
1880
|
+
super
|
1881
|
+
end
|
1882
|
+
|
1883
|
+
def element=(value)
|
1884
|
+
@element = value
|
1885
|
+
end
|
1886
|
+
|
1887
|
+
|
1888
|
+
def generate(back_folders, options={})
|
1889
|
+
@element.generate
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
class EmptyPage < Page
|
1895
|
+
def initialize(title, options)
|
1896
|
+
@element = Elements.new(self, {})
|
1897
|
+
super
|
1898
|
+
end
|
1899
|
+
|
1900
|
+
def element=(value)
|
1901
|
+
@element = value
|
1902
|
+
end
|
1903
|
+
|
1904
|
+
def generate(level)
|
1905
|
+
@body_class = "gray-bg"
|
1906
|
+
@content = <<-CONTENT
|
1907
|
+
<div id="wrapper">
|
1908
|
+
<div class="wrapper-content">
|
1909
|
+
<div class="container">
|
1910
|
+
#{@element.generate}
|
1911
|
+
</div>
|
1912
|
+
</div>
|
1913
|
+
</div>
|
1914
|
+
CONTENT
|
1915
|
+
super
|
1916
|
+
end
|
1917
|
+
end
|
1918
|
+
|
1571
1919
|
|
1572
1920
|
class CenterPage < Page
|
1573
1921
|
def initialize(title, options)
|
@@ -1645,6 +1993,50 @@ $(document).ready(function () {
|
|
1645
1993
|
@pages[path] = p
|
1646
1994
|
end
|
1647
1995
|
|
1996
|
+
def nonnav_page(path, title=nil, &block)
|
1997
|
+
|
1998
|
+
if title == nil
|
1999
|
+
title = path
|
2000
|
+
path = ""
|
2001
|
+
end
|
2002
|
+
|
2003
|
+
p = NonNavPage.new(title, @options)
|
2004
|
+
p.instance_eval(&block) if block
|
2005
|
+
@pages[path] = p
|
2006
|
+
end
|
2007
|
+
|
2008
|
+
|
2009
|
+
def empty_page(path, title=nil, &block)
|
2010
|
+
|
2011
|
+
if title == nil
|
2012
|
+
title = path
|
2013
|
+
path = ""
|
2014
|
+
end
|
2015
|
+
|
2016
|
+
p = EmptyPage.new(title, @options)
|
2017
|
+
|
2018
|
+
elem = Elements.new(p, {})
|
2019
|
+
elem.instance_eval(&block) if block
|
2020
|
+
|
2021
|
+
p.element=elem
|
2022
|
+
|
2023
|
+
@pages[path] = p
|
2024
|
+
end
|
2025
|
+
|
2026
|
+
def raw_page(path="", &block)
|
2027
|
+
|
2028
|
+
# raw pages dont even have a title
|
2029
|
+
|
2030
|
+
p = RawPage.new("", @options)
|
2031
|
+
|
2032
|
+
elem = Elements.new(p, {})
|
2033
|
+
elem.instance_eval(&block) if block
|
2034
|
+
|
2035
|
+
p.element=elem
|
2036
|
+
|
2037
|
+
@pages[path] = p
|
2038
|
+
end
|
2039
|
+
|
1648
2040
|
def include(file)
|
1649
2041
|
dir = File.dirname(@file)
|
1650
2042
|
filename = File.join([dir, file])
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Siaw
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: trollop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
description: Site generator with a simple DSL
|
@@ -74,9 +74,9 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
77
|
+
- .gitignore
|
78
|
+
- .rspec
|
79
|
+
- .travis.yml
|
80
80
|
- CODE_OF_CONDUCT.md
|
81
81
|
- Gemfile
|
82
82
|
- LICENSE.txt
|
@@ -696,17 +696,17 @@ require_paths:
|
|
696
696
|
- lib
|
697
697
|
required_ruby_version: !ruby/object:Gem::Requirement
|
698
698
|
requirements:
|
699
|
-
- -
|
699
|
+
- - '>='
|
700
700
|
- !ruby/object:Gem::Version
|
701
701
|
version: '0'
|
702
702
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
703
703
|
requirements:
|
704
|
-
- -
|
704
|
+
- - '>='
|
705
705
|
- !ruby/object:Gem::Version
|
706
706
|
version: '0'
|
707
707
|
requirements: []
|
708
708
|
rubyforge_project:
|
709
|
-
rubygems_version: 2.4.
|
709
|
+
rubygems_version: 2.4.7
|
710
710
|
signing_key:
|
711
711
|
specification_version: 4
|
712
712
|
summary: Website generator
|