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

Render private class notice inside Tag::Private.

parent 4d3435df
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ module JsDuck
            render_sidebar,
            "<div class='doc-contents'>",
              render_tags(@cls, :top),
              render_private_class_notice,
              @cls[:doc],
              render_enum_class_notice,
              render_tags(@cls, :bottom),
@@ -32,15 +31,6 @@ module JsDuck
        ].flatten.compact.join
    end

    def render_private_class_notice
      return if !@cls[:private]
      return [
        "<p class='private'><strong>NOTE</strong> ",
        "This is a private utility class for internal use by the framework. ",
        "Don't rely on its existence.</p>",
      ]
    end

    def render_enum_class_notice
      return if !@cls[:enum]

+12 −0
Original line number Diff line number Diff line
@@ -5,7 +5,19 @@ module JsDuck::Tag
    def initialize
      @key = :private
      @signature = {:long => "private", :short => "PRI"}
      @html_position = :top
      super
    end

    # Add notice to private classes
    def to_html(context)
      return unless context[:tagname] == :class

      return [
        "<p class='private'><strong>NOTE</strong> ",
        "This is a private utility class for internal use by the framework. ",
        "Don't rely on its existence.</p>",
      ]
    end
  end
end