sgassg
This commit is contained in:
parent
5585484059
commit
8d773126c1
8
docs/.gitignore
vendored
Executable file
8
docs/.gitignore
vendored
Executable file
@ -0,0 +1,8 @@
|
||||
.*
|
||||
!.gitignore
|
||||
!.gitmodules
|
||||
*~
|
||||
|
||||
components/
|
||||
|
||||
_site/
|
21
docs/LICENSE.md
Normal file
21
docs/LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
22
docs/Makefile
Normal file
22
docs/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
SRC = $(wildcard lib/*/*.js)
|
||||
HTML = $(wildcard lib/*/*.html)
|
||||
TEMPLATES = $(HTML:.html=.js)
|
||||
LESS = $(wildcard lib/*/*.less)
|
||||
CSS = $(LESS:.less=.css)
|
||||
|
||||
build: components $(SRC) $(TEMPLATES) $(CSS)
|
||||
@component build --verbose --out . --name assets
|
||||
|
||||
components: component.json
|
||||
@component install
|
||||
|
||||
%.js: %.html
|
||||
@component convert $<
|
||||
|
||||
%.css: %.less
|
||||
@lessc $< $@
|
||||
|
||||
clean:
|
||||
rm -fr build components $(TEMPLATES)
|
||||
|
||||
.PHONY: clean
|
68
docs/README.md
Executable file
68
docs/README.md
Executable file
@ -0,0 +1,68 @@
|
||||
## The "What ?" and the "Why ?"
|
||||
|
||||
**Carte** is a simple Jekyll based documentation website for APIs. It is designed as a boilerplate to build your own documentation and is heavily inspired from [Swagger](http://swagger.wordnik.com/) and [I/O docs](http://www.mashery.com/product/io-docs). Fork it, add specifications for your APIs calls and customize the theme. <small>Go ahead, see if we care.</small>
|
||||
|
||||
We built **Carte** because the existing options (Swagger and the likes) were trying to do too much and did not match our needs:
|
||||
|
||||
1. Most of our API calls are sending JSON objects, as opposed to a series of parameters,
|
||||
1. Being able to query the real API is nice, but running anything but `GET` calls can get tricky ("What do you mean I deleted my stuff? I was just trying out the API calls!"),
|
||||
1. Overall, setting up a separate server for what really requires a good static documentation seemed overkill.
|
||||
|
||||
The real value of **Carte** is its structure for describing APIs, not its underlying technical stack (or lack-thereof). In a nutshell; **we built a static template for your API documentation, feel free to re-use it**.
|
||||
|
||||
## Install
|
||||
|
||||
It' Jekyll god dammit:
|
||||
|
||||
1. Clone this repository on your local,
|
||||
1. [Install Jekyll](https://github.com/mojombo/jekyll/wiki/install),
|
||||
1. Go at the root of the repository and run ```jekyll serve --watch```,
|
||||
1. Go to http://localhost:4000,
|
||||
1. [Great success! High five!](http://www.youtube.com/watch?v=wWWyJwHQ-4E)
|
||||
|
||||
## How to...
|
||||
|
||||
### Adding a new API call
|
||||
|
||||
You can add a new API call by simply adding a new post in the `_posts` folder. Jekyll by default forces you to specify a date in the file path: it makes us sad pandas too, but you'll have to stick to this format. You can use dates to control the order in which API calls are displayed in the interface.
|
||||
|
||||
Each API call can define a few values in its YAML header:
|
||||
|
||||
Variable | Mandatory | Default | Description
|
||||
--- | --- | --- | ---
|
||||
``title`` | Y | - | A short description of what that calls does.
|
||||
``path`` | N | - | The URL for the API call, including potential parameters.
|
||||
``type`` | N | - | Set it to `PUT`, `GET`, `POST`, `DELETE` or nothing (for parts of your documentation that do not relate to an actual API call).
|
||||
|
||||
A typical header:
|
||||
|
||||
```
|
||||
---
|
||||
path: '/stuff/:id'
|
||||
title: 'Delete a thing'
|
||||
type: 'DELETE'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
```
|
||||
|
||||
We then describe the request and response (or whatever else you wish to talk about) in the body of our post. Check the placeholders present in the `_posts` folder to get an idea of what it can look like.
|
||||
|
||||
### Grouping calls
|
||||
|
||||
Adding a category to your YAML header will allows you to group methods in the navigation. It is particularly helpful as you start having a lot of methods and need to organize them. For example:
|
||||
|
||||
```
|
||||
---
|
||||
category: Stuff
|
||||
path: '/stuff/:id'
|
||||
title: 'Delete a thing'
|
||||
type: 'DELETE'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
```
|
||||
|
||||
### Edit the design
|
||||
|
||||
The default UI is mostly described through the `css/style.css` file and a couple short jQuery scripts in the `/_layouts/default.html` layout. Hack it to oblivion.
|
6
docs/_config.yml
Executable file
6
docs/_config.yml
Executable file
@ -0,0 +1,6 @@
|
||||
---
|
||||
exclude: ['README.markdown']
|
||||
permalink: ':title'
|
||||
pygments: true
|
||||
safe: false
|
||||
title: 'Carte'
|
17
docs/_layouts/default.html
Executable file
17
docs/_layouts/default.html
Executable file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>{{ site.title }}</title>
|
||||
<meta charset='utf-8'/>
|
||||
<meta name='description' content='Documentation website'/>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'/>
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>
|
||||
<link href='assets.css' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
<body>
|
||||
{{ content }}
|
||||
|
||||
<!--[if lt IE 9]><script src='http://html5shim.googlecode.com/svn/trunk/html5.js'></script><![endif]-->
|
||||
<script src='assets.js' type='text/javascript'></script>
|
||||
<script>require('boot');</script>
|
||||
</body>
|
||||
</html>
|
28
docs/_posts/2012-12-24-delete-a-thing.md
Normal file
28
docs/_posts/2012-12-24-delete-a-thing.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
category: Stuff
|
||||
path: '/stuff/:id'
|
||||
title: 'Delete a thing'
|
||||
type: 'DELETE'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
This method allows the user to post a new thing to his stuff.
|
||||
|
||||
### Request
|
||||
|
||||
* **`:id`** is the id the thing to delete.
|
||||
* The headers must include a **valid authentication token**.
|
||||
* **The body is omitted**.
|
||||
|
||||
### Response
|
||||
|
||||
Sends back a collection of things.
|
||||
|
||||
```Status: 200 Deleted```
|
||||
```{
|
||||
code: 200,
|
||||
message: 'Your thing (id: 736) was deleted'
|
||||
}```
|
||||
|
||||
For errors responses, see the [response status codes documentation](#response-status-codes).
|
39
docs/_posts/2012-12-25-put-a-thing.md
Executable file
39
docs/_posts/2012-12-25-put-a-thing.md
Executable file
@ -0,0 +1,39 @@
|
||||
---
|
||||
category: Stuff
|
||||
path: '/stuff/:id'
|
||||
title: 'Update a thing'
|
||||
type: 'PUT'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
This method allows the user to retrieve his stuff.
|
||||
|
||||
### Request
|
||||
|
||||
* **`:id`** is the id the thing to update.
|
||||
* The headers must include a **valid authentication token**.
|
||||
* **The body can't be empty** and must include at least the name attribute, a `string` that will be used as the name of the thing.
|
||||
|
||||
```Authentication: bearer f862f658-ad89-4fcb-995b-7a4c50554ff6```
|
||||
```{
|
||||
name: 'My new thing'
|
||||
}```
|
||||
|
||||
### Response
|
||||
|
||||
Sends back a collection of things.
|
||||
|
||||
```Status: 200 OK```
|
||||
```{
|
||||
{
|
||||
id: thing_1,
|
||||
name: 'My first thing'
|
||||
},
|
||||
{
|
||||
id: thing_2,
|
||||
name: 'My second thing'
|
||||
}
|
||||
}```
|
||||
|
||||
For errors responses, see the [response status codes documentation](#response-status-codes).
|
32
docs/_posts/2012-12-26-post-a-thing.md
Normal file
32
docs/_posts/2012-12-26-post-a-thing.md
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
category: Stuff
|
||||
path: '/stuff'
|
||||
title: 'Post a thing'
|
||||
type: 'POST'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
This method allows users to create a new thing.
|
||||
|
||||
### Request
|
||||
|
||||
* The headers must include a **valid authentication token**.
|
||||
* **The body can't be empty** and must include at least the name attribute, a `string` that will be used as the name of the thing.
|
||||
|
||||
```Authentication: bearer TOKEN```
|
||||
```{
|
||||
name: 'My new thing'
|
||||
}```
|
||||
|
||||
### Response
|
||||
|
||||
**If succeeds**, returns the created thing.
|
||||
|
||||
```Status: 201 Created```
|
||||
```{
|
||||
id: new_thing,
|
||||
name: 'My new thing'
|
||||
}```
|
||||
|
||||
For errors responses, see the [response status codes documentation](#response-status-codes).
|
32
docs/_posts/2012-12-27-get-stuff.md
Executable file
32
docs/_posts/2012-12-27-get-stuff.md
Executable file
@ -0,0 +1,32 @@
|
||||
---
|
||||
category: Stuff
|
||||
path: '/stuff'
|
||||
title: 'Get stuff'
|
||||
type: 'GET'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
This method allows users to retrieve stuff.
|
||||
|
||||
### Request
|
||||
|
||||
* The headers must include a **valid authentication token**.
|
||||
|
||||
### Response
|
||||
|
||||
Sends back a collection of things.
|
||||
|
||||
```Status: 200 OK```
|
||||
```{
|
||||
{
|
||||
id: thing_1,
|
||||
name: 'My first thing'
|
||||
},
|
||||
{
|
||||
id: thing_2,
|
||||
name: 'My second thing'
|
||||
}
|
||||
}```
|
||||
|
||||
For errors responses, see the [response status codes documentation](#response-status-codes).
|
20
docs/_posts/2012-12-28-authentication.md
Normal file
20
docs/_posts/2012-12-28-authentication.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
path: '/login'
|
||||
title: 'Authenticate'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
This method allows users to retrieve stuff.
|
||||
|
||||
### Response
|
||||
|
||||
Sends back a collection of things.
|
||||
|
||||
```Authentication: bearer TOKEN```
|
||||
```{
|
||||
id: thing_2,
|
||||
name: 'My second thing'
|
||||
}```
|
||||
|
||||
For errors responses, see the [response status codes documentation](#response-status-codes).
|
41
docs/_posts/2012-12-28-response-status-codes.md
Normal file
41
docs/_posts/2012-12-28-response-status-codes.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
title: 'Response status codes'
|
||||
|
||||
layout: nil
|
||||
---
|
||||
|
||||
### Success
|
||||
|
||||
Successes differ from errors in that their body may not be a simple response object with a code and a message. The headers however are consistent across all calls:
|
||||
|
||||
* `GET`, `PUT`, `DELETE` returns `200 OK` on success,
|
||||
* `POST ` returns 201 on success,
|
||||
|
||||
When [retrieving stuff](#get-stuff) for example:
|
||||
|
||||
```Status: 200 OK```
|
||||
```{
|
||||
{
|
||||
id: thing_1,
|
||||
name: 'My first thing'
|
||||
},
|
||||
{
|
||||
id: thing_2,
|
||||
name: 'My second thing'
|
||||
}
|
||||
}```
|
||||
|
||||
### Error
|
||||
|
||||
Error responses are simply returning [standard HTTP error codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) along with some additional information:
|
||||
|
||||
* The error code is sent back as a status header,
|
||||
* The body includes an object describing both the code and message (for debugging and/or display purposes),
|
||||
|
||||
For a call with an invalid authentication token for example:
|
||||
|
||||
```Status: 401 Access denied```
|
||||
```{
|
||||
code: 401,
|
||||
message: 'Access denied: invalid authentication token.'
|
||||
}```
|
639
docs/assets.css
Normal file
639
docs/assets.css
Normal file
@ -0,0 +1,639 @@
|
||||
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */
|
||||
|
||||
/* ==========================================================================
|
||||
HTML5 display definitions
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Correct `block` display not defined in IE 8/9.
|
||||
*/
|
||||
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct `inline-block` display not defined in IE 8/9.
|
||||
*/
|
||||
|
||||
audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent modern browsers from displaying `audio` without controls.
|
||||
* Remove excess height in iOS 5 devices.
|
||||
*/
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in IE 8/9.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Base
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Set default font family to sans-serif.
|
||||
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
||||
* user zoom.
|
||||
*/
|
||||
|
||||
html {
|
||||
font-family: sans-serif; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
-ms-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove default margin.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Links
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Address `outline` inconsistency between Chrome and other browsers.
|
||||
*/
|
||||
|
||||
a:focus {
|
||||
outline: thin dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Improve readability when focused and also mouse hovered in all browsers.
|
||||
*/
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Typography
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Address variable `h1` font-size and margin within `section` and `article`
|
||||
* contexts in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in IE 8/9, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in Safari 5 and Chrome.
|
||||
*/
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address differences between Firefox and other browsers.
|
||||
*/
|
||||
|
||||
hr {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in IE 8/9.
|
||||
*/
|
||||
|
||||
mark {
|
||||
background: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct font family set oddly in Safari 5 and Chrome.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Improve readability of pre-formatted text in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set consistent quote types.
|
||||
*/
|
||||
|
||||
q {
|
||||
quotes: "\201C" "\201D" "\2018" "\2019";
|
||||
}
|
||||
|
||||
/**
|
||||
* Address inconsistent and variable font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove border when inside `a` element in IE 8/9.
|
||||
*/
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct overflow displayed oddly in IE 9.
|
||||
*/
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Figures
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Address margin not present in IE 8/9 and Safari 5.
|
||||
*/
|
||||
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Define consistent border, margin, and padding.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct `color` not being inherited in IE 8/9.
|
||||
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||
*/
|
||||
|
||||
legend {
|
||||
border: 0; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct font family not being inherited in all browsers.
|
||||
* 2. Correct font size not being inherited in all browsers.
|
||||
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 2 */
|
||||
margin: 0; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
|
||||
* the UA stylesheet.
|
||||
*/
|
||||
|
||||
button,
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address inconsistent `text-transform` inheritance for `button` and `select`.
|
||||
* All other form control elements do not inherit `text-transform` values.
|
||||
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
|
||||
* Correct `select` style inheritance in Firefox 4+ and Opera.
|
||||
*/
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
||||
* and `video` controls.
|
||||
* 2. Correct inability to style clickable `input` types in iOS.
|
||||
* 3. Improve usability and consistency of cursor style between image-type
|
||||
* `input` and others.
|
||||
*/
|
||||
|
||||
button,
|
||||
html input[type="button"], /* 1 */
|
||||
input[type="reset"],
|
||||
input[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
cursor: pointer; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set default cursor for disabled elements.
|
||||
*/
|
||||
|
||||
button[disabled],
|
||||
html input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Address box sizing set to `content-box` in IE 8/9.
|
||||
* 2. Remove excess padding in IE 8/9.
|
||||
*/
|
||||
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
|
||||
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
|
||||
* (include `-moz` to future-proof).
|
||||
*/
|
||||
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box; /* 2 */
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove inner padding and search cancel button in Safari 5 and Chrome
|
||||
* on OS X.
|
||||
*/
|
||||
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove inner padding and border in Firefox 4+.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove default vertical scrollbar in IE 8/9.
|
||||
* 2. Improve readability and alignment in all browsers.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto; /* 1 */
|
||||
vertical-align: top; /* 2 */
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Tables
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove most spacing between table cells.
|
||||
*/
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* GENERAL */
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
body,
|
||||
input,
|
||||
textarea {
|
||||
color: #191919;
|
||||
font: 14px/140% 'Open Sans', Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #119bdf;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #29aeef;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
p,
|
||||
ul,
|
||||
code {
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', monospace, sans-serif;
|
||||
}
|
||||
|
||||
/* SIDEBAR */
|
||||
#sidebar {
|
||||
background: #191919;
|
||||
color: #fff;
|
||||
float: left;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
#sidebar h1 {
|
||||
background: #111;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#sidebar h2 {
|
||||
color: #888;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#sidebar ul#links {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#sidebar ul ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#sidebar ul li a {
|
||||
color: #fff;
|
||||
display: block;
|
||||
padding: 0 0 15px;
|
||||
}
|
||||
#sidebar ul li a:active,
|
||||
#sidebar ul li a.active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#sidebar input {
|
||||
background: #111;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
|
||||
-webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
|
||||
color: #ddd;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
#sidebar input:active,
|
||||
#sidebar input:focus {
|
||||
border-color: #ccc;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
-webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* References */
|
||||
#content {
|
||||
padding: 20px;
|
||||
padding-left: 260px;
|
||||
max-width: 700px;
|
||||
}
|
||||
|
||||
#content .control {
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#content article {
|
||||
clear: both;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
#content article > a {
|
||||
background: #333;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
padding: 15px;
|
||||
}
|
||||
#content article > a:hover {
|
||||
background: #222;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#content a h2 {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#content a h2 code {
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#content a h2 code b {
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
color: #fff;
|
||||
font-weight: normal;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
/* Default */
|
||||
#content article {
|
||||
border-color: #e2e7ea;
|
||||
}
|
||||
|
||||
#content article a h2 code {
|
||||
color: #657e8b;
|
||||
}
|
||||
|
||||
#content article a h2 code b {
|
||||
background: #657e8b;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* GET */
|
||||
#content article.GET a h2 code {
|
||||
color: #119bdf;
|
||||
}
|
||||
|
||||
#content article.GET a h2 code b {
|
||||
background: #119bdf;
|
||||
}
|
||||
|
||||
/* POST */
|
||||
#content article.POST a h2 code {
|
||||
color: #52ce0e;
|
||||
}
|
||||
|
||||
#content article.POST a h2 code b {
|
||||
background: #52ce0e;
|
||||
}
|
||||
|
||||
/* PUT */
|
||||
#content article.PUT a h2 code {
|
||||
color: #e08f10;
|
||||
}
|
||||
|
||||
#content article.PUT a h2 code b {
|
||||
background: #e08f10;
|
||||
}
|
||||
|
||||
/* DELETE */
|
||||
#content article.DELETE a h2 code {
|
||||
color: #e02a10;
|
||||
}
|
||||
|
||||
#content article.DELETE a h2 code b {
|
||||
background: #e02a10;
|
||||
}
|
||||
|
||||
/* Reference's body */
|
||||
#content h3 {
|
||||
}
|
||||
|
||||
#content .body {
|
||||
border-top: 1px solid #eef1f2;
|
||||
display: block;
|
||||
padding: 15px 15px 0;
|
||||
}
|
||||
|
||||
#content .body code {
|
||||
border: 1px solid #e2e7ea;
|
||||
background: #eef1f2;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
color: #546974;
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
#content .body p > code {
|
||||
display: block;
|
||||
padding: 15px;
|
||||
white-space: pre;
|
||||
}
|
9721
docs/assets.js
Normal file
9721
docs/assets.js
Normal file
File diff suppressed because it is too large
Load Diff
7
docs/component.json
Normal file
7
docs/component.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "carte",
|
||||
"description": "Simple API reference",
|
||||
"version": "0.0.1",
|
||||
"local": ["boot"],
|
||||
"paths": ["lib"]
|
||||
}
|
18
docs/index.html
Executable file
18
docs/index.html
Executable file
@ -0,0 +1,18 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<nav id='sidebar'>
|
||||
{% include nav.html %}
|
||||
</nav>
|
||||
|
||||
<section id='content'>
|
||||
{% for post in site.posts %}
|
||||
<article class='{{ post.type }}'>
|
||||
<a name='{{ post.url }}' href='#{{ post.url }}'><h2>{% if post.type %}<code><b>{{ post.type }}</b> {{ post.path }}</code> {% endif %}{{ post.title }}</h2></a>
|
||||
<section class='body'>
|
||||
{{ post.content }}
|
||||
</section>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</section>
|
11
docs/lib/boot/component.json
Normal file
11
docs/lib/boot/component.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "boot",
|
||||
"description": "Main app boot component",
|
||||
"dependencies": {
|
||||
"necolas/normalize.css": "*",
|
||||
"component/jquery": "*"
|
||||
},
|
||||
"local": ["filter"],
|
||||
"scripts": ["index.js"],
|
||||
"styles": ["style.css"]
|
||||
}
|
49
docs/lib/boot/index.js
Normal file
49
docs/lib/boot/index.js
Normal file
@ -0,0 +1,49 @@
|
||||
var $ = require('jquery'),
|
||||
Filter = require('filter');
|
||||
|
||||
// Collapsible articles
|
||||
$('article').each(function () {
|
||||
var that = $(this);
|
||||
var header = that.children('a');
|
||||
var body = that.children('.body');
|
||||
body.hide();
|
||||
header.toggle(
|
||||
function () { body.slideDown('fast'); that.addClass('active'); },
|
||||
function () { body.slideUp('fast'); that.removeClass('active'); }
|
||||
);
|
||||
});
|
||||
|
||||
var anchor = window.location.hash.substring(1);
|
||||
if (anchor) $('article a[name=' + anchor + ']').trigger('click');
|
||||
|
||||
// Expanding the article on link click and scrolling down to it
|
||||
$('#sidebar a').each(function () {
|
||||
var that = $(this);
|
||||
var id = that.attr('href').substring(1);
|
||||
that.click(function (e) {
|
||||
var header = $('article a[name="'+ id +'"]')
|
||||
if (!header.parent().hasClass('active')) header.trigger('click');
|
||||
$('html, body').animate({ scrollTop: header.offset().top }, 'fast');
|
||||
});
|
||||
|
||||
// If we find a link in the body with similar anchor, add the same behavior
|
||||
$('.body a[href=#'+ id +']').click(function (e) {
|
||||
$('#sidebar a[href=#'+ id +']').trigger('click');
|
||||
});
|
||||
});
|
||||
|
||||
// Hide all/Show all links
|
||||
var show = $('<a class=\'control show\'>Show all</a>');
|
||||
show.click(function () {
|
||||
$('#content article:not(".active") > a').trigger('click');
|
||||
});
|
||||
$('#content').prepend(show);
|
||||
|
||||
var hide = $('<a class=\'control hide\'>Hide all</a>');
|
||||
hide.click(function () {
|
||||
$('#content article.active > a').trigger('click');
|
||||
});
|
||||
$('#content').prepend(hide);
|
||||
|
||||
// Making our navigation sticky
|
||||
new Filter($('#sidebar > ul'));
|
240
docs/lib/boot/style.css
Normal file
240
docs/lib/boot/style.css
Normal file
@ -0,0 +1,240 @@
|
||||
/* GENERAL */
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
body,
|
||||
input,
|
||||
textarea {
|
||||
color: #191919;
|
||||
font: 14px/140% 'Open Sans', Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #119bdf;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #29aeef;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
p,
|
||||
ul,
|
||||
code {
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', monospace, sans-serif;
|
||||
}
|
||||
|
||||
/* SIDEBAR */
|
||||
#sidebar {
|
||||
background: #191919;
|
||||
color: #fff;
|
||||
float: left;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
#sidebar h1 {
|
||||
background: #111;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#sidebar h2 {
|
||||
color: #888;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#sidebar ul#links {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#sidebar ul ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#sidebar ul li a {
|
||||
color: #fff;
|
||||
display: block;
|
||||
padding: 0 0 15px;
|
||||
}
|
||||
#sidebar ul li a:active,
|
||||
#sidebar ul li a.active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#sidebar input {
|
||||
background: #111;
|
||||
border: 0;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
|
||||
-webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
|
||||
color: #ddd;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
#sidebar input:active,
|
||||
#sidebar input:focus {
|
||||
border-color: #ccc;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
-webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* References */
|
||||
#content {
|
||||
padding: 20px;
|
||||
padding-left: 260px;
|
||||
max-width: 700px;
|
||||
}
|
||||
|
||||
#content .control {
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#content article {
|
||||
clear: both;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
#content article > a {
|
||||
background: #333;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
padding: 15px;
|
||||
}
|
||||
#content article > a:hover {
|
||||
background: #222;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#content a h2 {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#content a h2 code {
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#content a h2 code b {
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
color: #fff;
|
||||
font-weight: normal;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
/* Default */
|
||||
#content article {
|
||||
border-color: #e2e7ea;
|
||||
}
|
||||
|
||||
#content article a h2 code {
|
||||
color: #657e8b;
|
||||
}
|
||||
|
||||
#content article a h2 code b {
|
||||
background: #657e8b;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* GET */
|
||||
#content article.GET a h2 code {
|
||||
color: #119bdf;
|
||||
}
|
||||
|
||||
#content article.GET a h2 code b {
|
||||
background: #119bdf;
|
||||
}
|
||||
|
||||
/* POST */
|
||||
#content article.POST a h2 code {
|
||||
color: #52ce0e;
|
||||
}
|
||||
|
||||
#content article.POST a h2 code b {
|
||||
background: #52ce0e;
|
||||
}
|
||||
|
||||
/* PUT */
|
||||
#content article.PUT a h2 code {
|
||||
color: #e08f10;
|
||||
}
|
||||
|
||||
#content article.PUT a h2 code b {
|
||||
background: #e08f10;
|
||||
}
|
||||
|
||||
/* DELETE */
|
||||
#content article.DELETE a h2 code {
|
||||
color: #e02a10;
|
||||
}
|
||||
|
||||
#content article.DELETE a h2 code b {
|
||||
background: #e02a10;
|
||||
}
|
||||
|
||||
/* Reference's body */
|
||||
#content h3 {
|
||||
}
|
||||
|
||||
#content .body {
|
||||
border-top: 1px solid #eef1f2;
|
||||
display: block;
|
||||
padding: 15px 15px 0;
|
||||
}
|
||||
|
||||
#content .body code {
|
||||
border: 1px solid #e2e7ea;
|
||||
background: #eef1f2;
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
color: #546974;
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
#content .body p > code {
|
||||
display: block;
|
||||
padding: 15px;
|
||||
white-space: pre;
|
||||
}
|
8
docs/lib/filter/component.json
Normal file
8
docs/lib/filter/component.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "filter",
|
||||
"description": "Makes lists of links filterable.",
|
||||
"dependencies": {
|
||||
"component/jquery": "*"
|
||||
},
|
||||
"scripts": ["index.js"]
|
||||
}
|
48
docs/lib/filter/index.js
Normal file
48
docs/lib/filter/index.js
Normal file
@ -0,0 +1,48 @@
|
||||
// Dependencies
|
||||
var $ = require('jquery');
|
||||
|
||||
// Expose `Filter`.
|
||||
module.exports = Filter;
|
||||
|
||||
// Case-insensitive contains()
|
||||
$.expr[':'].Contains = function(a,i,m){
|
||||
return (a.textContent || a.innerText || '').toUpperCase().indexOf(m[3].toUpperCase())>=0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a filterable list.
|
||||
*/
|
||||
function Filter(list) {
|
||||
this.el = list;
|
||||
|
||||
// Filter input
|
||||
var form = $('<form>').attr({ 'action':'#' });
|
||||
var input = $('<input>').attr({ 'type':'text', 'placeholder':'Filter by keyword' });
|
||||
$(form).append(input).prependTo(this.el);
|
||||
|
||||
// Filter function
|
||||
var self = this;
|
||||
$(input).change(function () {
|
||||
var filter = $(this).val();
|
||||
if(filter) {
|
||||
$(self.el).find('a:not(:Contains(' + filter + '))').parent().hide();
|
||||
$(self.el).find('a:Contains(' + filter + ')').parent().show();
|
||||
} else {
|
||||
$(self.el).find('li').show();
|
||||
}
|
||||
|
||||
// Hide titles when group is empty
|
||||
$(self.el).find('ul').each(function () {
|
||||
if (!$(this).find('li:visible').length) {
|
||||
$(this).prev('h2').hide();
|
||||
} else {
|
||||
$(this).prev('h2').show();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
})
|
||||
.keyup( function () { $(this).change(); });
|
||||
|
||||
return this;
|
||||
}
|
19
docs/nav.html
Normal file
19
docs/nav.html
Normal file
@ -0,0 +1,19 @@
|
||||
<h1>{{ site.title }}</h1>
|
||||
<ul id='links'>
|
||||
{% for post in site.posts %}
|
||||
{% if post.category == null %}
|
||||
<li><a href='#{{ post.url }}'>{{ post.title }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for category in site.categories %}
|
||||
<li><h2>{{ category | first }}</h2>
|
||||
<ul>
|
||||
{% for posts in category %}
|
||||
{% for post in posts %}
|
||||
<li class='{{ post.type }}'><a href='#{{ post.url }}'>{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
2
docs/robots.txt
Executable file
2
docs/robots.txt
Executable file
@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow: /images/
|
Loading…
Reference in New Issue
Block a user