caracal 0.1.8 → 0.2.0
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/.gitignore +1 -0
- data/CHANGELOG.md +17 -0
- data/README.md +27 -10
- data/lib/caracal.rb +1 -2
- data/lib/caracal/core/models/list_item_model.rb +2 -0
- data/lib/caracal/core/models/list_model.rb +1 -0
- data/lib/caracal/core/models/paragraph_model.rb +12 -5
- data/lib/caracal/core/text.rb +2 -1
- data/lib/caracal/document.rb +1 -3
- data/lib/caracal/renderers/document_renderer.rb +6 -12
- data/lib/caracal/renderers/styles_renderer.rb +7 -6
- data/lib/caracal/version.rb +1 -1
- data/spec/lib/caracal/core/models/paragraph_model_spec.rb +13 -3
- data/spec/lib/caracal/core/models/table_cell_model_spec.rb +5 -5
- metadata +3 -5
- data/lib/caracal/core/line_breaks.rb +0 -29
- data/spec/lib/caracal/core/line_breaks_spec.rb +0 -25
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bb4f8f78bfe33c9d9d5070949adf296c1d6921ed
         | 
| 4 | 
            +
              data.tar.gz: 2ee67fa3530320cbcd1b0cbff6067838241e7dd7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 35ae59436ca344e6deb31bd9db3086affcfe492929e0783ca828e2a3fd496f77168a2628bb493baca079591a060d292a87eaba07033c5077761bba3c608874a5
         | 
| 7 | 
            +
              data.tar.gz: 11214dec66d45079254a0a36476d6a2de9f27c7b2ae914069df5c82dbc420bee6e7162a890aab143f87853b5866e045f6a6f84c727d838240833670ad463f9cd
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            #### v0.2.0
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Enhancements
         | 
| 4 | 
            +
            	* Implemented true line breaks within paragraphs (@Linuus).
         | 
| 5 | 
            +
            	* Converted paragraph command to accept/allow blank content (@Linuus).
         | 
| 6 | 
            +
            	* Allowed :top and :bottom attributes to be set on default paragraph style (@jpdugan).
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            * Deprecations
         | 
| 10 | 
            +
            	* Line breaks are no longer allowed at the document level. Use blank paragraphs instead.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
             | 
| 13 | 
            +
             | 
| 14 | 
            +
            #### v0.1.x
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            * Enhancements
         | 
| 17 | 
            +
            	* Initial commits. (@jpdugan) 	 
         | 
    
        data/README.md
    CHANGED
    
    | @@ -22,10 +22,10 @@ Caracal::Document.save 'example.docx' do |docx| | |
| 22 22 | 
             
              # page 1
         | 
| 23 23 | 
             
              docx.h1 'Page 1 Header'
         | 
| 24 24 | 
             
              docx.hr
         | 
| 25 | 
            -
              docx. | 
| 25 | 
            +
              docx.p
         | 
| 26 26 | 
             
              docx.h2 'Section 1'
         | 
| 27 27 | 
             
              docx.p  'Lorem ipsum dolor....'
         | 
| 28 | 
            -
              docx. | 
| 28 | 
            +
              docx.p
         | 
| 29 29 | 
             
              docx.table @my_data, border_size: 4 do
         | 
| 30 30 | 
             
                cell_style rows[0], background: 'cccccc', bold: true
         | 
| 31 31 | 
             
              end
         | 
| @@ -34,19 +34,19 @@ Caracal::Document.save 'example.docx' do |docx| | |
| 34 34 | 
             
              docx.page
         | 
| 35 35 | 
             
              docx.h1 'Page 2 Header'
         | 
| 36 36 | 
             
              docx.hr
         | 
| 37 | 
            -
              docx. | 
| 37 | 
            +
              docx.p
         | 
| 38 38 | 
             
              docx.h2 'Section 2'
         | 
| 39 39 | 
             
              docx.p  'Lorem ipsum dolor....'
         | 
| 40 40 | 
             
              docx.ul do
         | 
| 41 41 | 
             
                li 'Item 1'
         | 
| 42 42 | 
             
                li 'Item 2'
         | 
| 43 43 | 
             
              end
         | 
