Commit fde61a89 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Rename --guide-toc-level to --guides-toc-level.

To be named more similarly with --guides option.

Improve the docs of the option - shorten lines and make the effect
of different argument values plain obvious.
parent 93537d4c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ module JsDuck
      @formatter.doc_context = {:filename => guide[:filename], :linenr => 0}
      @formatter.images = Img::Dir.new(guide["url"], "guides/#{guide["name"]}")
      html = @formatter.format(Util::IO.read(guide[:filename]))
      html = GuideToc.inject(html, guide['name'], @opts.guide_toc_level)
      html = GuideToc.inject(html, guide['name'], @opts.guides_toc_level)
      html = GuideAnchors.transform(html, guide['name'])

      # Report unused images (but ignore the icon files)
+17 −13
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ module JsDuck
    attr_accessor :message
    attr_accessor :welcome
    attr_accessor :guides
    attr_accessor :guide_toc_level
    attr_accessor :guides_toc_level
    attr_accessor :videos
    attr_accessor :examples
    attr_accessor :categories_path
@@ -113,7 +113,7 @@ module JsDuck
      @message = ""
      @welcome = nil
      @guides = nil
      @guide_toc_level = 2
      @guides_toc_level = 2
      @videos = nil
      @examples = nil
      @categories_path = nil
@@ -395,17 +395,21 @@ module JsDuck
          @guides = canonical(path)
        end

        opts.on('--guide-toc-level=LEVEL',
          "The maximum heading level to include in guides' tables of contents.",
        opts.on('--guides-toc-level=LEVEL',
          "Max heading level for guides' tables of contents.",
          "",
          "Values between 1 and 6 are allowed. Choosing 1 hides the table of ",
          "contents.",
          "Values between 1 and 6 define the maximum level of a heading",
          "to be included into guides' Table of Contents:",
          "",
          "The default is 2, indicating that only <h2>-level headings will ",
          "be included in the table of contents.") do |level|
          @guide_toc_level = level.to_i
          if !(1..6).include? @guide_toc_level
            Logger.fatal("Unsupported guide-toc-level: '#{level}'")
          "1 - Hides the table of contents.",
          "2 - <H2> headings are included.",
          "3 - <H2>,<H3> headings are included.",
          "4 - <H2>,<H3>,<H4> headings are included.",
          "5 - <H2>,<H3>,<H4>,<H5> headings are included.",
          "6 - <H2>,<H3>,<H4>,<H5>,<H6> headings are included.") do |level|
          @guides_toc_level = level.to_i
          if !(1..6).include? @guides_toc_level
            Logger.fatal("Unsupported --guides-toc-level: '#{level}'")
            exit(1)
          end
        end