diff options
35 files changed, 402 insertions, 402 deletions
diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb index 96ae1230..c686c673 100644 --- a/lib/asciidoctor.rb +++ b/lib/asciidoctor.rb @@ -188,7 +188,7 @@ module Asciidoctor # Flag to indicate whether encoding can be coerced to UTF-8 # _All_ input data must be force encoded to UTF-8 if Encoding.default_external is *not* UTF-8 - # Addresses failures performing string operations that are reported as "invalid byte sequence in US-ASCII" + # Addresses failures performing string operations that are reported as "invalid byte sequence in US-ASCII" # Ruby 1.8 doesn't seem to experience this problem (perhaps because it isn't validating the encodings) COERCE_ENCODING = !::RUBY_ENGINE_OPAL && ::RUBY_MIN_VERSION_1_9 @@ -422,7 +422,7 @@ module Asciidoctor # # Examples # - # = asciidoctor ( 1 ) + # = asciidoctor ( 1 ) # ManpageTitleVolnumRx = /^(.*)\((.*)\)$/ @@ -708,7 +708,7 @@ module Asciidoctor # # NOTE negative match for comment line is intentional since that isn't handled when looking for next list item # QUESTION should we check for line comment in regex or when scanning the lines? - # + # DefinitionListRx = /^(?!\/\/)#{CG_BLANK}*(.*?)(:{2,4}|;;)(?:#{CG_BLANK}+(.*))?$/ # Matches a sibling definition list item (which does not include the keyed type). @@ -730,7 +730,7 @@ module Asciidoctor CalloutListRx = /^<?(\d+)>#{CG_BLANK}+(.*)/ # Matches a callout reference inside literal text. - # + # # Examples # <1> (optionally prefixed by //, #, -- or ;; line comment chars) # <1> <2> (multiple callouts on one line) @@ -778,7 +778,7 @@ module Asciidoctor # Matches the general block macro pattern. # # Examples - # + # # gist::123456[] # #-- @@ -885,7 +885,7 @@ module Asciidoctor # Matches an implicit link and some of the link inline macro. # # Examples - # + # # http://github.com # http://github.com[GitHub] # @@ -1013,7 +1013,7 @@ module Asciidoctor # one,two # three;four # - DataDelimiterRx = /,|;/ + DataDelimiterRx = /,|;/ # Matches one or more consecutive digits on a single line. # @@ -1053,7 +1053,7 @@ module Asciidoctor # Matches a space escaped by a backslash. # # Examples - # + # # one\ two\ three # EscapedSpaceRx = /\\(#{CG_BLANK})/ diff --git a/lib/asciidoctor/abstract_block.rb b/lib/asciidoctor/abstract_block.rb index 894af30a..468cb173 100644 --- a/lib/asciidoctor/abstract_block.rb +++ b/lib/asciidoctor/abstract_block.rb @@ -182,7 +182,7 @@ class AbstractBlock < AbstractNode # Only applies to Document and Section instances # # Examples - # + # # section = Section.new(parent) # section << Block.new(section, :paragraph, :source => 'paragraph 1') # section << Section.new(parent) @@ -238,7 +238,7 @@ class AbstractBlock < AbstractNode # # Examples # - # doc.find_by context: :section + # doc.find_by context: :section # #=> Asciidoctor::Section@14459860 { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } # #=> Asciidoctor::Section@14505460 { level: 1, title: "First Section", blocks: 1 } # @@ -376,7 +376,7 @@ class AbstractBlock < AbstractNode # Walk the descendents of the current Document or Section # and reassign the section 0-based index value to each Section # as it appears in document order. - # + # # Returns nothing def reindex_sections @next_section_index = 0 diff --git a/lib/asciidoctor/abstract_node.rb b/lib/asciidoctor/abstract_node.rb index 6aa734ad..5bf375ee 100644 --- a/lib/asciidoctor/abstract_node.rb +++ b/lib/asciidoctor/abstract_node.rb @@ -366,7 +366,7 @@ class AbstractNode # NOTE base64 is autoloaded by reference to ::Base64 %(data:#{mimetype};base64,#{::Base64.encode64(bindata).delete EOL}) end - + # Public: Read the image data from the specified URI and generate a data URI # # The image data is read from the URI and converted to Base64. A data URI is @@ -392,7 +392,7 @@ class AbstractNode begin mimetype = nil bindata = open(image_uri, 'rb') {|file| - mimetype = file.content_type + mimetype = file.content_type file.read } # NOTE base64 is autoloaded by reference to ::Base64 @@ -484,7 +484,7 @@ class AbstractNode # start - the String start (i.e, parent) path (optional, default: nil) # preserve_uri_target - a Boolean indicating whether target should be preserved if contains a URI (default: true) # - # Returns the resolved [String] path + # Returns the resolved [String] path def normalize_web_path(target, start = nil, preserve_uri_target = true) if preserve_uri_target && (Helpers.uriish? target) target diff --git a/lib/asciidoctor/callouts.rb b/lib/asciidoctor/callouts.rb index 35f7ac4f..ef88aae5 100644 --- a/lib/asciidoctor/callouts.rb +++ b/lib/asciidoctor/callouts.rb @@ -93,7 +93,7 @@ class Callouts def rewind @list_index = 1 @co_index = 1 - + nil end diff --git a/lib/asciidoctor/cli/options.rb b/lib/asciidoctor/cli/options.rb index edf0b741..82db4e5e 100644 --- a/lib/asciidoctor/cli/options.rb +++ b/lib/asciidoctor/cli/options.rb @@ -136,12 +136,12 @@ Example: asciidoctor -b html5 source.asciidoc opts.on_tail('-V', '--version', 'display the version and runtime environment (or -v if no other flags or arguments)') do return print_version $stdout end - + end infiles = [] opts_parser.parse! args - + if args.empty? if self[:verbose] == 2 return print_version $stdout diff --git a/lib/asciidoctor/converter.rb b/lib/asciidoctor/converter.rb index d4c7f147..ca84daae 100644 --- a/lib/asciidoctor/converter.rb +++ b/lib/asciidoctor/converter.rb @@ -136,7 +136,7 @@ module Asciidoctor converter.extend Config end end - + include Config include BackendInfo diff --git a/lib/asciidoctor/converter/factory.rb b/lib/asciidoctor/converter/factory.rb index 565f2c66..c6d84d10 100644 --- a/lib/asciidoctor/converter/factory.rb +++ b/lib/asciidoctor/converter/factory.rb @@ -140,7 +140,7 @@ module Asciidoctor end nil end - + # Public: Lookup the custom converter registered with this factory to handle # the specified backend. # @@ -190,7 +190,7 @@ module Asciidoctor return converter end end - + base_converter = case backend when 'html5' unless defined? ::Asciidoctor::Converter::Html5Converter @@ -215,7 +215,7 @@ module Asciidoctor end return base_converter unless opts.key? :template_dirs - + unless defined? ::Asciidoctor::Converter::TemplateConverter require 'asciidoctor/converter/template'.to_s end diff --git a/lib/asciidoctor/converter/html5.rb b/lib/asciidoctor/converter/html5.rb index 9f77e0d4..867b9c68 100644 --- a/lib/asciidoctor/converter/html5.rb +++ b/lib/asciidoctor/converter/html5.rb @@ -207,7 +207,7 @@ module Asciidoctor unless (docinfo_content = node.docinfo :footer).empty? result << docinfo_content end - + # Load Javascript at the end of body for performance # See http://www.html5rocks.com/en/tutorials/speed/script-loading/ case highlighter diff --git a/lib/asciidoctor/converter/template.rb b/lib/asciidoctor/converter/template.rb index 4c14d3bb..b9e108ae 100644 --- a/lib/asciidoctor/converter/template.rb +++ b/lib/asciidoctor/converter/template.rb @@ -148,7 +148,7 @@ module Asciidoctor end # Internal: Creates a convert method for the specified name that delegates to the specified template. - # + # # Returns nothing def create_handler name, template metaclass = class << self; self; end diff --git a/lib/asciidoctor/document.rb b/lib/asciidoctor/document.rb index ac7e62a0..28d762bc 100644 --- a/lib/asciidoctor/document.rb +++ b/lib/asciidoctor/document.rb @@ -107,7 +107,7 @@ class Document < AbstractBlock # Public: Get the Boolean AsciiDoc compatibility mode # # enabling this attribute activates the following syntax changes: - # + # # * single quotes as constrained emphasis formatting marks # * single backticks parsed as inline literal, formatted as monospace # * single plus parsed as constrained, monospaced inline formatting @@ -352,10 +352,10 @@ class Document < AbstractBlock attr_overrides['icons'] ||= nil end end - + attr_overrides.delete_if do |key, val| verdict = false - # a nil value undefines the attribute + # a nil value undefines the attribute if val.nil? attrs.delete(key) else @@ -444,7 +444,7 @@ class Document < AbstractBlock # Public: Parse the AsciiDoc source stored in the {Reader} into an abstract syntax tree. # # If the data parameter is not nil, create a new {PreprocessorReader} and assigned it to the reader - # property of this object. Otherwise, continue with the reader that was created in {#initialize}. + # property of this object. Otherwise, continue with the reader that was created in {#initialize}. # Pass the reader to {Parser.parse} to parse the source data into an abstract syntax tree. # # If parsing has already been performed, this method returns without performing any processing. @@ -533,7 +533,7 @@ class Document < AbstractBlock if intval.to_s != current.to_s (current[0].ord + 1).chr else - intval + 1 + intval + 1 end end end @@ -639,7 +639,7 @@ class Document < AbstractBlock else return end - + if (separator = opts[:partition]) Title.new val, opts.merge({ :separator => (separator == true ? @attributes['title-separator'] : separator) }) elsif opts[:sanitize] && val.include?('<') @@ -711,7 +711,7 @@ class Document < AbstractBlock unrooted_attributes['invalid-header'] = true unless header_valid unrooted_attributes end - + # Internal: Branch the attributes so that the original state can be restored # at a future time. def save_attributes @@ -1093,7 +1093,7 @@ class Document < AbstractBlock start = ::Time.now.to_f if monitor r.write output, target - monitor[:write] = ::Time.now.to_f - start if monitor + monitor[:write] = ::Time.now.to_f - start if monitor output end diff --git a/lib/asciidoctor/extensions.rb b/lib/asciidoctor/extensions.rb index 7693a356..752e158e 100644 --- a/lib/asciidoctor/extensions.rb +++ b/lib/asciidoctor/extensions.rb @@ -36,7 +36,7 @@ module Extensions class Processor class << self # Public: Get the static configuration for this processor class. - # + # # Returns a configuration [Hash] def config @config ||= {} @@ -848,7 +848,7 @@ module Extensions # is not passed as an argument, it gets read from the name property of the # BlockProcessor instance. If a name still cannot be determined, an error # is raised. - # + # # Examples # # # as a BlockProcessor subclass @@ -871,7 +871,7 @@ module Extensions # # # as a method block # block do - # named :shout + # named :shout # process |parent, reader, attrs| # ... # end @@ -937,7 +937,7 @@ module Extensions # registered to handle. If a block macro name is not passed as an argument, # it gets read from the name property of the BlockMacroProcessor instance. # If a name still cannot be determined, an error is raised. - # + # # Examples # # # as a BlockMacroProcessor subclass @@ -1026,7 +1026,7 @@ module Extensions # registered to handle. If a block macro name is not passed as an argument, # it gets read from the name property of the InlineMacroProcessor instance. # If a name still cannot be determined, an error is raised. - # + # # Examples # # # as an InlineMacroProcessor subclass diff --git a/lib/asciidoctor/helpers.rb b/lib/asciidoctor/helpers.rb index 32150500..3b24067f 100644 --- a/lib/asciidoctor/helpers.rb +++ b/lib/asciidoctor/helpers.rb @@ -63,7 +63,7 @@ module Helpers # returns a String Array of normalized lines def self.normalize_lines_array data return [] if data.empty? - + # NOTE if data encoding is UTF-*, we only need 0..1 leading_bytes = (first_line = data[0])[0..2].bytes.to_a if COERCE_ENCODING @@ -99,7 +99,7 @@ module Helpers # data - a String of lines to normalize # # returns a String Array of normalized lines - def self.normalize_lines_from_string data + def self.normalize_lines_from_string data return [] if data.nil_or_empty? if COERCE_ENCODING diff --git a/lib/asciidoctor/inline.rb b/lib/asciidoctor/inline.rb index dcf1633b..f0fda2a8 100644 --- a/lib/asciidoctor/inline.rb +++ b/lib/asciidoctor/inline.rb @@ -15,7 +15,7 @@ class Inline < AbstractNode super(parent, context) @node_name = %(inline_#{context}) - @text = text + @text = text @id = opts[:id] @type = opts[:type] @@ -37,7 +37,7 @@ class Inline < AbstractNode def convert converter.convert self end - + # Alias render to convert to maintain backwards compatibility alias :render :convert end diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb index ce1ea32f..8c140ac8 100644 --- a/lib/asciidoctor/parser.rb +++ b/lib/asciidoctor/parser.rb @@ -133,7 +133,7 @@ class Parser # parse title and consume name section of manpage document parse_manpage_header(reader, document) if document.doctype == 'manpage' - + # NOTE block_attributes are the block-level attributes (not document attributes) that # precede the first line of content (document title, first section or first block) document.finalize_header block_attributes @@ -161,7 +161,7 @@ class Parser name_section_buffer = reader.read_lines_until(:break_on_blank_lines => true).join(' ').tr_s(' ', ' ') if (m = ManpageNamePurposeRx.match(name_section_buffer)) document.attributes['manname'] = document.sub_attributes m[1] - document.attributes['manpurpose'] = m[2] + document.attributes['manpurpose'] = m[2] # TODO parse multiple man names if document.backend == 'manpage' @@ -332,7 +332,7 @@ class Parser elsif first_block.content_model != :compound intro = Block.new section, :open, :content_model => :compound intro.style = 'partintro' - section.blocks.shift + section.blocks.shift if first_block.style == 'partintro' first_block.context = :paragraph first_block.style = nil @@ -399,7 +399,7 @@ class Parser # # reader - The Reader from which to retrieve the next block # parent - The Document, Section or Block to which the next block belongs - # + # # Returns a Section or Block object holding the parsed content of the processed lines #-- # QUESTION should next_block have an option for whether it should keep looking until @@ -418,7 +418,7 @@ class Parser options.delete(:text) text_only = false end - + parse_metadata = options.fetch(:parse_metadata, true) #parse_sections = options.fetch(:parse_sections, false) @@ -827,7 +827,7 @@ class Parser when :literal block = build_block(block_context, :verbatim, terminator, parent, reader, attributes) - + when :pass block = build_block(block_context, :raw, terminator, parent, reader, attributes) @@ -1071,7 +1071,7 @@ class Parser adjust_indentation! lines, indent, (attributes['tabsize'] || parent.document.attributes['tabsize']) elsif (tab_size = (attributes['tabsize'] || parent.document.attributes['tabsize']).to_i) > 0 adjust_indentation! lines, nil, tab_size - end + end end if (extension = options[:extension]) @@ -1318,7 +1318,7 @@ class Parser if list_item_reader.has_more_lines? comment_lines = list_item_reader.skip_line_comments subsequent_line = list_item_reader.peek_line - list_item_reader.unshift_lines comment_lines unless comment_lines.empty? + list_item_reader.unshift_lines comment_lines unless comment_lines.empty? if !subsequent_line.nil? continuation_connects_first_block = subsequent_line.empty? @@ -1367,7 +1367,7 @@ class Parser # # reader - The Reader from which to retrieve the lines. # list_type - The Symbol context of the list (:ulist, :olist, :colist or :dlist) - # sibling_trait - A Regexp that matches a sibling of this list item or String list marker + # sibling_trait - A Regexp that matches a sibling of this list item or String list marker # of the items in this list (default: nil) # has_text - Whether the list item has text defined inline (always true except for labeled lists) # @@ -1377,7 +1377,7 @@ class Parser # three states for continuation: :inactive, :active & :frozen # :frozen signifies we've detected sequential continuation lines & - # continuation is not permitted until reset + # continuation is not permitted until reset continuation = :inactive # if we are within a nested list, we don't throw away the list @@ -1437,7 +1437,7 @@ class Parser break else if continuation == :active && !this_line.empty? - # literal paragraphs have special considerations (and this is one of + # literal paragraphs have special considerations (and this is one of # two entry points into one) # if we don't process it as a whole, then a line in it that looks like a # list item will throw off the exit from it @@ -1470,7 +1470,7 @@ class Parser # advance to the next line of content if this_line.empty? reader.skip_blank_lines - this_line = reader.read_line + this_line = reader.read_line # if we hit eof or a sibling, stop reading break if this_line.nil? || is_sibling_list_item?(this_line, list_type, sibling_trait) end @@ -1827,7 +1827,7 @@ class Parser rev_metadata = {} if reader.has_more_lines? && !reader.next_line_empty? - rev_line = reader.read_line + rev_line = reader.read_line if (match = RevisionInfoLineRx.match(rev_line)) rev_metadata['revnumber'] = match[1].rstrip if match[1] unless (component = match[2].strip) == '' @@ -2180,7 +2180,7 @@ class Parser # Parser.resolve_ordered_list_marker(marker, 1, true) # # => 'A.' # - # Returns the String of the first marker in this number series + # Returns the String of the first marker in this number series def self.resolve_ordered_list_marker(marker, ordinal = 0, validate = false, reader = nil) number_style = ORDERED_LIST_STYLES.detect {|s| OrderedListMarkerRxMap[s] =~ marker } expected = actual = nil @@ -2231,7 +2231,7 @@ class Parser # # line - The String line to check # list_type - The context of the list (:olist, :ulist, :colist, :dlist) - # sibling_trait - The String marker for the list or the Regexp to match a sibling + # sibling_trait - The String marker for the list or the Regexp to match a sibling # # Returns a Boolean indicating whether this line is a sibling list item given # the criteria provided @@ -2386,7 +2386,7 @@ class Parser # # The column specs dictate the number of columns, relative # width of columns, default alignments for cells in each - # column, and/or default styles or filters applied to the cells in + # column, and/or default styles or filters applied to the cells in # the column. # # Every column spec is guaranteed to have a width @@ -2448,7 +2448,7 @@ class Parser # The default spec when pos == :end is {} since we already know we're at a # delimiter. When pos == :start, we *may* be at a delimiter, nil indicates # we're not. - # + # # returns the Hash of attributes that indicate how to layout # and style this cell in the table. def self.parse_cell_spec(line, pos = :start, delimiter = nil) @@ -2489,7 +2489,7 @@ class Parser spec['repeatcol'] = colspec unless colspec == 1 end end - + if m[3] colspec, rowspec = m[3].split '.' if !colspec.nil_or_empty? && Table::ALIGNMENTS[:h].has_key?(colspec) @@ -2577,7 +2577,7 @@ class Parser collector.push c end end - + # small optimization if no shorthand is found if type == :style parsed_style = attributes['style'] = raw_style @@ -2603,7 +2603,7 @@ class Parser attributes[%(#{option}-option)] = '' end if (existing_opts = attributes['options']) - attributes['options'] = (options + existing_opts.split(',')) * ',' + attributes['options'] = (options + existing_opts.split(',')) * ',' else attributes['options'] = options * ',' end @@ -2748,7 +2748,7 @@ class Parser value = value.downcase digits = { 'i' => 1, 'v' => 5, 'x' => 10 } result = 0 - + (0..value.length - 1).each {|i| digit = digits[value[i..i]] if i + 1 < value.length && digits[value[i+1..i+1]] > digit diff --git a/lib/asciidoctor/path_resolver.rb b/lib/asciidoctor/path_resolver.rb index 60932dce..3db77a30 100644 --- a/lib/asciidoctor/path_resolver.rb +++ b/lib/asciidoctor/path_resolver.rb @@ -96,7 +96,7 @@ module Asciidoctor # begin # resolver.system_path('images', '/etc', '/path/to/docs') # rescue SecurityError => e -# puts e.message +# puts e.message # end # => Start path /etc is outside of jail: /path/to/docs' # @@ -167,7 +167,7 @@ class PathResolver def is_web_root? path path.start_with? SLASH end - + # Public: Normalize path by converting any backslashes to forward slashes # # path - the String path to normalize @@ -198,7 +198,7 @@ class PathResolver path_segments, path_root, _ = partition_path path join_path path_segments, path_root end - + # Public: Partition the path into path segments and remove any empty segments # or segments that are self references (.). The path is converted to a posix # path before being partitioned. @@ -211,7 +211,7 @@ class PathResolver # path root (e.g., '/', './', 'c:/') if the path is absolute and the posix # version of the path. #-- - # QUESTION is it worth it to normalize slashes? it doubles the time elapsed + # QUESTION is it worth it to normalize slashes? it doubles the time elapsed def partition_path path, web_path = false if (result = web_path ? @_partition_path_web[path] : @_partition_path_sys[path]) return result @@ -265,7 +265,7 @@ class PathResolver #posix_path = posix_path.chomp '/' (web_path ? @_partition_path_web : @_partition_path_sys)[path] = [path_segments, root, posix_path] end - + # Public: Join the segments using the posix file separator (since Ruby knows # how to work with paths specified this way, regardless of OS). Use the root, # if specified, to construct an absolute path. Otherwise join the segments as @@ -283,7 +283,7 @@ class PathResolver segments * SLASH end end - + # Public: Resolve a system path from the target and start paths. If a jail # path is specified, enforce that the resolved directory is contained within # the jail path. If a jail path is not provided, the resolved path may be @@ -313,7 +313,7 @@ class PathResolver if target.nil_or_empty? target_segments = [] else - target_segments, target_root, _ = partition_path target + target_segments, target_root, _ = partition_path target end if target_segments.empty? @@ -327,7 +327,7 @@ class PathResolver return system_path start, jail, jail, opts end end - + if target_root && target_root != DOT_SLASH resolved_target = join_path target_segments, target_root # if target is absolute and a sub-directory of jail, or @@ -336,7 +336,7 @@ class PathResolver return resolved_target end end - + if start.nil_or_empty? start = jail ? jail : @working_dir elsif is_root? start @@ -344,7 +344,7 @@ class PathResolver else start = system_path start, jail, jail, opts end - + # both jail and start have been posixfied at this point if jail == start jail_segments, jail_root, _ = partition_path jail @@ -354,9 +354,9 @@ class PathResolver raise ::SecurityError, %(#{opts[:target_name] || 'Start path'} #{start} is outside of jail: #{jail} (disallowed in safe mode)) end - start_segments, start_root, _ = partition_path start + start_segments, start_root, _ = partition_path start jail_segments, jail_root, _ = partition_path jail - + # Already checked for this condition #if start_root != jail_root # raise ::SecurityError, %(Jail root #{jail_root} does not match root of #{opts[:target_name] || 'start path'}: #{start_root}) @@ -365,7 +365,7 @@ class PathResolver start_segments, start_root, _ = partition_path start jail_root = start_root end - + resolved_segments = start_segments.dup warned = false target_segments.each do |segment| @@ -386,7 +386,7 @@ class PathResolver resolved_segments.push segment end end - + join_path resolved_segments, jail_root end diff --git a/lib/asciidoctor/reader.rb b/lib/asciidoctor/reader.rb index fc482af6..993e51fd 100644 --- a/lib/asciidoctor/reader.rb +++ b/lib/asciidoctor/reader.rb @@ -7,7 +7,7 @@ class Reader attr_accessor :dir attr_accessor :path attr_accessor :lineno - + def initialize file, dir = nil, path = nil, lineno = nil @file = file @dir = dir @@ -445,7 +445,7 @@ class Reader skip_comments = options[:skip_line_comments] line_read = false line_restored = false - + complete = false while !complete && (line = read_line) complete = while true @@ -1080,7 +1080,7 @@ class PreprocessorReader < Reader end def include_depth - @include_stack.size + @include_stack.size end def exceeded_max_depth? diff --git a/lib/asciidoctor/section.rb b/lib/asciidoctor/section.rb index 38f935f0..51f5a35a 100644 --- a/lib/asciidoctor/section.rb +++ b/lib/asciidoctor/section.rb @@ -97,7 +97,7 @@ class Section < AbstractBlock while @document.references[:ids].has_key? gen_id gen_id = "#{base_id}#{sep}#{cnt}" cnt += 1 - end + end gen_id else nil diff --git a/lib/asciidoctor/substitutors.rb b/lib/asciidoctor/substitutors.rb index 26545df9..006dd56b 100644 --- a/lib/asciidoctor/substitutors.rb +++ b/lib/asciidoctor/substitutors.rb @@ -1303,12 +1303,12 @@ module Substitutors current.push c end end - + values << current.join.strip else values = str.split(',').map {|it| it.strip } end - + values end diff --git a/lib/asciidoctor/table.rb b/lib/asciidoctor/table.rb index aba984fa..bd900ede 100644 --- a/lib/asciidoctor/table.rb +++ b/lib/asciidoctor/table.rb @@ -42,7 +42,7 @@ class Table < AbstractBlock 'v' => :verse, 'a' => :asciidoc } - + # Public: A Hash mapping alignment abbreviations to alignments (horizontal # and vertial) that can be applies to a table column or cell ALIGNMENTS = { @@ -139,7 +139,7 @@ class Table < AbstractBlock if num_body_rows > 0 && attributes.key?('footer-option') @rows.foot = [@rows.body.pop] end - + nil end end @@ -348,7 +348,7 @@ class Table::ParserContext # Public: Determines whether the buffer has unclosed quotes. Used for CSV data. # - # returns true if the buffer has unclosed quotes, false if it doesn't or it + # returns true if the buffer has unclosed quotes, false if it doesn't or it # isn't quoted data def buffer_has_unclosed_quotes?(append = nil) record = %(#{@buffer}#{append}).strip @@ -455,7 +455,7 @@ class Table::ParserContext # unquote cell_text = cell_text[1...-1].strip end - + # collapses escaped quotes cell_text = cell_text.tr_s('"', '"') end diff --git a/test/attributes_test.rb b/test/attributes_test.rb index ed59c59c..fe824850 100644 --- a/test/attributes_test.rb +++ b/test/attributes_test.rb @@ -349,10 +349,10 @@ toc toc-placement! | |content |macro |nil raw_attrs, toc, toc_position, toc_placement, toc_class = expect attrs = Hash[*(raw_attrs.split ' ').map {|e| e.include?('=') ? e.split('=') : [e, ''] }.flatten] doc = document_from_string '', :attributes => attrs - toc ? (assert doc.attr?('toc', toc)) : (assert !doc.attr?('toc')) - toc_position ? (assert doc.attr?('toc-position', toc_position)) : (assert !doc.attr?('toc-position')) - toc_placement ? (assert doc.attr?('toc-placement', toc_placement)) : (assert !doc.attr?('toc-placement')) - toc_class ? (assert doc.attr?('toc-class', toc_class)) : (assert !doc.attr?('toc-class')) + toc ? (assert doc.attr?('toc', toc)) : (assert !doc.attr?('toc')) + toc_position ? (assert doc.attr?('toc-position', toc_position)) : (assert !doc.attr?('toc-position')) + toc_placement ? (assert doc.attr?('toc-placement', toc_placement)) : (assert !doc.attr?('toc-placement')) + toc_class ? (assert doc.attr?('toc-class', toc_class)) : (assert !doc.attr?('toc-class')) end end end @@ -618,7 +618,7 @@ Belly up to the {foo}. test 'does not substitute attributes inside listing blocks' do input = <<-EOS -:forecast: snow +:forecast: snow ---- puts 'The forecast for today is {forecast}' @@ -668,22 +668,22 @@ of the attribute named foo in your document. end test 'assigns attribute defined in attribute reference with set prefix and value' do - input = '{set:foo:bar}{foo}' - output = render_embedded_string input + input = '{set:foo:bar}{foo}' + output = render_embedded_string input assert_xpath '//p', output, 1 assert_xpath '//p[text()="bar"]', output, 1 end test 'assigns attribute defined in attribute reference with set prefix and no value' do input = "{set:foo}\n{foo}yes" - output = render_embedded_string input + output = render_embedded_string input assert_xpath '//p', output, 1 assert_xpath '//p[normalize-space(text())="yes"]', output, 1 end test 'assigns attribute defined in attribute reference with set prefix and empty value' do input = "{set:foo:}\n{foo}yes" - output = render_embedded_string input + output = render_embedded_string input assert_xpath '//p', output, 1 assert_xpath '//p[normalize-space(text())="yes"]', output, 1 end @@ -793,7 +793,7 @@ of the attribute named foo in your document. assert_equal 'A', doc.attributes['mycounter'] assert_xpath '//p[text()="A"]', output, 2 end - + test 'counter uses 0 as seed value if seed attribute is nil' do input = <<-EOS :mycounter: @@ -836,11 +836,11 @@ content EOS block = block_from_string input - assert_equal 'bar', block.attr('foo') - assert_equal '_bar', block.attr('_foo') - assert_equal 'bar1', block.attr('foo1') - assert_equal 'bar-bar', block.attr('foo-foo') - assert_equal 'bar.bar', block.attr('foo.foo') + assert_equal 'bar', block.attr('foo') + assert_equal '_bar', block.attr('_foo') + assert_equal 'bar1', block.attr('foo1') + assert_equal 'bar-bar', block.attr('foo-foo') + assert_equal 'bar.bar', block.attr('foo.foo') end test 'positional attributes assigned to block' do @@ -1069,7 +1069,7 @@ Text test 'a role can be added using add_role when the node has no roles' do input = <<-EOS -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1081,7 +1081,7 @@ A normal paragraph test 'a role can be added using add_role when the node already has a role' do input = <<-EOS [.role1] -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1094,7 +1094,7 @@ A normal paragraph test 'a role is not added using add_role if the node already has that role' do input = <<-EOS [.role1] -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1106,7 +1106,7 @@ A normal paragraph test 'an existing role can be removed using remove_role' do input = <<-EOS [.role1.role2] -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1119,7 +1119,7 @@ A normal paragraph test 'roles are not changed when a non-existent role is removed using remove_role' do input = <<-EOS [.role1] -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1131,7 +1131,7 @@ A normal paragraph test 'roles are not changed when using remove_role if the node has no roles' do input = <<-EOS -A normal paragraph +A normal paragraph EOS doc = document_from_string(input) para = doc.blocks.first @@ -1223,7 +1223,7 @@ Reference Manual preamble EOS doc = document_from_string input - assert_equal 'reference', doc.id + assert_equal 'reference', doc.id assert_equal 'refguide', doc.attr('css-signature') output = doc.render assert_xpath '//body[@id="reference"]', output, 1 diff --git a/test/blocks_test.rb b/test/blocks_test.rb index 8b532242..f0c04350 100644 --- a/test/blocks_test.rb +++ b/test/blocks_test.rb @@ -486,7 +486,7 @@ La la la <1> ____ <1> Not pointing to a callout EOS - + output = render_embedded_string input assert_xpath '//pre[text()="La la la <1>"]', output, 1 end @@ -675,7 +675,7 @@ listing content ---- paragraph 2 EOS - + output = render_embedded_string input assert_xpath '/*[@class="paragraph"]/p', output, 2 assert_xpath '/*[@class="listingblock"]', output, 1 @@ -1402,7 +1402,7 @@ section paragraph .Block title = Document Title -== First Section +== First Section paragraph EOS @@ -1740,7 +1740,7 @@ image::{bogus}[] output = render_embedded_string input assert_css 'img', output, 0 - assert_css 'h2', output, 1 + assert_css 'h2', output, 1 assert !output.include?('== Section Title') end @@ -1790,7 +1790,7 @@ image::http://#{resolve_localhost}:9876/fixtures/dot.gif[Dot] output = using_test_webserver do render_embedded_string input, :safe => :safe, :attributes => {'allow-uri-read' => ''} end - + assert_xpath '//img[@src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="][@alt="Dot"]', output, 1 end @@ -1805,7 +1805,7 @@ image::dot.gif[Dot] output = using_test_webserver do render_embedded_string input, :safe => :safe, :attributes => {'allow-uri-read' => ''} end - + assert_xpath '//img[@src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="][@alt="Dot"]', output, 1 end @@ -1820,7 +1820,7 @@ image::#{image_uri}[Missing image] output = using_test_webserver do render_embedded_string input, :safe => :safe, :attributes => {'allow-uri-read' => ''} end - + assert_xpath %(/*[@class="imageblock"]//img[@src="#{image_uri}"][@alt="Missing image"]), output, 1 end @@ -1835,7 +1835,7 @@ image::#{image_uri}[Dot] output = using_test_webserver do render_embedded_string input, :safe => :safe end - + assert_xpath %(/*[@class="imageblock"]//img[@src="#{image_uri}"][@alt="Dot"]), output, 1 end @@ -1985,7 +1985,7 @@ video::http://example.org/videos/cats-vs-dogs.avi[] assert_css 'video', output, 1 assert_css 'video[src="http://example.org/videos/cats-vs-dogs.avi"]', output, 1 end - + test 'video macro should output custom HTML with iframe for vimeo service' do input = <<-EOS video::67480300[vimeo, 400, 300, start=60, options=autoplay] @@ -2248,7 +2248,7 @@ puts "Hello, World!" assert_css '.listingblock pre code', output, 1 assert_css '.listingblock pre code:not([class])', output, 1 end - + test 'should not recognize fenced code blocks with more than three delimiters' do input = <<-EOS ````ruby diff --git a/test/converter_test.rb b/test/converter_test.rb index 15fa184d..0bb82926 100644 --- a/test/converter_test.rb +++ b/test/converter_test.rb @@ -317,7 +317,7 @@ content EOS begin - Asciidoctor::Converter::Factory.unregister_all + Asciidoctor::Converter::Factory.unregister_all class CustomConverterB include Asciidoctor::Converter @@ -333,7 +333,7 @@ content output = render_string input, :backend => 'foobar' assert 'foobar content', output ensure - Asciidoctor::Converter::Factory.unregister_all + Asciidoctor::Converter::Factory.unregister_all end end @@ -343,7 +343,7 @@ content EOS begin - Asciidoctor::Converter::Factory.unregister_all + Asciidoctor::Converter::Factory.unregister_all class CustomConverterC include Asciidoctor::Converter @@ -358,7 +358,7 @@ content output = render_string input, :backend => 'foobaz' assert 'foobaz content', output ensure - Asciidoctor::Converter::Factory.unregister_all + Asciidoctor::Converter::Factory.unregister_all end end end diff --git a/test/document_test.rb b/test/document_test.rb index 0f4f87dd..2419dc29 100644 --- a/test/document_test.rb +++ b/test/document_test.rb @@ -72,7 +72,7 @@ context 'Document' do doc = empty_document begin doc.safe = Asciidoctor::SafeMode::UNSAFE - flunk 'safe mode property of Asciidoctor::Document should not be writable!' + flunk 'safe mode property of Asciidoctor::Document should not be writable!' rescue end end @@ -304,7 +304,7 @@ preamble assert_equal 'sample.asciidoc', section_2.file assert_equal 18, section_2.lineno - last_block = section_2.blocks[-1] + last_block = section_2.blocks[-1] assert_equal :ulist, last_block.context refute_nil last_block.source_location assert_equal 'sample.asciidoc', last_block.file @@ -1219,7 +1219,7 @@ content assert_equal 1, nodes.size assert_match('<h1><strong>Document</strong> <span class="image"><img src="logo.png" alt="logo"></span> <em>Title</em> <span class="image"><img src="another-logo.png" alt="another logo"></span></h1>', output) end - + test 'should not choke on empty source' do doc = Asciidoctor::Document.new '' assert doc.blocks.empty? @@ -1560,7 +1560,7 @@ Text that has supporting information{empty}footnote:[An example footnote.]. end end - context 'Backends and Doctypes' do + context 'Backends and Doctypes' do test 'html5 backend doctype article' do result = render_string("= Title\n\nparagraph", :attributes => {'backend' => 'html5'}) assert_xpath '/html', result, 1 @@ -2034,7 +2034,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats EOS doc = document_from_string input - synopsis_section = doc.blocks.first + synopsis_section = doc.blocks.first refute_nil synopsis_section assert_equal :section, synopsis_section.context assert synopsis_section.special diff --git a/test/extensions_test.rb b/test/extensions_test.rb index aa6eb07b..0fa87cb1 100644 --- a/test/extensions_test.rb +++ b/test/extensions_test.rb @@ -276,7 +276,7 @@ context 'Extensions' do ensure Asciidoctor::Extensions.unregister_all end - + end end @@ -444,7 +444,7 @@ after Asciidoctor::Extensions.unregister_all end end - + test 'should call include processor to process include directive' do input = <<-EOS first line diff --git a/test/invoker_test.rb b/test/invoker_test.rb index 8f80bcbc..6e03ef1e 100644 --- a/test/invoker_test.rb +++ b/test/invoker_test.rb @@ -194,7 +194,7 @@ context 'Invoker' do destination_path = File.expand_path(File.join(File.dirname(__FILE__), 'test_output')) sample_outpath = File.join(destination_path, 'sample.html') begin - FileUtils.mkdir_p(destination_path) + FileUtils.mkdir_p(destination_path) # QUESTION should -D be relative to working directory or source directory? invoker = invoke_cli %w(-D test/test_output) #invoker = invoke_cli %w(-D ../../test/test_output) @@ -481,7 +481,7 @@ context 'Invoker' do test 'default mode for cli should be unsafe' do invoker = invoke_cli_to_buffer %w(-o /dev/null) doc = invoker.document - assert_equal Asciidoctor::SafeMode::UNSAFE, doc.safe + assert_equal Asciidoctor::SafeMode::UNSAFE, doc.safe end test 'should set safe mode if specified' do @@ -529,7 +529,7 @@ context 'Invoker' do assert !stdout_lines.empty? stdout_lines.each {|l| l.force_encoding Encoding::UTF_8 } if Asciidoctor::FORCE_ENCODING stdout_str = stdout_lines.join - assert stdout_str.include?('Codierungen sind verrückt auf älteren Versionen von Ruby') + assert stdout_str.include?('Codierungen sind verrückt auf älteren Versionen von Ruby') ensure ENV['LANG'] = old_lang end diff --git a/test/links_test.rb b/test/links_test.rb index 42339677..e8b8f1d9 100644 --- a/test/links_test.rb +++ b/test/links_test.rb @@ -85,7 +85,7 @@ context 'Links' do end test 'qualified url following smart apostrophe' do - output = render_embedded_string("l’http://www.irit.fr[IRIT]") + output = render_embedded_string("l’http://www.irit.fr[IRIT]") assert_match(/l’<a href=/, output) end @@ -317,7 +317,7 @@ context 'Links' do <\<_section_a>> EOS - + output = render_embedded_string input assert_xpath '//h2[@id="_section_a"][text()="Section A"]', output, 1 assert_xpath '//a[@href="#_section_a"][text()="Section A"]', output, 1 diff --git a/test/lists_test.rb b/test/lists_test.rb index 1feefc08..eb000708 100644 --- a/test/lists_test.rb +++ b/test/lists_test.rb @@ -352,7 +352,7 @@ paragraph in list item 1 - list item 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'ul', output, 1 assert_css 'ul li', output, 2 assert_xpath '(//ul/li)[1]/p[text()="list item 1"]', output, 1 @@ -1079,7 +1079,7 @@ Lists ---- 5.times { print "Odelay!" } ---- - + * Item two EOS output = render_string input @@ -1099,7 +1099,7 @@ Lists * Item one, paragraph one + [source] - + * Item two EOS output = render_string input @@ -1117,7 +1117,7 @@ Lists * Item one, paragraph one + .Disappears into the ether - + * Item two EOS output = render_string input @@ -1218,7 +1218,7 @@ paragraph for list item 1 . list item 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist ol', output, 1 assert_css '.olist ol > li', output, 2 assert_css '.ulist ul', output, 1 @@ -1251,7 +1251,7 @@ bullet 1 paragraph * bullet 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_xpath '(//ul)[1]/li', output, 2 @@ -1292,7 +1292,7 @@ paragraph for list item 1 . list item 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist ol', output, 1 assert_css '.olist ol > li', output, 2 assert_css '.ulist ul', output, 1 @@ -1333,7 +1333,7 @@ paragraph for list item 1 . list item 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist ol', output, 1 assert_css '.olist ol > li', output, 2 assert_css '.ulist ul', output, 1 @@ -1375,7 +1375,7 @@ paragraph for list item 1 . list item 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist ol', output, 1 assert_css '.olist ol > li', output, 2 assert_css '.ulist ul', output, 1 @@ -1417,7 +1417,7 @@ bullet 1 paragraph * bullet 2 EOS - output = render_embedded_string input + output = render_embedded_string input assert_xpath '((//ul)[1]/li[1])/*', output, 3 assert_xpath '(((//ul)[1]/li[1])/*)[1]/self::p[text()="bullet 1"]', output, 1 @@ -1577,7 +1577,7 @@ List . Refactor! EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist.arabic.dry', output, 1 assert_css '.olist ol.arabic', output, 1 end @@ -1590,7 +1590,7 @@ List . Refactor! EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist.loweralpha.dry', output, 1 assert_css '.olist ol.loweralpha', output, 1 end @@ -1603,7 +1603,7 @@ List . Refactor! EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist.arabic.dry', output, 1 assert_css '.olist ol.arabic', output, 1 end @@ -1616,7 +1616,7 @@ List . Refactor! EOS - output = render_embedded_string input + output = render_embedded_string input assert_css '.olist.loweralpha.dry', output, 1 assert_css '.olist ol.loweralpha', output, 1 end @@ -2598,7 +2598,7 @@ definition last:: EOS - output = render_embedded_string input + output = render_embedded_string input assert_xpath '//tr', output, 2 assert_xpath '(//tr)[1]/td[@class="hdlist1"]', output, 1 # NOTE I'm trimming the trailing <br> in Asciidoctor @@ -2616,7 +2616,7 @@ definition last:: EOS - output = render_embedded_string input, :backend => 'docbook' + output = render_embedded_string input, :backend => 'docbook' assert_xpath '//row', output, 2 assert_xpath '(//row)[1]/entry', output, 2 assert_xpath '((//row)[1]/entry)[1]/simpara', output, 2 @@ -2762,13 +2762,13 @@ context 'Description lists redux' do term1:: def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text from first line after blank lines' do input = <<-EOS == Lists @@ -2778,13 +2778,13 @@ term1:: def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text from first line after blank line and immediately preceding next item' do input = <<-EOS == Lists @@ -2794,7 +2794,7 @@ term1:: def1 term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 2 @@ -2811,14 +2811,14 @@ def1 term2:: def2 EOS - + output = render_embedded_string input assert_css 'dl', output, 1 assert_css 'dl > dt', output, 2 assert_css 'dl > dd', output, 2 assert_xpath '(//dl/dd)[1]/p[text()="def1"]', output, 1 end - + test 'folds text from first line after comment line' do input = <<-EOS == Lists @@ -2827,13 +2827,13 @@ term1:: // comment def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text from line following comment line offset by blank line' do input = <<-EOS == Lists @@ -2843,13 +2843,13 @@ term1:: // comment def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text from subsequent indented line' do input = <<-EOS == Lists @@ -2857,13 +2857,13 @@ def1 term1:: def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text from indented line after blank line' do input = <<-EOS == Lists @@ -2872,13 +2872,13 @@ term1:: def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 end - + test 'folds text that looks like ruler offset by blank line' do input = <<-EOS == Lists @@ -2887,13 +2887,13 @@ term1:: ''' EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="'''"]), output, 1 end - + test 'folds text that looks like ruler offset by blank line and line comment' do input = <<-EOS == Lists @@ -2903,13 +2903,13 @@ term1:: // comment ''' EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="'''"]), output, 1 end - + test 'folds text that looks like ruler and the line following it offset by blank line' do input = <<-EOS == Lists @@ -2919,13 +2919,13 @@ term1:: ''' continued EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[normalize-space(text())="''' continued"]), output, 1 end - + test 'folds text that looks like title offset by blank line' do input = <<-EOS == Lists @@ -2934,13 +2934,13 @@ term1:: .def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()=".def1"]', output, 1 end - + test 'folds text that looks like title offset by blank line and line comment' do input = <<-EOS == Lists @@ -2950,13 +2950,13 @@ term1:: // comment .def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()=".def1"]', output, 1 end - + test 'folds text that looks like admonition offset by blank line' do input = <<-EOS == Lists @@ -2965,7 +2965,7 @@ term1:: NOTE: def1 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -2980,14 +2980,14 @@ term1:: == Another Section EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="== Another Section"]', output, 1 assert_xpath '//h2', output, 1 end - + test 'folds text of first literal line offset by blank line appends subsequent literals offset by blank line as blocks' do input = <<-EOS == Lists @@ -3001,7 +3001,7 @@ term1:: literal EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3009,7 +3009,7 @@ term1:: assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="literalblock"]', output, 2 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 2 end - + test 'folds text of subsequent line and appends following literal line offset by blank line as block if term has no inline definition' do input = <<-EOS == Lists @@ -3021,7 +3021,7 @@ def1 term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 2 @@ -3029,7 +3029,7 @@ term2:: def2 assert_xpath '(//*[@class="dlist"]//dd)[1]/p/following-sibling::*[@class="literalblock"]', output, 1 assert_xpath '(//*[@class="dlist"]//dd)[1]/p/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 1 end - + test 'appends literal line attached by continuation as block if item has no inline definition' do input = <<-EOS == Lists @@ -3038,7 +3038,7 @@ term1:: + literal EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3046,7 +3046,7 @@ term1:: assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]//pre[text()="literal"]', output, 1 end - + test 'appends literal line attached by continuation as block if item has no inline definition followed by ruler' do input = <<-EOS == Lists @@ -3057,7 +3057,7 @@ term1:: ''' EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3066,7 +3066,7 @@ term1:: assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]//pre[text()="literal"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::hr', output, 1 end - + test 'appends line attached by continuation as block if item has no inline definition followed by ruler' do input = <<-EOS == Lists @@ -3077,7 +3077,7 @@ para ''' EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3086,7 +3086,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]/p[text()="para"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::hr', output, 1 end - + test 'appends line attached by continuation as block if item has no inline definition followed by block' do input = <<-EOS == Lists @@ -3099,7 +3099,7 @@ para literal .... EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3109,7 +3109,7 @@ literal assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="literalblock"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 1 end - + test 'appends block attached by continuation but not subsequent block not attached by continuation' do input = <<-EOS == Lists @@ -3123,7 +3123,7 @@ literal detached .... EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3133,7 +3133,7 @@ detached assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="literalblock"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="literalblock"]//pre[text()="detached"]', output, 1 end - + test 'appends list if item has no inline definition' do input = <<-EOS == Lists @@ -3144,14 +3144,14 @@ term1:: * two * three EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath '//*[@class="dlist"]//dd/p', output, 0 assert_xpath '//*[@class="dlist"]//dd//ul/li', output, 3 end - + test 'appends list to first term when followed immediately by second term' do input = <<-EOS == Lists @@ -3163,7 +3163,7 @@ term1:: * three term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 2 @@ -3227,7 +3227,7 @@ paragraph assert_xpath '(//*[@class="dlist"]//dd)[1]/p/following-sibling::*[@class="ulist"]//li', output, 3 assert_css '.dlist + .paragraph', output, 1 end - + test 'appends list and paragraph block when line following list attached by continuation' do input = <<-EOS == Lists @@ -3241,7 +3241,7 @@ term1:: + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3251,7 +3251,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="ulist"]/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="ulist"]/following-sibling::*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'first continued line associated with nested list item and second continued line associated with term' do input = <<-EOS == Lists @@ -3264,7 +3264,7 @@ nested list para + term1 para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3275,7 +3275,7 @@ term1 para assert_xpath '//*[@class="dlist"]//dd/*[@class="ulist"]/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="ulist"]/following-sibling::*[@class="paragraph"]/p[text()="term1 para"]', output, 1 end - + test 'literal line attached by continuation swallows adjacent line that looks like term' do input = <<-EOS == Lists @@ -3288,7 +3288,7 @@ notnestedterm::: literal notnestedterm::: EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3296,7 +3296,7 @@ notnestedterm::: assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]', output, 2 assert_xpath %(//*[@class="dlist"]//dd/*[@class="literalblock"]//pre[text()=" literal\nnotnestedterm:::"]), output, 2 end - + test 'line attached by continuation is appended as paragraph if term has no inline definition' do input = <<-EOS == Lists @@ -3305,7 +3305,7 @@ term1:: + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3362,7 +3362,7 @@ not a term::: def assert_css '.dlist > dl > dd > .quoteblock', output, 1 assert output.include?('not a term::: def') end - + test 'appends line as paragraph if attached by continuation following blank line and line comment when term has no inline definition' do input = <<-EOS == Lists @@ -3373,7 +3373,7 @@ term1:: + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3381,7 +3381,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'line attached by continuation offset by blank line is appended as paragraph if term has no inline definition' do input = <<-EOS == Lists @@ -3391,7 +3391,7 @@ term1:: + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3399,7 +3399,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'delimited block breaks list even when term has no inline definition' do input = <<-EOS == Lists @@ -3409,14 +3409,14 @@ term1:: detached ==== EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 0 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="exampleblock"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="exampleblock"]//p[text()="detached"]', output, 1 end - + test 'attribute line breaks list even when term has no inline definition' do input = <<-EOS == Lists @@ -3425,14 +3425,14 @@ term1:: [verse] detached EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 0 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="verseblock"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="verseblock"]/pre[text()="detached"]', output, 1 end - + test 'id line breaks list even when term has no inline definition' do input = <<-EOS == Lists @@ -3441,7 +3441,7 @@ term1:: [[id]] detached EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 0 @@ -3459,13 +3459,13 @@ detached term1:: def1 continued EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1 end - + test 'folds text from inline definition and subsequent lines' do input = <<-EOS == Lists @@ -3474,13 +3474,13 @@ term1:: def1 continued continued EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued\ncontinued"]), output, 1 end - + test 'folds text from inline definition and line following comment line' do input = <<-EOS == Lists @@ -3489,13 +3489,13 @@ term1:: def1 // comment continued EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1 end - + test 'folds text from inline definition and subsequent indented line' do input = <<-EOS == Lists @@ -3503,13 +3503,13 @@ continued term1:: def1 continued EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 assert_xpath %(//*[@class="dlist"]//dd/p[text()="def1\ncontinued"]), output, 1 end - + test 'appends literal line offset by blank line as block if item has inline definition' do input = <<-EOS == Lists @@ -3518,7 +3518,7 @@ term1:: def1 literal EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3526,7 +3526,7 @@ term1:: def1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="literalblock"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 1 end - + test 'appends literal line offset by blank line as block and appends line after continuation as block if item has inline definition' do input = <<-EOS == Lists @@ -3537,7 +3537,7 @@ term1:: def1 + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3547,7 +3547,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="literalblock"]/following-sibling::*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'appends line after continuation as block and literal line offset by blank line as block if item has inline definition' do input = <<-EOS == Lists @@ -3558,7 +3558,7 @@ para literal EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3568,7 +3568,7 @@ para assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]/following-sibling::*[@class="literalblock"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/*[@class="paragraph"]/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 1 end - + test 'appends list if item has inline definition' do input = <<-EOS == Lists @@ -3579,14 +3579,14 @@ term1:: def1 * two * three EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd/p[text()="def1"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="ulist"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="ulist"]/ul/li', output, 3 end - + test 'appends literal line attached by continuation as block if item has inline definition followed by ruler' do input = <<-EOS == Lists @@ -3597,7 +3597,7 @@ term1:: def1 ''' EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3606,7 +3606,7 @@ term1:: def1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="literalblock"]//pre[text()="literal"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::hr', output, 1 end - + test 'line offset by blank line breaks list if term has inline definition' do input = <<-EOS == Lists @@ -3615,7 +3615,7 @@ term1:: def1 detached EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3648,7 +3648,7 @@ Detached assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="sect2"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="sect2"]/h3[text()="Detached"]', output, 1 end - + test 'line attached by continuation is appended as paragraph if term has inline definition followed by detached paragraph' do input = <<-EOS == Lists @@ -3659,7 +3659,7 @@ para detached EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3669,7 +3669,7 @@ detached assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph"]/p[text()="detached"]', output, 1 end - + test 'line attached by continuation is appended as paragraph if term has inline definition followed by detached block' do input = <<-EOS == Lists @@ -3682,7 +3682,7 @@ para detached **** EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3692,7 +3692,7 @@ detached assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="sidebarblock"]', output, 1 assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="sidebarblock"]//p[text()="detached"]', output, 1 end - + test 'line attached by continuation offset by line comment is appended as paragraph if term has inline definition' do input = <<-EOS == Lists @@ -3702,7 +3702,7 @@ term1:: def1 + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3710,7 +3710,7 @@ para assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'line attached by continuation offset by blank line is appended as paragraph if term has inline definition' do input = <<-EOS == Lists @@ -3720,7 +3720,7 @@ term1:: def1 + para EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 1 assert_xpath '//*[@class="dlist"]//dd', output, 1 @@ -3728,7 +3728,7 @@ para assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="paragraph"]', output, 1 assert_xpath '//*[@class="dlist"]//dd/p/following-sibling::*[@class="paragraph"]/p[text()="para"]', output, 1 end - + test 'line comment offset by blank line divides lists because item has text' do input = <<-EOS == Lists @@ -3739,11 +3739,11 @@ term1:: def1 term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 2 end - + test 'ruler offset by blank line divides lists because item has text' do input = <<-EOS == Lists @@ -3754,11 +3754,11 @@ term1:: def1 term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 2 end - + test 'block title offset by blank line divides lists and becomes title of second list because item has text' do input = <<-EOS == Lists @@ -3769,7 +3769,7 @@ term1:: def1 term2:: def2 EOS - + output = render_embedded_string input assert_xpath '//*[@class="dlist"]/dl', output, 2 assert_xpath '(//*[@class="dlist"])[2]/*[@class="title"][text()="title"]', output, 1 @@ -4097,7 +4097,7 @@ main = putStrLn "Hello, World!" -- <1> [{}, {'source-highlighter' => 'coderay'}].each do |attributes| output = render_embedded_string input, :attributes => attributes assert_xpath '//b', output, 4 - nodes = xmlnodes_at_css 'pre', output + nodes = xmlnodes_at_css 'pre', output assert_equal %(puts 'Hello, world!' (1)), nodes[0].text assert_equal %(println 'Hello, world!' (1)), nodes[1].text assert_equal %((def hello (fn [] "Hello, world!")) (1)\n(hello)), nodes[2].text @@ -4115,7 +4115,7 @@ hello_world() -> io:fwrite("hello, world\n"). % <1> EOS output = render_embedded_string input assert_xpath '//b', output, 1 - nodes = xmlnodes_at_css 'pre', output + nodes = xmlnodes_at_css 'pre', output assert_equal %(hello_world() -> io:fwrite("hello, world\n"). (1)), nodes[0].text end diff --git a/test/paragraphs_test.rb b/test/paragraphs_test.rb index 4a3b0402..b9ef3058 100644 --- a/test/paragraphs_test.rb +++ b/test/paragraphs_test.rb @@ -26,7 +26,7 @@ Paragraph. Winning. EOS output = render_embedded_string input - + assert_css 'p', output, 2 assert_xpath '(//p)[1]/preceding-sibling::*[@class = "title"]', output, 1 assert_xpath '(//p)[1]/preceding-sibling::*[@class = "title"][text() = "Titled"]', output, 1 @@ -60,7 +60,7 @@ paragraph . wrapped line EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'p', output, 1 assert_xpath %(//p[text()="paragraph\n. wrapped line"]), output, 1 end @@ -71,7 +71,7 @@ paragraph .wrapped line EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'p', output, 1 assert_xpath %(//p[text()="paragraph\n.wrapped line"]), output, 1 end diff --git a/test/parser_test.rb b/test/parser_test.rb index 12024e48..7a1237d9 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -118,7 +118,7 @@ context "Parser" do line = 'height=100,caption="",link="images/octocat.png"' expected = {'height' => '100', 'caption' => '', 'link' => 'images/octocat.png'} Asciidoctor::AttributeList.new(line).parse_into(attributes) - assert_equal expected, attributes + assert_equal expected, attributes end test "collect named attribute single-quoted" do @@ -134,7 +134,7 @@ context "Parser" do line = "height=100,caption='',link='images/octocat.png'" expected = {'height' => '100', 'caption' => '', 'link' => 'images/octocat.png'} Asciidoctor::AttributeList.new(line).parse_into(attributes) - assert_equal expected, attributes + assert_equal expected, attributes end test "collect named attributes unquoted" do @@ -688,9 +688,9 @@ devtmpfs 3.9G 0 3.9G 0% /dev test 'preserve block indent if indent is -1' do input = <<-EOS def names - + @name.split ' ' - + end EOS diff --git a/test/preamble_test.rb b/test/preamble_test.rb index 8bce2a3d..52b3c3de 100644 --- a/test/preamble_test.rb +++ b/test/preamble_test.rb @@ -144,7 +144,7 @@ The axe came swinging. EOS d = document_from_string(input) - assert_equal 'book', d.doctype + assert_equal 'book', d.doctype output = d.render assert_xpath '//h1', output, 3 assert_xpath %{//*[@id="preamble"]//p[text() = "Back then#{expand_entity 8230}#{expand_entity 8203}"]}, output, 1 diff --git a/test/reader_test.rb b/test/reader_test.rb index 1267eeca..281d7f08 100644 --- a/test/reader_test.rb +++ b/test/reader_test.rb @@ -223,7 +223,7 @@ third line test 'source_lines should return copy of original data Array' do reader = Asciidoctor::Reader.new SAMPLE_DATA reader.read_lines - assert_equal SAMPLE_DATA, reader.source_lines + assert_equal SAMPLE_DATA, reader.source_lines end test 'source should return original data Array joined as String' do @@ -494,12 +494,12 @@ include::include-file.asciidoc[] reader = doc.reader assert_equal 'link:include-file.asciidoc[]', reader.read_line end - + test 'include directive is enabled when safe mode is less than SECURE' do input = <<-EOS include::fixtures/include-file.asciidoc[] EOS - + doc = document_from_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME output = doc.render assert_match(/included content/, output) @@ -509,7 +509,7 @@ include::fixtures/include-file.asciidoc[] input = <<-EOS include::fixtures/include file.asciidoc[] EOS - + include_file = File.join DIRNAME, 'fixtures', 'include-file.asciidoc' include_file_with_sp = File.join DIRNAME, 'fixtures', 'include file.asciidoc' begin @@ -526,7 +526,7 @@ include::fixtures/include file.asciidoc[] input = <<-EOS include::fixtures/include{sp}file.asciidoc[] EOS - + include_file = File.join DIRNAME, 'fixtures', 'include-file.asciidoc' include_file_with_sp = File.join DIRNAME, 'fixtures', 'include file.asciidoc' begin @@ -599,14 +599,14 @@ include::fixtures/parent-include.adoc[] assert_equal fixtures_dir, reader.dir assert_equal 'fixtures/parent-include.adoc', reader.path end - + test 'missing file referenced by include directive is replaced by warning' do input = <<-EOS include::fixtures/no-such-file.adoc[] trailing content EOS - + begin doc = document_from_string input, :safe => :safe, :base_dir => DIRNAME assert_equal 2, doc.blocks.size @@ -625,7 +625,7 @@ include::fixtures/chapter-a.adoc[] trailing content EOS - + begin doc = document_from_string input, :safe => :safe, :base_dir => DIRNAME assert_equal 2, doc.blocks.size @@ -650,7 +650,7 @@ include::#{include_path}[] result = document_from_string input, :safe => :unsafe, :base_dir => ::Dir.tmpdir assert_equal 'Chapter A', result.doctitle end - + test 'include directive can retrieve data from uri' do #url = 'http://echo.jsontest.com/name/asciidoctor' url = %(http://#{resolve_localhost}:9876/name/asciidoctor) @@ -667,7 +667,7 @@ include::#{url}[] refute_nil output assert_match(expect, output) end - + test 'inaccessible uri referenced by include directive does not crash processor' do url = %(http://#{resolve_localhost}:9876/no_such_file) input = <<-EOS @@ -686,12 +686,12 @@ include::#{url}[] refute_nil output assert_match(/Unresolved directive/, output) end - + test 'include directive supports line selection' do input = <<-EOS include::fixtures/include-file.asciidoc[lines=1;3..4;6..-1] EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match(/first line/, output) refute_match(/second line/, output) @@ -703,12 +703,12 @@ include::fixtures/include-file.asciidoc[lines=1;3..4;6..-1] assert_match(/eighth line/, output) assert_match(/last line of included content/, output) end - + test 'include directive supports line selection using quoted attribute value' do input = <<-EOS include::fixtures/include-file.asciidoc[lines="1, 3..4 , 6 .. -1"] EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match(/first line/, output) refute_match(/second line/, output) @@ -720,24 +720,24 @@ include::fixtures/include-file.asciidoc[lines="1, 3..4 , 6 .. -1"] assert_match(/eighth line/, output) assert_match(/last line of included content/, output) end - + test 'include directive supports tagged selection' do input = <<-EOS include::fixtures/include-file.asciidoc[tag=snippetA] EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match(/snippetA content/, output) refute_match(/snippetB content/, output) refute_match(/non-tagged content/, output) refute_match(/included content/, output) end - + test 'include directive supports multiple tagged selection' do input = <<-EOS include::fixtures/include-file.asciidoc[tags=snippetA;snippetB] EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match(/snippetA content/, output) assert_match(/snippetB content/, output) @@ -752,7 +752,7 @@ include::fixtures/include-file.asciidoc[tags=snippetA;snippetB] include::fixtures/include-file.xml[tag=snippet] ---- EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match('<snippet>content</snippet>', output) refute_match('root', output) @@ -778,7 +778,7 @@ snippetB content) input = <<-EOS include::fixtures/include-file.asciidoc[tag=snippetZ] EOS - + old_stderr = $stderr $stderr = StringIO.new begin @@ -790,18 +790,18 @@ include::fixtures/include-file.asciidoc[tag=snippetZ] $stderr = old_stderr end end - + test 'lines attribute takes precedence over tags attribute in include directive' do input = <<-EOS include::fixtures/include-file.asciidoc[lines=1, tags=snippetA;snippetB] EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME assert_match(/first line of included content/, output) refute_match(/snippetA content/, output) refute_match(/snippetB content/, output) end - + test 'indent of included file can be reset to size of indent attribute' do input = <<-EOS [source, xml] @@ -809,7 +809,7 @@ include::fixtures/include-file.asciidoc[lines=1, tags=snippetA;snippetB] include::fixtures/basic-docinfo.xml[lines=2..3, indent=0] ---- EOS - + output = render_string input, :safe => :safe, :header_footer => false, :base_dir => DIRNAME result = xmlnodes_at_xpath('//pre', output, 1).text assert_equal "<year>2013</year>\n<holder>Acme™, Inc.</holder>", result @@ -819,20 +819,20 @@ include::fixtures/basic-docinfo.xml[lines=2..3, indent=0] input = <<-EOS include::fixtures/include-file.asciidoc[] EOS - + include_processor = Class.new { def initialize document end - + def handles? target false end - + def process reader, target, attributes raise 'TestIncludeHandler should not have been invoked' end } - + document = empty_safe_document :base_dir => DIRNAME reader = Asciidoctor::PreprocessorReader.new document, input reader.instance_variable_set '@include_processors', [include_processor.new(document)] @@ -863,7 +863,7 @@ content document = Asciidoctor.load input, :safe => :safe, :base_dir => DIRNAME, :parse => false assert_equal expected, document.reader.read_lines end - + test 'attributes are substituted in target of include directive' do input = <<-EOS :fixturesdir: fixtures @@ -871,17 +871,17 @@ content include::{fixturesdir}/include-file.{ext}[] EOS - + doc = document_from_string input, :safe => :safe, :base_dir => DIRNAME output = doc.render assert_match(/included content/, output) end - + test 'line is skipped by default if target of include directive resolves to empty' do input = <<-EOS include::{foodir}/include-file.asciidoc[] EOS - + doc = empty_safe_document :base_dir => DIRNAME reader = Asciidoctor::PreprocessorReader.new doc, input assert_equal 'Unresolved directive in <stdin> - include::{foodir}/include-file.asciidoc[]', reader.read_line @@ -891,23 +891,23 @@ include::{foodir}/include-file.asciidoc[] input = <<-EOS include::{foodir}/include-file.asciidoc[] EOS - + doc = empty_safe_document :base_dir => DIRNAME, :attributes => {'attribute-missing' => 'drop'} reader = Asciidoctor::PreprocessorReader.new doc, input assert_nil reader.read_line end - + test 'line following dropped include is not dropped' do input = <<-EOS include::{foodir}/include-file.asciidoc[] yo EOS - + doc = empty_safe_document :base_dir => DIRNAME, :attributes => {'attribute-missing' => 'drop'} reader = Asciidoctor::PreprocessorReader.new doc, input assert_equal 'yo', reader.read_line end - + test 'escaped include directive is left unprocessed' do input = <<-EOS \\include::fixtures/include-file.asciidoc[] @@ -922,7 +922,7 @@ yo assert_equal 'include::fixtures/include-file.asciidoc[]', reader.read_line assert_equal '\\escape preserved here', reader.read_line end - + test 'include directive not at start of line is ignored' do input = <<-EOS include::include-file.asciidoc[] @@ -933,7 +933,7 @@ yo assert_equal :literal, para.context assert_equal 'include::include-file.asciidoc[]', para.source end - + test 'include directive is disabled when max-include-depth attribute is 0' do input = <<-EOS include::include-file.asciidoc[] @@ -942,11 +942,11 @@ include::include-file.asciidoc[] assert_equal 1, para.lines.size assert_equal 'include::include-file.asciidoc[]', para.source end - + test 'max-include-depth cannot be set by document' do input = <<-EOS :max-include-depth: 1 - + include::include-file.asciidoc[] EOS para = block_from_string input, :safe => :safe, :attributes => { 'max-include-depth' => 0 } @@ -1018,7 +1018,7 @@ ifdef::asciidoctor[] Asciidoctor! endif::asciidoctor[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader assert_nil reader.process_line(reader.lines.first) @@ -1030,14 +1030,14 @@ ifdef::asciidoctor[] Asciidoctor! endif::asciidoctor[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader assert_equal 1, reader.lineno assert_equal 'Asciidoctor!', reader.peek_line assert_equal 2, reader.lineno end - + test 'process_line returns line if cursor not advanced' do input = <<-EOS content @@ -1045,7 +1045,7 @@ ifdef::asciidoctor[] Asciidoctor! endif::asciidoctor[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader refute_nil reader.process_line(reader.lines.first) @@ -1058,35 +1058,35 @@ ifdef::asciidoctor[] Asciidoctor! endif::asciidoctor[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader assert_equal 1, reader.lineno assert_equal 'content', reader.peek_line assert_equal 1, reader.lineno end - + test 'peek_line returns nil if cursor advances past end of source' do input = <<-EOS ifdef::foobar[] swallowed content endif::foobar[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader assert_equal 1, reader.lineno assert_nil reader.peek_line assert_equal 4, reader.lineno end - + test 'ifdef with defined attribute includes content' do input = <<-EOS ifdef::holygrail[] There is a holy grail! endif::holygrail[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'holygrail' => '' } reader = doc.reader lines = [] @@ -1095,14 +1095,14 @@ endif::holygrail[] end assert_equal 'There is a holy grail!', (lines * ::Asciidoctor::EOL) end - + test 'ifdef with defined attribute includes text in brackets' do input = <<-EOS On our quest we go... ifdef::holygrail[There is a holy grail!] There was much rejoicing. EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'holygrail' => '' } reader = doc.reader lines = [] @@ -1123,14 +1123,14 @@ endif::showScript[] result = doc.reader.read assert_equal 'The script is shown!', result end - + test 'ifndef with defined attribute does not include text in brackets' do input = <<-EOS On our quest we go... ifndef::hardships[There is a holy grail!] There was no rejoicing. EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'hardships' => '' } reader = doc.reader lines = [] @@ -1139,7 +1139,7 @@ There was no rejoicing. end assert_equal "On our quest we go...\nThere was no rejoicing.", (lines * ::Asciidoctor::EOL) end - + test 'include with non-matching nested exclude' do input = <<-EOS ifdef::grail[] @@ -1150,7 +1150,7 @@ endif::swallow[] grail endif::grail[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'grail' => '' } reader = doc.reader lines = [] @@ -1159,7 +1159,7 @@ endif::grail[] end assert_equal "holy\ngrail", (lines * ::Asciidoctor::EOL) end - + test 'nested excludes with same condition' do input = <<-EOS ifndef::grail[] @@ -1168,7 +1168,7 @@ not here endif::grail[] endif::grail[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'grail' => '' } reader = doc.reader lines = [] @@ -1177,7 +1177,7 @@ endif::grail[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'include with nested exclude of inverted condition' do input = <<-EOS ifdef::grail[] @@ -1188,7 +1188,7 @@ endif::grail[] grail endif::grail[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'grail' => '' } reader = doc.reader lines = [] @@ -1197,7 +1197,7 @@ endif::grail[] end assert_equal "holy\ngrail", (lines * ::Asciidoctor::EOL) end - + test 'exclude with matching nested exclude' do input = <<-EOS poof @@ -1210,7 +1210,7 @@ here endif::swallow[] gone EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'grail' => '' } reader = doc.reader lines = [] @@ -1219,7 +1219,7 @@ gone end assert_equal "poof\ngone", (lines * ::Asciidoctor::EOL) end - + test 'exclude with nested include using shorthand end' do input = <<-EOS poof @@ -1232,7 +1232,7 @@ in here endif::[] gone EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'grail' => '' } reader = doc.reader lines = [] @@ -1241,14 +1241,14 @@ gone end assert_equal "poof\ngone", (lines * ::Asciidoctor::EOL) end - + test 'ifdef with one alternative attribute set includes content' do input = <<-EOS ifdef::holygrail,swallow[] Our quest is complete! endif::holygrail,swallow[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'swallow' => '' } reader = doc.reader lines = [] @@ -1257,14 +1257,14 @@ endif::holygrail,swallow[] end assert_equal 'Our quest is complete!', (lines * ::Asciidoctor::EOL) end - + test 'ifdef with no alternative attributes set does not include content' do input = <<-EOS ifdef::holygrail,swallow[] Our quest is complete! endif::holygrail,swallow[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1273,14 +1273,14 @@ endif::holygrail,swallow[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'ifdef with all required attributes set includes content' do input = <<-EOS ifdef::holygrail+swallow[] Our quest is complete! endif::holygrail+swallow[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'holygrail' => '', 'swallow' => '' } reader = doc.reader lines = [] @@ -1289,14 +1289,14 @@ endif::holygrail+swallow[] end assert_equal 'Our quest is complete!', (lines * ::Asciidoctor::EOL) end - + test 'ifdef with missing required attributes does not include content' do input = <<-EOS ifdef::holygrail+swallow[] Our quest is complete! endif::holygrail+swallow[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'holygrail' => '' } reader = doc.reader lines = [] @@ -1305,14 +1305,14 @@ endif::holygrail+swallow[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'ifndef with undefined attribute includes block' do input = <<-EOS ifndef::holygrail[] Our quest continues to find the holy grail! endif::holygrail[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1321,14 +1321,14 @@ endif::holygrail[] end assert_equal 'Our quest continues to find the holy grail!', (lines * ::Asciidoctor::EOL) end - + test 'ifndef with one alternative attribute set includes content' do input = <<-EOS ifndef::holygrail,swallow[] Our quest is complete! endif::holygrail,swallow[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'swallow' => '' } reader = doc.reader lines = [] @@ -1337,14 +1337,14 @@ endif::holygrail,swallow[] end assert_equal 'Our quest is complete!', (lines * ::Asciidoctor::EOL) end - + test 'ifndef with no alternative attributes set includes content' do input = <<-EOS ifndef::holygrail,swallow[] Our quest is complete! endif::holygrail,swallow[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1353,14 +1353,14 @@ endif::holygrail,swallow[] end assert_equal 'Our quest is complete!', (lines * ::Asciidoctor::EOL) end - + test 'ifndef with any required attributes set does not include content' do input = <<-EOS ifndef::holygrail+swallow[] Our quest is complete! endif::holygrail+swallow[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'swallow' => '' } reader = doc.reader lines = [] @@ -1369,14 +1369,14 @@ endif::holygrail+swallow[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'ifndef with no required attributes set includes content' do input = <<-EOS ifndef::holygrail+swallow[] Our quest is complete! endif::holygrail+swallow[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1385,14 +1385,14 @@ endif::holygrail+swallow[] end assert_equal 'Our quest is complete!', (lines * ::Asciidoctor::EOL) end - + test 'escaped ifdef is unescaped and ignored' do input = <<-EOS \\ifdef::holygrail[] content \\endif::holygrail[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1433,14 +1433,14 @@ endif::[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'ifeval comparing double-quoted attribute to matching string includes content' do input = <<-EOS ifeval::["{gem}" == "asciidoctor"] Asciidoctor it is! endif::[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'gem' => 'asciidoctor' } reader = doc.reader lines = [] @@ -1449,14 +1449,14 @@ endif::[] end assert_equal 'Asciidoctor it is!', (lines * ::Asciidoctor::EOL) end - + test 'ifeval comparing single-quoted attribute to matching string includes content' do input = <<-EOS ifeval::['{gem}' == 'asciidoctor'] Asciidoctor it is! endif::[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'gem' => 'asciidoctor' } reader = doc.reader lines = [] @@ -1465,14 +1465,14 @@ endif::[] end assert_equal 'Asciidoctor it is!', (lines * ::Asciidoctor::EOL) end - + test 'ifeval comparing quoted attribute to non-matching string drops content' do input = <<-EOS ifeval::['{gem}' == 'asciidoctor'] Asciidoctor it is! endif::[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'gem' => 'tilt' } reader = doc.reader lines = [] @@ -1481,14 +1481,14 @@ endif::[] end assert_equal '', (lines * ::Asciidoctor::EOL) end - + test 'ifeval comparing attribute to lower version number includes content' do input = <<-EOS ifeval::['{asciidoctor-version}' >= '0.1.0'] That version will do! endif::[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1497,14 +1497,14 @@ endif::[] end assert_equal 'That version will do!', (lines * ::Asciidoctor::EOL) end - + test 'ifeval comparing attribute to self includes content' do input = <<-EOS ifeval::['{asciidoctor-version}' == '{asciidoctor-version}'] Of course it's the same! endif::[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1513,14 +1513,14 @@ endif::[] end assert_equal 'Of course it\'s the same!', (lines * ::Asciidoctor::EOL) end - + test 'ifeval arguments can be transposed' do input = <<-EOS ifeval::['0.1.0' <= '{asciidoctor-version}'] That version will do! endif::[] EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] @@ -1529,14 +1529,14 @@ endif::[] end assert_equal 'That version will do!', (lines * ::Asciidoctor::EOL) end - + test 'ifeval matching numeric equality includes content' do input = <<-EOS ifeval::[{rings} == 1] One ring to rule them all! endif::[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'rings' => '1' } reader = doc.reader lines = [] @@ -1552,7 +1552,7 @@ ifeval::[{rings} != 0] One ring to rule them all! endif::[] EOS - + doc = Asciidoctor::Document.new input, :attributes => { 'rings' => '1' } reader = doc.reader lines = [] @@ -1561,13 +1561,13 @@ endif::[] end assert_equal 'One ring to rule them all!', (lines * ::Asciidoctor::EOL) end - + test 'ifdef with no target is ignored' do input = <<-EOS ifdef::[] content EOS - + doc = Asciidoctor::Document.new input reader = doc.reader lines = [] diff --git a/test/sections_test.rb b/test/sections_test.rb index b213148d..31ab3ab2 100644 --- a/test/sections_test.rb +++ b/test/sections_test.rb @@ -266,7 +266,7 @@ preamble end end - context "level 1" do + context "level 1" do test "with multiline syntax" do assert_xpath "//h2[@id='_my_section'][text() = 'My Section']", render_string("My Section\n-----------") end @@ -292,7 +292,7 @@ preamble test "with XML entity" do assert_xpath "//h2[@id='_where_s_the_love'][text() = \"Where#{[8217].pack('U*')}s the love?\"]", render_string("== Where's the love?") end - + test "with non-word character" do assert_xpath "//h2[@id='_where_s_the_love'][text() = \"Where’s the love?\"]", render_string("== Where’s the love?") end @@ -351,7 +351,7 @@ content end if ::RUBY_MIN_VERSION_1_9 end - context "level 2" do + context "level 2" do test "with multiline syntax" do assert_xpath "//h3[@id='_my_section'][text() = 'My Section']", render_string(":fragment:\nMy Section\n~~~~~~~~~~~") end @@ -359,9 +359,9 @@ content test "with single line syntax" do assert_xpath "//h3[@id='_my_title'][text() = 'My Title']", render_string(":fragment:\n=== My Title") end - end + end - context "level 3" do + context "level 3" do test "with multiline syntax" do assert_xpath "//h4[@id='_my_section'][text() = 'My Section']", render_string(":fragment:\nMy Section\n^^^^^^^^^^") end @@ -371,7 +371,7 @@ content end end - context "level 4" do + context "level 4" do test "with multiline syntax" do assert_xpath "//h5[@id='_my_section'][text() = 'My Section']", render_string(":fragment:\nMy Section\n++++++++++") end @@ -381,7 +381,7 @@ content end end - context "level 5" do + context "level 5" do test "with single line syntax" do assert_xpath "//h6[@id='_my_title'][text() = 'My Title']", render_string(":fragment:\n====== My Title") end @@ -681,8 +681,8 @@ Master section text. end assert errors.empty? - assert_match(/Master document written by Doc Writer/, output) - assert_match(/Standalone document written by Junior Writer/, output) + assert_match(/Master document written by Doc Writer/, output) + assert_match(/Standalone document written by Junior Writer/, output) assert_xpath '//*[@class="sect1"]/h2[text() = "Standalone Document"]', output, 1 assert_xpath '//*[@class="sect2"]/h3[text() = "Section in Standalone"]', output, 1 assert_xpath '//*[@class="sect1"]/h2[text() = "Section in Master"]', output, 1 @@ -798,7 +798,7 @@ content = Title :sectnums: -== Section_1 +== Section_1 text @@ -822,7 +822,7 @@ text text EOS - + output = render_string input assert_xpath '//h2[@id="_section_1"][starts-with(text(), "1. ")]', output, 1 assert_xpath '//h3[@id="_section_1_1"][starts-with(text(), "1.1. ")]', output, 1 @@ -837,7 +837,7 @@ text = Title :numbered: -== Section_1 +== Section_1 text @@ -861,7 +861,7 @@ text text EOS - + output = render_string input assert_xpath '//h2[@id="_section_1"][starts-with(text(), "1. ")]', output, 1 assert_xpath '//h3[@id="_section_1_1"][starts-with(text(), "1.1. ")]', output, 1 diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb index a97efacb..d3a08cab 100644 --- a/test/substitutions_test.rb +++ b/test/substitutions_test.rb @@ -12,7 +12,7 @@ context 'Substitutions' do test 'apply normal substitutions' do para = block_from_string("[blue]_http://asciidoc.org[AsciiDoc]_ & [red]*Ruby*\n§ Making +++<u>documentation</u>+++ together +\nsince (C) {inception_year}.") para.document.attributes['inception_year'] = '2012' - result = para.apply_normal_subs(para.lines) + result = para.apply_normal_subs(para.lines) assert_equal %{<em class="blue"><a href="http://asciidoc.org">AsciiDoc</a></em> & <strong class="red">Ruby</strong>\n§ Making <u>documentation</u> together<br>\nsince © 2012.}, result end end @@ -1108,47 +1108,47 @@ EOS para = block_from_string('kbd:[F3]', :attributes => {'experimental' => ''}) assert_equal %q{<kbd>F3</kbd>}, para.sub_macros(para.source) end - + test 'kbd macro with single key, docbook backend' do para = block_from_string('kbd:[F3]', :backend => 'docbook', :attributes => {'experimental' => ''}) assert_equal %q{<keycap>F3</keycap>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination' do para = block_from_string('kbd:[Ctrl+Shift+T]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination with spaces' do para = block_from_string('kbd:[Ctrl + Shift + T]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination delimited by commas' do para = block_from_string('kbd:[Ctrl,Shift,T]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination containing a plus key no spaces' do para = block_from_string('kbd:[Ctrl++]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>+</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination delimited by commands containing a comma key' do para = block_from_string('kbd:[Ctrl,,]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>,</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination containing a plus key with spaces' do para = block_from_string('kbd:[Ctrl + +]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>+</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination containing escaped bracket' do para = block_from_string('kbd:[Ctrl + \]]', :attributes => {'experimental' => ''}) assert_equal %q{<span class="keyseq"><kbd>Ctrl</kbd>+<kbd>]</kbd></span>}, para.sub_macros(para.source) end - + test 'kbd macro with key combination, docbook backend' do para = block_from_string('kbd:[Ctrl+Shift+T]', :backend => 'docbook', :attributes => {'experimental' => ''}) assert_equal %q{<keycombo><keycap>Ctrl</keycap><keycap>Shift</keycap><keycap>T</keycap></keycombo>}, para.sub_macros(para.source) @@ -1329,7 +1329,7 @@ EOS test 'complex inline passthrough macro' do text_to_escape = %q{[(] <'basic form'> <'logical operator'> <'basic form'> [)]} - para = block_from_string %($$#{text_to_escape}$$) + para = block_from_string %($$#{text_to_escape}$$) result = para.extract_passthroughs(para.source) assert_equal 1, para.passthroughs.size assert_equal text_to_escape, para.passthroughs[0][:text] @@ -1473,7 +1473,7 @@ EOS end test 'replaces dashes' do - para = block_from_string %(-- foo foo--bar foo\\--bar foo -- bar foo \\-- bar + para = block_from_string %(-- foo foo--bar foo\\--bar foo -- bar foo \\-- bar stuff in between -- foo stuff in between @@ -1495,7 +1495,7 @@ foo — ' end if ::RUBY_MIN_VERSION_1_9 test 'replaces marks' do - para = block_from_string '(C) (R) (TM) \(C) \(R) \(TM)' + para = block_from_string '(C) (R) (TM) \(C) \(R) \(TM)' assert_equal '© ® ™ (C) (R) (TM)', para.sub_replacements(para.source) end diff --git a/test/tables_test.rb b/test/tables_test.rb index ba2b2cfc..2d9513cf 100644 --- a/test/tables_test.rb +++ b/test/tables_test.rb @@ -277,10 +277,10 @@ A | here| a | there [frame="topbot",options="header,footer"] |=== |Item |Quantity -|Item 1 |1 -|Item 2 |2 -|Item 3 |3 -|Total |6 +|Item 1 |1 +|Item 2 |2 +|Item 3 |3 +|Total |6 |=== EOS output = render_embedded_string input @@ -302,10 +302,10 @@ A | here| a | there [frame="topbot",options="header,footer"] |=== |Item |Quantity -|Item 1 |1 -|Item 2 |2 -|Item 3 |3 -|Total |6 +|Item 1 |1 +|Item 2 |2 +|Item 3 |3 +|Total |6 |=== EOS output = render_embedded_string input, :backend => 'docbook' @@ -538,7 +538,7 @@ d|9 2+>|10 assert_css 'table > tbody > tr:nth-child(2) > td', output, 3 assert_css 'table > tbody > tr:nth-child(3) > td', output, 1 assert_css 'table > tbody > tr:nth-child(4) > td', output, 2 - + assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(1).halign-left.valign-top p em', output, 1 assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(2).halign-right.valign-top p strong', output, 1 assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(3).halign-center.valign-top p', output, 1 @@ -564,7 +564,7 @@ d|9 2+>|10 |AAA |BBB |CCC |=== EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'table > tbody > tr:nth-child(1) > td', output, 2 assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(1)[colspan="2"]', output, 1 assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(2):not([colspan])', output, 1 @@ -684,10 +684,10 @@ that I can't know enough... that I am always hungrily operating on the margins of a potentially great harvest of future knowledge and wisdom. -I wouldn't have it any other way. +I wouldn't have it any other way. |=== EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'table', output, 1 assert_css 'table > colgroup > col', output, 3 assert_css 'table > thead', output, 1 @@ -783,7 +783,7 @@ output file name is used. table = doc.blocks.first assert !table.nil? tbody = table.rows.body - assert_equal 2, tbody.size + assert_equal 2, tbody.size body_cell_1_3 = tbody[0][2] assert !body_cell_1_3.inner_document.nil? assert body_cell_1_3.inner_document.nested? @@ -1060,7 +1060,7 @@ Year,Make,Model,Description,Price air, moon roof, loaded",4799.00 |=== EOS - output = render_embedded_string input + output = render_embedded_string input assert_css 'table', output, 1 assert_css 'table > colgroup > col[style*="width: 20%"]', output, 5 assert_css 'table > thead > tr', output, 1 @@ -1138,7 +1138,7 @@ single cell [options="breakable"] |=== |Item |Quantity -|Item 1 |1 +|Item 1 |1 |=== EOS output = render_embedded_string input, :backend => 'docbook45' @@ -1151,7 +1151,7 @@ single cell [options="breakable"] |=== |Item |Quantity -|Item 1 |1 +|Item 1 |1 |=== EOS output = render_embedded_string input, :backend => 'docbook5' @@ -1164,7 +1164,7 @@ single cell [options="unbreakable"] |=== |Item |Quantity -|Item 1 |1 +|Item 1 |1 |=== EOS output = render_embedded_string input, :backend => 'docbook5' @@ -1177,7 +1177,7 @@ single cell [options="unbreakable"] |=== |Item |Quantity -|Item 1 |1 +|Item 1 |1 |=== EOS output = render_embedded_string input, :backend => 'docbook45' diff --git a/test/test_helper.rb b/test/test_helper.rb index a8ae7c9b..46070dcc 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -234,7 +234,7 @@ class Minitest::Test alias :entity :expand_entity def invoke_cli_with_filenames(argv = [], filenames = [], &block) - + filepaths = Array.new filenames.each { |filename| @@ -304,7 +304,7 @@ class Minitest::Test session.close break end - + if resource == '/name/asciidoctor' session.print %(HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n) session.print %({"name": "asciidoctor"}\n) @@ -343,7 +343,7 @@ class Minitest::Test end ### -# +# # Context goodness provided by @citrusbyte's contest. # See https://github.com/citrusbyte/contest # |
