Merge "Remove #bodyContent { width: 100%; }"
[lhc/web/wiklou.git] / maintenance / jsduck / MetaTags.rb
index 83cc088..cde7d3b 100644 (file)
@@ -1,6 +1,8 @@
+# Custom tags for JSDuck 4.x
 # See also:
 # - https://github.com/senchalabs/jsduck/wiki/Tags
 # - https://github.com/senchalabs/jsduck/wiki/Custom-tags
+# - https://github.com/senchalabs/jsduck/wiki/Custom-tags/7f5c32e568eab9edc8e3365e935bcb836cb11f1d
 require 'jsduck/meta_tag'
 
 class SourceTag < JsDuck::MetaTag
@@ -67,3 +69,35 @@ class SeeTag < JsDuck::MetaTag
     end
   end
 end
+
+# As of JSDuck 5 this is in core
+class FiresTag < JsDuck::MetaTag
+  def initialize
+    @name = 'fires'
+    @multiline = true
+  end
+
+  # @param tags All matches of this tag on one class.
+  def to_html(tags)
+    doc = []
+    doc << '<h3 class="pa">Fires</h3>'
+    doc << [
+        '<ul>',
+        tags.map {|tag| render_long_event(tag) },
+        '</ul>',
+      ]
+    doc
+  end
+
+  def render_long_event(tag)
+    if tag =~ /\A(\w+)( .*)?\Z/m
+      name = $1
+      doc = $2 ? ': ' + $2 : ''
+      return [
+        '<li>',
+        format("{@link #event-#{name}} #{doc}"),
+        '</li>'
+      ]
+    end
+  end
+end