asciidoctor 0.1.4 → 1.5.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.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +209 -25
- data/{LICENSE → LICENSE.adoc} +4 -3
- data/README.adoc +392 -395
- data/Rakefile +94 -137
- data/benchmark/benchmark.rb +127 -0
- data/benchmark/sample-data/mdbasics.adoc +334 -0
- data/bin/asciidoctor +5 -8
- data/bin/asciidoctor-safe +4 -8
- data/compat/asciidoc.conf +78 -11
- data/compat/font-awesome-3-compat.css +397 -0
- data/data/stylesheets/asciidoctor-default.css +399 -0
- data/data/stylesheets/coderay-asciidoctor.css +89 -0
- data/features/open_block.feature +92 -0
- data/features/pass_block.feature +66 -0
- data/features/step_definitions.rb +42 -0
- data/features/text_formatting.feature +55 -0
- data/features/xref.feature +116 -0
- data/lib/asciidoctor.rb +1155 -605
- data/lib/asciidoctor/abstract_block.rb +157 -71
- data/lib/asciidoctor/abstract_node.rb +150 -93
- data/lib/asciidoctor/attribute_list.rb +85 -90
- data/lib/asciidoctor/block.rb +51 -24
- data/lib/asciidoctor/callouts.rb +4 -7
- data/lib/asciidoctor/cli.rb +3 -0
- data/lib/asciidoctor/cli/invoker.rb +86 -76
- data/lib/asciidoctor/cli/options.rb +111 -61
- data/lib/asciidoctor/converter.rb +232 -0
- data/lib/asciidoctor/converter/base.rb +58 -0
- data/lib/asciidoctor/converter/composite.rb +66 -0
- data/lib/asciidoctor/converter/docbook45.rb +94 -0
- data/lib/asciidoctor/converter/docbook5.rb +684 -0
- data/lib/asciidoctor/converter/factory.rb +225 -0
- data/lib/asciidoctor/converter/html5.rb +1081 -0
- data/lib/asciidoctor/converter/template.rb +296 -0
- data/lib/asciidoctor/core_ext.rb +7 -0
- data/lib/asciidoctor/core_ext/object/nil_or_empty.rb +23 -0
- data/lib/asciidoctor/core_ext/string/chr.rb +6 -0
- data/lib/asciidoctor/core_ext/symbol/length.rb +6 -0
- data/lib/asciidoctor/document.rb +590 -304
- data/lib/asciidoctor/extensions.rb +1100 -308
- data/lib/asciidoctor/helpers.rb +109 -46
- data/lib/asciidoctor/inline.rb +16 -9
- data/lib/asciidoctor/list.rb +23 -15
- data/lib/asciidoctor/opal_ext.rb +4 -0
- data/lib/asciidoctor/opal_ext/comparable.rb +38 -0
- data/lib/asciidoctor/opal_ext/dir.rb +13 -0
- data/lib/asciidoctor/opal_ext/error.rb +2 -0
- data/lib/asciidoctor/opal_ext/file.rb +125 -0
- data/lib/asciidoctor/{lexer.rb → parser.rb} +646 -455
- data/lib/asciidoctor/path_resolver.rb +141 -77
- data/lib/asciidoctor/reader.rb +257 -187
- data/lib/asciidoctor/section.rb +12 -16
- data/lib/asciidoctor/stylesheets.rb +91 -0
- data/lib/asciidoctor/substitutors.rb +1548 -0
- data/lib/asciidoctor/table.rb +73 -57
- data/lib/asciidoctor/timings.rb +39 -0
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +22 -14
- data/man/asciidoctor.adoc +18 -10
- data/test/attributes_test.rb +314 -14
- data/test/blocks_test.rb +763 -118
- data/test/converter_test.rb +352 -0
- data/test/document_test.rb +518 -199
- data/test/extensions_test.rb +273 -103
- data/test/fixtures/asciidoc_index.txt +27 -13
- data/test/fixtures/basic-docinfo.xml +1 -1
- data/test/fixtures/chapter-a.adoc +3 -0
- data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +6 -0
- data/test/fixtures/docinfo.xml +1 -1
- data/test/fixtures/include-file.asciidoc +2 -0
- data/test/fixtures/master.adoc +5 -0
- data/test/invoker_test.rb +173 -61
- data/test/links_test.rb +97 -21
- data/test/lists_test.rb +181 -22
- data/test/options_test.rb +86 -2
- data/test/paragraphs_test.rb +47 -5
- data/test/{lexer_test.rb → parser_test.rb} +128 -57
- data/test/paths_test.rb +36 -1
- data/test/preamble_test.rb +25 -17
- data/test/reader_test.rb +404 -249
- data/test/sections_test.rb +623 -58
- data/test/substitutions_test.rb +609 -132
- data/test/tables_test.rb +198 -24
- data/test/test_helper.rb +101 -31
- data/test/text_test.rb +88 -31
- metadata +160 -64
- data/Gemfile +0 -12
- data/Guardfile +0 -18
- data/asciidoctor.gemspec +0 -143
- data/lib/asciidoctor/backends/_stylesheets.rb +0 -466
- data/lib/asciidoctor/backends/base_template.rb +0 -114
- data/lib/asciidoctor/backends/docbook45.rb +0 -774
- data/lib/asciidoctor/backends/docbook5.rb +0 -103
- data/lib/asciidoctor/backends/html5.rb +0 -1214
- data/lib/asciidoctor/renderer.rb +0 -259
- data/lib/asciidoctor/substituters.rb +0 -1083
- data/test/fixtures/asciidoc.txt +0 -105
- data/test/fixtures/ascshort.txt +0 -32
- data/test/fixtures/list_elements.asciidoc +0 -10
- data/test/renderer_test.rb +0 -162
    
        data/lib/asciidoctor/table.rb
    CHANGED
    
    | @@ -3,6 +3,19 @@ module Asciidoctor | |
| 3 3 | 
             
            # It supports all three of AsciiDoc's table formats: psv, dsv and csv.
         | 
| 4 4 | 
             
            class Table < AbstractBlock
         | 
| 5 5 |  | 
| 6 | 
            +
              # Public: A data object that encapsulates the collection of rows (head, foot, body) for a table
         | 
| 7 | 
            +
              class Rows
         | 
| 8 | 
            +
                attr_accessor :head, :foot, :body
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def initialize head = [], foot = [], body = []
         | 
| 11 | 
            +
                  @head = head
         | 
| 12 | 
            +
                  @foot = foot
         | 
| 13 | 
            +
                  @body = body
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                alias :[] :send
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 6 19 | 
             
              # Public: A String key that specifies the default table format in AsciiDoc (psv)
         | 
| 7 20 | 
             
              DEFAULT_DATA_FORMAT = 'psv'
         | 
| 8 21 |  | 
| @@ -54,9 +67,9 @@ class Table < AbstractBlock | |
| 54 67 | 
             
              # Public: Boolean specifies whether this table has a header row
         | 
| 55 68 | 
             
              attr_accessor :has_header_option
         | 
| 56 69 |  | 
| 57 | 
            -
              def initialize | 
| 58 | 
            -
                super | 
| 59 | 
            -
                @rows = Rows.new | 
| 70 | 
            +
              def initialize parent, attributes
         | 
| 71 | 
            +
                super parent, :table
         | 
| 72 | 
            +
                @rows = Rows.new
         | 
| 60 73 | 
             
                @columns = []
         | 
| 61 74 |  | 
| 62 75 | 
             
                @has_header_option = attributes.has_key? 'header-option'
         | 
| @@ -65,7 +78,7 @@ class Table < AbstractBlock | |
| 65 78 | 
             
                # to resolve an integer width from potential bogus input
         | 
| 66 79 | 
             
                pcwidth = attributes['width']
         | 
| 67 80 | 
             
                pcwidth_intval = pcwidth.to_i.abs
         | 
| 68 | 
            -
                if pcwidth_intval == 0 && pcwidth !=  | 
| 81 | 
            +
                if pcwidth_intval == 0 && pcwidth != '0' || pcwidth_intval > 100
         | 
| 69 82 | 
             
                  pcwidth_intval = 100
         | 
| 70 83 | 
             
                end
         | 
| 71 84 | 
             
                @attributes['tablepcwidth'] = pcwidth_intval
         | 
| @@ -79,7 +92,7 @@ class Table < AbstractBlock | |
| 79 92 | 
             
              # Internal: Returns whether the current row being processed is
         | 
| 80 93 | 
             
              # the header row
         | 
| 81 94 | 
             
              def header_row?
         | 
| 82 | 
            -
                @has_header_option && @rows.body. | 
| 95 | 
            +
                @has_header_option && @rows.body.empty?
         | 
| 83 96 | 
             
              end
         | 
| 84 97 |  | 
| 85 98 | 
             
              # Internal: Creates the Column objects from the column spec
         | 
| @@ -87,18 +100,19 @@ class Table < AbstractBlock | |
| 87 100 | 
             
              # returns nothing
         | 
| 88 101 | 
             
              def create_columns(col_specs)
         | 
| 89 102 | 
             
                total_width = 0
         | 
| 90 | 
            -
                 | 
| 103 | 
            +
                cols = []
         | 
| 104 | 
            +
                col_specs.each do |col_spec|
         | 
| 91 105 | 
             
                  total_width += col_spec['width']
         | 
| 92 | 
            -
                   | 
| 93 | 
            -
             | 
| 94 | 
            -
                }
         | 
| 106 | 
            +
                  cols << Column.new(self, cols.size, col_spec)
         | 
