Sha256: 0e30d70cce3578b67a10c11d5c98c5a68068187ea479f6fdd11b9dae1e144d66

Contents?: true

Size: 683 Bytes

Versions: 8

Compression:

Stored size: 683 Bytes

Contents

module Appium
  class Lint
    ###
    # Each doc must have exactly 1 h1
    class H1Multiple < Base
      def call
        h1_count = 0
        in_code_block = false
        input.lines.each_with_index do |line, index|
          code_block = !! line.match(/^```/)
          in_code_block = ! in_code_block if code_block

          next if in_code_block

          h1_detected = !! line.match(/^#[^#]/)
          if h1_detected # only warn if h1 detected
            h1_count += 1
            warn index if h1_count > 1
          end
        end

        warnings
      end

      FAIL = 'each doc must contain exactly one h1'

      def fail
        FAIL
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
appium_doc_lint-0.0.10 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.9 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.8 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.7 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.6 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.5 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.4 lib/appium_doc_lint/lint/h1_multiple.rb
appium_doc_lint-0.0.3 lib/appium_doc_lint/lint/h1_multiple.rb