| 44 | 
            -
              docx. | 
| 44 | 
            +
              docx.p
         | 
| 45 45 | 
             
              docx.img image_url('graph.png'), width: 500, height: 300
         | 
| 46 46 | 
             
            end
         | 
| 47 47 | 
             
            ```
         | 
| 48 48 |  | 
| 49 | 
            -
            **You can | 
| 49 | 
            +
            **You can!** Read on.
         | 
| 50 50 |  | 
| 51 51 |  | 
| 52 52 | 
             
            ## Why is Caracal Needed?
         | 
| @@ -330,7 +330,8 @@ docx.style do | |
| 330 330 | 
             
              align     :left           # sets the alignment. accepts :left, :center, :right, and :both.
         | 
| 331 331 | 
             
              line      360             # sets the line height. units in twips.
         | 
| 332 332 | 
             
              top       100             # sets the spacing above the paragraph. units in twips.
         | 
| 333 | 
            -
              bottom    0               # sets the spacing below the paragraph. units in twips. | 
| 333 | 
            +
              bottom    0               # sets the spacing below the paragraph. units in twips.
         | 
| 334 | 
            +
            end
         | 
| 334 335 | 
             
            ```
         | 
| 335 336 |  | 
| 336 337 | 
             
            Caracal establishes a standard set of default styles for every document. Default styles can be overridden by issuing a `style` command referencing an existing id. Default style ids are:
         | 
| @@ -348,7 +349,7 @@ Caracal establishes a standard set of default styles for every document. Default | |
| 348 349 |  | 
| 349 350 | 
             
            ### Paragraphs
         | 
| 350 351 |  | 
| 351 | 
            -
             | 
| 352 | 
            +
            Paragraph text can be added using the `p` method.  The method accepts several optional parameters for controlling the style and behavior of the paragrpah. 
         | 
| 352 353 |  | 
| 353 354 | 
             
            In its simple form, a paragraph accepts a text string and formatting options.
         | 
| 354 355 |  | 
| @@ -376,6 +377,8 @@ docx.p do | |
| 376 377 | 
             
              link 'link', 'https://www.example.com'
         | 
| 377 378 | 
             
              text ' to something awesome', color: '555555', size: 32, bold: true, italic: true, underline: true
         | 
| 378 379 | 
             
              text '.'
         | 
| 380 | 
            +
              br
         | 
| 381 | 
            +
              text 'This text follows a line break.'
         | 
| 379 382 | 
             
            end
         | 
| 380 383 | 
             
            ```
         | 
| 381 384 |  | 
| @@ -431,10 +434,20 @@ end | |
| 431 434 |  | 
| 432 435 | 
             
            ### Line Breaks
         | 
| 433 436 |  | 
| 434 | 
            -
            Line breaks can be added via the `br` method | 
| 437 | 
            +
            Line breaks can be added via the `br` method inside paragraphs.
         | 
| 438 | 
            +
             | 
| 439 | 
            +
            ```ruby
         | 
| 440 | 
            +
            docx.p do
         | 
| 441 | 
            +
              text 'This sentence precedes the line break.'
         | 
| 442 | 
            +
              br
         | 
| 443 | 
            +
              text 'This sentence follows the line break.'
         | 
| 444 | 
            +
            end
         | 
| 445 | 
            +
            ```
         | 
| 446 | 
            +
             | 
| 447 | 
            +
            Line breaks only work instead paragraph-like commands. If you want to create an empty line between two paragraphs, use an empty paragraph instead.
         | 
| 435 448 |  | 
| 436 449 | 
             
            ```ruby
         | 
| 437 | 
            -
            docx. | 
| 450 | 
            +
            docx.p
         | 
| 438 451 | 
             
            ```
         | 
| 439 452 |  | 
| 440 453 |  | 
| @@ -449,6 +462,8 @@ docx.ol do | |
| 449 462 | 
             
                text 'Second item with a '
         | 
| 450 463 | 
             
                link 'link', 'http://www.google.com'
         | 
| 451 464 | 
             
                text '.'
         | 
| 465 | 
            +
                br
         | 
| 466 | 
            +
                text 'This sentence follows a line break.'
         | 
| 452 467 | 
             
              end
         | 
| 453 468 | 
             
            end
         | 
| 454 469 | 
             
            ```
         | 
