diff --git a/Gemfile b/Gemfile index 88debfe9..0ab243d0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -gem 'jekyll', '3.3.1' +gem 'jekyll', '3.6.2' group :jekyll_plugins do - gem 'jekyll-seo-tag', '2.1.0' - gem 'jekyll-sitemap', '0.12.0' + gem 'jekyll-seo-tag', '2.4.0' + gem 'jekyll-sitemap', '1.1.1' end diff --git a/Gemfile.lock b/Gemfile.lock index f542f649..1bf93906 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,53 +1,59 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.5.0) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) colorator (1.1.0) - ffi (1.9.14) + ffi (1.9.18) forwardable-extended (2.6.0) - jekyll (3.3.1) + jekyll (3.6.2) addressable (~> 2.4) colorator (~> 1.0) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 1.1) - kramdown (~> 1.3) - liquid (~> 3.0) + kramdown (~> 1.14) + liquid (~> 4.0) mercenary (~> 0.3.3) pathutil (~> 0.9) - rouge (~> 1.7) + rouge (>= 1.7, < 3) safe_yaml (~> 1.0) - jekyll-sass-converter (1.5.0) + jekyll-sass-converter (1.5.1) sass (~> 3.4) - jekyll-seo-tag (2.1.0) + jekyll-seo-tag (2.4.0) jekyll (~> 3.3) - jekyll-sitemap (0.12.0) + jekyll-sitemap (1.1.1) jekyll (~> 3.3) - jekyll-watch (1.5.0) - listen (~> 3.0, < 3.1) - kramdown (1.13.0) - liquid (3.0.6) - listen (3.0.8) + jekyll-watch (1.5.1) + listen (~> 3.0) + kramdown (1.16.2) + liquid (4.0.0) + listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) mercenary (0.3.6) - pathutil (0.14.0) + pathutil (0.16.1) forwardable-extended (~> 2.6) - public_suffix (2.0.4) - rb-fsevent (0.9.8) - rb-inotify (0.9.7) - ffi (>= 0.5.0) - rouge (1.11.1) + public_suffix (3.0.1) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rouge (2.2.1) + ruby_dep (1.5.0) safe_yaml (1.0.4) - sass (3.4.22) + sass (3.5.5) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) PLATFORMS ruby DEPENDENCIES - jekyll (= 3.3.1) - jekyll-seo-tag (= 2.1.0) - jekyll-sitemap (= 0.12.0) + jekyll (= 3.6.2) + jekyll-seo-tag (= 2.4.0) + jekyll-sitemap (= 1.1.1) BUNDLED WITH - 1.12.5 + 1.16.0.pre.3 diff --git a/_api/_defaults.md b/_api/_defaults.md index e1e90256..0b832f22 100644 --- a/_api/_defaults.md +++ b/_api/_defaults.md @@ -1,7 +1,16 @@ --- -title: +title: position: -type: -description: -right_code: +parameters: + - name: + content: +content_markdown: +left_code_blocks: + - code_block: + title: + language: +right_code_blocks: + - code_block: + title: + language: --- diff --git a/_api/books_add.md b/_api/books_add.md index dea59f77..cd5748e4 100644 --- a/_api/books_add.md +++ b/_api/books_add.md @@ -3,43 +3,44 @@ title: /books position: 1.1 type: post description: Create Book -right_code: | - ~~~ json - { - "id": 3, - "title": "The Book Thief", - "score": 4.3, - "dateAdded": "5/1/2015" - } - ~~~ - {: title="Response" } +parameters: + - name: title + content: The title for the book + - name: score + content: The book's score between 0 and 5 +content_markdown: |- + The book will automatically be added to your reading list + {: .success} - ~~~ json - { - "error": true, - "message": "Invalid score" - } - ~~~ - {: title="Error" } + Adds a book to your collection. +left_code_blocks: + - code_block: |- + $.post("http://api.myapp.com/books/", { + "token": "YOUR_APP_KEY", + "title": "The Book Thief", + "score": 4.3 + }, function(data) { + alert(data); + }); + title: jQuery + language: javascript +right_code_blocks: + - code_block: |- + { + "id": 3, + "title": "The Book Thief", + "score": 4.3, + "dateAdded": "5/1/2015" + } + title: Response + language: json + - code_block: |- + { + "error": true, + "message": "Invalid score" + } + title: Error + language: json --- -title -: The title for the book -score -: The book's score between 0 and 5 -The book will automatically be added to your reading list -{: .success } - -Adds a book to your collection. - -~~~ javascript -$.post("http://api.myapp.com/books/", { - "token": "YOUR_APP_KEY", - "title": "The Book Thief", - "score": 4.3 -}, function(data) { - alert(data); -}); -~~~ -{: title="jQuery" } diff --git a/_api/books_delete.md b/_api/books_delete.md index 00f99db8..007db9c8 100644 --- a/_api/books_delete.md +++ b/_api/books_delete.md @@ -3,35 +3,39 @@ title: /books/:id position: 1.5 type: delete description: Deletes a book -right_code: | - ~~~ json - { - "id": 3, - "status": "deleted" - } - ~~~ - {: title="Response" } - - ~~~ json - { - "error": true, - "message": "Book doesn't exist" - } - ~~~ - {: title="Error" } +parameters: + - name: + content: +content_markdown: |- + Deletes a book in your collection. +left_code_blocks: + - code_block: |- + $.ajax({ + "url": "http://api.myapp.com/books/3", + "type": "DELETE", + "data": { + "token": "YOUR_APP_KEY" + }, + "success": function(data) { + alert(data); + } + }); + title: jQuery + language: javascript +right_code_blocks: + - code_block: |2- + { + "id": 3, + "status": "deleted" + } + title: Response + language: json + - code_block: |2- + { + "error": true, + "message": "Book doesn't exist" + } + title: Error + language: json --- -Deletes a book in your collection. -~~~ javascript -$.ajax({ - "url": "http://api.myapp.com/books/3", - "type": "DELETE", - "data": { - "token": "YOUR_APP_KEY" - }, - "success": function(data) { - alert(data); - } -}); -~~~ -{: title="jQuery" } diff --git a/_api/books_get.md b/_api/books_get.md index bdb1c57e..30df6faf 100644 --- a/_api/books_get.md +++ b/_api/books_get.md @@ -3,33 +3,35 @@ title: /books/:id position: 1.3 type: get description: Get Book -right_code: | - ~~~ json - { - "id": 3, - "title": "The Book Thief", - "score": 4.3, - "dateAdded": "5/1/2015" - } - ~~~ - {: title="Response" } - - ~~~ json - { - "error": true, - "message": "Book doesn't exist" - } - ~~~ - {: title="Error" } ---- - -Returns a specific book from your collection - -~~~ javascript -$.get("http://api.myapp.com/books/3", { - token: "YOUR_APP_KEY", -}, function(data) { - alert(data); -}); -~~~ -{: title="jQuery" } +parameters: + - name: + content: +content_markdown: |- + Returns a specific book from your collection +left_code_blocks: + - code_block: |- + $.get("http://api.myapp.com/books/3", { + token: "YOUR_APP_KEY", + }, function(data) { + alert(data); + }); + title: jQuery + language: javascript +right_code_blocks: + - code_block: |2- + { + "id": 3, + "title": "The Book Thief", + "score": 4.3, + "dateAdded": "5/1/2015" + } + title: Response + language: json + - code_block: |2- + { + "error": true, + "message": "Book doesn't exist" + } + title: Error + language: json +--- \ No newline at end of file diff --git a/_api/books_list.md b/_api/books_list.md index 10997271..065ab3da 100644 --- a/_api/books_list.md +++ b/_api/books_list.md @@ -3,68 +3,63 @@ title: /books position: 1.0 type: get description: List all books -right_code: | - ~~~ json - [ - { - "id": 1, - "title": "The Hunger Games", - "score": 4.5, - "dateAdded": "12/12/2013" - }, - { - "id": 1, - "title": "The Hunger Games", - "score": 4.7, - "dateAdded": "15/12/2013" - }, - ] - ~~~ - {: title="Response" } +parameters: + - name: offset + content: Offset the results by this amount + - name: limit + content: Limit the number of books returned +content_markdown: |- + This call will return a maximum of 100 books + {: .info } - ~~~ json - { - "error": true, - "message": "Invalid offset" - } - ~~~ - {: title="Error" } ---- -offset -: Offset the results by this amount - -limit -: Limit the number of books returned - -This call will return a maximum of 100 books -{: .info } - -Lists all the photos you have access to. You can paginate by using the parameters listed above. - -~~~ javascript -$.get("http://api.myapp.com/books/", { "token": "YOUR_APP_KEY"}, function(data) { - alert(data); -}); -~~~ -{: title="jQuery" } - -~~~ python -r = requests.get("http://api.myapp.com/books/", token="YOUR_APP_KEY") -print r.text -~~~ -{: title="Python" } - -~~~ javascript -var request = require("request"); -request("http://api.myapp.com/books?token=YOUR_APP_KEY", function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body); - } -}); -~~~ -{: title="Node.js" } - -~~~ bash -curl http://sampleapi.readme.com/orders?key=YOUR_APP_KEY -~~~ -{: title="Curl" } + Lists all the photos you have access to. You can paginate by using the parameters listed above. +left_code_blocks: + - code_block: |- + $.get("http://api.myapp.com/books/", { "token": "YOUR_APP_KEY"}, function(data) { + alert(data); + }); + title: jQuery + language: javascript + - code_block: |- + r = requests.get("http://api.myapp.com/books/", token="YOUR_APP_KEY") + print r.text + title: Python + language: python + - code_block: |- + var request = require("request"); + request("http://api.myapp.com/books?token=YOUR_APP_KEY", function (error, response, body) { + if (!error && response.statusCode == 200) { + console.log(body); + } + title: Node.js + language: javascript + - code_block: |- + curl http://sampleapi.readme.com/orders?key=YOUR_APP_KEY + title: Curl + language: bash +right_code_blocks: + - code_block: |2- + [ + { + "id": 1, + "title": "The Hunger Games", + "score": 4.5, + "dateAdded": "12/12/2013" + }, + { + "id": 1, + "title": "The Hunger Games", + "score": 4.7, + "dateAdded": "15/12/2013" + }, + ] + title: Response + language: json + - code_block: |2- + { + "error": true, + "message": "Invalid offset" + } + title: Error + language: json +--- \ No newline at end of file diff --git a/_api/books_update.md b/_api/books_update.md index c8670c6b..1b6ccfae 100644 --- a/_api/books_update.md +++ b/_api/books_update.md @@ -3,46 +3,44 @@ title: /books/:id position: 1.4 type: put description: Update Book -right_code: | - ~~~ json - { - "id": 3, - "title": "The Book Stealer", - "score": 5, - "dateAdded": "5/1/2015" - } - ~~~ - {: title="Response" } - - ~~~ json - { - "error": true, - "message": "Book doesn't exist" - } - ~~~ - {: title="Error" } ---- - -title -: The title for the book - -score -: The book's score between 0 and 5 - -Update an existing book in your collection. - -~~~ javascript -$.ajax({ - "url": "http://api.myapp.com/books/3", - "type": "PUT", - "data": { - "token": "YOUR_APP_KEY", - "score": 5.0, - "title": "The Book Stealer" - }, - "success": function(data) { - alert(data); - } -}); -~~~ -{: title="jQuery" } +parameters: + - name: title + content: The title for the book + - name: score + content: The book's score between 0 and 5 +content_markdown: |- + Update an existing book in your collection. +left_code_blocks: + - code_block: |- + $.ajax({ + "url": "http://api.myapp.com/books/3", + "type": "PUT", + "data": { + "token": "YOUR_APP_KEY", + "score": 5.0, + "title": "The Book Stealer" + }, + "success": function(data) { + alert(data); + } + }); + title: jQuery + language: javascript +right_code_blocks: + - code_block: |2- + { + "id": 3, + "title": "The Book Stealer", + "score": 5, + "dateAdded": "5/1/2015" + } + title: Response + language: json + - code_block: |2- + { + "error": true, + "message": "Book doesn't exist" + } + title: Error + language: json +--- \ No newline at end of file diff --git a/_config.yml b/_config.yml index b6d1e269..68b0802e 100644 --- a/_config.yml +++ b/_config.yml @@ -20,7 +20,7 @@ gems: exclude: - readme.md - - LICENCE + - LICENSE defaults: - @@ -28,9 +28,43 @@ defaults: path: "" values: layout: default + - + scope: + type: "documentation" + values: + _hide_content: true + - + scope: + type: "api" + values: + _hide_content: true types: - get - put - delete - post + +languages: + - bash + - c + - css + - html + - java + - javascript + - json + - php + - python + - ruby + +_options: + content_markdown: + format: p h4 h5 h6 + bold: true + italic: true + link: true + bulletedlist: true + numberedlist: true + image: true + table: true + styles: /css/editor.css diff --git a/_documentation/_defaults.md b/_documentation/_defaults.md index e1e90256..0b832f22 100644 --- a/_documentation/_defaults.md +++ b/_documentation/_defaults.md @@ -1,7 +1,16 @@ --- -title: +title: position: -type: -description: -right_code: +parameters: + - name: + content: +content_markdown: +left_code_blocks: + - code_block: + title: + language: +right_code_blocks: + - code_block: + title: + language: --- diff --git a/_documentation/authentication.md b/_documentation/authentication.md index acc90cfa..ffe25d44 100644 --- a/_documentation/authentication.md +++ b/_documentation/authentication.md @@ -1,23 +1,29 @@ --- title: Authentication position: 2 -right_code: | - ~~~ javascript - $.get("http://api.myapp.com/books/", { "token": "YOUR_APP_KEY"}, function(data) { - alert(data); - }); - ~~~ - {: title="jQuery" } +parameters: + - name: + content: +content_markdown: |- + You need to be authenticated for all API requests. You can generate an API key in your developer dashboard. - ~~~ bash - curl http://api.myapp.com/books?token=YOUR_APP_KEY - ~~~ - {: title="Curl" } ---- - -You need to be authenticated for all API requests. You can generate an API key in your developer dashboard. - -Add the API key to all requests as a GET parameter. + Add the API key to all requests as a GET parameter. -Nothing will work unless you include this API key -{: .error } + Nothing will work unless you include this API key + {: .error} +left_code_blocks: + - code_block: + title: + language: +right_code_blocks: + - code_block: |2- + $.get("http://api.myapp.com/books/", { "token": "YOUR_APP_KEY"}, function(data) { + alert(data); + }); + title: JQuery + language: javascript + - code_block: |2- + curl http://api.myapp.com/books?token=YOUR_APP_KEY + title: Curl + language: bash +--- \ No newline at end of file diff --git a/_documentation/errors.md b/_documentation/errors.md index f4e2cd0d..cada3600 100644 --- a/_documentation/errors.md +++ b/_documentation/errors.md @@ -1,20 +1,28 @@ --- title: Errors position: 3 ---- - -| Code | Name | Description | -|------|-------------|----------------------------------| -| 200 | OK | Success | -| 201 | Created | Creation Successful | -| 400 | Bad Request | We could not process that action | -| 403 | Forbidden | We couldn't authenticate you | - -All errors will return JSON in the following format: +parameters: + - name: + content: +content_markdown: |- + | Code | Name | Description | + | --- | --- | --- | + | 200 | OK | Success | + | 201 | Created | Creation Successful | + | 400 | Bad Request | We could not process that action | + | 403 | Forbidden | We couldn't authenticate you | -~~~ json -{ - "error": true, - "message": "error message here" -} -~~~ + All errors will return JSON in the following format: +left_code_blocks: + - code_block: |- + { + "error": true, + "message": "error message here" + } + title: Response + language: json +right_code_blocks: + - code_block: + title: + language: +--- \ No newline at end of file diff --git a/_documentation/getting_started.md b/_documentation/getting_started.md index 0f0e505d..c9d41c77 100644 --- a/_documentation/getting_started.md +++ b/_documentation/getting_started.md @@ -1,22 +1,33 @@ --- title: Getting Started position: 1 ---- - -Welcome to our API. +parameters: + - name: + content: +content_markdown: |- + Welcome to our API. -This API document is designed for those interested in developing for our platform. + This API document is designed for those interested in developing for our platform. -This API is still under development and will evolve. + This API is still under development and will evolve. -You'll succeed if you do this. -{: .success } + You'll succeed if you do this. + {: .success } -Here's some useful information. -{: .info } + Here's some useful information. + {: .info } -Something may not happen if you try and do this. -{: .warning } + Something may not happen if you try and do this. + {: .warning } -Something bad will happen if you do this. -{: .error } + Something bad will happen if you do this. + {: .error } +left_code_blocks: + - code_block: + title: + language: +right_code_blocks: + - code_block: + title: + language: +--- \ No newline at end of file diff --git a/_includes/relative-src.html b/_includes/relative-src.html new file mode 100644 index 00000000..45354481 --- /dev/null +++ b/_includes/relative-src.html @@ -0,0 +1 @@ +{% assign prefix = include.src | slice: 0, 2 %}{% assign protocol = include.src | slice: 0, 4 %}{% unless protocol == 'http' or prefix == "//" %}{{ site.baseurl }}{% endunless %}{{ include.src }} \ No newline at end of file diff --git a/_includes/syntax-highlight.html b/_includes/syntax-highlight.html new file mode 100644 index 00000000..cfdf54ef --- /dev/null +++ b/_includes/syntax-highlight.html @@ -0,0 +1,8 @@ +{% capture highlight %} +``` {{ include.block.language }} +{{ include.block.code_block }} +``` +{: title="{{ include.block.title }}" } +{% endcapture %} + +{{ highlight | markdownify }} \ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html index b393364b..276dbaba 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -4,9 +4,9 @@ - + - + {% seo %} {% if jekyll.environment == 'production' %} @@ -23,11 +23,11 @@

