markus 4.0.4 → 4.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af5cabcc93edb55c26a0848ed5a9465e6c701810
4
- data.tar.gz: c02c1259cfb00570c3cf34235026cb46a7cf480a
3
+ metadata.gz: 5b9f7311225a8dfb0eef7755ecb5e2f85592320d
4
+ data.tar.gz: fd5a692cefe8acc1fa1ec8ba2e62241966d52d92
5
5
  SHA512:
6
- metadata.gz: d34189bcc84912024b27e28a8363499bd24ce6191b7155ab8488518be8b5f95953f0df36b4a22d580c552ba3271a65eece20ece5cd0ae2d569eb5fec62eb9219
7
- data.tar.gz: 8afdc81c62a3c8efe447bdaa25cf6b2b2a72a9a383552b39b25dab0390f24c8aacd32da764f2d0612dd6becb3a275d57e70eacfb4ef657804349e55ffa1959bb
6
+ metadata.gz: 64d0b9064af360ae718ac2dc237232735a46c237f153eb2fc9ee65e57a8f69228964833a843dd1ca76bdc56c3b6a11b659e612133e3aae0316c829a092cae256
7
+ data.tar.gz: 9b406d8de67b3533b0f25ee34255f64577b785fae3365aac179ae3c72d7af0254bbdbdb362382426bec196f3d98647c64217a7b0ae0aa44947ca61770145033b
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 4.0 "ufind"
2
+ Changed to class only and DSL
3
+
1
4
  3.0 "bank"
2
5
  * some changes since 1.0 but not important to list them here, cause
3
6
  nobody except pp. peedomator used it.
data/lib/markus.rb CHANGED
@@ -35,22 +35,26 @@ class MarkUS
35
35
  self.class.__markus_reload = value == true ? true : false
36
36
  end #}}}
37
37
 
38
- def json_!(name) #{{{
39
- markus_! name, :json
38
+ def json_!(name,params={}) #{{{
39
+ markus_! name, :json, params
40
40
  end #}}}
41
- def xml_!(name) #{{{
42
- markus_! name, :xml
41
+ def xml_!(name,params={}) #{{{
42
+ markus_! name, :xml, params
43
43
  end #}}}
44
- def html_!(name) #{{{
45
- markus_! name, :html
44
+ def html_!(name,params={}) #{{{
45
+ markus_! name, :html, params
46
46
  end #}}}
47
47
 
48
- def markus_!(name,type) #{{{
48
+ def markus_!(name,type,params={}) #{{{
49
49
  @__markus = []
50
50
  @__markus_buffer = []
51
51
  @__markus_level = -1
52
52
  @__markus_parent = nil
53
53
 
54
+ params.each do |k,v|
55
+ self.instance_variable_set(("@" + k.to_s).to_sym, v)
56
+ end if params.is_a? Hash
57
+
54
58
  self.class.__markus_do_reload
55
59
  self.class.__markus_includes.each do |some|
56
60
  if some.__markus_do_reload
data/markus.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "markus"
3
- s.version = "4.0.4"
3
+ s.version = "4.0.5"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "MarkUS - Markup UnderScore. Quick n' dirty templating in the spirit of markaby."
data/test/change.mt_ CHANGED
@@ -3,7 +3,7 @@ class TestJsonChange < MarkUS
3
3
 
4
4
  template :main do
5
5
  element_! do
6
- query_ 57
6
+ query_ 60
7
7
  end
8
8
  end
9
9
  end
@@ -2,6 +2,6 @@ class ChangeIncludeCommon < MarkUS
2
2
  reload
3
3
 
4
4
  template :test do
5
- query_ 64
5
+ query_ 101
6
6
  end
7
7
  end
data/test/html.mt_ CHANGED
@@ -8,6 +8,8 @@ class TestHTML < MarkUS
8
8
  span_ do
9
9
  'Some Text'
10
10
  end
11
+ span_ 'Some Text'
12
+ span_ @a
11
13
  input_ :type => 'text', :value => 'hello world'
12
14
  end
13
15
  end
@@ -6,19 +6,19 @@ class TestBasicHTML < Minitest::Test
6
6
  def test_xml
