diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /maintenance/jsduck | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'maintenance/jsduck')
-rw-r--r-- | maintenance/jsduck/CustomTags.rb | 116 | ||||
-rw-r--r-- | maintenance/jsduck/MetaTags.rb | 69 | ||||
-rw-r--r-- | maintenance/jsduck/categories.json | 55 | ||||
-rw-r--r-- | maintenance/jsduck/config.json | 47 | ||||
-rw-r--r-- | maintenance/jsduck/eg-iframe.html | 154 |
5 files changed, 273 insertions, 168 deletions
diff --git a/maintenance/jsduck/CustomTags.rb b/maintenance/jsduck/CustomTags.rb new file mode 100644 index 00000000..2aff9881 --- /dev/null +++ b/maintenance/jsduck/CustomTags.rb @@ -0,0 +1,116 @@ +# Custom tags for JSDuck 5.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/tag/tag' + +class CommonTag < JsDuck::Tag::Tag + def initialize + @html_position = POS_DOC + 0.1 + @repeatable = true + end + + def parse_doc(scanner, position) + if @multiline + return { :tagname => @tagname, :doc => :multiline } + else + text = scanner.match(/.*$/) + return { :tagname => @tagname, :doc => text } + end + end + + def process_doc(context, tags, position) + context[@tagname] = tags + end + + def format(context, formatter) + context[@tagname].each do |tag| + tag[:doc] = formatter.format(tag[:doc]) + end + end +end + +class SourceTag < CommonTag + def initialize + @tagname = :source + @pattern = "source" + super + end + + def to_html(context) + context[@tagname].map do |source| + <<-EOHTML + <h3 class='pa'>Source</h3> + #{source[:doc]} + EOHTML + end.join + end +end + +class SeeTag < CommonTag + def initialize + @tagname = :see + @pattern = "see" + super + end + + def format(context, formatter) + position = context[:files][0] + context[@tagname].each do |tag| + tag[:doc] = '<li>' + render_long_see(tag[:doc], formatter, position) + '</li>' + end + end + + def to_html(context) + <<-EOHTML + <h3 class="pa">Related</h3> + <ul> + #{ context[@tagname].map {|tag| tag[:doc] }.join("\n") } + </ul> + EOHTML + end + + def render_long_see(tag, formatter, position) + if tag =~ /\A([^\s]+)( .*)?\Z/m + name = $1 + doc = $2 ? ': ' + $2 : '' + return formatter.format("{@link #{name}} #{doc}") + else + JsDuck::Logger.warn(nil, 'Unexpected @see argument: "'+tag+'"', position) + return tag + end + end +end + +class ContextTag < CommonTag + def initialize + @tagname = :context + @pattern = 'context' + super + end + + def format(context, formatter) + position = context[:files][0] + context[@tagname].each do |tag| + tag[:doc] = render_long_context(tag[:doc], formatter, position) + end + end + + def to_html(context) + <<-EOHTML + <h3 class="pa">Context</h3> + #{ context[@tagname].last[:doc] } + EOHTML + end + + def render_long_context(tag, formatter, position) + if tag =~ /\A([^\s]+)/m + name = $1 + return formatter.format("`context` : {@link #{name}}") + else + JsDuck::Logger.warn(nil, 'Unexpected @context argument: "'+tag+'"', position) + return tag + end + end +end diff --git a/maintenance/jsduck/MetaTags.rb b/maintenance/jsduck/MetaTags.rb deleted file mode 100644 index 83cc0884..00000000 --- a/maintenance/jsduck/MetaTags.rb +++ /dev/null @@ -1,69 +0,0 @@ -# See also: -# - https://github.com/senchalabs/jsduck/wiki/Tags -# - https://github.com/senchalabs/jsduck/wiki/Custom-tags -require 'jsduck/meta_tag' - -class SourceTag < JsDuck::MetaTag - def initialize - # This defines the name of the @tag - @name = 'source' - end - - # Generate HTML output for this tag. - # One can make use of the #format method to easily support - # Markdown and {@link} tags inside the contents of the tag. - # - # @param tags All matches of this tag on one class. - def to_html(tags) - '<h3 class="pa">Source</h3>' + tags.map {|tag| format(tag) }.join("\n") - end -end - -class ContextTag < JsDuck::MetaTag - def initialize - @name = 'context' - end - - # @param tags All matches of this tag on one class. - def to_html(tags) - return '<h3 class="pa">Context</h3>' + render_long_context(tags.last) - end - - def render_long_context(tag) - if tag =~ /\A([^\s]+)/m - name = $1 - return format("`this` : {@link #{name}}") - end - end -end - -class SeeTag < JsDuck::MetaTag - def initialize - @name = 'see' - @multiline = true - end - - # @param tags All matches of this tag on one class. - def to_html(tags) - doc = [] - doc << '<h3 class="pa">Related</h3>' - doc << [ - '<ul>', - tags.map {|tag| render_long_see(tag) }, - '</ul>', - ] - doc - end - - def render_long_see(tag) - if tag =~ /\A([^\s]+)( .*)?\Z/m - name = $1 - doc = $2 ? ': ' + $2 : '' - return [ - '<li>', - format("{@link #{name}} #{doc}"), - '</li>' - ] - end - end -end diff --git a/maintenance/jsduck/categories.json b/maintenance/jsduck/categories.json index f96902d8..d6163bde 100644 --- a/maintenance/jsduck/categories.json +++ b/maintenance/jsduck/categories.json @@ -9,7 +9,7 @@ "mw.Map", "mw.Message", "mw.loader", - "mw.log", + "mw.loader.store", "mw.html", "mw.html.Cdata", "mw.html.Raw", @@ -20,12 +20,13 @@ "name": "General", "classes": [ "mw.Title", - "mw.inspect", - "mw.inspect.reports", + "mw.Uri", "mw.notification", + "mw.Notification_", "mw.user", "mw.util", - "mw.plugin.*" + "mw.plugin.*", + "mw.cookie" ] }, { @@ -35,6 +36,42 @@ { "name": "API", "classes": ["mw.Api*"] + }, + { + "name": "Language", + "classes": [ + "mw.language*", + "mw.cldr", + "mw.jqueryMsg" + ] + }, + { + "name": "Page", + "classes": [ + "mw.page*" + ] + }, + { + "name": "Interfaces", + "classes": [ + "mw.Feedback" + ] + }, + { + "name": "Special", + "classes": [ + "mw.special*" + ] + }, + { + "name": "Development", + "classes": [ + "mw.log", + "mw.inspect", + "mw.inspect.reports", + "mw.Debug", + "mw.Debug.profile" + ] } ] }, @@ -43,7 +80,11 @@ "groups": [ { "name": "Plugins", - "classes": ["jQuery.plugin.*"] + "classes": [ + "jQuery.client", + "jQuery.colorUtil", + "jQuery.plugin.*" + ] } ] }, @@ -51,6 +92,10 @@ "name": "Upstream", "groups": [ { + "name": "OOJS", + "classes": ["OO", "OO.*"] + }, + { "name": "jQuery", "classes": ["jQuery", "jQuery.Event", "jQuery.Callbacks", "jQuery.Promise", "jQuery.Deferred", "jQuery.jqXHR", "QUnit"] }, diff --git a/maintenance/jsduck/config.json b/maintenance/jsduck/config.json index e6e0f658..e97f2923 100644 --- a/maintenance/jsduck/config.json +++ b/maintenance/jsduck/config.json @@ -1,27 +1,40 @@ { "--title": "MediaWiki core - Documentation", - "--footer": "Documentation for MediaWiki core. Generated on {DATE} by {JSDUCK} {VERSION}.", "--categories": "./categories.json", - "--meta-tags": "./MetaTags.rb", "--eg-iframe": "./eg-iframe.html", - "--warnings": ["-no_doc"], + "--tags": "./CustomTags.rb", + "--warnings": ["-nodoc(class,public)"], "--builtin-classes": true, + "--warnings-exit-nonzero": true, + "--external": "HTMLElement,HTMLDocument,Window,File", + "--footer": "Documentation for MediaWiki core. Generated on {DATE} by {JSDUCK} {VERSION}.", "--output": "../../docs/js", "--": [ "./external.js", - "../../resources/mediawiki/mediawiki.js", - "../../resources/mediawiki/mediawiki.log.js", - "../../resources/mediawiki/mediawiki.util.js", - "../../resources/mediawiki/mediawiki.Title.js", - "../../resources/mediawiki/mediawiki.inspect.js", - "../../resources/mediawiki/mediawiki.notify.js", - "../../resources/mediawiki/mediawiki.notification.js", - "../../resources/mediawiki/mediawiki.user.js", - "../../resources/mediawiki.action/mediawiki.action.edit.js", - "../../resources/mediawiki.action/mediawiki.action.view.postEdit.js", - "../../resources/mediawiki.page/mediawiki.page.startup.js", - "../../resources/mediawiki.api", - "../../resources/jquery/jquery.localize.js", - "../../resources/jquery/jquery.spinner.js" + "../../resources/src/mediawiki", + "../../resources/src/mediawiki.action", + "../../resources/src/mediawiki.api", + "../../resources/src/mediawiki.language", + "../../resources/src/mediawiki.page", + "../../resources/src/mediawiki.special", + "../../resources/src/jquery/jquery.accessKeyLabel.js", + "../../resources/src/jquery/jquery.arrowSteps.js", + "../../resources/src/jquery/jquery.autoEllipsis.js", + "../../resources/src/jquery/jquery.badge.js", + "../../resources/src/jquery/jquery.byteLength.js", + "../../resources/src/jquery/jquery.byteLimit.js", + "../../resources/src/jquery/jquery.checkboxShiftClick.js", + "../../resources/src/jquery/jquery.client.js", + "../../resources/src/jquery/jquery.colorUtil.js", + "../../resources/src/jquery/jquery.confirmable.js", + "../../resources/src/jquery/jquery.footHovzer.js", + "../../resources/src/jquery/jquery.getAttrs.js", + "../../resources/src/jquery/jquery.hidpi.js", + "../../resources/src/jquery/jquery.localize.js", + "../../resources/src/jquery/jquery.makeCollapsible.js", + "../../resources/src/jquery/jquery.spinner.js", + "../../resources/src/jquery/jquery.tabIndex.js", + "../../resources/lib/oojs", + "../../resources/lib/oojs-ui" ] } diff --git a/maintenance/jsduck/eg-iframe.html b/maintenance/jsduck/eg-iframe.html index 86eae4b6..7dc4afa8 100644 --- a/maintenance/jsduck/eg-iframe.html +++ b/maintenance/jsduck/eg-iframe.html @@ -1,88 +1,88 @@ <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <title>MediaWiki Code Example</title> - <script src="modules/startup.js"></script> - <script> - function startUp() { - mw.config = new mw.Map(); - } - </script> - <script src="modules/jquery/jquery.js"></script> - <script src="modules/mediawiki/mediawiki.js"></script> - <style> - .mw-jsduck-log { - position: relative; - min-height: 3em; - margin-top: 2em; - background: #f7f7f7; - border: 1px solid #e4e4e4; - } + <meta charset="utf-8"> + <title>MediaWiki Code Example</title> + <script src="modules/startup.js"></script> + <script> + function startUp() { + mw.config = new mw.Map(); + } + </script> + <script src="modules/jquery/jquery.js"></script> + <script src="modules/mediawiki/mediawiki.js"></script> + <style> + .mw-jsduck-log { + position: relative; + min-height: 3em; + margin-top: 2em; + background: #f7f7f7; + border: 1px solid #e4e4e4; + } - .mw-jsduck-log::after { - position: absolute; - bottom: 100%; - right: -1px; - padding: 0.5em; - background: #fff; - border: 1px solid #e4e4e4; - border-bottom: 0; - border-radius: 0.5em 0.5em 0 0; - font: normal 0.5em sans-serif; - content: 'console'; - } + .mw-jsduck-log::after { + position: absolute; + bottom: 100%; + right: -1px; + padding: 0.5em; + background: #fff; + border: 1px solid #e4e4e4; + border-bottom: 0; + border-radius: 0.5em 0.5em 0 0; + font: normal 0.5em sans-serif; + content: 'console'; + } - .mw-jsduck-log-line { - padding: 0.2em 0.5em; - white-space: pre-wrap; - } + .mw-jsduck-log-line { + padding: 0.2em 0.5em; + white-space: pre-wrap; + } - .mw-jsduck-log-line:nth-child(odd) { - background: #fff; - } - </style> + .mw-jsduck-log-line:nth-child(odd) { + background: #fff; + } + </style> </head> <body> - <script> - /** - * Basic log console for the example iframe in documentation pages. - */ - ( function () { - var pre; - mw.log = function () { - var str, i, len, line; - if ( !pre ) { - pre = document.createElement( 'pre' ); - pre.className = 'mw-jsduck-log'; - document.body.appendChild( pre ); - } - str = []; - for ( i = 0, len = arguments.length; i < len; i++ ) { - str.push( String( arguments[ i ] ) ); - } - line = document.createElement( 'div' ); - line.className = 'mw-jsduck-log-line'; - line.appendChild( - document.createTextNode( str.join( ' , ' ) + '\n' ) - ); - pre.appendChild( line ); - }; - }() ); +<script> + /** + * Basic log console for the example iframe in documentation pages. + */ + ( function () { + var pre; + mw.log = function () { + var str, i, len, line; + if ( !pre ) { + pre = document.createElement( 'pre' ); + pre.className = 'mw-jsduck-log'; + document.body.appendChild( pre ); + } + str = []; + for ( i = 0, len = arguments.length; i < len; i++ ) { + str.push( String( arguments[ i ] ) ); + } + line = document.createElement( 'div' ); + line.className = 'mw-jsduck-log-line'; + line.appendChild( + document.createTextNode( str.join( ' , ' ) + '\n' ) + ); + pre.appendChild( line ); + }; + }() ); - /** - * Method called by jsduck to execute the example code. - */ - function loadInlineExample( code, options, callback ) { - try { - eval( code ); - callback && callback( true ); - } catch (e) { - mw.log( 'Uncaught exception: ' + e ); - callback && callback( false, e ); - throw e; - } - } - </script> + /** + * Method called by jsduck to execute the example code. + */ + function loadInlineExample( code, options, callback ) { + try { + eval( code ); + callback && callback( true ); + } catch ( e ) { + mw.log( 'Uncaught exception: ' + e ); + callback && callback( false, e ); + throw e; + } + } +</script> </body> </html> |