- {{ site.title }} logo + {{ site.title }} logo

-
+
diff --git a/_sass/_main.scss b/_sass/_main.scss index ddc1bbf2..9f3f384d 100644 --- a/_sass/_main.scss +++ b/_sass/_main.scss @@ -272,6 +272,10 @@ hr { border-radius: 2px; } +.warning { + border-color: #ffc107; +} + .info { border-color: #56ADEC; } @@ -463,7 +467,7 @@ header { } .open-nav { - background-image: url(/images/menu.svg); + background-image: url($base-url + '/images/menu.svg'); background-color: transparent; background-repeat: no-repeat; background-size: 100%; diff --git a/_sass/cloudcannon.scss b/_sass/cloudcannon.scss new file mode 100644 index 00000000..ee84b360 --- /dev/null +++ b/_sass/cloudcannon.scss @@ -0,0 +1,26 @@ +.editor-link { + display: none; + float: right; + margin-top: 0; + border: 0; + border-radius: 2px; + box-sizing: border-box; + font-size: 2rem; + text-decoration: none; + padding: 10px 15px; + margin: 0; + font-size: 18px; + cursor: pointer; + background-color: #f7e064; + color: #333; + box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.2); + + &:hover { + background-color: #f4d525; + color: #333; + } +} + +.cms-editor-active .editor-link { + display: inline-block; +} \ No newline at end of file diff --git a/css/editor.css b/css/editor.css new file mode 100644 index 00000000..79e93da4 --- /dev/null +++ b/css/editor.css @@ -0,0 +1,24 @@ +.error, .warning, .info, .success { + border-left: 5px solid #FD0; + padding: 10px 15px; + margin-left: -20px; + margin-right: -15px; + background-color: #FAFAFA; + border-radius: 2px; +} + +p.warning { + border-color: #ffc107; +} + +p.info { + border-color: #56ADEC; +} + +p.error { + border-color: #F20; +} + +p.success { + border-color: #6c0; +} \ No newline at end of file diff --git a/css/style.scss b/css/style.scss index 6f78368a..e8f30d35 100644 --- a/css/style.scss +++ b/css/style.scss @@ -13,7 +13,14 @@ $space: 20px; $mobile-break: 700px; +{% if site.baseurl %} + $base-url: {{ site.baseurl }}; +{% else %} + $base-url: ''; +{% endif %} + @import "mixins"; @import "main"; @import "borland"; @import "monaki"; +@import "cloudcannon"; diff --git a/images/_screenshot.png b/images/_screenshot.png index 43de957f..181756df 100644 Binary files a/images/_screenshot.png and b/images/_screenshot.png differ diff --git a/index.html b/index.html index a6702a1d..c1c2c03e 100644 --- a/index.html +++ b/index.html @@ -14,17 +14,35 @@

{% endif %} + Edit

{% if doc.description %} -

{{doc.description}}

+

{{ doc.description }}

+ {% endif %} + + {% if doc.parameters and doc.parameters[0].name %} +
Parameters
+
+ {% for parameter in doc.parameters %} +
{{ parameter.name }}
+
{{ parameter.content }}
+ {% endfor %} +
{% endif %} - {{ doc.content | replace: "
", "
Parameters
" }} + {{ doc.content_markdown | markdownify | replace: "
", "
Parameters
" }} + + {% if doc.left_code_blocks and doc.left_code_blocks[0].code_block %} + {% for block in doc.left_code_blocks %} + {% include syntax-highlight.html block=block %} + {% endfor %} + {% endif %} - - {% if doc.right_code %} -
- {{ doc.right_code | markdownify }} + {% if doc.right_code_blocks and doc.right_code_blocks[0].code_block %} +
+ {% for block in doc.right_code_blocks %} + {% include syntax-highlight.html block=block %} + {% endfor %}
{% endif %}
diff --git a/js/.gitignore b/js/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/readme.md b/readme.md index 7031e548..e4b90db1 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,7 @@ Learn Jekyll with step-by-step tutorials and videos at [Jekyll Tips](http://jeky ## Develop -Aviator was built with [Jekyll](http://jekyllrb.com/) version 3.1.6, but should support newer versions as well. +Aviator was built with [Jekyll](http://jekyllrb.com/) version 3.6.2, but should support newer versions as well. Install the dependencies with [Bundler](http://bundler.io/): diff --git a/search.html b/search.html index 8e5166e1..59e55c82 100644 --- a/search.html +++ b/search.html @@ -6,7 +6,7 @@

Search Results

- +

Loading results

    @@ -25,7 +25,7 @@

    Search Results

    "category": "{{ collection.label | xml_escape }}", "description": "{{item.description | xml_escape }}", "type": "{{item.type | xml_escape}}", - "url": "/#{{ item.id | replace: '/', '' | replace: '.', '' | xml_escape }}", + "url": "{{ site.baseurl }}/#{{ item.id | replace: '/', '' | replace: '.', '' | xml_escape }}", "content": {{ item.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }} } {% assign added = true %} @@ -35,5 +35,5 @@

    Search Results

    {% endfor %} }; - - + +