Commit 2cac599b authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Allow documented CSS idents to begin without $.

It's not fully correct, but at least it makes the @member tag work as expected.
parent 3d695250
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ module JsDuck
  class DocParser
    # Pass in :css to be able to parse CSS doc-comments
    def initialize(mode = :js)
      @ident_pattern = (mode == :css) ? /\$[\w-]*/ : /\w+/
      @ident_chain_pattern = (mode == :css) ? /\$[\w-]+(\.[\w-]+)*/ : /\w+(\.\w+)*/
      @ident_pattern = (mode == :css) ? /\$?[\w-]+/ : /[$\w]\w*/
      @ident_chain_pattern = (mode == :css) ? /\$?[\w-]+(\.[\w-]+)*/ : /[$\w]\w*(\.\w+)*/
    end

    def parse(input)
+15 −0
Original line number Diff line number Diff line
@@ -37,6 +37,21 @@ describe JsDuck::Aggregator do
    end
  end

  describe "CSS @var with @member" do
    before do
      @doc = parse(<<-EOCSS)[0]
        /**
         * @var {measurement} $button-height Default height for buttons.
         * @member Ext.Button
         */
      EOCSS
    end

    it "detects owner" do
      @doc[:owner].should == "Ext.Button"
    end
  end

  describe "CSS doc-comment followed by @mixin" do
    before do
      @doc = parse(<<-EOCSS)[0]