| @@ -462,6 +477,8 @@ docx.ul do | |
| 462 477 | 
             
                text 'Second item with a '
         | 
| 463 478 | 
             
                link 'link', 'http://www.google.com'
         | 
| 464 479 | 
             
                text '.'
         | 
| 480 | 
            +
                br
         | 
| 481 | 
            +
                text 'This sentence follows a line break.'
         | 
| 465 482 | 
             
              end
         | 
| 466 483 | 
             
            end
         | 
| 467 484 | 
             
            ```
         | 
| @@ -588,7 +605,7 @@ c1 = Caracal::Core::Models:TableCellModel.new do | |
| 588 605 | 
             
              end
         | 
| 589 606 |  | 
| 590 607 | 
             
              p 'This is a sentence above an image.'
         | 
| 591 | 
            -
               | 
| 608 | 
            +
              p
         | 
| 592 609 | 
             
              img image_url('example.png'), width: 200, height: 100
         | 
| 593 610 | 
             
            end  
         | 
| 594 611 | 
             
            ```
         | 
    
        data/lib/caracal.rb
    CHANGED
    
    | @@ -24,9 +24,8 @@ require 'caracal/document' | |
| 24 24 | 
             
            #
         | 
| 25 25 | 
             
            Caracal::Core::Models::TableCellModel.class_eval do
         | 
| 26 26 | 
             
              include Caracal::Core::Images
         | 
| 27 | 
            -
              include Caracal::Core::LineBreaks
         | 
| 28 27 | 
             
              include Caracal::Core::Lists
         | 
| 29 28 | 
             
              include Caracal::Core::Rules
         | 
| 30 29 | 
             
              include Caracal::Core::Tables
         | 
| 31 30 | 
             
              include Caracal::Core::Text
         | 
| 32 | 
            -
            end
         | 
| 31 | 
            +
            end
         | 
| @@ -65,6 +65,7 @@ module Caracal | |
| 65 65 | 
             
                      else
         | 
| 66 66 | 
             
                        raise Caracal::Errors::InvalidModelError, 'Ordered lists require at least one list item.'
         | 
| 67 67 | 
             
                      end
         | 
| 68 | 
            +
                      model
         | 
| 68 69 | 
             
                    end
         | 
| 69 70 |  | 
| 70 71 | 
             
                    # .ul
         | 
| @@ -77,6 +78,7 @@ module Caracal | |
| 77 78 | 
             
                      else
         | 
| 78 79 | 
             
                        raise Caracal::Errors::InvalidModelError, 'Unordered lists require at least one list item.'
         | 
| 79 80 | 
             
                      end
         | 
| 81 | 
            +
                      model
         | 
| 80 82 | 
             
                    end
         | 
| 81 83 |  | 
| 82 84 |  | 
| @@ -28,10 +28,8 @@ module Caracal | |
| 28 28 |  | 
| 29 29 | 
             
                    # initialization
         | 
| 30 30 | 
             
                    def initialize(options={}, &block)
         | 
| 31 | 
            -
                       | 
| 32 | 
            -
             | 
| 33 | 
            -
                      end
         | 
| 34 | 
            -
                      
         | 
| 31 | 
            +
                      content = options.delete(:content) { "" }
         | 
| 32 | 
            +
                      text content, options.dup
         | 
| 35 33 | 
             
                      super options, &block
         | 
| 36 34 | 
             
                    end
         | 
| 37 35 |  | 
| @@ -104,6 +102,14 @@ module Caracal | |
| 104 102 | 
             
                      else
         | 
| 105 103 | 
             
                        raise Caracal::Errors::InvalidModelError, ':link method must receive strings for the display text and the external href.'
         | 
| 106 104 | 
             
                      end
         | 
| 105 | 
            +
                      model
         | 
| 106 | 
            +
                    end
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                    # .br
         | 
| 109 | 
            +
                    def br
         | 
| 110 | 
            +
                      model = Caracal::Core::Models::LineBreakModel.new()
         | 
| 111 | 
            +
                      runs << model
         | 
