diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-10 14:37:40 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-10 14:37:40 +0100 |
commit | 4817d853f45f699b959a76ca1c6ec74833875b47 (patch) | |
tree | 0d049acbdc95856a4cf290f8ea1331eb01f9a625 /web | |
parent | 04f03cb543e0af844bc115b517a355a2de6abe47 (diff) | |
download | taginfo-4817d853f45f699b959a76ca1c6ec74833875b47.tar taginfo-4817d853f45f699b959a76ca1c6ec74833875b47.tar.gz |
API documentation fixes and improvements
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/api.rb | 2 | ||||
-rw-r--r-- | web/lib/api/v4/key.rb | 1 | ||||
-rw-r--r-- | web/lib/api/v4/tag.rb | 1 | ||||
-rw-r--r-- | web/views/taginfo/apidoc.erb | 16 | ||||
-rw-r--r-- | web/views/taginfo/index.erb | 2 |
5 files changed, 15 insertions, 7 deletions
diff --git a/web/lib/api.rb b/web/lib/api.rb index d2ce590..8586857 100644 --- a/web/lib/api.rb +++ b/web/lib/api.rb @@ -3,7 +3,7 @@ class API @@paths = {} - attr_accessor :version, :path, :parameters, :paging, :filter, :sort, :result, :description, :example, :ui + attr_accessor :version, :path, :parameters, :paging, :filter, :sort, :result, :description, :notes, :example, :ui def self.paths @@paths diff --git a/web/lib/api/v4/key.rb b/web/lib/api/v4/key.rb index 420ef37..5e6a23b 100644 --- a/web/lib/api/v4/key.rb +++ b/web/lib/api/v4/key.rb @@ -300,6 +300,7 @@ class Taginfo < Sinatra::Base [:tags_combination, :ARRAY_OF_STRINGS, 'List of keys/tags that can be combined with this key.'], [:tags_linked, :ARRAY_OF_STRINGS, 'List of keys/tags related to this key.'] ]), + :notes => 'To get the complete thumbnail image URL, concatenate <tt>thumb_url_prefix</tt>, width of image in pixels, and <tt>thumb_url_suffix</tt>. The thumbnail image width must be smaller than <tt>width</tt>, use the <tt>image_url</tt> otherwise.', :example => { :key => 'highway' }, :ui => '/keys/highway#wiki' }) do diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb index 20a0559..20e4613 100644 --- a/web/lib/api/v4/tag.rb +++ b/web/lib/api/v4/tag.rb @@ -194,6 +194,7 @@ class Taginfo < Sinatra::Base [:tags_combination, :ARRAY_OF_STRINGS, 'List of keys/tags that can be combined with this tag.'], [:tags_linked, :ARRAY_OF_STRINGS, 'List of keys/tags related to this tag.'] ]), + :notes => 'To get the complete thumbnail image URL, concatenate <tt>thumb_url_prefix</tt>, width of image in pixels, and <tt>thumb_url_suffix</tt>. The thumbnail image width must be smaller than <tt>width</tt>, use the <tt>image_url</tt> otherwise.', :example => { :key => 'highway', :value => 'residential' }, :ui => '/tags/highway=residential#wiki' }) do diff --git a/web/views/taginfo/apidoc.erb b/web/views/taginfo/apidoc.erb index 1fd19e8..2dec778 100644 --- a/web/views/taginfo/apidoc.erb +++ b/web/views/taginfo/apidoc.erb @@ -26,12 +26,12 @@ <% API.paths.keys.sort.each do |version| API.paths[version].keys.sort.each do |path| doc = API.paths[version][path] - if !doc.deprecated? || params[:show_deprecated] %> -<a name="<%= doc.complete_path.tr('/', '_')[1,1000] %>"></a> + if !doc.deprecated? || params[:show_deprecated] + hashpath = doc.complete_path.tr('/', '_')[1,1000] %> +<a name="<%= hashpath %>"></a> <h2><%= doc.complete_path %><%= doc.deprecated? ? " <span class='bad'>Deprecated. Use <a href='##{ doc.superseded_by.tr('/', '_')[1,1000] }'>#{ doc.superseded_by }</a> instead.</span>" : '' %></h2> <table class="desc"> <tr> - <tr> <th>Path:</th> <td><tt><%= doc.complete_path %></tt></td> </tr> @@ -61,12 +61,18 @@ </tr> <tr> <th>Example:</th> - <td><a rel="nofollow" href="<%= doc.show_example %>" target="_blank"><%= doc.show_example %></a></td> + <td><a rel="nofollow" href="<%= h(doc.show_example) %>" target="_blank"><%= h(doc.show_example) %></a></td> </tr> <tr> <th title="User interface page where this API is used">UI Example:</th> - <td><a href="<%= doc.show_ui %>" target="_blank"><%= doc.show_ui %></a></td> + <td><a href="<%= h(doc.show_ui) %>" target="_blank"><%= h(doc.show_ui) %></a></td> </tr> +<% if doc.notes %> + <tr> + <th>Notes:</th> + <td><%= doc.notes %></td> + </tr> +<% end %> </table> <% end end diff --git a/web/views/taginfo/index.erb b/web/views/taginfo/index.erb index 40f4790..4f2875c 100644 --- a/web/views/taginfo/index.erb +++ b/web/views/taginfo/index.erb @@ -15,5 +15,5 @@ <tr><td><%= k %></td><td><%= TaginfoConfig.get("instance.#{k}") %></td></tr> <% end %> </table> - <p style="margin-top: 10px;">These config settings are also available from the <tt>/api/4/site</tt> <a href="/taginfo/apidoc#api_4_site">API call</a>.</p> + <p style="margin-top: 10px;">These config settings are also available from the <tt>/api/4/site/info</tt> <a href="/taginfo/apidoc#api_4_site_info">API call</a>.</p> </div> |