Loading Rakefile +0 −1 Original line number Diff line number Diff line Loading @@ -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", Loading lib/jsduck/app.rb +0 −3 Original line number Diff line number Diff line Loading @@ -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 Loading lib/jsduck/doc_formatter.rb +0 −32 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -67,10 +63,8 @@ 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>\s*@example( +[^\n]*)?\s+/m end Loading @@ -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 Loading @@ -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>' Loading Loading @@ -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 Loading Loading @@ -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) Loading lib/jsduck/options.rb +0 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ module JsDuck attr_accessor :videos attr_accessor :examples attr_accessor :categories_path attr_accessor :inline_examples_dir attr_accessor :pretty_json attr_accessor :images attr_accessor :link_tpl Loading Loading @@ -87,7 +86,6 @@ module JsDuck @videos = nil @examples = nil @categories_path = nil @inline_examples_dir = nil @pretty_json = false @images = [] @link_tpl = '<a href="#!/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>' Loading Loading @@ -214,10 +212,6 @@ module JsDuck @categories_path = canonical(path) end opts.on('--inline-examples=PATH', "Path to inline examples directory.", " ") do |path| @inline_examples_dir = canonical(path) end opts.on('--pretty-json', "Turn on pretty-printing of JSON.", " ") do @pretty_json = true end Loading spec/doc_formatter_spec.rb +0 −14 Original line number Diff line number Diff line Loading @@ -113,20 +113,6 @@ describe JsDuck::DocFormatter do '<img src="some/image.png" alt="foo"bar"/>' end # {@example ...} it "replaces {@example foo.js} with source from foo.js file" do @formatter.get_example = lambda { "Some code" } @formatter.replace('{@example foo.js}').should == '<pre class="inline-example"><code>Some code</code></pre>' end it "escapes HTML inside source of {@example}" do @formatter.get_example = lambda { "Some <html> code" } @formatter.replace('{@example foo.js}').should == '<pre class="inline-example"><code>Some <html> code</code></pre>' end # auto-conversion of identifiable ClassNames to links describe "auto-detect" do before do Loading Loading
Rakefile +0 −1 Original line number Diff line number Diff line Loading @@ -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", Loading
lib/jsduck/app.rb +0 −3 Original line number Diff line number Diff line Loading @@ -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 Loading
lib/jsduck/doc_formatter.rb +0 −32 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -67,10 +63,8 @@ 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>\s*@example( +[^\n]*)?\s+/m end Loading @@ -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 Loading @@ -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>' Loading Loading @@ -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 Loading Loading @@ -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) Loading
lib/jsduck/options.rb +0 −6 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ module JsDuck attr_accessor :videos attr_accessor :examples attr_accessor :categories_path attr_accessor :inline_examples_dir attr_accessor :pretty_json attr_accessor :images attr_accessor :link_tpl Loading Loading @@ -87,7 +86,6 @@ module JsDuck @videos = nil @examples = nil @categories_path = nil @inline_examples_dir = nil @pretty_json = false @images = [] @link_tpl = '<a href="#!/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>' Loading Loading @@ -214,10 +212,6 @@ module JsDuck @categories_path = canonical(path) end opts.on('--inline-examples=PATH', "Path to inline examples directory.", " ") do |path| @inline_examples_dir = canonical(path) end opts.on('--pretty-json', "Turn on pretty-printing of JSON.", " ") do @pretty_json = true end Loading
spec/doc_formatter_spec.rb +0 −14 Original line number Diff line number Diff line Loading @@ -113,20 +113,6 @@ describe JsDuck::DocFormatter do '<img src="some/image.png" alt="foo"bar"/>' end # {@example ...} it "replaces {@example foo.js} with source from foo.js file" do @formatter.get_example = lambda { "Some code" } @formatter.replace('{@example foo.js}').should == '<pre class="inline-example"><code>Some code</code></pre>' end it "escapes HTML inside source of {@example}" do @formatter.get_example = lambda { "Some <html> code" } @formatter.replace('{@example foo.js}').should == '<pre class="inline-example"><code>Some <html> code</code></pre>' end # auto-conversion of identifiable ClassNames to links describe "auto-detect" do before do Loading