Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn @SInCE & @new to builtin Tag classes.
For now I'm leaving out the tooltip text implementation for the @new tag - needs some further refactoring.
- Loading branch information
Showing
9 changed files
with
84 additions
and
87 deletions.
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
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,23 @@ | ||
require "jsduck/builtins/boolean_tag" | ||
|
||
module JsDuck::Builtins | ||
class New < BooleanTag | ||
def initialize | ||
@key = :new | ||
@signature = {:long => "★", :short => "★"} # unicode black star char | ||
end | ||
|
||
# Initializes the tooltip text. | ||
# | ||
# FIXME: Copy-pasted code from old Boolean tag class, doesn't | ||
# currently work as it's never called. | ||
def create_tooltip!(imports, new_since) | ||
if new_since | ||
@signature[:tooltip] = "New since #{new_since}" | ||
elsif imports.length > 0 | ||
@signature[:tooltip] = "New since #{imports.last[:version]}" | ||
end | ||
end | ||
|
||
end | ||
end |
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,32 @@ | ||
require "jsduck/builtins/tag" | ||
require "jsduck/logger" | ||
|
||
module JsDuck::Builtins | ||
class Since < Tag | ||
def initialize | ||
@pattern = "since" | ||
@key = :since | ||
@html_position = :bottom | ||
end | ||
|
||
def parse(p) | ||
p.add_tag(:since) | ||
p.skip_horiz_white | ||
p.current_tag[:version] = p.match(/.*$/).strip | ||
end | ||
|
||
def process_doc(tags) | ||
if tags.length > 1 | ||
JsDuck::Logger.warn(nil, "Only one @since tag allowed per class/member.") | ||
end | ||
tags[0][:version] | ||
end | ||
|
||
def to_html(context) | ||
<<-EOHTML | ||
<p>Available since: <b>#{context[:since]}</b></p> | ||
EOHTML | ||
end | ||
|
||
end | ||
end |
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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