(PDOC-212, PDOC-213) add support for @note and @todo

parent d122b196
......@@ -57,7 +57,9 @@ module PuppetStrings::Markdown
# e.g. {:tag_name=>"author", :text=>"eputnam"}
{ :return_val => 'return',
: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
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?
......
......@@ -8,6 +8,14 @@
<%= "The #{name} class." %>
<% end -%>
<% if todo -%>
* **TODO** <%= todo %>
<% end -%>
<% if note -%>
* **Note** <%= note %>
<% end -%>
<% if since -%>
* **Since** <%= since %>
......
......@@ -7,7 +7,15 @@ Type: <%= type %>
<% elsif summary -%>
<%= summary %>
<% else -%>
<%= "The #{name} class." %>
<%= "The #{name} function." %>
<% end -%>
<% if todo -%>
* **TODO** <%= todo %>
<% end -%>
<% if note -%>
* **Note** <%= note %>
<% end -%>
<% signatures.each do |sig| -%>
......@@ -16,6 +24,16 @@ Type: <%= type %>
<% if sig.text -%>
<%= sig.text %>
<% elsif sig.summary -%>
<%= sig.summary %>
<% else -%>
<%= "The #{name} function." %>
<% end -%>
<% if sig.note -%>
* **Note** <%= sig.note %>
<% end -%>
<% if sig.return_type -%>
Returns: `<%= sig.return_type %>`<% if sig.return_val %> <%= sig.return_val %><% end %>
......
......@@ -8,6 +8,14 @@
<%= "The #{name} type." %>
<% end -%>
<% if todo -%>
* **TODO** <%= todo %>
<% end -%>
<% if note -%>
* **Note** <%= note %>
<% end -%>
<% if since -%>
* **Since** <%= since %>
......
<% object.tags(:note).each do |tag| %>
<div class="note notetag">
<strong>Note:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
# Initializes the template.
# @return [void]
def init
sections :header, :box_info, :summary, :overview, T('tags'), :source
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
end
# Renders the box_info section.
......
<% object.tags(:todo).each do |tag| %>
<div class="note todo">
<strong>TODO:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
<% object.tags(:note).each do |tag| %>
<div class="note notetag">
<strong>Note:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
# Initializes the template.
# @return [void]
def init
sections :header, :box_info, :summary, :overview, T('tags'), :source
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
end
<% object.tags(:todo).each do |tag| %>
<div class="note todo">
<strong>TODO:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
<% object.tags(:note).each do |tag| %>
<div class="note notetag">
<strong>Note:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
# Initializes the template.
# @return [void]
def init
sections :header, :box_info, :summary, :overview, [T('tags'), :source]
sections :header, :box_info, :summary, :overview, :note, :todo, [T('tags'), :source]
end
<% object.tags(:todo).each do |tag| %>
<div class="note todo">
<strong>TODO:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
<% object.tags(:note).each do |tag| %>
<div class="note notetag">
<strong>Note:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
# Initializes the template.
# @return [void]
def init
sections :header, :box_info, :summary, :overview, T('tags'), :source
sections :header, :box_info, :summary, :overview, :note, :todo, T('tags'), :source
end
# Renders the box_info section.
......
<% object.tags(:todo).each do |tag| %>
<div class="note todo">
<strong>TODO:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
<% object.tags(:note).each do |tag| %>
<div class="note notetag">
<strong>Note:</strong>
<%= htmlify_line tag.text %>
</div>
<% end %>
# Initializes the template.
# @return [void]
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
# Renders the box_info section.
......
<% 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",
"file": "(stdin)",
"line": 5,
"line": 7,
"inherits": "foo::bar",
"docstring": {
"text": "A simple class.",
"tags": [
{
"tag_name": "todo",
"text": "Do a thing"
},
{
"tag_name": "note",
"text": "Some note"
},
{
"tag_name": "param",
"text": "First param.",
......@@ -44,7 +52,7 @@
{
"name": "dt",
"file": "(stdin)",
"line": 12,
"line": 14,
"docstring": {
"text": "A simple defined type.",
"tags": [
......
......@@ -3,11 +3,19 @@
{
"name": "klass",
"file": "(stdin)",
"line": 5,
"line": 7,
"inherits": "foo::bar",
"docstring": {
"text": "A simple class.",
"tags": [
{
"tag_name": "todo",
"text": "Do a thing"
},
{
"tag_name": "note",
"text": "Some note"
},
{
"tag_name": "param",
"text": "First param.",
......@@ -44,7 +52,7 @@
{
"name": "dt",
"file": "(stdin)",
"line": 12,
"line": 14,
"docstring": {
"text": "A simple defined type.",
"tags": [
......
......@@ -8,6 +8,14 @@
"docstring": {
"text": "A simple class.",
"tags": [
{
"tag_name": "todo",
"text": "Do a thing"
},
{
"tag_name": "note",
"text": "Some note"
},
{
"tag_name": "param",
"text": "First param.",
......
......@@ -39,6 +39,10 @@ _Private Classes_
An overview for a simple class.
* **TODO** Do something.
* **Note** Some note.
* **Since** 1.0.0
* **See also**
......
......@@ -43,6 +43,10 @@ _Private Classes_
An overview for a simple class.
* **TODO** Do a thing
* **Note** some note
* **Since** 1.0.0
* **See also**
......
......@@ -7,6 +7,8 @@ describe PuppetStrings::Json do
# Populate the YARD registry with both Puppet and Ruby source
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
# A simple class.
# @todo Do a thing
# @note Some note
# @param param1 First param.
# @param param2 Second param.
# @param param3 Third param.
......
......@@ -9,6 +9,8 @@ describe PuppetStrings::Markdown do
YARD::Parser::SourceParser.parse_string(<<-SOURCE, :puppet)
# An overview for a simple class.
# @summary A simple class.
# @todo Do a thing
# @note some note
# @since 1.0.0
# @see www.puppet.com
# @example This is an example
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment