weblet 0.2.3 → 0.2.4
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/weblet.rb +19 -14
- metadata +3 -3
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a20edd9605c808815e0aa3cfc7e9779406760cca57fd34db6011c81f2abaa3f2
         | 
| 4 | 
            +
              data.tar.gz: 1b99f0adc8fde98fe110fb06783644c3245ced80a4c5b03a4aa6f8bb20410e1e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3e7690b5ee283aee9c596e4496c738b756579801c54994bf0761e78a3a0825f9968eb84c5998675d3b6c8daf6a958a682872712f34a94631c60c74748cc3a156
         | 
| 7 | 
            +
              data.tar.gz: 1aef800f17899e8b11e48bac43fdbfa254e848ff3db59ea840da8b2ecbfd7808cef3a4ff6257adda2b3a351f7bfedc8c36806769f5e91f07b897084a97c7f768
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/lib/weblet.rb
    CHANGED
    
    | @@ -12,11 +12,16 @@ class WebletBuilder | |
| 12 12 |  | 
| 13 13 | 
             
                @marker, @debug = marker, debug
         | 
| 14 14 |  | 
| 15 | 
            +
                s.strip!
         | 
| 16 | 
            +
                
         | 
| 15 17 | 
             
                # the default marker is the hash symbol (#) but the client can set their 
         | 
| 16 18 | 
             
                # own marker by simply using their custom symbol in the 1st line of input
         | 
| 17 19 | 
             
                @marker ||= s[0]
         | 
| 18 20 |  | 
| 19 | 
            -
                 | 
| 21 | 
            +
                a = scan(s.strip)
         | 
| 22 | 
            +
                puts 'a: ' + a.inspect if @debug
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                @a = build(a)
         | 
| 20 25 | 
             
                @a.unshift *['weblet', {}, '']
         | 
| 21 26 |  | 
| 22 27 | 
             
              end
         | 
| @@ -38,21 +43,21 @@ class WebletBuilder | |
| 38 43 |  | 
| 39 44 | 
             
              def build(a)
         | 
| 40 45 |  | 
| 46 | 
            +
                puts 'a: ' + a.inspect if @debug
         | 
| 47 | 
            +
                
         | 
| 41 48 | 
             
                a.map do |x|
         | 
| 42 49 |  | 
| 43 50 | 
             
                  puts 'x: ' + x.inspect if @debug
         | 
| 44 51 |  | 
| 45 | 
            -
                  if x.is_a? String then
         | 
| 46 | 
            -
                     | 
| 52 | 
            +
                  if x[0].is_a? String then
         | 
| 53 | 
            +
                    
         | 
| 54 | 
            +
                    head, body = x[0].split("\n", 2)
         | 
| 47 55 | 
             
                    [:node, {id: head[/#{@marker}(\w+)/,1]}, '',['![', {}, body.strip]]
         | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
                    [:node, {id:  | 
| 52 | 
            -
             | 
| 53 | 
            -
                    x.flatten!(1)
         | 
| 54 | 
            -
                    head, body = x.shift.split("\n", 2)
         | 
| 55 | 
            -
                    [:node, {id: head[/#{@marker}(\w+)/,1].rstrip}, body.rstrip, *build(x)]
         | 
| 56 | 
            +
                    
         | 
| 57 | 
            +
                  elsif x[0] and x[0].is_a? Array
         | 
| 58 | 
            +
                            
         | 
| 59 | 
            +
                    [:node, {id: x[0][0][/#{@marker}(\w+)/,1]}, '', *build(x[1..-1])]
         | 
| 60 | 
            +
                    
         | 
| 56 61 | 
             
                  end
         | 
| 57 62 |  | 
| 58 63 | 
             
                end
         | 
| @@ -85,10 +90,10 @@ class Weblet | |
| 85 90 | 
             
                @doc.root.xml pretty: true
         | 
| 86 91 | 
             
              end
         | 
| 87 92 |  | 
| 88 | 
            -
              def render(*args)
         | 
| 93 | 
            +
              def render(*args, b=@b)
         | 
| 89 94 |  | 
| 90 95 | 
             
                if args.first.is_a? String then
         | 
| 91 | 
            -
                  path = args.first.split('/' | 
| 96 | 
            +
                  path = args.first.split('/').map(&:to_sym)
         | 
| 92 97 | 
             
                else
         | 
| 93 98 | 
             
                  path = *args.flatten(1)
         | 
| 94 99 | 
             
                end
         | 
| @@ -100,7 +105,7 @@ class Weblet | |
| 100 105 | 
             
                  r = found.cdatas.join if found
         | 
| 101 106 | 
             
                end
         | 
| 102 107 |  | 
| 103 | 
            -
                eval('%Q(' + r + ')',  | 
| 108 | 
            +
                eval('%Q(' + r + ')', b) if r
         | 
| 104 109 |  | 
| 105 110 | 
             
              end
         | 
| 106 111 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: weblet
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -46,7 +46,7 @@ dependencies: | |
| 46 46 | 
             
                    version: '1.5'
         | 
| 47 47 | 
             
                - - ">="
         | 
| 48 48 | 
             
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            -
                    version: 1.5. | 
| 49 | 
            +
                    version: 1.5.11
         | 
| 50 50 | 
             
              type: :runtime
         | 
| 51 51 | 
             
              prerelease: false
         | 
| 52 52 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -56,7 +56,7 @@ dependencies: | |
| 56 56 | 
             
                    version: '1.5'
         | 
| 57 57 | 
             
                - - ">="
         | 
| 58 58 | 
             
                  - !ruby/object:Gem::Version
         | 
| 59 | 
            -
                    version: 1.5. | 
| 59 | 
            +
                    version: 1.5.11
         | 
| 60 60 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 61 61 | 
             
              name: rxfhelper
         | 
| 62 62 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |