implemented api reference support

This commit is contained in:
Kilian Ciuffolo
2015-11-09 09:55:04 -08:00
parent 563f84c3b4
commit 263f7eaf30
11 changed files with 105 additions and 3 deletions
+3 -1
View File
@@ -1,7 +1,9 @@
.bundle
.jekyll-metadata
_data/api/*
_data/nav_api.yml
_site
_config-prod.yml
_config-local.yml
docs
api/*
vendor
View File
+47
View File
@@ -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 %}
+2 -1
View File
@@ -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>
+2 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -0,0 +1,6 @@
---
layout: default
title: Classes
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit laborum.
type: folder
---
+6
View File
@@ -0,0 +1,6 @@
---
layout: default
title: API Reference
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit laborum.
type: folder
---
+9
View File
@@ -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 %}