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

Sync Options::Record field names with option names.

So that the option name used inside JSDuck is the same as the --option
used on command line.

Rename the following:

* categories_path --> categories
* output_dir --> output
* template_dir --> template
* img_tpl --> img
* link_tpl --> link
* imports -->  import
parent 7e1fe717
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ module JsDuck
      @guides = Guides.create(@opts.guides, doc_formatter, @opts)
      @videos = Videos.create(@opts.videos)
      @examples = Examples.create(@opts.examples, @opts)
      @categories = Categories::Factory.create(@opts.categories_path, doc_formatter, @relations)
      @categories = Categories::Factory.create(@opts.categories, doc_formatter, @relations)
      @news = News.create(@relations, doc_formatter, @opts)
    end

@@ -45,8 +45,8 @@ module JsDuck
    #
    # Welcome page and categories are written in JsDuck::IndexHtml
    def write
      @guides.write(@opts.output_dir+"/guides")
      Img::Writer.copy(@images.all_used, @opts.output_dir+"/images")
      @guides.write(@opts.output+"/guides")
      Img::Writer.copy(@images.all_used, @opts.output+"/images")
    end

  end
+4 −4
Original line number Diff line number Diff line
@@ -20,19 +20,19 @@ module JsDuck
    def write
      format_classes

      clean_output_dir unless @opts.output_dir == :stdout
      clean_output_dir unless @opts.output == :stdout

      export_classes
      export_examples_in_guides if @opts.export == :examples

      Util::Stdout.flush if @opts.output_dir == :stdout
      Util::Stdout.flush if @opts.output == :stdout
    end

    private

    def export_classes
      cw = ClassWriter.new(get_exporter, @relations, @opts)
      cw.write(@opts.output_dir, ".json")
      cw.write(@opts.output, ".json")
    end

    def get_exporter
@@ -45,7 +45,7 @@ module JsDuck

    def export_examples_in_guides
      gw = GuideWriter.new(Exporter::Examples, @assets.guides, @opts)
      gw.write(@opts.output_dir, ".json")
      gw.write(@opts.output, ".json")
    end

    # -- util routines --
+2 −2
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ module JsDuck
      # recognized classnames.
      #
      # Replaces {@link Class#member link text} in given string with
      # HTML from @link_tpl.
      # HTML from --link.
      #
      # Replaces {@img path/to/image.jpg Alt text} with HTML from @img_tpl.
      # Replaces {@img path/to/image.jpg Alt text} with HTML from --img.
      #
      # Adds 'inline-example' class to code examples beginning with @example.
      #
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ module JsDuck
      elsif File.exists?(dir+"/icon-lg.png")
        FileUtils.mv(dir+"/icon-lg.png", dir+"/icon.png")
      else
        FileUtils.cp(@opts.template_dir+"/resources/images/default-guide.png", dir+"/icon.png")
        FileUtils.cp(@opts.template+"/resources/images/default-guide.png", dir+"/icon.png")
      end
    end

+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ module JsDuck
      attr_accessor :doc_context

      def initialize(opts={})
        @tpl = opts[:img_tpl] || '<img src="%u" alt="%a" width="%w" height="%h"/>'
        @tpl = opts[:img] || '<img src="%u" alt="%a" width="%w" height="%h"/>'

        @re = /\{@img\s+(\S*?)(?:\s+(.+?))?\}/m
      end
Loading