Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsduck
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
extjs
jsduck
Commits
76dcf0e7
Commit
76dcf0e7
authored
Mar 30, 2013
by
Rene Saarsoo
Browse files
Options
Downloads
Patches
Plain Diff
Implement @localdoc tag.
parent
b4e18797
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/jsduck/tag/localdoc.rb
+33
-0
33 additions, 0 deletions
lib/jsduck/tag/localdoc.rb
lib/jsduck/tag/tag.rb
+12
-11
12 additions, 11 deletions
lib/jsduck/tag/tag.rb
spec/aggregator_localdoc_spec.rb
+65
-0
65 additions, 0 deletions
spec/aggregator_localdoc_spec.rb
with
110 additions
and
11 deletions
lib/jsduck/tag/localdoc.rb
0 → 100644
+
33
−
0
View file @
76dcf0e7
require
"jsduck/tag/tag"
require
'jsduck/format/shortener'
module
JsDuck::Tag
# Non-inheritable documentation
class
Localdoc
<
Tag
def
initialize
@pattern
=
"localdoc"
@tagname
=
:localdoc
@html_position
=
POS_LOCALDOC
end
def
parse_doc
(
p
,
pos
)
{
:tagname
=>
:localdoc
,
:doc
=>
:multiline
,
}
end
def
process_doc
(
m
,
tags
,
pos
)
m
[
:localdoc
]
=
tags
.
map
{
|
t
|
t
[
:doc
]
}.
join
(
"
\n\n
"
)
end
def
format
(
m
,
formatter
)
m
[
:localdoc
]
=
formatter
.
format
(
m
[
:localdoc
])
end
def
to_html
(
m
)
m
[
:localdoc
]
end
end
end
This diff is collapsed.
Click to expand it.
lib/jsduck/tag/tag.rb
+
12
−
11
View file @
76dcf0e7
...
...
@@ -171,17 +171,18 @@ module JsDuck::Tag
POS_ASIDE
=
1
POS_PRIVATE
=
2
POS_DOC
=
3
POS_DEFAULT
=
4
POS_SINCE
=
5
POS_DEPRECATED
=
6
POS_ENUM
=
7
POS_TEMPLATE
=
8
POS_PREVENTABLE
=
9
POS_PARAM
=
10
POS_SUBPROPERTIES
=
11
POS_RETURN
=
12
POS_THROWS
=
13
POS_OVERRIDES
=
14
POS_LOCALDOC
=
4
POS_DEFAULT
=
5
POS_SINCE
=
6
POS_DEPRECATED
=
7
POS_ENUM
=
8
POS_TEMPLATE
=
9
POS_PREVENTABLE
=
10
POS_PARAM
=
11
POS_SUBPROPERTIES
=
12
POS_RETURN
=
13
POS_THROWS
=
14
POS_OVERRIDES
=
15
# Called before #to_html to allow rendering of Markdown content.
# For this an instance of DocFormatter is passed in, on which one
...
...
This diff is collapsed.
Click to expand it.
spec/aggregator_localdoc_spec.rb
0 → 100644
+
65
−
0
View file @
76dcf0e7
require
"mini_parser"
describe
JsDuck
::
Aggregator
do
def
parse
(
string
)
Helper
::
MiniParser
.
parse
(
string
,
{
:inherit_doc
=>
true
})
end
describe
"Inheriting from parent with @localdoc"
do
let
(
:cls
)
do
@docs
=
parse
(
<<-
EOF
)
/**
* @class Parent
* Parent docs.
* @localdoc Parent-specific docs.
*/
/**
* @class Child
* @extend Parent
* @inheritdoc
*/
EOF
@docs
[
"Child"
]
end
it
"inherits :doc"
do
cls
[
:doc
].
should
==
"Parent docs."
end
it
"doesn't inherit @localdoc"
do
cls
[
:localdoc
].
should
==
nil
end
end
describe
"Inheriting while having @localdoc in both parent and child"
do
let
(
:cls
)
do
@docs
=
parse
(
<<-
EOF
)
/**
* @class Parent
* Parent docs.
* @localdoc Parent-specific docs.
*/
/**
* @class Child
* @extend Parent
* @inheritdoc
* @localdoc Child-specific docs.
*/
EOF
@docs
[
"Child"
]
end
it
"inherits :doc"
do
cls
[
:doc
].
should
==
"Parent docs."
end
it
"keeps local @localdoc"
do
cls
[
:localdoc
].
should
==
"Child-specific docs."
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment