diff --git a/_includes/api-member.html b/_includes/api-member.html new file mode 100644 index 0000000..0fe266d --- /dev/null +++ b/_includes/api-member.html @@ -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 %} diff --git a/_includes/namespace.html b/_includes/namespace.html deleted file mode 100644 index 986c1a9..0000000 --- a/_includes/namespace.html +++ /dev/null @@ -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 %} diff --git a/_includes/search-db.json b/_includes/search-db.json index 5cddce8..b07dd91 100644 --- a/_includes/search-db.json +++ b/_includes/search-db.json @@ -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 %} diff --git a/_plugins/anchor.rb b/_plugins/anchor.rb new file mode 100644 index 0000000..94f78dd --- /dev/null +++ b/_plugins/anchor.rb @@ -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) diff --git a/_plugins/api_url.rb b/_plugins/api_url.rb index 421adf0..f7be54c 100644 --- a/_plugins/api_url.rb +++ b/_plugins/api_url.rb @@ -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 diff --git a/_plugins/json_format.rb b/_plugins/json_format.rb new file mode 100644 index 0000000..d582b38 --- /dev/null +++ b/_plugins/json_format.rb @@ -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) diff --git a/_plugins/search_index.rb b/_plugins/search_index.rb new file mode 100644 index 0000000..52ebafa --- /dev/null +++ b/_plugins/search_index.rb @@ -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) diff --git a/get-started/index.md b/get-started/index.md index 5a6443c..4c3b70f 100644 --- a/get-started/index.md +++ b/get-started/index.md @@ -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 %} diff --git a/pages.json b/pages.json index 5adb93c..5f5cea1 100644 --- a/pages.json +++ b/pages.json @@ -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 }} diff --git a/search-db.json b/search-db.json index d90b608..e17c198 100644 --- a/search-db.json +++ b/search-db.json @@ -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 }}