<%=
t_(<<~TEXT.chomp
    # This is a data file that contains information describing the text that is
    # displayed on pages in the Lang section of Sonic Pi's help panel.
    TEXT
)
%>

## <%= t_('Function name') %>
## ====================
# <%= t_('A unique identifier for this function.') %>
["<%= item[:name] %>"]

## <%= t_('Function summary') %>
## ====================
# <%= t_('A short phrase describing this Sonic Pi function.') %>
<%
summary = item[:summary]
summary[0] = summary[0].capitalize
-%>
summary = "<%= t_(summary) %>"

## <%= t_('Function description') %>
## ====================
# <%= t_('The detailed description of this function.') %>
doc = '''
<%= t_(item[:doc]) %>
'''

## <%= t_('Function args') %>
## ====================
<%=
t_(<<~TEXT.chomp
# Args are the required parameters for the function. Each arg has two documented
# properties:
# - the arg's name
# - the arg's type (number, integer, symbol, ...).
TEXT
)
%>
# <%= t_('Example:') %>
# <%= t_('(Repeat the following for every arg):') %>
# [[chord.args]]
# name = "tonic"
# type = "symbol"
<% item[:args].each do |name, type| %>
[["<%= item[:name] %>".args]]
name = "<%= name %>"
type = "<%= t_(type) %>"
<% end -%>

## <%= t_('Function introduction') %>
## ====================
# <%= t_('The label describing the version of Sonic Pi in which this function first appeared.') %>
["<%= item[:name] %>".introduced]
label = "<%= t_("Introduced in #{item[:introduced].to_s}") %>"

## <%= t_('Function options') %>
## ====================
<%=
t_(<<~TEXT.chomp
# The options are the optional parameters of this function.
# Each option has two documented properties:
# - the option's name
# - the option's description doc.
TEXT
)
%>
# <%= t_('Example:') %>
# [chord.options]
# label = "Options"

# <%= t_('Now repeat the following for every option:') %>
# [[chord.options.list]]
# name = "invert:"
# doc = '''
# Apply the specified num inversions to chord. See the fn `chord_invert`.
# '''
<% if item[:opts] && !item[:opts].empty? %>
["<%= item[:name] %>".options]
label = "<%= t_('Options') %>"
<% item[:opts].each do |name, doc| %>
[["<%= item[:name] %>".options.list]]
name = "<%= name.to_s %>:"
doc = '''
<%= t_(doc) %>
'''
<% end -%>
<% end -%>

## <%= t_('Function examples') %>
## ====================
<%=
t_(<<~TEXT.chomp
# Each function may have one or more examples. If it has any, they are listed
# under an overall 'Example' or 'Examples' label (heading), and each example has
# a numbered sub-heading.
TEXT
)
%>
# <%= t_('Example:') %>
# [chord.examples]
# label = "Example"
# label_plural = "Examples"

# <%= t_('Now repeat the following for every example:') %>
# [[chord.examples.list]]
# label = "Example 1"
# example = '''
# puts (chord :e, :minor) # returns a ring of midi notes - (ring 64, 67, 71)
# '''
["<%= item[:name] %>".examples]
label = "<%= t_('Example') %>"
label_plural = "<%= t_('Examples') %>"
<% item[:examples].each_with_index do |e, index| %>
[["<%= item[:name] %>".examples.list]]
label = "<%= t_("Example #{index + 1}") %>"
example = '''
<%= e %>
'''
<% end %>
