Skip to content

Commit

Permalink
Update API Endpoints docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jvatic committed Sep 22, 2013
1 parent 1a0ddbf commit 21d79d8
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 31 deletions.
10 changes: 1 addition & 9 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@
set :images_dir, 'images'

set :markdown_engine, :redcarpet
set :markdown,
fenced_code_blocks: true,
no_intra_emphasis: true,
autolink: true,
tables: true,
strikethrough: true,
lax_html_blocks: true,
space_after_headers: true,
superscript: true
set :markdown, REDCARPET_EXTENTIONS

helpers do
def nav_link_with_active(text, target, attributes = {})
Expand Down
11 changes: 11 additions & 0 deletions lib/markdown_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
require 'cgi'
require 'middleman-core/renderers/redcarpet'

REDCARPET_EXTENTIONS = {
fenced_code_blocks: true,
no_intra_emphasis: true,
autolink: true,
tables: true,
strikethrough: true,
lax_html_blocks: true,
space_after_headers: true,
superscript: true
}.freeze

module MarkdownHelpers
def anchor(text)
text.downcase.strip.gsub(/[^a-z0-9 ]/, '').gsub(/\s+/, '-')
Expand Down
5 changes: 4 additions & 1 deletion lib/tent_doc/api_example.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'yajl'
require 'markdown_html'

module TentDoc
class APIExample
Expand All @@ -19,7 +20,9 @@ def initialize(data, options = {})
end

def compile
data.gsub(/\{(\w+) example\}/) { api_examples[$1] }
data.gsub(/\{(\w+) example\}/) do
Redcarpet::Markdown.new(Middleman::Renderers::MiddlemanRedcarpetHTML, REDCARPET_EXTENTIONS).render(api_examples[$1])
end
end

private
Expand Down
149 changes: 128 additions & 21 deletions source/docs/api.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,24 @@ current page and pages that do not exist are omitted.

## new_post

{new_post example}
<div class='panel panel-primary'>
<div class='panel-heading'>POST new_post</div>

<div class='panel-body'>
{new_post example}
</div>
</div>

### Attachments

{new_multipart_post example}
<div class='panel panel-primary'>
<div class='panel-heading'>POST new_post</div>

<div class='panel-body'>
{new_multipart_post example}
</div>
</div>


## posts_feed

Expand Down Expand Up @@ -68,70 +81,164 @@ a deterministic sort.

### Examples

{posts_feed example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET posts_feed</div>

<div class='panel-body'>
{posts_feed example}
</div>
</div>

#### Refs

{posts_feed_refs example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET posts_feed</div>

<div class='panel-body'>
{posts_feed_refs example}
</div>
</div>

#### Conditional Request

{posts_feed_304 example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET posts_feed</div>

<div class='panel-body'>
{posts_feed_304 example}
</div>
</div>

#### HEAD Request (Count)

{posts_feed_count example}
<div class='panel panel-primary'>
<div class='panel-heading'>HEAD posts_feed</div>

<div class='panel-body'>
{posts_feed_count example}
</div>
</div>

## post

### Create New Version

{new_post_version example}
<div class='panel panel-primary'>
<div class='panel-heading'>PUT post</div>

<div class='panel-body'>
{new_post_version example}
</div>
</div>

### Get (with refs)

{post_refs example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET post</div>

<div class='panel-body'>
{post_refs example}
</div>
</div>

### Mentions

{post_mentions example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET post</div>

#### HEAD (Count)
<div class='panel-body'>
{post_mentions example}
</div>
</div>

{post_mentions_count example}
<div class='panel panel-primary'>
<div class='panel-heading'>HEAD post</div>

<div class='panel-body'>
{post_mentions_count example}
</div>
</div>

### Versions

{post_versions example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET post</div>

<div class='panel-body'>
{post_versions example}
</div>
</div>

#### HEAD (Count)
<div class='panel panel-primary'>
<div class='panel-heading'>HEAD post</div>

{post_versions_count example}
<div class='panel-body'>
{post_versions_count example}
</div>
</div>

### Child Versions

{post_children example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET post</div>

<div class='panel-body'>
{post_children example}
</div>
</div>

#### HEAD (Count)
<div class='panel panel-primary'>
<div class='panel-heading'>HEAD post</div>

{post_children_count example}
<div class='panel-body'>
{post_children_count example}
</div>
</div>

## attachment

{get_attachment example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET attachment</div>

<div class='panel-body'>
{get_attachment example}
</div>
</div>

## post_attachment

{get_post_attachment example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET post_attachment</div>

<div class='panel-body'>
{get_post_attachment example}
</div>
</div>

## batch

Documentation pending

## server_info

Documentation pending

## oauth_auth

{oauth_redirect example}
<div class='panel panel-primary'>
<div class='panel-heading'>GET oauth</div>

<div class='panel-body'>
{oauth_redirect example}
</div>
</div>

## oauth_token

{oauth_token example}
<div class='panel panel-primary'>
<div class='panel-heading'>POST oauth_token</div>

<div class='panel-body'>
{oauth_token example}
</div>
</div>

0 comments on commit 21d79d8

Please sign in to comment.