brief 1.9.12 → 1.9.13
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/Gemfile.lock +1 -1
- data/lib/brief/document/transformer.rb +23 -6
- data/lib/brief/document.rb +4 -0
- data/lib/brief/model/serializers.rb +0 -4
- data/lib/brief/model.rb +5 -1
- data/lib/brief/repository.rb +3 -0
- data/lib/brief/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ffd7a1f8f048a0d051ae83e1365775048bc7961e
         | 
| 4 | 
            +
              data.tar.gz: 7c3a9ea58040102998143f4e20ef5a289c92bdf1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ee496381895b9ee3243f8d1e719b02aaef678670609672f52e3c542ada03005e7c4f10985b00f5b642d74bae3493707e3ade50bc48ab22115f0993ac9d8b7c59
         | 
| 7 | 
            +
              data.tar.gz: 9e93004ee76ba3fc42b3cf99bcc9c09a4a3ae1e0312895283588cc8f55556a2b73d629faecddc314bf9ef89ae9e24e40dc53ab5ceada036e45b23f7f8df56583
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -14,10 +14,20 @@ module Brief | |
| 14 14 |  | 
| 15 15 | 
             
                def inline_svg_content
         | 
| 16 16 | 
             
                  inline_svg_images.each do |img|
         | 
| 17 | 
            -
                     | 
| 17 | 
            +
                    src = img['src'].to_s
         | 
| 18 18 |  | 
| 19 | 
            -
                    if  | 
| 20 | 
            -
                       | 
| 19 | 
            +
                    if src.match(/=/)
         | 
| 20 | 
            +
                      _, value = img['src'].to_s.split("=")
         | 
| 21 | 
            +
                    else
         | 
| 22 | 
            +
                      value = src
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    begin
         | 
| 26 | 
            +
                      if asset = document.briefcase.find_asset(value)
         | 
| 27 | 
            +
                        img.replace("<div class='svg-wrapper'>#{ asset.read }</div>")
         | 
| 28 | 
            +
                      end
         | 
| 29 | 
            +
                    rescue
         | 
| 30 | 
            +
                      nil
         | 
| 21 31 | 
             
                    end
         | 
| 22 32 | 
             
                  end
         | 
| 23 33 | 
             
                end
         | 
| @@ -30,9 +40,14 @@ module Brief | |
| 30 40 | 
             
                    if instruction == "link" && attribute == "path"
         | 
| 31 41 | 
             
                      begin
         | 
| 32 42 | 
             
                        link_to_doc = document.briefcase.document_at(value)
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                         | 
| 35 | 
            -
             | 
| 43 | 
            +
             | 
| 44 | 
            +
                        if link_to_doc.exist?
         | 
| 45 | 
            +
                          text = link_to_doc.send(strategy)
         | 
| 46 | 
            +
                          node.inner_html = text
         | 
| 47 | 
            +
                          node['href'] = "brief://#{ link_to_doc.path }"
         | 
| 48 | 
            +
                        else
         | 
| 49 | 
            +
                          node['href'] = "brief://document-not-found"
         | 
| 50 | 
            +
                        end
         | 
| 36 51 | 
             
                      rescue
         | 
| 37 52 | 
             
                        nil
         | 
| 38 53 | 
             
                      end
         | 
| @@ -57,6 +72,8 @@ module Brief | |
| 57 72 | 
             
                      node.replace(replacement) if replacement
         | 
| 58 73 | 
             
                    end
         | 
| 59 74 | 
             
                  end
         | 
| 75 | 
            +
                rescue
         | 
| 76 | 
            +
                  nil
         | 
| 60 77 | 
             
                end
         | 
| 61 78 |  | 
| 62 79 | 
             
                private
         | 
    
        data/lib/brief/document.rb
    CHANGED
    
    
| @@ -10,10 +10,6 @@ module Brief::Model::Serializers | |
| 10 10 | 
             
                  doc_path = path.realpath.relative_path_from(briefcase_docs_path).to_s
         | 
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 | 
            -
                # TEMP
         | 
| 14 | 
            -
                title = data.try(:[], :title) || extracted_content_data.try(:title) || (send(:title) rescue nil) || path.basename.to_s.gsub(/\.html.md/,'')
         | 
| 15 | 
            -
                title = title.to_s.gsub(/\.md/,'')
         | 
| 16 | 
            -
             | 
| 17 13 | 
             
                {
         | 
| 18 14 | 
             
                  data: data,
         | 
| 19 15 | 
             
                  extracted: extracted_content_data,
         | 
    
        data/lib/brief/model.rb
    CHANGED
    
    | @@ -29,6 +29,10 @@ module Brief | |
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| 31 31 | 
             
                module AccessorMethods
         | 
| 32 | 
            +
                  def title
         | 
| 33 | 
            +
                    document_title
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 32 36 | 
             
                  def document_title
         | 
| 33 37 | 
             
                    data.try(:[], :title) ||
         | 
| 34 38 | 
             
                    extracted_content_data.try(:title) ||
         | 
| @@ -265,7 +269,7 @@ module Brief | |
| 265 269 | 
             
                    definition.send(:section_mappings, *args)
         | 
| 266 270 | 
             
                  end
         | 
| 267 271 |  | 
| 268 | 
            -
                  def generate_template_content_from(object, include_frontmatter = true)
         | 
| 272 | 
            +
                  def generate_template_content_from(object={}, include_frontmatter = true)
         | 
| 269 273 | 
             
                    @erb ||= ERB.new(template_body)
         | 
| 270 274 | 
             
                    content = @erb.result(binding)
         | 
| 271 275 | 
             
                    frontmatter = object.slice(*attribute_names)
         | 
    
        data/lib/brief/repository.rb
    CHANGED
    
    | @@ -65,6 +65,9 @@ module Brief | |
| 65 65 | 
             
                InvalidPath = Class.new(Exception)
         | 
| 66 66 |  | 
| 67 67 | 
             
                def normalize_path(p)
         | 
| 68 | 
            +
                  p = p.to_s
         | 
| 69 | 
            +
                  p = p + '.md' unless p.match(/\.\w+$/)
         | 
| 70 | 
            +
             | 
| 68 71 | 
             
                  docs_path.join(p).tap do |normalized|
         | 
| 69 72 | 
             
                    if normalized.to_s.split("/").length < docs_path.realpath.to_s.split("/").length
         | 
| 70 73 | 
             
                      raise InvalidPath
         | 
    
        data/lib/brief/version.rb
    CHANGED