Commit df2a465b authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Parse and process @author and @docauthor tags.

But still create no output.  Simply make it easier for somebody
to override the tag and add the output capability.
parent c9300d3c
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
require "jsduck/tag/tag"

module JsDuck::Tag
  # Author tag gets processed, but no output gets created.  Users of
  # JSDuck may override this tag to make it print the names of
  # authors.
  class Author < Tag
    def initialize
      @pattern = "author"
      @tagname = :author
    end

    # @author Name of Author <email@example.com> ...
    # Everything until the end of line gets just ignored.
    def parse_doc(p)
      p.match(/.*$/)
      name = p.match(/[^<\n]*/).strip
      if p.look(/</)
        p.match(/</)
        email = p.match(/[^>\n]*/)
        p.match(/>/)
      end

      return {:tagname => @tagname, :name => name, :email => email}
    end

    def process_doc(context, tags, pos)
      context[@tagname] = tags
    end
  end
end
+2 −0
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@ module JsDuck::Tag
  # Exactly the same as @author tag - it's simply ignored.
  class Docauthor < Author
    def initialize
      super
      @pattern = "docauthor"
      @tagname = :docauthor
    end
  end
end