瀏覽代碼

More styling for responses documentation.

pull/24/head
Ben Kurtovic 9 年之前
父節點
當前提交
7a58c99104
共有 2 個文件被更改,包括 41 次插入22 次删除
  1. +19
    -0
      static/api.css
  2. +22
    -22
      templates/api.mako

+ 19
- 0
static/api.css 查看文件

@@ -2,6 +2,10 @@ h1, h2 {
font-family: sans-serif; font-family: sans-serif;
} }


pre {
white-space: pre-wrap;
}

div#help { div#help {
margin: auto; margin: auto;
max-width: 1200px; max-width: 1200px;
@@ -11,6 +15,19 @@ span.code {
font-family: monospace; font-family: monospace;
} }


span.resp-dtype, span.resp-desc {
padding: 0 0.25em;
background-color: #E5E5E5;
}

span.resp-dtype {
color: #009;
}

span.resp-desc {
color: #090;
}

span.param-key { span.param-key {
color: #009; color: #009;
font-weight: bold; font-weight: bold;
@@ -36,6 +53,8 @@ table.parameters th {
table.parameters tr:first-child { table.parameters tr:first-child {
font-family: sans-serif; font-family: sans-serif;
font-size: 1.17em; font-size: 1.17em;
background-color: #369;
color: white;
} }


table.parameters td:first-child { table.parameters td:first-child {


+ 22
- 22
templates/api.mako 查看文件

@@ -156,39 +156,39 @@
<pre>{ <pre>{
"status": "error", "status": "error",
"error": { "error": {
"code": (string) error code,
"info": (string) human-readable description of error
"code": <span class="resp-dtype">string</span> <span class="resp-desc">error code</span>,
"info": <span class="resp-dtype">string</span> <span class="resp-desc">human-readable description of error</span>
} }
}</pre> }</pre>
<p>Valid responses for <span class="code">action=compare</span> and <span class="code">action=search</span> are formatted like this:</p> <p>Valid responses for <span class="code">action=compare</span> and <span class="code">action=search</span> are formatted like this:</p>
<pre>{ <pre>{
"status": "ok", "status": "ok",
"meta": { "meta": {
"time": (float) time to generate results, in seconds,
"queries": (int) number of search engine queries made,
"cached": (boolean) whether or not these results are cached from an earlier search (always false in the case of action=compare),
(only if cached=true) "cache_time": (string) human-readable time of the original search that the results are cached from
"redirected": (boolean) whether or not a redirect was followed
"time": <span class="resp-dtype">float</span> <span class="resp-desc">time to generate results, in seconds</span>,
"queries": <span class="resp-dtype">int</span> <span class="resp-desc">number of search engine queries made</span>,
"cached": <span class="resp-dtype">boolean</span> <span class="resp-desc">whether or not these results are cached from an earlier search (always false in the case of action=compare)</span>,
(only if cached=true) "cache_time": <span class="resp-dtype">string</span> <span class="resp-desc">human-readable time of the original search that the results are cached from</span>,
"redirected": <span class="resp-dtype">boolean</span> <span class="resp-desc">whether or not a redirect was followed</span>
}, },
"page": { "page": {
"title": (string) the normalized title of the page checked,
"url": (string) the full URL of the page checked
"title": <span class="resp-dtype">string</span> <span class="resp-desc">the normalized title of the page checked</span>,
"url": <span class="resp-dtype">string</span> <span class="resp-desc">the full URL of the page checked</span>
}, },
(only if redirected=true) "original_page": { (only if redirected=true) "original_page": {
"title": (string) the normalized title of the original page whose redirect was followed,
"url": (string) the full URL of the original page whose redirect was followed
"title": <span class="resp-dtype">string</span> <span class="resp-desc">the normalized title of the original page whose redirect was followed</span>,
"url": <span class="resp-dtype">string</span> <span class="resp-desc">the full URL of the original page whose redirect was followed</span>
}, },
"best": { "best": {
"url": (string) the URL of the best match found, or null if no matches were found,
"confidence": (float) the confidence of a violation in the best match, or 0.0 if no matches were found,
"violation": (string) one of "suspected", "possible", or "none"
"url": <span class="resp-dtype">string</span> <span class="resp-desc">the URL of the best match found, or null if no matches were found</span>,
"confidence": <span class="resp-dtype">float</span> <span class="resp-desc">the confidence of a violation in the best match, or 0.0 if no matches were found</span>,
"violation": <span class="resp-dtype">string</span> <span class="resp-desc">one of "suspected", "possible", or "none"</span>
}, },
"sources": [ "sources": [
{ {
"url": (string) the URL of the source,
"confidence": (float) the confidence of a violation in the source,
"violation": (string) one of "suspected", "possible", or "none",
"skipped": (boolean) whether or not the source was skipped due to the check finishing early (see note about noskip above)
"url": <span class="resp-dtype">string</span> <span class="resp-desc">the URL of the source</span>,
"confidence": <span class="resp-dtype">float</span> <span class="resp-desc">the confidence of a violation in the source</span>,
"violation": <span class="resp-dtype">string</span> <span class="resp-desc">one of "suspected", "possible", or "none"</span>,
"skipped": <span class="resp-dtype">boolean</span> <span class="resp-desc">whether or not the source was skipped due to the check finishing early (see note about noskip above)</span>
}, },
... ...
] ]
@@ -200,15 +200,15 @@
"status": "ok", "status": "ok",
"langs": [ "langs": [
[ [
(string) language code,
(string) human-readable language name
<span class="resp-dtype">string</span> <span class="resp-desc">language code</span>,
<span class="resp-dtype">string</span> <span class="resp-desc">human-readable language name</span>
], ],
... ...
], ],
"projects": [ "projects": [
[ [
(string) project code,
(string) human-readable project name
<span class="resp-dtype">string</span> <span class="resp-desc">project code</span>,
<span class="resp-dtype">string</span> <span class="resp-desc">human-readable project name</span>
], ],
... ...
] ]


Loading…
取消
儲存