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

New numeric Tag#html_position for ordering HTML.

Instead of having three fixed places for positioning the docs, the Tag
classes are now sorted based on a numeric #html_position value.  For
start I'm defining three constants, but any other values can also be
used.
parent 117ca608
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -19,9 +19,7 @@ module JsDuck
          "<div>",
            render_sidebar,
            "<div class='doc-contents'>",
              render_tags(@cls, :top),
              render_tags(@cls, :doc),
              render_tags(@cls, :bottom),
              render_tags(@cls),
            "</div>",
            "<div class='members'>",
              render_all_sections,
@@ -30,8 +28,8 @@ module JsDuck
        ].flatten.compact.join
    end

    def render_tags(member, position)
      TagRenderer.render(member, position)
    def render_tags(member)
      TagRenderer.render(member)
    end

    def render_sidebar
@@ -216,11 +214,7 @@ module JsDuck
    def render_long_doc(m)
      doc = []

      doc << render_tags(m, :top)

      doc << render_tags(m, :doc)

      doc << render_tags(m, :bottom)
      doc << render_tags(m)

      doc << render_params_and_return(m)

+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ module JsDuck::Tag
    def initialize
      @pattern = "aside"
      @key = :aside
      @html_position = :top
      @html_position = POS_BEFORE_DOC
    end

    # Parses: @aside [ guide | video| example ] name
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ module JsDuck::Tag
    def initialize
      @key = :default
      @merge_context = [:cfg, :property, :css_var]
      @html_position = :bottom
      @html_position = POS_AFTER_DOC
    end

    def merge(h, docs, code)
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ module JsDuck::Tag
      if @key
        @pattern = @key.to_s
        @signature = {:long => @key.to_s, :short => @key.to_s[0..2].upcase}
        @html_position = :bottom
        @html_position = POS_AFTER_DOC
      end
    end

+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ module JsDuck::Tag
  class Doc < Tag
    def initialize
      @key = :doc
      @html_position = :doc
      @html_position = POS_DOC
    end

    def format(m, formatter)
Loading