(PDOC-212, PDOC-213) add support for @note and @todo
This commit is contained in:
parent
d122b1962b
commit
adbf887246
|
@ -57,7 +57,9 @@ module PuppetStrings::Markdown
|
||||||
# e.g. {:tag_name=>"author", :text=>"eputnam"}
|
# e.g. {:tag_name=>"author", :text=>"eputnam"}
|
||||||
{ :return_val => 'return',
|
{ :return_val => 'return',
|
||||||
:since => 'since',
|
:since => 'since',
|
||||||
:summary => 'summary' }.each do |method_name, tag_name|
|
:summary => 'summary',
|
||||||
|
:note => 'note',
|
||||||
|
:todo => 'todo' }.each do |method_name, tag_name|
|
||||||
# @return [String] unless the tag is nil or the string.length == 0
|
# @return [String] unless the tag is nil or the string.length == 0
|
||||||
define_method method_name do
|
define_method method_name do
|
||||||
@tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0][:text] unless @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0].nil? || @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0][:text].length.zero?
|
@tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0][:text] unless @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0].nil? || @tags.select { |tag| tag[:tag_name] == "#{tag_name}" }[0][:text].length.zero?
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
<%= "The #{name} class." %>
|
<%= "The #{name} class." %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
<% if todo -%>
|
||||||
|
* **TODO** <%= todo %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
<% if note -%>
|
||||||
|
* **Note** <%= note %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
<% if since -%>
|
<% if since -%>
|
||||||
* **Since** <%= since %>
|
* **Since** <%= since %>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,15 @@ Type: <%= type %>
|
||||||
<% elsif summary -%>
|
<% elsif summary -%>
|
||||||
<%= summary %>
|
<%= summary %>
|
||||||
<% else -%>
|
<% else -%>
|
||||||
<%= "The #{name} class." %>
|
<%= "The #{name} function." %>
|
||||||
|
<% end -%>
|
||||||
|
<% if todo -%>
|
||||||
|
* **TODO** <%= todo %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
<% if note -%>
|
||||||
|
* **Note** <%= note %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% signatures.each do |sig| -%>
|
<% signatures.each do |sig| -%>
|
||||||
|
@ -16,6 +24,16 @@ Type: <%= type %>
|
||||||
<% if sig.text -%>
|
<% if sig.text -%>
|
||||||
<%= sig.text %>
|
<%= sig.text %>
|
||||||
|
|
||||||
|
<% elsif sig.summary -%>
|
||||||
|
<%= sig.summary %>
|
||||||
|
|
||||||
|
<% else -%>
|
||||||
|
<%= "The #{name} function." %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
<% if sig.note -%>
|
||||||
|
* **Note** <%= sig.note %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if sig.return_type -%>
|
<% if sig.return_type -%>
|
||||||
Returns: `<%= sig.return_type %>`<% if sig.return_val %> <%= sig.return_val %><% end %>
|
Returns: `<%= sig.return_type %>`<% if sig.return_val %> <%= sig.return_val %><% end %>
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
<%= "The #{name} type." %>
|
<%= "The #{name} type." %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
<% if todo -%>
|
||||||
|
* **TODO** <%= todo %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
<% if note -%>
|
||||||
|
* **Note** <%= note %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
<% if since -%>
|
<% if since -%>
|
||||||
* **Since** <%= since %>
|
* **Since** <%= since %>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:note).each do |tag| %>
|
||||||
|
<div class="note notetag">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,7 @@
|
||||||
# Initializes the template.
|
# Initializes the template.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init
|
def init
|
||||||
sections :header, :box_info, :summary, :overview, T('tags'), :source
|
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders the box_info section.
|
# Renders the box_info section.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:todo).each do |tag| %>
|
||||||
|
<div class="note todo">
|
||||||
|
<strong>TODO:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:note).each do |tag| %>
|
||||||
|
<div class="note notetag">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,5 +1,5 @@
|
||||||
# Initializes the template.
|
# Initializes the template.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init
|
def init
|
||||||
sections :header, :box_info, :summary, :overview, T('tags'), :source
|
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:todo).each do |tag| %>
|
||||||
|
<div class="note todo">
|
||||||
|
<strong>TODO:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:note).each do |tag| %>
|
||||||
|
<div class="note notetag">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,5 +1,5 @@
|
||||||
# Initializes the template.
|
# Initializes the template.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init
|
def init
|
||||||
sections :header, :box_info, :summary, :overview, [T('tags'), :source]
|
sections :header, :box_info, :summary, :overview, :note, :todo, [T('tags'), :source]
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:todo).each do |tag| %>
|
||||||
|
<div class="note todo">
|
||||||
|
<strong>TODO:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:note).each do |tag| %>
|
||||||
|
<div class="note notetag">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,7 @@
|
||||||
# Initializes the template.
|
# Initializes the template.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init
|
def init
|
||||||
sections :header, :box_info, :summary, :overview, T('tags'), :source
|
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders the box_info section.
|
# Renders the box_info section.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:todo).each do |tag| %>
|
||||||
|
<div class="note todo">
|
||||||
|
<strong>TODO:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:note).each do |tag| %>
|
||||||
|
<div class="note notetag">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,7 @@
|
||||||
# Initializes the template.
|
# Initializes the template.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def init
|
def init
|
||||||
sections :header, :box_info, :summary, :overview, T('tags'), :properties, :parameters, :features
|
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :properties, :parameters, :features
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders the box_info section.
|
# Renders the box_info section.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% object.tags(:todo).each do |tag| %>
|
||||||
|
<div class="note todo">
|
||||||
|
<strong>TODO:</strong>
|
||||||
|
<%= htmlify_line tag.text %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -3,11 +3,19 @@
|
||||||
{
|
{
|
||||||
"name": "klass",
|
"name": "klass",
|
||||||
"file": "(stdin)",
|
"file": "(stdin)",
|
||||||
"line": 5,
|
"line": 7,
|
||||||
"inherits": "foo::bar",
|
"inherits": "foo::bar",
|
||||||
"docstring": {
|
"docstring": {
|
||||||
"text": "A simple class.",
|
"text": "A simple class.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
{
|
||||||
|
"tag_name": "todo",
|
||||||
|
"text": "Do a thing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag_name": "note",
|
||||||
|
"text": "Some note"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"tag_name": "param",
|
"tag_name": "param",
|
||||||
"text": "First param.",
|
"text": "First param.",
|
||||||
|
@ -44,7 +52,7 @@
|
||||||
{
|
{
|
||||||
"name": "dt",
|
"name": "dt",
|
||||||
"file": "(stdin)",
|
"file": "(stdin)",
|
||||||
"line": 12,
|
"line": 14,
|
||||||
"docstring": {
|
"docstring": {
|
||||||
"text": "A simple defined type.",
|
"text": "A simple defined type.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
@ -3,11 +3,19 @@
|
||||||
{
|
{
|
||||||
"name": "klass",
|
"name": "klass",
|
||||||
"file": "(stdin)",
|
"file": "(stdin)",
|
||||||
"line": 5,
|
"line": 7,
|
||||||
"inherits": "foo::bar",
|
"inherits": "foo::bar",
|
||||||
"docstring": {
|
"docstring": {
|
||||||
"text": "A simple class.",
|
"text": "A simple class.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
{
|
||||||
|
"tag_name": "todo",
|
||||||
|
"text": "Do a thing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag_name": "note",
|
||||||
|
"text": "Some note"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"tag_name": "param",
|
"tag_name": "param",
|
||||||
"text": "First param.",
|
"text": "First param.",
|
||||||
|
@ -44,7 +52,7 @@
|
||||||
{
|
{
|
||||||
"name": "dt",
|
"name": "dt",
|
||||||
"file": "(stdin)",
|
"file": "(stdin)",
|
||||||
"line": 12,
|
"line": 14,
|
||||||
"docstring": {
|
"docstring": {
|
||||||
"text": "A simple defined type.",
|
"text": "A simple defined type.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
"docstring": {
|
"docstring": {
|
||||||
"text": "A simple class.",
|
"text": "A simple class.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
{
|
||||||
|
"tag_name": "todo",
|
||||||
|
"text": "Do a thing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag_name": "note",
|
||||||
|
"text": "Some note"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"tag_name": "param",
|
"tag_name": "param",
|
||||||
"text": "First param.",
|
"text": "First param.",
|
||||||
|
|
|
@ -39,6 +39,10 @@ _Private Classes_
|
||||||
|
|
||||||
An overview for a simple class.
|
An overview for a simple class.
|
||||||
|
|
||||||
|
* **TODO** Do something.
|
||||||
|
|
||||||
|
* **Note** Some note.
|
||||||
|
|
||||||
* **Since** 1.0.0
|
* **Since** 1.0.0
|
||||||
|
|
||||||
* **See also**
|
* **See also**
|
||||||
|
|
|
@ -43,6 +43,10 @@ _Private Classes_
|
||||||
|
|
||||||
An overview for a simple class.
|
An overview for a simple class.
|
||||||
|
|
||||||
|
* **TODO** Do a thing
|
||||||
|
|
||||||
|
* **Note** some note
|
||||||
|
|
||||||
* **Since** 1.0.0
|
* **Since** 1.0.0
|
||||||
|
|
||||||
* **See also**
|
* **See also**
|
||||||
|
|
|
@ -7,6 +7,8 @@ describe PuppetStrings::Json do
|
||||||
# Populate the YARD registry with both Puppet and Ruby source
|
# Populate the YARD registry with both Puppet and Ruby source
|
||||||
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
|
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
|
||||||
# A simple class.
|
# A simple class.
|
||||||
|
# @todo Do a thing
|
||||||
|
# @note Some note
|
||||||
# @param param1 First param.
|
# @param param1 First param.
|
||||||
# @param param2 Second param.
|
# @param param2 Second param.
|
||||||
# @param param3 Third param.
|
# @param param3 Third param.
|
||||||
|
|
|
@ -9,6 +9,8 @@ describe PuppetStrings::Markdown do
|
||||||
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
|
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
|
||||||
# An overview for a simple class.
|
# An overview for a simple class.
|
||||||
# @summary A simple class.
|
# @summary A simple class.
|
||||||
|
# @todo Do a thing
|
||||||
|
# @note some note
|
||||||
# @since 1.0.0
|
# @since 1.0.0
|
||||||
# @see www.puppet.com
|
# @see www.puppet.com
|
||||||
# @example This is an example
|
# @example This is an example
|
||||||
|
|
Loading…
Reference in New Issue