Loading lib/jsduck/doc_parser.rb +8 −15 Original line number Diff line number Diff line Loading @@ -115,9 +115,11 @@ module JsDuck elsif look(/@type\b/) at_type elsif look(/@xtype\b/) at_xtype at_xtype(/@xtype/, "widget") elsif look(/@ftype\b/) at_ftype at_xtype(/@ftype/, "feature") elsif look(/@ptype\b/) at_xtype(/@ptype/, "plugin") elsif look(/@member\b/) at_member elsif look(/@inherit[dD]oc\b/) Loading Loading @@ -316,21 +318,12 @@ module JsDuck skip_white end # matches @xtype name def at_xtype match(/@xtype/) # matches @xtype/ptype/ftype/... name def at_xtype(tag, namespace) match(tag) add_tag(:alias) skip_horiz_white @current_tag[:name] = "widget." + (ident_chain || "") skip_white end # matches @ftype name def at_ftype match(/@ftype/) add_tag(:alias) skip_horiz_white @current_tag[:name] = "feature." + (ident_chain || "") @current_tag[:name] = namespace + "." + (ident_chain || "") skip_white end Loading spec/aggregator_aliases_spec.rb +28 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,34 @@ describe JsDuck::Aggregator do end end describe "class with @ftype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @ftype foo */ EOS end it "detects a feature alias" do @doc[:aliases].should == {"feature" => ["foo"]} end end describe "class with @ptype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @ptype foo */ EOS end it "detects a plugin alias" do @doc[:aliases].should == {"plugin" => ["foo"]} end end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] Loading Loading
lib/jsduck/doc_parser.rb +8 −15 Original line number Diff line number Diff line Loading @@ -115,9 +115,11 @@ module JsDuck elsif look(/@type\b/) at_type elsif look(/@xtype\b/) at_xtype at_xtype(/@xtype/, "widget") elsif look(/@ftype\b/) at_ftype at_xtype(/@ftype/, "feature") elsif look(/@ptype\b/) at_xtype(/@ptype/, "plugin") elsif look(/@member\b/) at_member elsif look(/@inherit[dD]oc\b/) Loading Loading @@ -316,21 +318,12 @@ module JsDuck skip_white end # matches @xtype name def at_xtype match(/@xtype/) # matches @xtype/ptype/ftype/... name def at_xtype(tag, namespace) match(tag) add_tag(:alias) skip_horiz_white @current_tag[:name] = "widget." + (ident_chain || "") skip_white end # matches @ftype name def at_ftype match(/@ftype/) add_tag(:alias) skip_horiz_white @current_tag[:name] = "feature." + (ident_chain || "") @current_tag[:name] = namespace + "." + (ident_chain || "") skip_white end Loading
spec/aggregator_aliases_spec.rb +28 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,34 @@ describe JsDuck::Aggregator do end end describe "class with @ftype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @ftype foo */ EOS end it "detects a feature alias" do @doc[:aliases].should == {"feature" => ["foo"]} end end describe "class with @ptype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @ptype foo */ EOS end it "detects a plugin alias" do @doc[:aliases].should == {"plugin" => ["foo"]} end end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] Loading