| 112 | 
            +
                      model
         | 
| 107 113 | 
             
                    end
         | 
| 108 114 |  | 
| 109 115 | 
             
                    # .text
         | 
| @@ -117,6 +123,7 @@ module Caracal | |
| 117 123 | 
             
                      else
         | 
| 118 124 | 
             
                        raise Caracal::Errors::InvalidModelError, ':text method must receive a string for the display text.'
         | 
| 119 125 | 
             
                      end
         | 
| 126 | 
            +
                      model
         | 
| 120 127 | 
             
                    end
         | 
| 121 128 |  | 
| 122 129 |  | 
| @@ -140,4 +147,4 @@ module Caracal | |
| 140 147 |  | 
| 141 148 | 
             
                end
         | 
| 142 149 | 
             
              end
         | 
| 143 | 
            -
            end
         | 
| 150 | 
            +
            end
         | 
    
        data/lib/caracal/core/text.rb
    CHANGED
    
    
    
        data/lib/caracal/document.rb
    CHANGED
    
    | @@ -4,7 +4,6 @@ require 'zip' | |
| 4 4 | 
             
            require 'caracal/core/file_name'
         | 
| 5 5 | 
             
            require 'caracal/core/fonts'
         | 
| 6 6 | 
             
            require 'caracal/core/images'
         | 
| 7 | 
            -
            require 'caracal/core/line_breaks'
         | 
| 8 7 | 
             
            require 'caracal/core/list_styles'
         | 
| 9 8 | 
             
            require 'caracal/core/lists'
         | 
| 10 9 | 
             
            require 'caracal/core/page_breaks'
         | 
| @@ -47,7 +46,6 @@ module Caracal | |
| 47 46 | 
             
                include Caracal::Core::ListStyles
         | 
| 48 47 |  | 
| 49 48 | 
             
                include Caracal::Core::Images
         | 
| 50 | 
            -
                include Caracal::Core::LineBreaks
         | 
| 51 49 | 
             
                include Caracal::Core::Lists
         | 
| 52 50 | 
             
                include Caracal::Core::PageBreaks
         | 
| 53 51 | 
             
                include Caracal::Core::Rules
         | 
| @@ -243,4 +241,4 @@ module Caracal | |
| 243 241 | 
             
                end
         | 
| 244 242 |  | 
| 245 243 | 
             
              end
         | 
| 246 | 
            -
            end
         | 
| 244 | 
            +
            end
         | 
| @@ -149,13 +149,8 @@ module Caracal | |
| 149 149 | 
             
                  end
         | 
| 150 150 |  | 
| 151 151 | 
             
                  def render_linebreak(xml, model)
         | 
| 152 | 
            -
                    xml.send 'w: | 
| 153 | 
            -
                      xml.send 'w: | 
| 154 | 
            -
                        xml.send 'w:contextualSpacing', { 'w:val' => '0' }
         | 
| 155 | 
            -
                      end
         | 
| 156 | 
            -
                      xml.send 'w:r', run_options do
         | 
| 157 | 
            -
                        xml.send 'w:rtl', { 'w:val' => '0' }
         | 
| 158 | 
            -
                      end
         | 
| 152 | 
            +
                    xml.send 'w:r' do
         | 
| 153 | 
            +
                      xml.send 'w:br'
         | 
| 159 154 | 
             
                    end
         | 
| 160 155 | 
             
                  end
         | 
| 161 156 |  | 
| @@ -312,10 +307,9 @@ module Caracal | |
| 312 307 |  | 
| 313 308 | 
             
                    # don't know why this is needed, but it prevents a 
         | 
| 314 309 | 
             
                    # rendering error.
         | 
| 315 | 
            -
                     | 
| 316 | 
            -
                  end | 
| 317 | 
            -
             | 
| 318 | 
            -
                  
         | 
| 310 | 
            +
                    render_paragraph(xml, Caracal::Core::Models::ParagraphModel.new)
         | 
| 311 | 
            +
                  end
         | 
| 312 | 
            +
             | 
| 319 313 |  | 
| 320 314 | 
             
                  #============= OPTIONS ===================================
         | 
