fixe api reference search and layout
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
{% 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 | type | summary
|
||||
--- | --- | ---
|
||||
{% for item in include.data.properties %}{{ item.name }} | {% if item.dataTypes[0] contains 'tinymce' %}[`{{ item.dataTypes[0] }}`]({{ site.baseurl }}/api/class/{{ item.dataTypes[0] | api_url }}){% else %}`{{ item.dataTypes[0] }}`{% endif %}| {{ item.summary | no_nl }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.data.methods.size > 0 %}
|
||||
## Methods
|
||||
link | summary
|
||||
--- | ---
|
||||
{% for item in include.data.methods %}[{{ item.name }}()](#{{ item.name | anchor }}) | {{ item.summary | no_nl }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.data.events.size > 0 %}
|
||||
## Events
|
||||
link | summary
|
||||
--- | ---
|
||||
{% for item in include.data.events %}[{{ item.name }}](#{{ item.name | anchor }}) | {{ item.summary | no_nl }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.data.methods.size > 0 %}
|
||||
## Methods
|
||||
{% for item in include.data.methods %}
|
||||
|
||||
### {{ item.name }}()
|
||||
```js
|
||||
{{ include.data.name }}#{{ item.signature }}
|
||||
```
|
||||
|
||||
{{ item.summary | no_nl }}
|
||||
|
||||
{% if item.params.size > 0 %}
|
||||
##### Parameters
|
||||
|
||||
{% for param in item.params %}* `{{ param.name }}` ({% if param.types[0] contains 'tinymce' %}[{{ param.types[0] }}]({{ site.baseurl }}/api/class/{{ param.types[0] | api_url }}){% else %}`{{ param.types[0] }}`{% endif %}) - {{ param.desc | no_nl }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
##### Return value
|
||||
|
||||
{% if item.return.types.size > 0 %}
|
||||
{% for type in item.return.types %}* {% if type contains 'tinymce' %}[`{{ type }}`]({{ site.baseurl }}/api/class/{{ type | api_url }}){% else %}`{{ type }}`{% endif %} - {{ item.return.desc | no_nl }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
* `undefined` - No return value
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.data.events.size > 0 %}
|
||||
## Events
|
||||
|
||||
{% for item in include.data.events %}
|
||||
### {{ item.name }}
|
||||
{{ item.summary | no_nl }}
|
||||
|
||||
{% if item.params.size > 0 %}
|
||||
##### Parameters
|
||||
|
||||
Name | Type | Description
|
||||
--- | --- | ---
|
||||
{% for param in item.params %}{{ param.name }} | {% if param.types[0] contains 'tinymce' %}[`{{ param.types[0] }}`]({{ site.baseurl }}/api/class/{{ param.types[0] | api_url }}){% else %}`{{ param.types[0] }}`{% endif %} | {{ param.desc | no_nl }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -1,47 +0,0 @@
|
||||
{% 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 %}
|
||||
@@ -13,18 +13,18 @@
|
||||
{% assign_page page_data = page_path %}
|
||||
|
||||
{% if page_data.type != 'index' and page_data.type != 'folder' %}
|
||||
"{{ page_data.title | downcase | replace_regex:'[^a-zA-Z0-9]','-' }}": "{{ url }}",
|
||||
"{{ page_data.title | search_index }}": "{{ url }}",
|
||||
|
||||
{% if page_data.description %}
|
||||
"{{ page_data.description | downcase | replace_regex:'[^a-zA-Z0-9]','-' }}": "{{ url }}",
|
||||
"{{ page_data.description | search_index }}": "{{ url }}",
|
||||
{% endif %}
|
||||
|
||||
{% if link.url contains '#' %}
|
||||
"{{ link.url | remove:'#' | downcase | replace_regex:'[^a-zA-Z0-9]','-' }}": "{{ url }}{{ link.url }}",
|
||||
"{{ link.url | search_index }}": "{{ url }}{{ link.url }}",
|
||||
{% endif %}
|
||||
|
||||
{% if page_data.keywords %}
|
||||
"{{ page_data.keywords }}": "{{ url }}",
|
||||
"{{ page_data.keywords | search_index }}": "{{ url }}",
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
module Jekyll
|
||||
module AnchorFilter
|
||||
def anchor(input)
|
||||
input.gsub(/[^a-zA-Z]/, "").downcase if !input.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::AnchorFilter)
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
module Jekyll
|
||||
module APIURLFilter
|
||||
def api_url(input)
|
||||
input.gsub(/\./, "/").downcase if !input.nil?
|
||||
input.downcase if !input.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
module Jekyll
|
||||
module JSONFormatFilter
|
||||
def json_format(input)
|
||||
input = JSON.parse(input).to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::JSONFormatFilter)
|
||||
@@ -0,0 +1,9 @@
|
||||
module Jekyll
|
||||
module SearchIndexFilter
|
||||
def search_index(input)
|
||||
input.gsub(/[^a-zA-Z0-9]+/, "-").gsub(/^-|-$/, "").downcase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::SearchIndexFilter)
|
||||
@@ -2,7 +2,7 @@
|
||||
layout: default
|
||||
title: Get Started
|
||||
description: If you are new to TinyMCE, this is the place to start.
|
||||
type: folder
|
||||
type: index
|
||||
---
|
||||
|
||||
{% assign links = site.data.nav[0].pages %}
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
layout: empty
|
||||
---
|
||||
|
||||
{
|
||||
{% capture json %}{
|
||||
{% for page in site.pages %}
|
||||
"{{ page.url }}": {
|
||||
"title": "{{ page.title }}",
|
||||
@@ -10,4 +10,5 @@ layout: empty
|
||||
"url": "{{ page.url }}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
}
|
||||
}{% endcapture %}
|
||||
{{ json | json_format }}
|
||||
|
||||
+5
-3
@@ -2,7 +2,9 @@
|
||||
layout: empty
|
||||
---
|
||||
|
||||
{
|
||||
{% include search-db.json links=site.data.nav preceding_address="/" %}
|
||||
{% assign links = site.data.nav | array_concat:site.data.nav_api %}
|
||||
{% capture json %}{
|
||||
{% include search-db.json links=links preceding_address="/" %}
|
||||
"": ""
|
||||
}
|
||||
}{% endcapture %}
|
||||
{{ json | json_format }}
|
||||
|
||||
Reference in New Issue
Block a user