Commit 43ec1d32 authored by Nick Poulden's avatar Nick Poulden
Browse files

Merge master

parents fcd6ffb8 18867be7
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ class JsDuckRunner
      "--guides", "#{@sdk_dir}/extjs/docs/guides.json",
      "--videos", "#{@sdk_dir}/extjs/docs/videos.json",
      "--examples", "#{@sdk_dir}/extjs/examples/examples.json",
      "--inline-examples", "#{@sdk_dir}/extjs/docs/resources",
      "--categories", "#{@sdk_dir}/extjs/docs/categories.json",
      "--output", "#{@out_dir}",
      "--builtin-classes",
@@ -228,13 +227,30 @@ class JsDuckRunner
      "--touch-examples-ui",
      "--output", "#{@out_dir}",
      "--external=google.maps.Map,google.maps.LatLng",
      "--images", "#{@sdk_dir}/touch/docs/resources",
      "#{@sdk_dir}/touch/resources/themes/stylesheets/sencha-touch/default",
    ]

    @options += extract_jsb_build_files("#{@sdk_dir}/touch/touch.jsb3")
  end

  def add_touch_export
    @options += [
      "--json",
      "--output", "#{@out_dir}/../export/touch1",
      "--external=google.maps.Map,google.maps.LatLng",
    ]
    @options += extract_jsb_build_files("#{@sdk_dir}/touch/sencha-touch.jsb3")
  end

  def add_touch2_export
    @options += [
      "--json",
      "--output", "#{@out_dir}/../export/touch2",
      "--external=google.maps.Map,google.maps.LatLng",
    ]
    @options += extract_jsb_build_files("#{@sdk_dir}/touch/touch.jsb3")
  end

  def add_animator
    head_html = <<-EOHTML
      <link rel="canonical" href="http://docs.sencha.com/animator/1-0/" />
@@ -443,6 +459,19 @@ task :touch2, [:mode] => :sass do |t, args|
  runner.copy_touch2_build
end

desc "Run JSDuck JSON Export (for internal use at Sencha)\n" +
     "export[touch]  - creates export for Touch 1\n" +
     "export[touch2] - creates export for Touch 2"
task :export, [:mode] do |t, args|
  mode = args[:mode]
  throw "Unknown mode #{mode}" unless ["touch", "touch2"].include?(mode)

  runner = JsDuckRunner.new
  runner.add_touch_export if mode == "touch"
  runner.add_touch2_export if mode == "touch2"
  runner.run
end

desc "Run JSDuck on Sencha Animator (for internal use at Sencha)\n" +
     "animator         - creates debug/development version\n" +
     "animator[export] - create live version for deployment\n"
+7 −2
Original line number Diff line number Diff line
@@ -80,9 +80,14 @@ old_classes.each_pair do |name, cls|
  end
end

# do HTML output
# Choose title based on filename
if out_file =~ /touch/
  title = "Comparison of Touch 1.1.1 and Touch 2.0.0"
else
  title = "Comparison of Ext 4.0.7 and Ext 4.1.0"
#title = "Comparison of Touch 1.1.1 and Touch 2.0.0"
end

# do HTML output
html = []
html << <<-EOHTML
<!DOCTYPE html>
+0 −3
Original line number Diff line number Diff line
@@ -222,9 +222,6 @@ module JsDuck
      formatter.link_tpl = @opts.link_tpl if @opts.link_tpl
      formatter.img_tpl = @opts.img_tpl if @opts.img_tpl
      formatter.relations = @relations
      if @opts.inline_examples_dir
        formatter.get_example = lambda {|path| IO.read(@opts.inline_examples_dir + "/" + path) }
      end
      formatter
    end

+1 −33
Original line number Diff line number Diff line
@@ -29,10 +29,6 @@ module JsDuck
    # Default value: '<img src="%u" alt="%a"/>'
    attr_accessor :img_tpl

    # Assign to this a function that retrieves the example code when
    # passed in a filename
    attr_accessor :get_example

    # This will hold list of all image paths gathered from {@img} tags.
    attr_accessor :images

@@ -67,11 +63,9 @@ module JsDuck
      @images = []
      @link_tpl = '<a href="%c%#%m">%a</a>'
      @img_tpl = '<img src="%u" alt="%a"/>'
      @example_tpl = '<pre class="inline-example"><code>%a</code></pre>'
      @link_re = /\{@link\s+(\S*?)(?:\s+(.+?))?\}/m
      @img_re = /\{@img\s+(\S*?)(?:\s+(.+?))?\}/m
      @example_re = /\{@example\s+(\S*?)\s*\}/m
      @example_annotation_re = /<pre><code>@example( +[^\n]*)?\s+/m
      @example_annotation_re = /<pre><code>\s*@example( +[^\n]*)?\s+/m
    end

    # Replaces {@link} and {@img} tags, auto-generates links for
@@ -82,8 +76,6 @@ module JsDuck
    #
    # Replaces {@img path/to/image.jpg Alt text} with HTML from @img_tpl.
    #
    # Replaces {@example path/to/example.js} with source from that file.
    #
    # Adds 'inline-example' class to code examples beginning with @example.
    #
    # Additionally replaces strings recognized as ClassNames with
@@ -97,8 +89,6 @@ module JsDuck
          out += replace_link_tag(s.scan(@link_re))
        elsif s.check(@img_re)
          out += replace_img_tag(s.scan(@img_re))
        elsif s.check(@example_re)
          out += replace_example_tag(s.scan(@example_re))
        elsif s.check(@example_annotation_re)
          s.scan(@example_annotation_re)
          out += '<pre class="inline-example"><code>'
@@ -152,10 +142,6 @@ module JsDuck
      input.sub(@img_re) { img($1, $2) }
    end

    def replace_example_tag(input)
      input.sub(@example_re) { example($1) }
    end

    def replace_class_names(input)
      input.gsub(/(\A|\s)([A-Z][A-Za-z0-9.]*[A-Za-z0-9])(?:(#)([A-Za-z0-9]+))?([.,]?(?:\s|\Z))/m) do
        before = $1
@@ -188,24 +174,6 @@ module JsDuck
      end
    end

    # Replaces example template with example read from file
    def example(path)
      @example_tpl.gsub(/(%\w)/) do
        case $1
        when '%a'
          if @get_example
            CGI.escapeHTML(@get_example.call(path))
          else
            file = @doc_context[:filename]
            line = @doc_context[:linenr]
            Logger.instance.warn("--inline-examples not specified, but {@example} found", file, line)
          end
        else
          $1
        end
      end
    end

    # applies the link template
    def link(cls, member, anchor_text, type=nil)
      # Use the canonical class name for link (not some alternateClassName)
+9 −3
Original line number Diff line number Diff line
@@ -270,12 +270,18 @@ module JsDuck
      end
    end

    # <mixins> := "mixins" ":" <object-literal>
    # <mixins> := "mixins" ":" [ <object-literal> | <array-literal> ]
    def ext_define_mixins
      if look("mixins", ":", "{")
      if look("mixins", ":")
        match("mixins", ":")
        lit = literal
        lit && lit[:value].map {|x| x[:value][:value] }
        if lit && lit[:type] == :object
          lit[:value].map {|x| x[:value][:value] }
        elsif lit && lit[:type] == :array
          lit[:value].map {|x| x[:value] }
        else
          nil
        end
      end
    end

Loading