| 321 315 |  | 
| @@ -357,4 +351,4 @@ module Caracal | |
| 357 351 |  | 
| 358 352 | 
             
                end
         | 
| 359 353 | 
             
              end
         | 
| 360 | 
            -
            end
         | 
| 354 | 
            +
            end
         | 
| @@ -43,7 +43,7 @@ module Caracal | |
| 43 43 | 
             
                              xml.send 'w:keepNext',     { 'w:val' => '0' }
         | 
| 44 44 | 
             
                              xml.send 'w:keepLines',    { 'w:val' => '0' }
         | 
| 45 45 | 
             
                              xml.send 'w:widowControl', { 'w:val' => '1' }
         | 
| 46 | 
            -
                              xml.send 'w:spacing',       | 
| 46 | 
            +
                              xml.send 'w:spacing',      spacing_options(s, true)
         | 
| 47 47 | 
             
                              xml.send 'w:ind',          { 'w:left' => '0', 'w:firstLine' => '0', 'w:right' => '0' }
         | 
| 48 48 | 
             
                              xml.send 'w:jc',           { 'w:val' => s.style_align.to_s }
         | 
| 49 49 | 
             
                            end
         | 
| @@ -69,8 +69,9 @@ module Caracal | |
| 69 69 | 
             
                            xml.send 'w:basedOn', { 'w:val' => s.style_base }
         | 
| 70 70 | 
             
                            xml.send 'w:next',    { 'w:val' => s.style_next }
         | 
| 71 71 | 
             
                            xml.send 'w:pPr' do
         | 
