Browse Source

implemented api reference support

pull/45/head
Kilian Ciuffolo 10 years ago
parent
commit
263f7eaf30
  1. 4
      .gitignore
  2. 0
      _data/api/.gitkeep
  3. 47
      _includes/namespace.html
  4. 3
      _includes/nav.html
  5. 3
      _layouts/default.html
  6. 9
      _plugins/api_url.rb
  7. 12
      _plugins/array_concat.rb
  8. 9
      _plugins/no_nl.rb
  9. 6
      api/class/index.md
  10. 6
      api/index.md
  11. 9
      api/mixin/index.md

4
.gitignore

@ -1,7 +1,9 @@
.bundle
.jekyll-metadata
_data/api/*
_data/nav_api.yml
_site
_config-prod.yml
_config-local.yml
docs
api/*
vendor

0
_data/api/.gitkeep

47
_includes/namespace.html

@ -0,0 +1,47 @@
{% if include.data.borrows.size %}
## Extends
{% for item in include.data.borrows %}
[{{ item }}]({{ site.baseurl }}/api/class/{{ item | api_url }})
{% endfor %}
{% endif %}
{% if include.data.properties.size > 0 %}
## Properties
link | summary
--- | ---
{% for item in include.data.properties %}[{{ item.name }}]({{ site.baseurl }}/api/{{ item.dataTypes[0] | api_url }}) | {{ item.summary | no_nl }}
{% endfor %}
{% endif %}
{% if include.data.methods.size > 0 %}
## Methods
{% for item in include.data.methods %}
### {{ item.name }}
{{ item.summary | no_nl }}
#### Signature
`{{ item.signature }}`
{% if item.params.size > 0 %}
#### Parameters
Name | Type | Description
--- | --- | ---
{% for param in item.params %}{{ param.name }} | {{ param.types }} | {{ param.desc | no_nl }}
{% endfor %}
{% endif %}
#### Return type
{% for type in item.return.types %}[{{ type }}]({{ site.baseurl}}/api/class/{{ type | api_url }}), {% endfor %}: {{ item.return.desc }}
{% endfor %}
{% endif %}
{% if include.data.events.size > 0 %}
## Events
link | summary
--- | ---
{% for item in include.data.events %}[{{ item.name }}]({{ site.baseurl }}/api/{{ item.dataTypes[0] | api_url }}) | {{ item.summary | no_nl }}
{% endfor %}
{% endif %}

3
_includes/nav.html

@ -1,6 +1,7 @@
<ul>
{% for link in include.links %}
{% if page.url contains link.url %}
{% capture slash_url_slash %}/{{ link.url }}/{% endcapture %}
{% if page.url contains slash_url_slash %}
<li class="active">
{% else %}
<li>

3
_layouts/default.html

@ -37,7 +37,8 @@
<div class="main {{ page.type }}">
<aside class="side-nav">
{% include nav.html links=site.data.nav preceding_address="/" %}
{% assign nav = site.data.nav | array_concat:site.data.nav_api %}
{% include nav.html links=nav preceding_address="/" %}
</aside>
<div class="heading">

9
_plugins/api_url.rb

@ -0,0 +1,9 @@
module Jekyll
module APIURLFilter
def api_url(input)
input.gsub(/\./, "/").downcase if !input.nil?
end
end
end
Liquid::Template.register_filter(Jekyll::APIURLFilter)

12
_plugins/array_concat.rb

@ -0,0 +1,12 @@
module Jekyll
module ArrayConcatFilter
def array_concat(arr1, arr2)
result = []
result.concat(arr1)
result.concat(arr2)
arr1 = result
end
end
end
Liquid::Template.register_filter(Jekyll::ArrayConcatFilter)

9
_plugins/no_nl.rb

@ -0,0 +1,9 @@
module Jekyll
module NoNLFilter
def no_nl(input)
input.gsub(/\n/, " ")if !input.nil?
end
end
end
Liquid::Template.register_filter(Jekyll::NoNLFilter)

6
api/class/index.md

@ -0,0 +1,6 @@
---
layout: default
title: Classes
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit laborum.
type: folder
---

6
api/index.md

@ -0,0 +1,6 @@
---
layout: default
title: API Reference
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit laborum.
type: folder
---

9
api/mixin/index.md

@ -0,0 +1,9 @@
---
layout: default
title: Mixins
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit laborum.
type: folder
---
{% assign links = site.data.nav_api[1].pages %}
{% include index.html links=links %}
Loading…
Cancel
Save