Commit 394fe946 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Turn @author & @docauthor into builtin Tag classes.

parent 3aecf67a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
require "jsduck/builtins/tag"

module JsDuck::Builtins
  class Author < Tag
    def initialize
      @pattern = "author"
    end

    # @author Name of Author <email@example.com> ...
    # Everything until the end of line gets just ignored.
    def parse(p)
      p.match(/.*$/)
    end
  end
end
+10 −0
Original line number Diff line number Diff line
require "jsduck/builtins/author"

module JsDuck::Builtins
  # Exactly the same as @author tag - it's simply ignored.
  class Docauthor < Author
    def initialize
      @pattern = "docauthor"
    end
  end
end

lib/jsduck/tag/author.rb

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
require "jsduck/meta_tag"

module JsDuck::Tag
  # Implementation of hidden @author tag
  class Author < JsDuck::MetaTag
    def initialize
      @name = "author"
    end
  end
end

lib/jsduck/tag/docauthor.rb

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
require "jsduck/meta_tag"

module JsDuck::Tag
  # Implementation of hidden @docauthor tag
  class Docauthor < JsDuck::MetaTag
    def initialize
      @name = "docauthor"
    end
  end
end
+6 −6
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ describe JsDuck::Aggregator do

  class AuthorTag < JsDuck::MetaTag
    def initialize
      @name = "author"
      @name = "xauthor"
      @key = :author
    end
  end
@@ -52,8 +52,8 @@ describe JsDuck::Aggregator do
      @doc = parse(<<-EOS)[0]
        /**
         * @class MyClass
         * @author John Doe
         * @author Steve Jobs
         * @xauthor John Doe
         * @xauthor Steve Jobs
         * @email Kill Bill
         * Comment here.
         */
@@ -77,7 +77,7 @@ describe JsDuck::Aggregator do
         * @long Some text
         * on multiple
         * lines.
         * @author Steve Jobs
         * @xauthor Steve Jobs
         */
      EOS
    end
@@ -96,7 +96,7 @@ describe JsDuck::Aggregator do
        /**
         * @class MyClass
         * @long Me {@link foo bar}
         * @author Me {@link foo bar}
         * @xauthor Me {@link foo bar}
         */
      EOS
    end
@@ -115,7 +115,7 @@ describe JsDuck::Aggregator do
        /**
         * @method foo
         * Some description.
         * @author John Doe
         * @xauthor John Doe
         */
      EOS
    end