| 107 | 
            +
                end
         | 
| 95 108 |  | 
| 96 | 
            -
                 | 
| 97 | 
            -
                  @attributes['colcount'] =  | 
| 98 | 
            -
                  even_width = (100.0 /  | 
| 99 | 
            -
                   | 
| 109 | 
            +
                unless cols.empty?
         | 
| 110 | 
            +
                  @attributes['colcount'] = cols.size
         | 
| 111 | 
            +
                  even_width = (100.0 / cols.size).floor
         | 
| 112 | 
            +
                  cols.each {|c| c.assign_width(total_width, even_width) }
         | 
| 100 113 | 
             
                end
         | 
| 101 114 |  | 
| 115 | 
            +
                @columns = cols
         | 
| 102 116 | 
             
                nil
         | 
| 103 117 | 
             
              end
         | 
| 104 118 |  | 
| @@ -110,34 +124,33 @@ class Table < AbstractBlock | |
| 110 124 | 
             
                # set rowcount before splitting up body rows
         | 
| 111 125 | 
             
                @attributes['rowcount'] = @rows.body.size
         | 
| 112 126 |  | 
| 113 | 
            -
                 | 
| 114 | 
            -
             | 
| 127 | 
            +
                num_body_rows = @rows.body.size
         | 
| 128 | 
            +
                if num_body_rows > 0 && @has_header_option
         | 
| 129 | 
            +
                  head = @rows.body.shift
         | 
| 130 | 
            +
                  num_body_rows -= 1
         | 
| 115 131 | 
             
                  # styles aren't applied to header row
         | 
| 116 132 | 
             
                  head.each {|c| c.style = nil }
         | 
| 117 133 | 
             
                  # QUESTION why does AsciiDoc use an array for head? is it
         | 
| 118 134 | 
             
                  # possible to have more than one based on the syntax?
         | 
| 119 | 
            -
                  rows.head = [head]
         | 
| 135 | 
            +
                  @rows.head = [head]
         | 
| 120 136 | 
             
                end
         | 
| 121 137 |  | 
| 122 | 
            -
                if  | 
| 123 | 
            -
                  rows.foot = [rows.body.pop]
         | 
| 138 | 
            +
                if num_body_rows > 0 && attributes.has_key?('footer-option')
         | 
| 139 | 
            +
                  @rows.foot = [@rows.body.pop]
         | 
| 124 140 | 
             
                end
         | 
| 125 141 |  | 
| 126 142 | 
             
                nil
         | 
| 127 143 | 
             
              end
         | 
| 128 144 | 
             
            end
         | 
| 129 145 |  | 
| 130 | 
            -
            # Public: A struct that encapsulates the collection of rows (head, foot, body) for a table
         | 
| 131 | 
            -
            Table::Rows = Struct.new(:head, :foot, :body)
         | 
| 132 | 
            -
             | 
| 133 146 | 
             
            # Public: Methods to manage the columns of an AsciiDoc table. In particular, it
         | 
| 134 147 | 
             
            # keeps track of the column specs
         | 
| 135 148 | 
             
            class Table::Column < AbstractNode
         | 
| 136 149 | 
             
              # Public: Get/Set the Symbol style for this column.
         | 
| 137 150 | 
             
              attr_accessor :style
         | 
| 138 151 |  | 
| 139 | 
            -
              def initialize | 
| 140 | 
            -
                super | 
| 152 | 
            +
              def initialize table, index, attributes = {}
         | 
| 153 | 
            +
                super table, :column
         | 
| 141 154 | 
             
                @style = attributes['style']
         | 
| 142 155 | 
             
                attributes['colnumber'] = index + 1
         | 
| 143 156 | 
             
                attributes['width'] ||= 1
         | 
| @@ -186,18 +199,18 @@ class Table::Cell < AbstractNode | |
| 186 199 | 
             
              # Public: The internal Asciidoctor::Document for a cell that has the asciidoc style
         | 
| 187 200 | 
             
              attr_reader :inner_document
         | 
| 188 201 |  | 
| 189 | 
            -
              def initialize | 
| 190 | 
            -
                super | 
| 202 | 
            +
              def initialize column, text, attributes = {}, cursor = nil
         | 
| 203 | 
            +
                super column, :cell
         | 
| 191 204 | 
             
                @text = text
         | 
| 192 205 | 
             
                @style = nil
         | 
| 193 206 | 
             
                @colspan = nil
         | 
| 194 207 | 
             
                @rowspan = nil
         | 
| 195 208 | 
             
                # TODO feels hacky
         | 
| 196 | 
            -
                if  | 
| 209 | 
            +
                if column
         | 
| 197 210 | 
             
                  @style = column.attributes['style']
         | 
| 198 211 | 
             
                  update_attributes(column.attributes)
         | 
| 199 212 | 
             
                end
         | 
| 200 | 
            -
                if  | 
| 213 | 
            +
                if attributes
         | 
| 201 214 | 
             
                  @colspan = attributes.delete('colspan')
         | 
| 202 215 | 
             
                  @rowspan = attributes.delete('rowspan')
         | 
| 203 216 | 
             
                  # TODO eventualy remove the style attribute from the attributes hash
         | 
| @@ -213,9 +226,9 @@ class Table::Cell < AbstractNode | |
| 213 226 | 
             
                  # NOTE we need to process the first line of content as it may not have been processed
         | 
| 214 227 | 
             
                  # the included content cannot expect to match conditional terminators in the remaining
         | 
| 215 228 | 
             
                  # lines of table cell content, it must be self-contained logic
         | 
| 216 | 
            -
                  inner_document_lines = @text. | 
| 217 | 
            -
                  unless inner_document_lines.empty? || !inner_document_lines. | 
| 218 | 
            -
                    unprocessed_lines = inner_document_lines[0 | 
| 229 | 
            +
                  inner_document_lines = @text.split(EOL)
         | 
| 230 | 
            +
                  unless inner_document_lines.empty? || !inner_document_lines[0].include?('::')
         | 
| 231 | 
            +
                    unprocessed_lines = inner_document_lines[0]
         | 
| 219 232 | 
             
                    processed_lines = PreprocessorReader.new(@document, unprocessed_lines).readlines
         | 
| 220 233 | 
             
                    if processed_lines != unprocessed_lines
         | 
| 221 234 | 
             
                      inner_document_lines.shift
         | 
| @@ -235,11 +248,11 @@ class Table::Cell < AbstractNode | |
| 235 248 | 
             
              # Public: Handles the body data (tbody, tfoot), applying styles and partitioning into paragraphs
         | 
| 236 249 | 
             
              def content
         | 
| 237 250 | 
             
                if @style == :asciidoc
         | 
| 238 | 
            -
                  @inner_document. | 
| 251 | 
            +
                  @inner_document.convert
         | 
| 239 252 | 
             
                else
         | 
| 240 | 
            -
                  text.split( | 
| 241 | 
            -
                    !@style || @style == :header ? p : Inline.new(parent, :quoted, p, :type => @style). | 
| 242 | 
            -
                   | 
| 253 | 
            +
                  text.split(BlankLineRx).map do |p|
         | 
| 254 | 
            +
                    !@style || @style == :header ? p : Inline.new(parent, :quoted, p, :type => @style).convert
         | 
| 255 | 
            +
                  end
         | 
| 243 256 | 
             
                end
         | 
| 244 257 | 
             
              end
         | 
| 245 258 |  | 
| @@ -283,19 +296,18 @@ class Table::ParserContext | |
| 283 296 | 
             
                @table = table
         | 
| 284 297 | 
             
                # TODO if reader.cursor becomes a reference, this would require .dup
         | 
| 285 298 | 
             
                @last_cursor = reader.cursor
         | 
| 286 | 
            -
                if attributes | 
| 287 | 
            -
                   | 
| 288 | 
            -
             | 
| 289 | 
            -
                    raise "Illegal table format: #@format"
         | 
| 299 | 
            +
                if (@format = attributes['format'])
         | 
| 300 | 
            +
                  unless Table::DATA_FORMATS.include? @format
         | 
| 301 | 
            +
                    raise %(Illegal table format: #{@format})
         | 
| 290 302 | 
             
                  end
         | 
| 291 303 | 
             
                else
         | 
| 292 304 | 
             
                  @format = Table::DEFAULT_DATA_FORMAT
         | 
| 293 305 | 
             
                end
         | 
| 294 306 |  | 
| 295 | 
            -
                if @format == 'psv' && !attributes.has_key? | 
| 296 | 
            -
                   | 
| 307 | 
            +
                @delimiter = if @format == 'psv' && !(attributes.has_key? 'separator') && table.document.nested?
         | 
| 308 | 
            +
                  '!'
         | 
| 297 309 | 
             
                else
         | 
| 298 | 
            -
                   | 
| 310 | 
            +
                  attributes['separator'] || Table::DEFAULT_DELIMITERS[@format]
         | 
| 299 311 | 
             
                end
         | 
| 300 312 | 
             
                @delimiter_re = /#{Regexp.escape @delimiter}/
         | 
| 301 313 | 
             
                @col_count = table.columns.empty? ? -1 : table.columns.size
         | 
| @@ -319,9 +331,9 @@ class Table::ParserContext | |
| 319 331 | 
             
              # Public: Checks whether the line provided contains the cell delimiter
         | 
| 320 332 | 
             
              # used by this table.
         | 
| 321 333 | 
             
              #
         | 
| 322 | 
            -
              # returns MatchData if the line contains the delimiter, false otherwise
         | 
| 334 | 
            +
              # returns Regexp MatchData if the line contains the delimiter, false otherwise
         | 
| 323 335 | 
             
              def match_delimiter(line)
         | 
| 324 | 
            -
                 | 
| 336 | 
            +
                @delimiter_re.match(line)
         | 
| 325 337 | 
             
              end
         | 
| 326 338 |  | 
| 327 339 | 
             
              # Public: Skip beyond the matched delimiter because it was a false positive
         | 
| @@ -329,7 +341,7 @@ class Table::ParserContext | |
| 329 341 | 
             
              #
         | 
| 330 342 | 
             
              # returns the String after the match
         | 
| 331 343 | 
             
              def skip_matched_delimiter(match, escaped = false)
         | 
| 332 | 
            -
                @buffer = %( | 
| 344 | 
            +
                @buffer = %(#{@buffer}#{escaped ? match.pre_match.chop : match.pre_match}#{@delimiter})
         | 
| 333 345 | 
             
                match.post_match
         | 
| 334 346 | 
             
              end
         | 
| 335 347 |  | 
| @@ -338,7 +350,7 @@ class Table::ParserContext | |
| 338 350 | 
             
              # returns true if the buffer has unclosed quotes, false if it doesn't or it 
         | 
| 339 351 | 
             
              # isn't quoted data
         | 
| 340 352 | 
             
              def buffer_has_unclosed_quotes?(append = nil)
         | 
| 341 | 
            -
                record =  | 
| 353 | 
            +
                record = %(#{@buffer}#{append}).strip
         | 
| 342 354 | 
             
                record.start_with?('"') && !record.start_with?('""') && !record.end_with?('"')
         | 
| 343 355 | 
             
              end
         | 
| 344 356 |  | 
| @@ -347,7 +359,7 @@ class Table::ParserContext | |
| 347 359 | 
             
              # returns true if the buffer starts with a double quote (and not an escaped double quote),
         | 
| 348 360 | 
             
              # false otherwise
         | 
| 349 361 | 
             
              def buffer_quoted?
         | 
| 350 | 
            -
                @buffer.lstrip | 
| 362 | 
            +
                @buffer = @buffer.lstrip
         | 
| 351 363 | 
             
                @buffer.start_with?('"') && !@buffer.start_with?('""')
         | 
| 352 364 | 
             
              end
         | 
| 353 365 |  | 
| @@ -422,7 +434,7 @@ class Table::ParserContext | |
| 422 434 | 
             
              def close_cell(eol = false)
         | 
| 423 435 | 
             
                cell_text = @buffer.strip
         | 
| 424 436 | 
             
                @buffer = ''
         | 
| 425 | 
            -
                if format == 'psv'
         | 
| 437 | 
            +
                if @format == 'psv'
         | 
| 426 438 | 
             
                  cell_spec = take_cell_spec
         | 
| 427 439 | 
             
                  if cell_spec.nil?
         | 
| 428 440 | 
             
                    warn "asciidoctor: ERROR: #{@last_cursor.line_info}: table missing leading separator, recovering automatically"
         | 
| @@ -435,12 +447,12 @@ class Table::ParserContext | |
| 435 447 | 
             
                else
         | 
| 436 448 | 
             
                  cell_spec = nil
         | 
| 437 449 | 
             
                  repeat = 1
         | 
| 438 | 
            -
                  if format == 'csv'
         | 
| 450 | 
            +
                  if @format == 'csv'
         | 
| 439 451 | 
             
                    if !cell_text.empty? && cell_text.include?('"')
         | 
| 440 452 | 
             
                      # this may not be perfect logic, but it hits the 99%
         | 
| 441 453 | 
             
                      if cell_text.start_with?('"') && cell_text.end_with?('"')
         | 
| 442 454 | 
             
                        # unquote
         | 
| 443 | 
            -
                        cell_text = cell_text[1 | 
| 455 | 
            +
                        cell_text = cell_text[1...-1].strip
         | 
| 444 456 | 
             
                      end
         | 
| 445 457 |  | 
| 446 458 | 
             
                      # collapses escaped quotes
         | 
| @@ -449,11 +461,15 @@ class Table::ParserContext | |
| 449 461 | 
             
                  end
         | 
| 450 462 | 
             
                end
         | 
| 451 463 |  | 
| 452 | 
            -
                1.upto(repeat)  | 
| 464 | 
            +
                1.upto(repeat) do |i|
         | 
| 453 465 | 
             
                  # make column resolving an operation
         | 
| 454 466 | 
             
                  if @col_count == -1
         | 
| 455 | 
            -
                    @table.columns << Table::Column.new(@table, @current_row.size + i - 1)
         | 
| 456 | 
            -
                     | 
| 467 | 
            +
                    @table.columns << (column = Table::Column.new(@table, @current_row.size + i - 1))
         | 
| 468 | 
            +
                    if cell_spec && (cell_spec.has_key? 'colspan') && (extra_cols = cell_spec['colspan'].to_i - 1) > 0
         | 
| 469 | 
            +
                      extra_cols.times do |j|
         | 
| 470 | 
            +
                        @table.columns << Table::Column.new(@table, @current_row.size + i + j - 1)
         | 
| 471 | 
            +
                      end
         | 
| 472 | 
            +
                    end
         | 
| 457 473 | 
             
                  else
         | 
| 458 474 | 
             
                    # QUESTION is this right for cells that span columns?
         | 
| 459 475 | 
             
                    column = @table.columns[@current_row.size]
         | 
| @@ -461,7 +477,7 @@ class Table::ParserContext | |
| 461 477 |  | 
| 462 478 | 
             
                  cell = Table::Cell.new(column, cell_text, cell_spec, @last_cursor)
         | 
| 463 479 | 
             
                  @last_cursor = @reader.cursor
         | 
| 464 | 
            -
                  unless cell.rowspan | 
| 480 | 
            +
                  unless !cell.rowspan || cell.rowspan == 1
         | 
| 465 481 | 
             
                    activate_rowspan(cell.rowspan, (cell.colspan || 1))
         | 
| 466 482 | 
             
                  end
         | 
| 467 483 | 
             
                  @col_visits += (cell.colspan || 1)
         | 
| @@ -469,7 +485,7 @@ class Table::ParserContext | |
| 469 485 | 
             
                  # don't close the row if we're on the first line and the column count has not been set explicitly
         | 
| 470 486 | 
             
                  # TODO perhaps the col_count/linenum logic should be in end_of_row? (or a should_end_row? method)
         | 
| 471 487 | 
             
                  close_row if end_of_row? && (@col_count != -1 || @linenum > 0 || (eol && i == repeat))
         | 
| 472 | 
            -
                 | 
| 488 | 
            +
                end
         | 
| 473 489 | 
             
                @open_cell = false
         | 
| 474 490 | 
             
                nil
         | 
| 475 491 | 
             
              end
         | 
| @@ -496,8 +512,8 @@ class Table::ParserContext | |
| 496 512 | 
             
              # returns nothing
         | 
| 497 513 | 
             
              def activate_rowspan(rowspan, colspan)
         | 
| 498 514 | 
             
                1.upto(rowspan - 1).each {|i|
         | 
| 499 | 
            -
                   | 
| 500 | 
            -
                  @active_rowspans[i]  | 
| 515 | 
            +
                  # longhand assignment used for Opal compatibility
         | 
| 516 | 
            +
                  @active_rowspans[i] = (@active_rowspans[i] || 0) + colspan
         | 
| 501 517 | 
             
                }
         | 
| 502 518 | 
             
                nil
         | 
| 503 519 | 
             
              end
         | 
| @@ -510,7 +526,7 @@ class Table::ParserContext | |
| 510 526 | 
             
              # Public: Calculate the effective column visits, which consists of the number of
         | 
| 511 527 | 
             
              # cells plus any active rowspans.
         | 
| 512 528 | 
             
              def effective_col_visits
         | 
| 513 | 
            -
                @col_visits + @active_rowspans | 
| 529 | 
            +
                @col_visits + @active_rowspans[0]
         | 
| 514 530 | 
             
              end
         | 
| 515 531 |  | 
| 516 532 | 
             
              # Internal: Advance to the next line (which may come after the parser begins processing
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            module Asciidoctor
         | 
| 2 | 
            +
              class Timings
         | 
| 3 | 
            +
                def initialize
         | 
| 4 | 
            +
                  @log = {}
         | 
| 5 | 
            +
                  @timers = {}
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def start key
         | 
| 9 | 
            +
                  @timers[key] = ::Time.now
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def record key
         | 
| 13 | 
            +
                  @log[key] = (::Time.now - (@timers.delete key))
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def read_parse
         | 
| 17 | 
            +
                  (time = (@log[:read] || 0) + (@log[:parse] || 0)) > 0 ? time : nil
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def convert
         | 
| 21 | 
            +
                  @log[:convert] || 0
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def read_parse_convert
         | 
| 25 | 
            +
                  (time = (@log[:read] || 0) + (@log[:parse] || 0) + (@log[:convert] || 0)) > 0 ? time : nil
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                def total
         | 
| 29 | 
            +
                  (time = (@log[:read] || 0) + (@log[:parse] || 0) + (@log[:convert] || 0) + (@log[:write] || 0)) > 0 ? time : nil
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                def print_report to = $stdout, subject = nil
         | 
| 33 | 
            +
                  to.puts %(Input file: #{subject}) if subject
         | 
| 34 | 
            +
                  to.puts %(  Time to read and parse source: #{'%05.5f' % read_parse.to_i})
         | 
| 35 | 
            +
                  to.puts %(  Time to convert document: #{'%05.5f' % convert.to_i})
         | 
| 36 | 
            +
                  to.puts %(  Total time (read, parse and convert): #{'%05.5f' % read_parse_convert.to_i})
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
    
        data/lib/asciidoctor/version.rb
    CHANGED
    
    
    
        data/man/asciidoctor.1
    CHANGED
    
    | @@ -1,23 +1,23 @@ | |
| 1 1 | 
             
            '\" t
         | 
| 2 2 | 
             
            .\"     Title: asciidoctor
         | 
| 3 3 | 
             
            .\"    Author: Dan Allen
         | 
| 4 | 
            -
            .\" Generator: Asciidoctor  | 
| 5 | 
            -
            .\"      Date:  | 
| 4 | 
            +
            .\" Generator: Asciidoctor 1.5.0
         | 
| 5 | 
            +
            .\"      Date: 2014-05-19
         | 
| 6 6 | 
             
            .\"    Manual: Asciidoctor Manual
         | 
| 7 | 
            -
            .\"    Source: Asciidoctor  | 
| 7 | 
            +
            .\"    Source: Asciidoctor 1.5.0
         | 
| 8 8 | 
             
            .\"  Language: English
         | 
| 9 9 | 
             
            .\"
         | 
| 10 | 
            -
            .TH "ASCIIDOCTOR" "1" " | 
| 10 | 
            +
            .TH "ASCIIDOCTOR" "1" "2014-08-12" "Asciidoctor 1\&.5\&.0" "Asciidoctor Manual"
         | 
| 11 11 | 
             
            .ie \n(.g .ds Aq \(aq
         | 
| 12 12 | 
             
            .el       .ds Aq '
         | 
| 13 13 | 
             
            .nh
         | 
| 14 14 | 
             
            .ad l
         | 
| 15 15 | 
             
            .SH "SYNOPSIS"
         | 
| 16 16 | 
             
            .sp
         | 
| 17 | 
            -
            \fBasciidoctor\fR [\fIOPTION\fR] | 
| 17 | 
            +
            \fBasciidoctor\fR [\fIOPTION\fR]... \fIFILE\fR...
         | 
| 18 18 | 
             
            .SH "DESCRIPTION"
         | 
| 19 19 | 
             
            .sp
         | 
| 20 | 
            -
            The asciidoctor(1) command converts the AsciiDoc source file(s) \fIFILE\fR to  | 
| 20 | 
            +
            The asciidoctor(1) command converts the AsciiDoc source file(s) \fIFILE\fR to HTML5, DocBook 4\&.5, DocBook 5\&.0 and other custom output formats\&.
         | 
| 21 21 | 
             
            .sp
         | 
| 22 22 | 
             
            If \fIFILE\fR is \fI\-\fR then the AsciiDoc source is read from standard input\&.
         | 
| 23 23 | 
             
            .SH "OPTIONS"
         | 
| @@ -50,7 +50,7 @@ This option may be specified more than once\&. | |
| 50 50 | 
             
            .PP
         | 
| 51 51 | 
             
            \fB\-b, \-\-backend\fR=\fIBACKEND\fR
         | 
| 52 52 | 
             
            .RS 4
         | 
| 53 | 
            -
            Backend output file format: \fIhtml5\fR, \fIdocbook45\fR and \fIdocbook5\fR supported out of the box\&. You can also use the backend alias names \fIhtml\fR (aliased to \fIhtml5\fR) or \fIdocbook\fR (aliased to \ | 
| 53 | 
            +
            Backend output file format: \fIhtml5\fR, \fIdocbook45\fR and \fIdocbook5\fR supported out of the box\&. You can also use the backend alias names \fIhtml\fR (aliased to \fIhtml5\fR) or \fIdocbook\fR (aliased to \fIdocbook5\fR)\&. Defaults to \fIhtml5\fR\&. Other options can be passed, but if Asciidoctor cannot find the backend, it will fail during rendering\&.
         | 
| 54 54 | 
             
            .RE
         | 
| 55 55 | 
             
            .PP
         | 
| 56 56 | 
             
            \fB\-d, \-\-doctype\fR=\fIDOCTYPE\fR
         | 
| @@ -61,7 +61,7 @@ Document type: \fIarticle\fR, \fIbook\fR, \fImanpage\fR or \fIinline\fR\&. Sets | |
| 61 61 | 
             
            .PP
         | 
| 62 62 | 
             
            \fB\-C, \-\-compact\fR
         | 
| 63 63 | 
             
            .RS 4
         | 
| 64 | 
            -
            Compact the output by removing blank lines\&.  | 
| 64 | 
            +
            Compact the output by removing blank lines\&. (No longer in use)\&.
         | 
| 65 65 | 
             
            .RE
         | 
| 66 66 | 
             
            .PP
         | 
| 67 67 | 
             
            \fB\-D, \-\-destination\-dir\fR=\fIDIR\fR
         | 
| @@ -71,12 +71,12 @@ Destination output directory\&. Defaults to the directory containing the source | |
| 71 71 | 
             
            .PP
         | 
| 72 72 | 
             
            \fB\-E, \-\-template\-engine\fR=\fINAME\fR
         | 
| 73 73 | 
             
            .RS 4
         | 
| 74 | 
            -
            Template engine to use for the custom render templates\&. The gem with the same name as the engine will be loaded automatically\&. This name is also used to build the full path to the custom templates\&.
         | 
| 74 | 
            +
            Template engine to use for the custom render templates\&. The gem with the same name as the engine will be loaded automatically\&. This name is also used to build the full path to the custom templates\&. If a template engine is not specified, it will be auto\-detected based on the file extension of the custom templates found\&.
         | 
| 75 75 | 
             
            .RE
         | 
| 76 76 | 
             
            .PP
         | 
| 77 77 | 
             
            \fB\-e, \-\-eruby\fR
         | 
| 78 78 | 
             
            .RS 4
         | 
| 79 | 
            -
            Specifies the eRuby implementation to use for rendering the  | 
| 79 | 
            +
            Specifies the eRuby implementation to use for rendering the custom ERB templates\&. Supported values are \fIerb\fR and \fIerubis\fR\&. Defaults to \fIerb\fR\&.
         | 
| 80 80 | 
             
            .RE
         | 
| 81 81 | 
             
            .PP
         | 
| 82 82 | 
             
            \fB\-n, \-\-section\-numbers\fR
         | 
| @@ -104,6 +104,11 @@ This option may be specified more than once\&. Matching templates found in subse | |
| 104 104 | 
             
            .RE
         | 
| 105 105 | 
             
            .SS "Processing Information"
         | 
| 106 106 | 
             
            .PP
         | 
| 107 | 
            +
            \fB\-q, \-\-quiet\fR
         | 
| 108 | 
            +
            .RS 4
         | 
| 109 | 
            +
            Silence warnings\&.
         | 
| 110 | 
            +
            .RE
         | 
| 111 | 
            +
            .PP
         | 
| 107 112 | 
             
            \fB\-\-trace\fR
         | 
| 108 113 | 
             
            .RS 4
         | 
| 109 114 | 
             
            Include backtrace information on errors\&. Not enabled by default\&.
         | 
| @@ -113,6 +118,11 @@ Include backtrace information on errors\&. Not enabled by default\&. | |
| 113 118 | 
             
            .RS 4
         | 
| 114 119 | 
             
            Verbosely print processing information and configuration file checks to stderr\&.
         | 
| 115 120 | 
             
            .RE
         | 
| 121 | 
            +
            .PP
         | 
| 122 | 
            +
            \fB\-t, \-\-timings\fR
         | 
| 123 | 
            +
            .RS 4
         | 
| 124 | 
            +
            Display timings information (time to read, parse and convert)
         | 
| 125 | 
            +
            .RE
         | 
| 116 126 | 
             
            .SS "Program Information"
         | 
| 117 127 | 
             
            .PP
         | 
| 118 128 | 
             
            \fB\-h, \-\-help\fR
         | 
| @@ -149,15 +159,13 @@ Git source repository on GitHub: <\fBhttps://github\&.com/asciidoctor/asciidocto | |
| 149 159 | 
             
            .sp
         | 
| 150 160 | 
             
            Project web site: <\fBhttp://asciidoctor\&.org\fR>
         | 
| 151 161 | 
             
            .sp
         | 
| 152 | 
            -
            GitHub organization: <\ | 
| 162 | 
            +
            GitHub organization: <\fBhttps://github\&.com/asciidoctor\fR>
         | 
| 153 163 | 
             
            .sp
         | 
| 154 164 | 
             
            Mailinglist / forum: <\fBhttp://discuss\&.asciidoctor\&.org\fR>
         | 
| 155 165 | 
             
            .SH "COPYING"
         | 
| 156 166 | 
             
            .sp
         | 
| 157 | 
            -
            Copyright (C) 2012\- | 
| 167 | 
            +
            Copyright (C) 2012\-2014 Dan Allen, Ryan Waldron and the Asciidoctor Project\&. Free use of this software is granted under the terms of the MIT License\&.
         | 
| 158 168 | 
             
            .SH "AUTHOR"
         | 
| 159 169 | 
             
            .PP
         | 
| 160 170 | 
             
            \fBDan Allen\fR
         | 
| 161 | 
            -
            .RS 4
         | 
| 162 | 
            -
            Author.
         | 
| 163 171 | 
             
            .RE
         |