templates/message.md.erb
---
title: '<%= message.name %>'
sort_title: '<%= message.name.underscore %>'
category: API
excerpt: 'FIXME: Add a description'
---
[comment]: <> (THIS PART IS GENERATED - AKA DON'T EDIT THIS PART MANUALLY)
# <%= message.name %>
> {{ page.excerpt }}
## Attributes:
<%- message.attributes.each do |attribute| -%>
<%- # Link if we are referencing a global or local Enum or an other Message
linked_type = attribute.type
if enum = message.enums.find{|e| e.name == attribute.type}
linked_type = "[#{attribute.type}](##{enum.name.underscore})"
elsif enum = proto.enums.find{|e| e.name == attribute.type}
linked_type = "[#{attribute.type}](../../enums/#{enum.name}/)"
elsif msg = proto.messages.find{|m| m.name == attribute.type}
linked_type = "[#{attribute.type}](../#{msg.name}/)"
end
-%>
- <%= attribute.tag %>: <%= attribute.name %> (<%= linked_type %>)<%= " #{attribute.modifier}" if attribute.modifier %>
<%- end -%>
## Enums:
<%- if message.enums.empty? -%>
- None
<%- else -%>
<%- message.enums.each do |enum| -%>
### <%= enum.name %>
<%- enum.values.each do |value| -%>
- <%= value.tag %>: <%= value.name %>
<%- end -%>
<%- end -%>
<%- end -%>
## Referenced by:
<%- # Find if any messages references an enum with the same name
if (references = proto.messages.find_all{|m| (m.attributes.map(&:type) - m.enums.map(&:name)).include?(message.name)}).empty?
-%>
- None
<%- else -%>
<%- references.each do |ref| -%>
- [<%= ref.name %>](../<%= ref.name %>/)
<%- end -%>
<%- end -%>
[comment]: <> (YOU CAN EDIT AFTER THIS)