| 72 | 
            -
                              xml.send 'w:keepNext',          { 'w:val' => ' | 
| 73 | 
            -
                              xml.send 'w:keepLines',         { 'w:val' => ' | 
| 72 | 
            +
                              xml.send 'w:keepNext',          { 'w:val' => '0' }
         | 
| 73 | 
            +
                              xml.send 'w:keepLines',         { 'w:val' => '0' }
         | 
| 74 | 
            +
                              xml.send 'w:widowControl',      { 'w:val' => '1' }
         | 
| 74 75 | 
             
                              xml.send 'w:spacing',           spacing_options(s)                              unless spacing_options(s).nil?
         | 
| 75 76 | 
             
                              xml.send 'w:contextualSpacing', { 'w:val' => '1' }
         | 
| 76 77 | 
             
                              xml.send 'w:jc',                { 'w:val' => s.style_align.to_s }               unless s.style_align.nil?
         | 
| @@ -122,9 +123,9 @@ module Caracal | |
| 122 123 | 
             
                    { 'w:cs' => name, 'w:hAnsi' => name, 'w:eastAsia' => name, 'w:ascii' => name }
         | 
| 123 124 | 
             
                  end
         | 
| 124 125 |  | 
| 125 | 
            -
                  def spacing_options(style)
         | 
| 126 | 
            -
                    top     = style.style_top
         | 
| 127 | 
            -
                    bottom  = style.style_bottom
         | 
| 126 | 
            +
                  def spacing_options(style, default=false)
         | 
| 127 | 
            +
                    top     = (default) ? style.style_top.to_i    : style.style_top
         | 
| 128 | 
            +
                    bottom  = (default) ? style.style_bottom.to_i : style.style_bottom
         | 
| 128 129 | 
             
                    line    = style.style_line
         | 
| 129 130 |  | 
| 130 131 | 
             
                    options = nil
         | 
    
        data/lib/caracal/version.rb
    CHANGED
    
    
| @@ -13,6 +13,7 @@ describe Caracal::Core::Models::ParagraphModel do | |
| 13 13 | 
             
                end
         | 
| 14 14 | 
             
              end
         | 
| 15 15 |  | 
| 16 | 
            +
             | 
| 16 17 | 
             
              #-------------------------------------------------------------
         | 
| 17 18 | 
             
              # Configuration
         | 
| 18 19 | 
             
              #-------------------------------------------------------------
         | 
| @@ -29,9 +30,9 @@ describe Caracal::Core::Models::ParagraphModel do | |
| 29 30 | 
             
                  it { expect(subject.paragraph_italic).to eq false }
         | 
| 30 31 | 
             
                  it { expect(subject.paragraph_underline).to eq true }
         | 
| 31 32 | 
             
                end
         | 
| 32 | 
            -
             | 
| 33 | 
            +
             | 
| 33 34 | 
             
              end
         | 
| 34 | 
            -
             | 
| 35 | 
            +
             | 
| 35 36 |  | 
| 36 37 | 
             
              #-------------------------------------------------------------
         | 
| 37 38 | 
             
              # Public Methods
         | 
| @@ -110,6 +111,15 @@ describe Caracal::Core::Models::ParagraphModel do | |
| 110 111 |  | 
| 111 112 | 
             
                  it { expect(subject.runs.size).to eq length + 1 }
         | 
| 112 113 | 
             
                end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                # .br
         | 
| 116 | 
            +
                describe '.br' do
         | 
| 117 | 
            +
                  let!(:length) { subject.runs.length }
         | 
| 118 | 
            +
                  
         | 
| 119 | 
            +
                  before { subject.br }
         | 
| 120 | 
            +
                  
         | 
| 121 | 
            +
                  it { expect(subject.runs.size).to eq length + 1 }
         | 
| 122 | 
            +
                end
         | 
| 113 123 |  | 
| 114 124 | 
             
                # .text
         | 
| 115 125 | 
             
                describe '.text' do
         | 
| @@ -159,4 +169,4 @@ describe Caracal::Core::Models::ParagraphModel do | |
| 159 169 |  | 
| 160 170 | 
             
              end
         | 
| 161 171 |  | 
| 162 | 
            -
            end
         | 
| 172 | 
            +
            end
         | 
| @@ -101,14 +101,14 @@ describe Caracal::Core::Models::TableCellModel do | |
| 101 101 |  | 
| 102 102 | 
             
                describe 'content functions' do
         | 
| 103 103 |  | 
| 104 | 
            -
                  # . | 
| 105 | 
            -
                  describe '. | 
| 104 | 
            +
                  # .p
         | 
| 105 | 
            +
                  describe '.p' do
         | 
| 106 106 | 
             
                    let!(:size) { subject.contents.size }
         | 
| 107 107 |  | 
| 108 | 
            -
                    before { subject. | 
| 108 | 
            +
                    before { subject.p }
         | 
| 109 109 |  | 
| 110 110 | 
             
                    it { expect(subject.contents.size).to eq size + 1 }
         | 
| 111 | 
            -
                    it { expect(subject.contents.last).to be_a(Caracal::Core::Models:: | 
| 111 | 
            +
                    it { expect(subject.contents.last).to be_a(Caracal::Core::Models::ParagraphModel) }
         | 
| 112 112 | 
             
                  end
         | 
| 113 113 |  | 
| 114 114 | 
             
                  # .img
         | 
| @@ -218,4 +218,4 @@ describe Caracal::Core::Models::TableCellModel do | |
| 218 218 |  | 
| 219 219 | 
             
              end
         | 
| 220 220 |  | 
| 221 | 
            -
            end
         | 
| 221 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: caracal
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Trade Infomatics
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014- | 
| 12 | 
            +
            date: 2014-10-10 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: nokogiri
         | 
| @@ -105,6 +105,7 @@ extra_rdoc_files: [] | |
| 105 105 | 
             
            files:
         | 
| 106 106 | 
             
            - ".gitignore"
         | 
| 107 107 | 
             
            - ".travis.yml"
         | 
| 108 | 
            +
            - CHANGELOG.md
         | 
| 108 109 | 
             
            - Gemfile
         | 
| 109 110 | 
             
            - LICENSE.txt
         | 
| 110 111 | 
             
            - README.md
         | 
| @@ -114,7 +115,6 @@ files: | |
| 114 115 | 
             
            - lib/caracal/core/file_name.rb
         | 
| 115 116 | 
             
            - lib/caracal/core/fonts.rb
         | 
| 116 117 | 
             
            - lib/caracal/core/images.rb
         | 
| 117 | 
            -
            - lib/caracal/core/line_breaks.rb
         | 
| 118 118 | 
             
            - lib/caracal/core/list_styles.rb
         | 
| 119 119 | 
             
            - lib/caracal/core/lists.rb
         | 
| 120 120 | 
             
            - lib/caracal/core/models/base_model.rb
         | 
| @@ -165,7 +165,6 @@ files: | |
| 165 165 | 
             
            - spec/lib/caracal/core/file_name_spec.rb
         | 
| 166 166 | 
             
            - spec/lib/caracal/core/fonts_spec.rb
         | 
| 167 167 | 
             
            - spec/lib/caracal/core/images_spec.rb
         | 
| 168 | 
            -
            - spec/lib/caracal/core/line_breaks_spec.rb
         | 
| 169 168 | 
             
            - spec/lib/caracal/core/list_styles_spec.rb
         | 
| 170 169 | 
             
            - spec/lib/caracal/core/lists_spec.rb
         | 
| 171 170 | 
             
            - spec/lib/caracal/core/models/base_model_spec.rb
         | 
| @@ -226,7 +225,6 @@ test_files: | |
| 226 225 | 
             
            - spec/lib/caracal/core/file_name_spec.rb
         | 
| 227 226 | 
             
            - spec/lib/caracal/core/fonts_spec.rb
         | 
| 228 227 | 
             
            - spec/lib/caracal/core/images_spec.rb
         | 
| 229 | 
            -
            - spec/lib/caracal/core/line_breaks_spec.rb
         | 
| 230 228 | 
             
            - spec/lib/caracal/core/list_styles_spec.rb
         | 
| 231 229 | 
             
            - spec/lib/caracal/core/lists_spec.rb
         | 
| 232 230 | 
             
            - spec/lib/caracal/core/models/base_model_spec.rb
         | 
| @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            require 'caracal/core/models/line_break_model'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            module Caracal
         | 
| 5 | 
            -
              module Core
         | 
| 6 | 
            -
                
         | 
| 7 | 
            -
                # This module encapsulates all the functionality related to adding line
         | 
| 8 | 
            -
                # breaks to the document.
         | 
| 9 | 
            -
                #
         | 
| 10 | 
            -
                module LineBreaks
         | 
| 11 | 
            -
                  def self.included(base)
         | 
| 12 | 
            -
                    base.class_eval do
         | 
| 13 | 
            -
                      
         | 
| 14 | 
            -
                      #-------------------------------------------------------------
         | 
| 15 | 
            -
                      # Public Methods
         | 
| 16 | 
            -
                      #-------------------------------------------------------------
         | 
| 17 | 
            -
                      
         | 
| 18 | 
            -
                      def br
         | 
| 19 | 
            -
                        model     = Caracal::Core::Models::LineBreakModel.new()
         | 
| 20 | 
            -
                        contents << model
         | 
| 21 | 
            -
                        model
         | 
| 22 | 
            -
                      end
         | 
| 23 | 
            -
                      
         | 
| 24 | 
            -
                    end
         | 
| 25 | 
            -
                  end
         | 
| 26 | 
            -
                end
         | 
| 27 | 
            -
                
         | 
| 28 | 
            -
              end
         | 
| 29 | 
            -
            end
         | 
| @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            require 'spec_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe Caracal::Core::LineBreaks do
         | 
| 4 | 
            -
              subject { Caracal::Document.new }
         | 
| 5 | 
            -
              
         | 
| 6 | 
            -
              
         | 
| 7 | 
            -
              #-------------------------------------------------------------
         | 
| 8 | 
            -
              # Public Methods
         | 
| 9 | 
            -
              #-------------------------------------------------------------
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              describe 'public method tests' do
         | 
| 12 | 
            -
                
         | 
| 13 | 
            -
                # .br
         | 
| 14 | 
            -
                describe '.br' do
         | 
| 15 | 
            -
                  let!(:size) { subject.contents.size }
         | 
| 16 | 
            -
                  
         | 
| 17 | 
            -
                  before { subject.br }
         | 
| 18 | 
            -
                  
         | 
| 19 | 
            -
                  it { expect(subject.contents.size).to eq size + 1 }
         | 
| 20 | 
            -
                  it { expect(subject.contents.last).to be_a(Caracal::Core::Models::LineBreakModel) }
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
                
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
              
         | 
| 25 | 
            -
            end
         |