7
7
  s = TestHTML.new
8
8
  s.__markus_indent = true
9
- assert s.xml_!(:main) == "<html>\n <body class=\"test\">\n <a href=\"https://ruby-lang.org\">Ruby</a>\n <span>\nSome Text\n </span>\n <input type=\"text\" value=\"hello world\"/>\n </body>\n</html>"
9
+ assert s.xml_!(:main) == "<html>\n <body class=\"test\">\n <a href=\"https://ruby-lang.org\">Ruby</a>\n <span>\nSome Text\n </span>\n <span>Some Text</span>\n <span/>\n <input type=\"text\" value=\"hello world\"/>\n </body>\n</html>"
10
10
  end
11
11
 
12
12
  def test_html
13
13
  s = TestHTML.new
14
14
  s.__markus_indent = true
15
- assert s.html_!(:main) == "<html>\n <body class=\"test\">\n <a href=\"https://ruby-lang.org\">Ruby</a>\n <span>\nSome Text\n </span>\n <input type=\"text\" value=\"hello world\"></input>\n </body>\n</html>"
15
+ assert s.html_!(:main) == "<html>\n <body class=\"test\">\n <a href=\"https://ruby-lang.org\">Ruby</a>\n <span>\nSome Text\n </span>\n <span>Some Text</span>\n <span></span>\n <input type=\"text\" value=\"hello world\"></input>\n </body>\n</html>"
16
16
  end
17
17
 
18
18
  def test_xml_noindent
19
19
  s = TestHTML.new
20
20
  s.__markus_indent = false
21
- assert s.xml_!(:main) == "<html><body class=\"test\"><a href=\"https://ruby-lang.org\">Ruby</a><span>Some Text</span><input type=\"text\" value=\"hello world\"/></body></html>"
21
+ assert s.xml_!(:main, :a => 3) == "<html><body class=\"test\"><a href=\"https://ruby-lang.org\">Ruby</a><span>Some Text</span><span>Some Text</span><span>3</span><input type=\"text\" value=\"hello world\"/></body></html>"
22
22
  end
23
23
 
24
24
  end
data/test/tc_change.rb CHANGED
@@ -1,18 +1,18 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/smartrunner')
2
-
3
- $fname = File.expand_path(File.dirname(__FILE__) + '/change.mt_')
4
- load $fname
2
+ load File.expand_path(File.dirname(__FILE__) + '/change.mt_')
5
3
 
6
4
  class TestChange < Minitest::Test
7
5
 
8
6
  def test_json
7
+ fname = File.expand_path(File.dirname(__FILE__) + '/change.mt_')
8
+
9
9
  s = TestJsonChange.new
10
10
  newnum = nil
11
- newcontent = File.read($fname).gsub(/query_ (\d+)/) do
11
+ newcontent = File.read(fname).gsub(/query_ (\d+)/) do
12
12
  newnum = ($1.to_i + 1).to_s
13
13
  "query_ " + newnum
14
14
  end
15
- File.write($fname,newcontent)
15
+ File.write(fname,newcontent)
16
16
  assert s.json_!(:main) == %Q({"query": #{newnum}})
17
17
  end
18
18
 
@@ -1,18 +1,18 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/smartrunner')
2
2
  load File.expand_path(File.dirname(__FILE__) + '/change_include.mt_')
3
3
 
4
- $fname = File.expand_path(File.dirname(__FILE__) + '/change_include_common.mt_')
5
-
6
4
  class TestChangeInclude < Minitest::Test
7
5
 
8
6
  def test_json
7
+ fname = File.expand_path(File.dirname(__FILE__) + '/change_include_common.mt_')
8
+
9
9
  s = ChangeInclude.new
10
10
  newnum = nil
11
- newcontent = File.read($fname).gsub(/query_ (\d+)/) do
11
+ newcontent = File.read(fname).gsub(/query_ (\d+)/) do
12
12
  newnum = ($1.to_i + 1).to_s
13
13
  "query_ " + newnum
14
14
  end
15
- File.write($fname,newcontent)
15
+ File.write(fname,newcontent)
16
16
 
17
17
  assert s.json_!(:main) == %Q("query": #{newnum})
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markus
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler