-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0858d0
commit 32b00c2
Showing
3,783 changed files
with
451,415 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/ve"] | ||
path = lib/ve | ||
url = https://gerrit.wikimedia.org/r/VisualEditor/VisualEditor.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = :this | ||
@pattern = 'this' | ||
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("`this` : {@link #{name}}") | ||
else | ||
JsDuck::Logger.warn(nil, 'Unexpected @this argument: "'+tag+'"', position) | ||
return tag | ||
end | ||
end | ||
end |
Oops, something went wrong.