Commit 4ddb119d authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Implement @private & @ignore as meta-tags.

Hacks no more needed to inject private tag into meta tags list,
it's now in there naturally. Although now I'm doing a small hack
to make :private appear on doc object hash itself.

With this, the [pri] label will appear in search results dropdown.
parent 37e91df2
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ module JsDuck
          :examples => @assets.examples.to_array,
          :search => SearchData.new.create(@relations.classes),
          :stats => @opts.stats ? Stats.new.create(@relations.classes) : [],
          :signatures => signatures,
          :signatures => MetaTagRegistry.instance.signatures,
          :localStorageDb => @opts.local_storage_db,
          :showPrintButton => @opts.seo,
          :touchExamplesUi => @opts.touch_examples_ui,
@@ -33,13 +33,6 @@ module JsDuck
      File.open(filename, 'w') {|f| f.write(js) }
    end

    def signatures
      sigs = MetaTagRegistry.instance.signatures
      # Inject private to meta tag signatures list
      sigs << {:key => 'private', :long => 'private', :short => 'PRI'}
      sigs
    end

  end

end
+0 −2
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@ module JsDuck
      [:name, :tagname, :owner, :meta, :id].each do |key|
        m_copy[key] = m[key]
      end
      # Inject :private to meta.
      m_copy[:meta][:private] = true if m[:private]
      m_copy
    end

+0 −2
Original line number Diff line number Diff line
@@ -134,8 +134,6 @@ module JsDuck
          at_var
        elsif look(/@inheritable\b/)
          boolean_at_tag(/@inheritable/, :inheritable)
        elsif look(/@(private|ignore)\b/)
          boolean_at_tag(/@(private|ignore)/, :private)
        elsif look(/@accessor\b/)
          boolean_at_tag(/@accessor/, :accessor)
        elsif look(/@evented\b/)
+4 −1
Original line number Diff line number Diff line
@@ -227,12 +227,15 @@ module JsDuck
    # Detects properties common for each doc-object and adds them
    def add_shared(hash, doc_map)
      hash.merge!({
        :private => !!doc_map[:private],
        :inheritable => !!doc_map[:inheritable],
        :inheritdoc => doc_map[:inheritdoc] ? doc_map[:inheritdoc].first : nil,
        :meta => detect_meta(doc_map),
      })
      # copy :private also to main hash
      hash[:private] = true if hash[:meta][:private]

      hash[:id] = create_member_id(hash)

      return hash
    end

+13 −0
Original line number Diff line number Diff line
require "jsduck/meta_tag"

module JsDuck::Tag
  # @ignore is alias for @private
  class Ignore < JsDuck::MetaTag
    def initialize
      @name = "ignore"
      @key = :private
      @boolean = true
    end
  end
end
Loading