Skip to content

Commit

Permalink
Add missing JSON field to docs generator output for constants (#6218)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored and bcardiff committed Jun 21, 2018
1 parent 60cde01 commit 666c192
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/compiler/crystal/tools/doc/constant.cr
Expand Up @@ -17,6 +17,10 @@ class Crystal::Doc::Constant
@const.name
end

def id
name
end

def value
@const.value
end
Expand All @@ -27,6 +31,7 @@ class Crystal::Doc::Constant

def to_json(builder : JSON::Builder)
builder.object do
builder.field "id", id
builder.field "name", name
builder.field "value", value.try(&.to_s)
builder.field "doc", doc
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/tools/doc/html/type.html
Expand Up @@ -59,7 +59,7 @@ <h2>Constant Summary</h2>
<% end %>
<dl>
<% type.constants.each do |const| %>
<dt class="entry-const" id="<%= const.name %>">
<dt class="entry-const" id="<%= const.id %>">
<strong><%= const.name %></strong> = <code><%= const.formatted_value %></code>
</dt>
<% if doc = const.formatted_doc %>
Expand Down

0 comments on commit 666c192

Please sign in to comment.