improve api documentation syntax highlighting
refs CNVS-26515 Switch to the prettify library and highlight not just json but html, xml, and bash. test plan: `rake doc:api` and open up the generated docs. throughout the docs, code should be syntax highlighted, including stuff like curl commands and xml that weren't highlighted before. It should be easier to copy/paste this code now, without a weird hidden text box appearing. Change-Id: Icd33159836826e144cb14b96187cb8c645559885 Reviewed-on: https://gerrit.instructure.com/70345 Reviewed-by: Brad Humphrey <brad@instructure.com> Tested-by: Jenkins Product-Review: Brian Palmer <brianp@instructure.com> QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
0a4e16282d
commit
3390bfae08
|
@ -25,11 +25,15 @@ POST and PUT requests may also optionally be sent in <a href="http://www.json.or
|
|||
|
||||
As an example, this HTML form request:
|
||||
|
||||
name=test+name&file_ids[]=1&file_ids[]=2&sub[name]=foo&sub[message]=bar
|
||||
```bash
|
||||
name=test+name&file_ids[]=1&file_ids[]=2&sub[name]=foo&sub[message]=bar
|
||||
```
|
||||
|
||||
would translate into this JSON request:
|
||||
|
||||
{ "name": "test name", "file_ids": [1,2], "sub": { "name": "foo", "message": "bar" } }
|
||||
```json
|
||||
{ "name": "test name", "file_ids": [1,2], "sub": { "name": "foo", "message": "bar" } }
|
||||
```
|
||||
|
||||
With either encoding, all timestamps are sent and returned in ISO 8601 format (UTC time zone):
|
||||
|
||||
|
@ -44,11 +48,15 @@ query string or POST parameters is also supported.
|
|||
|
||||
OAuth2 Token sent in header:
|
||||
|
||||
curl -H "Authorization: Bearer <ACCESS-TOKEN>" https://canvas.instructure.com/api/v1/courses
|
||||
```bash
|
||||
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://canvas.instructure.com/api/v1/courses"
|
||||
```
|
||||
|
||||
OAuth2 Token sent in query string:
|
||||
|
||||
curl https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>
|
||||
```bash
|
||||
curl "https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>"
|
||||
```
|
||||
|
||||
Read more about <a href="oauth.html">OAuth2 and how to get access tokens.</a>
|
||||
|
||||
|
@ -73,5 +81,6 @@ itself. You can generate this documentation yourself if you've set up a
|
|||
local Canvas environment following the instructions on <a href="https://www.github.com/instructure/canvas-lms/wiki">Github</a>,
|
||||
run the following command from your Canvas directory:
|
||||
|
||||
bundle exec rake doc:api
|
||||
|
||||
```bash
|
||||
bundle exec rake doc:api
|
||||
```
|
||||
|
|
|
@ -4,43 +4,43 @@ Grade Passback Tools
|
|||
Graded external tools are configured just like regular external tools. The
|
||||
difference is that rather than adding the tool to a course as a link in a
|
||||
module, a navigation item, etc. the tool gets added as an assignment.
|
||||
Instructors will see a new assignment type called "External Tool" where
|
||||
Instructors will see a new assignment type called "External Tool" where
|
||||
they can select a tool configuration to use for the assignment. When students
|
||||
go to view the assignment instead of seeing a standard Canvas description
|
||||
they'll see the tool loaded in an iframe on the page. The tool can then
|
||||
they'll see the tool loaded in an iframe on the page. The tool can then
|
||||
send grading information back to Canvas.
|
||||
|
||||
Tools can know that they have been launched in a graded context because
|
||||
an additional parameter is sent across, `lis_outcome_service_url`,
|
||||
as specified in the LTI 1.1 specification. Grades are passed back to Canvas
|
||||
from the tool's servers using the
|
||||
<a href="http://www.imsglobal.org/LTI/v1p1/ltiIMGv1p1.html#_Toc319560472">outcomes component of LTI 1.1</a>.
|
||||
as specified in the LTI 1.1 specification. Grades are passed back to Canvas
|
||||
from the tool's servers using the
|
||||
<a href="http://www.imsglobal.org/LTI/v1p1/ltiIMGv1p1.html#_Toc319560472">outcomes component of LTI 1.1</a>.
|
||||
|
||||
## Data Return Extension
|
||||
|
||||
Canvas sends an extension parameter for assignment launches that allows the tool
|
||||
provider to pass back values as submission text in canvas.
|
||||
The key is `ext_outcome_data_values_accepted` and the value is a comma separated list of
|
||||
provider to pass back values as submission text in canvas.
|
||||
The key is `ext_outcome_data_values_accepted` and the value is a comma separated list of
|
||||
types of data accepted. The currently available data types are `url` and `text`.
|
||||
So the added launch parameter will look like this:
|
||||
So the added launch parameter will look like this:
|
||||
|
||||
`ext_outcome_data_values_accepted=url,text`
|
||||
|
||||
### Returning Data Values from Tool Provider
|
||||
|
||||
|
||||
If the external tool wants to supply these values, it can augment the POX sent
|
||||
with the grading value. <a href="http://www.imsglobal.org/LTI/v1p1/ltiIMGv1p1.html#_Toc319560473">LTI replaceResult POX</a>
|
||||
|
||||
Only one type of resultData should be sent, if multiple types are sent the tool
|
||||
consumer behavior is undefined and is implementation-specific. Canvas will take
|
||||
Only one type of resultData should be sent, if multiple types are sent the tool
|
||||
consumer behavior is undefined and is implementation-specific. Canvas will take
|
||||
the text value and ignore the url value if both are sent.
|
||||
|
||||
####Text
|
||||
|
||||
Add a `resultData` node with a `text` node of plain text in the same encoding as
|
||||
Add a `resultData` node with a `text` node of plain text in the same encoding as
|
||||
the rest of the document within it like this:
|
||||
|
||||
<pre>
|
||||
```xml
|
||||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
<imsx_POXEnvelopeRequest xmlns="http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
|
||||
<imsx_POXHeader>
|
||||
|
@ -69,13 +69,13 @@ the rest of the document within it like this:
|
|||
</replaceResultRequest>
|
||||
</imsx_POXBody>
|
||||
</imsx_POXEnvelopeRequest>
|
||||
</pre>
|
||||
```
|
||||
|
||||
####URL
|
||||
|
||||
Add a `resultData` node with a `url` node within it like this:
|
||||
|
||||
<pre>
|
||||
```xml
|
||||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
<imsx_POXEnvelopeRequest xmlns="http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
|
||||
<imsx_POXHeader>
|
||||
|
@ -104,7 +104,7 @@ Add a `resultData` node with a `url` node within it like this:
|
|||
</replaceResultRequest>
|
||||
</imsx_POXBody>
|
||||
</imsx_POXEnvelopeRequest>
|
||||
</pre>
|
||||
```
|
||||
|
||||
|
||||
## Total Score Return Extension
|
||||
|
@ -125,7 +125,7 @@ Simply add a node called `resultTotalScore` instead of `resultScore`. If both ar
|
|||
sent, then `resultScore` will be ignored. The `textString` value should be
|
||||
an Integer or Float value.
|
||||
|
||||
<pre>
|
||||
```xml
|
||||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
<imsx_POXEnvelopeRequest xmlns="http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
|
||||
<imsx_POXHeader>
|
||||
|
@ -151,4 +151,4 @@ an Integer or Float value.
|
|||
</replaceResultRequest>
|
||||
</imsx_POXBody>
|
||||
</imsx_POXEnvelopeRequest>
|
||||
</pre>
|
||||
```
|
||||
|
|
|
@ -30,8 +30,10 @@ Secondary collections should never be considered as ordered or complete.
|
|||
|
||||
Example:
|
||||
|
||||
{
|
||||
"meta": {"primaryCollection": "comments"},
|
||||
"comments": [...],
|
||||
"authors": [...]
|
||||
}
|
||||
```json
|
||||
{
|
||||
"meta": {"primaryCollection": "comments"},
|
||||
"comments": [...],
|
||||
"authors": [...]
|
||||
}
|
||||
```
|
||||
|
|
|
@ -11,10 +11,11 @@ For example, consider an assignment description containing a link to a wiki page
|
|||
the same course. The description returned by the Get Assignment API might look
|
||||
like this:
|
||||
|
||||
!!!javascript
|
||||
<a href="http://canvas.example.com/courses/123/pages/a-wiki-page"
|
||||
data-api-endpoint="http://canvas.example.com/api/v1/courses/123/pages/a-wiki-page"
|
||||
data-api-returntype="Page">More information here</a>
|
||||
```html
|
||||
<a href="http://canvas.example.com/courses/123/pages/a-wiki-page"
|
||||
data-api-endpoint="http://canvas.example.com/api/v1/courses/123/pages/a-wiki-page"
|
||||
data-api-returntype="Page">More information here</a>
|
||||
```
|
||||
|
||||
The currently supported `data-api-returntype` values are:
|
||||
|
||||
|
|
|
@ -42,28 +42,31 @@ Arguments:
|
|||
|
||||
Example Request:
|
||||
|
||||
curl 'https://<canvas>/api/v1/users/self/files' \
|
||||
-F 'name=profile_pic.jpg' \
|
||||
-F 'size=302185' \
|
||||
-F 'content_type=image/jpeg' \
|
||||
-F 'parent_folder_path=my_files/section1' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```bash
|
||||
curl 'https://<canvas>/api/v1/users/self/files' \
|
||||
-F 'name=profile_pic.jpg' \
|
||||
-F 'size=302185' \
|
||||
-F 'content_type=image/jpeg' \
|
||||
-F 'parent_folder_path=my_files/section1' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
Example Response:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
"upload_url": "https://some-bucket.s3.amazonaws.com/",
|
||||
"upload_params": {
|
||||
"key": "/users/1234/files/profile_pic.jpg",
|
||||
"acl": "private",
|
||||
"Filename": "profile_pic.jpg",
|
||||
"AWSAccessKeyId": "some_id",
|
||||
"Policy": "some_opaque_string",
|
||||
"Signature": "another_opaque_string",
|
||||
"Content-Type": "image/jpeg"
|
||||
}
|
||||
}
|
||||
```json
|
||||
{
|
||||
"upload_url": "https://some-bucket.s3.amazonaws.com/",
|
||||
"upload_params": {
|
||||
"key": "/users/1234/files/profile_pic.jpg",
|
||||
"acl": "private",
|
||||
"Filename": "profile_pic.jpg",
|
||||
"AWSAccessKeyId": "some_id",
|
||||
"Policy": "some_opaque_string",
|
||||
"Signature": "another_opaque_string",
|
||||
"Content-Type": "image/jpeg"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
At this point, the file object has been created in Canvas in a "pending"
|
||||
state, with no content. It will not appear in any listings in the UI until
|
||||
|
@ -91,16 +94,18 @@ last parameter following all the others.
|
|||
|
||||
Example Request:
|
||||
|
||||
curl '<upload_url>' \
|
||||
-F 'key=/users/1234/files/profile_pic.jpg' \
|
||||
-F 'acl=private' \
|
||||
-F 'Filename=profile_pic.jpg' \
|
||||
-F 'AWSAccessKeyId=some_id' \
|
||||
-F 'Policy=some_opaque_string' \
|
||||
-F 'Signature=another_opaque_string' \
|
||||
-F 'Content-Type=image/jpeg' \
|
||||
-F '<any other fields returned in upload_params>' \
|
||||
-F 'file=@my_local_file.jpg'
|
||||
```bash
|
||||
curl '<upload_url>' \
|
||||
-F 'key=/users/1234/files/profile_pic.jpg' \
|
||||
-F 'acl=private' \
|
||||
-F 'Filename=profile_pic.jpg' \
|
||||
-F 'AWSAccessKeyId=some_id' \
|
||||
-F 'Policy=some_opaque_string' \
|
||||
-F 'Signature=another_opaque_string' \
|
||||
-F 'Content-Type=image/jpeg' \
|
||||
-F '<any other fields returned in upload_params>' \
|
||||
-F 'file=@my_local_file.jpg'
|
||||
```
|
||||
|
||||
The access token is not sent with this request.
|
||||
|
||||
|
@ -130,20 +135,23 @@ authentication.
|
|||
|
||||
Example Request:
|
||||
|
||||
curl -X POST '<Location>' \
|
||||
-H 'Content-Length: 0' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```bash
|
||||
curl -X POST '<Location>' \
|
||||
-H 'Content-Length: 0' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
Example Response:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
'id': 1234,
|
||||
'url': '...url to download the file...',
|
||||
'content-type': 'image/jpeg',
|
||||
'display_name': 'profile_pic.jpg',
|
||||
'size': 302185
|
||||
}
|
||||
```json
|
||||
{
|
||||
"id": 1234,
|
||||
"url": "...url to download the file...",
|
||||
"content-type": "image/jpeg",
|
||||
"display_name": "profile_pic.jpg",
|
||||
"size": 302185
|
||||
}
|
||||
```
|
||||
|
||||
<h2 class='api_method_name' name='method.file_uploads.url' data-subtopic="Uploading Files">
|
||||
<a name="method.file_uploads.url" href="#method.file_uploads.url">Uploading via URL</a>
|
||||
|
@ -167,22 +175,25 @@ with the addition of one new parameter:
|
|||
|
||||
Example Request:
|
||||
|
||||
curl 'https://<canvas>/api/v1/users/self/files' \
|
||||
-F 'url=http://example.com/my_pic.jpg' \
|
||||
-F 'name=profile_pic.jpg' \
|
||||
-F 'size=302185' \
|
||||
-F 'content_type=image/jpeg' \
|
||||
-F 'parent_folder_path=my_files/section1' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```bash
|
||||
curl 'https://<canvas>/api/v1/users/self/files' \
|
||||
-F 'url=http://example.com/my_pic.jpg' \
|
||||
-F 'name=profile_pic.jpg' \
|
||||
-F 'size=302185' \
|
||||
-F 'content_type=image/jpeg' \
|
||||
-F 'parent_folder_path=my_files/section1' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
Example Response:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
'id': 1234,
|
||||
'upload_status': 'pending',
|
||||
'status_url' '...url to check status...'
|
||||
}
|
||||
```json
|
||||
{
|
||||
"id": 1234,
|
||||
"upload_status": "pending",
|
||||
"status_url": "...url to check status..."
|
||||
}
|
||||
```
|
||||
|
||||
Canvas will return a status_url parameter, which is a Canvas
|
||||
API endpoint that the application can periodically poll to check on the
|
||||
|
@ -196,35 +207,40 @@ the status_url.
|
|||
|
||||
Example Request:
|
||||
|
||||
curl 'https://<canvas>/api/v1/files/1234/5678/status' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```bash
|
||||
curl 'https://<canvas>/api/v1/files/1234/5678/status' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
When still pending:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
'upload_status': 'pending'
|
||||
}
|
||||
```json
|
||||
{
|
||||
"upload_status": "pending"
|
||||
}
|
||||
```
|
||||
|
||||
When complete:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
'upload_status': 'ready',
|
||||
// This is the normal attachment JSON response object
|
||||
'attachment': {
|
||||
'id': 1234,
|
||||
'url': '...url to download the file...',
|
||||
'content-type': 'image/jpeg',
|
||||
'display_name': 'profile_pic.jpg',
|
||||
'size': 302185
|
||||
}
|
||||
}
|
||||
```json
|
||||
{
|
||||
"upload_status": "ready",
|
||||
// This is the normal attachment JSON response object
|
||||
"attachment": {
|
||||
"id": 1234,
|
||||
"url": "...url to download the file...",
|
||||
"content-type": "image/jpeg",
|
||||
"display_name": "profile_pic.jpg",
|
||||
"size": 302185
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
On error:
|
||||
|
||||
!!!javascript
|
||||
{
|
||||
'upload_status': 'errored',
|
||||
'message': 'Invalid response code, expected 200 got 404'
|
||||
}
|
||||
```json
|
||||
{
|
||||
"upload_status": "errored",
|
||||
"message": "Invalid response code, expected 200 got 404"
|
||||
}
|
||||
```
|
||||
|
|
|
@ -251,6 +251,8 @@ pre.code {
|
|||
padding: 15px;
|
||||
border: 1px solid black;
|
||||
overflow: scroll;
|
||||
background-color: #2A404D;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div.syntaxhighlighter {
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* Pretty printing styles. Used with prettify.js. */
|
||||
/* Vim sunburst theme by David Leibovic */
|
||||
pre .str {
|
||||
color: #65B042;
|
||||
}
|
||||
/* string - green */
|
||||
pre .kwd {
|
||||
color: #E28964;
|
||||
}
|
||||
/* keyword - dark pink */
|
||||
pre .com {
|
||||
color: #AEAEAE;
|
||||
font-style: italic;
|
||||
}
|
||||
/* comment - gray */
|
||||
pre .typ {
|
||||
color: #89bdff;
|
||||
}
|
||||
/* type - light blue */
|
||||
pre .lit {
|
||||
color: #3387CC;
|
||||
}
|
||||
/* literal - blue */
|
||||
pre .pun {
|
||||
color: #fff;
|
||||
}
|
||||
/* punctuation - white */
|
||||
pre .pln {
|
||||
color: #fff;
|
||||
}
|
||||
/* plaintext - white */
|
||||
pre .tag {
|
||||
color: #89bdff;
|
||||
}
|
||||
/* html/xml tag - light blue */
|
||||
pre .atn {
|
||||
color: #bdb76b;
|
||||
}
|
||||
/* html/xml attribute name - khaki */
|
||||
pre .atv {
|
||||
color: #65B042;
|
||||
}
|
||||
/* html/xml attribute value - green */
|
||||
pre .dec {
|
||||
color: #3387CC;
|
||||
}
|
||||
/* decimal - blue */
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
color: #AEAEAE;
|
||||
}
|
||||
/* IE indents via margin-left */
|
||||
li.L0,
|
||||
li.L1,
|
||||
li.L2,
|
||||
li.L3,
|
||||
li.L5,
|
||||
li.L6,
|
||||
li.L7,
|
||||
li.L8 {
|
||||
list-style-type: none;
|
||||
}
|
||||
/* Alternate shading for lines */
|
||||
@media print {
|
||||
pre .str {
|
||||
color: #060;
|
||||
}
|
||||
pre .kwd {
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .com {
|
||||
color: #600;
|
||||
font-style: italic;
|
||||
}
|
||||
pre .typ {
|
||||
color: #404;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .lit {
|
||||
color: #044;
|
||||
}
|
||||
pre .pun {
|
||||
color: #440;
|
||||
}
|
||||
pre .pln {
|
||||
color: #000;
|
||||
}
|
||||
pre .tag {
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre .atn {
|
||||
color: #404;
|
||||
}
|
||||
pre .atv {
|
||||
color: #060;
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
.syntaxhighlighter {
|
||||
background-color: white !important;
|
||||
}
|
||||
.syntaxhighlighter .line.alt1 {
|
||||
background-color: white !important;
|
||||
}
|
||||
.syntaxhighlighter .line.alt2 {
|
||||
background-color: white !important;
|
||||
}
|
||||
.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
|
||||
background-color: #e0e0e0 !important;
|
||||
}
|
||||
.syntaxhighlighter .line.highlighted.number {
|
||||
color: black !important;
|
||||
}
|
||||
.syntaxhighlighter table caption {
|
||||
color: black !important;
|
||||
}
|
||||
.syntaxhighlighter .gutter {
|
||||
color: #afafaf !important;
|
||||
}
|
||||
.syntaxhighlighter .gutter .line {
|
||||
border-right: 3px solid #6ce26c !important;
|
||||
}
|
||||
.syntaxhighlighter .gutter .line.highlighted {
|
||||
background-color: #6ce26c !important;
|
||||
color: white !important;
|
||||
}
|
||||
.syntaxhighlighter.printing .line .content {
|
||||
border: none !important;
|
||||
}
|
||||
.syntaxhighlighter.collapsed {
|
||||
overflow: visible !important;
|
||||
}
|
||||
.syntaxhighlighter.collapsed .toolbar {
|
||||
color: blue !important;
|
||||
background: white !important;
|
||||
border: 1px solid #6ce26c !important;
|
||||
}
|
||||
.syntaxhighlighter.collapsed .toolbar a {
|
||||
color: blue !important;
|
||||
}
|
||||
.syntaxhighlighter.collapsed .toolbar a:hover {
|
||||
color: red !important;
|
||||
}
|
||||
.syntaxhighlighter .toolbar {
|
||||
color: white !important;
|
||||
background: #6ce26c !important;
|
||||
border: none !important;
|
||||
}
|
||||
.syntaxhighlighter .toolbar a {
|
||||
color: white !important;
|
||||
}
|
||||
.syntaxhighlighter .toolbar a:hover {
|
||||
color: black !important;
|
||||
}
|
||||
.syntaxhighlighter .plain, .syntaxhighlighter .plain a {
|
||||
color: black !important;
|
||||
}
|
||||
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
|
||||
color: #008200 !important;
|
||||
}
|
||||
.syntaxhighlighter .string, .syntaxhighlighter .string a {
|
||||
color: blue !important;
|
||||
}
|
||||
.syntaxhighlighter .keyword {
|
||||
color: #006699 !important;
|
||||
}
|
||||
.syntaxhighlighter .preprocessor {
|
||||
color: gray !important;
|
||||
}
|
||||
.syntaxhighlighter .variable {
|
||||
color: #aa7700 !important;
|
||||
}
|
||||
.syntaxhighlighter .value {
|
||||
color: #009900 !important;
|
||||
}
|
||||
.syntaxhighlighter .functions {
|
||||
color: #ff1493 !important;
|
||||
}
|
||||
.syntaxhighlighter .constants {
|
||||
color: #0066cc !important;
|
||||
}
|
||||
.syntaxhighlighter .script {
|
||||
font-weight: bold !important;
|
||||
color: #006699 !important;
|
||||
background-color: none !important;
|
||||
}
|
||||
.syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
|
||||
color: gray !important;
|
||||
}
|
||||
.syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
|
||||
color: #ff1493 !important;
|
||||
}
|
||||
.syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.syntaxhighlighter .keyword {
|
||||
font-weight: bold !important;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
|
||||
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
|
||||
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
|
||||
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
|
||||
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
|
||||
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
|
||||
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
|
||||
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
|
||||
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
|
||||
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d<c.9;d++)i[c[d]]=a}2 o(c){1 a=r.H("J"),d=3;a.K=c;a.M="L/t";a.G="t";a.u=a.v=2(){6(!d&&(!8.7||8.7=="F"||8.7=="z")){d=q;e[c]=q;a:{4(1 p y e)6(e[p]==3)B a;j&&5.C(k)}a.u=a.v=x;a.D.O(a)}};r.N.R(a)}1 f=Q,l=h.P(),i={},e={},j=3,k=x,b;5.T=2(c){k=c;j=q};4(b=0;b<f.9;b++){1 m=f[b].w?f[b]:f[b].S(/\\s+/),g=m.w();n(m,g)}4(b=0;b<l.9;b++)6(g=i[l[b].E.A]){e[g]=3;o(g)}}})();',56,56,'|var|function|false|for|SyntaxHighlighter|if|readyState|this|length|||||||||||||||||true|document||javascript|onload|onreadystatechange|pop|null|in|complete|brush|break|highlight|parentNode|params|loaded|language|createElement|autoloader|script|src|text|type|body|removeChild|findElements|arguments|appendChild|split|all'.split('|'),0,{}))
|
|
@ -1,52 +0,0 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'break case catch continue ' +
|
||||
'default delete do else false ' +
|
||||
'for function if in instanceof ' +
|
||||
'new null return super switch ' +
|
||||
'this throw true try typeof var while with'
|
||||
;
|
||||
|
||||
var r = SyntaxHighlighter.regexLib;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
|
||||
];
|
||||
|
||||
this.forHtmlScript(r.scriptScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['js', 'jscript', 'javascript'];
|
||||
|
||||
SyntaxHighlighter.brushes.JScript = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
File diff suppressed because one or more lines are too long
|
@ -2,8 +2,16 @@
|
|||
<meta charset="UTF-8">
|
||||
<title><%= options[:page_title] %></title>
|
||||
<link rel="stylesheet" href="<%= url_for("css/common.css") %>" type="text/css" media="screen" charset="utf-8" />
|
||||
<link href="<%= url_for("css/shThemeDefault.css") %>" rel="stylesheet" type="text/css" />
|
||||
<script src="<%= url_for("js/shCore.js") %>" type="text/javascript"></script>
|
||||
<link href="<%= url_for("css/prettify.css") %>" rel="stylesheet" type="text/css" media="screen" />
|
||||
<script src="<%= url_for("js/jquery.min.js") %>" type="text/javascript"></script>
|
||||
<script src="<%= url_for("js/shAutoloader.js") %>" type="text/javascript"></script>
|
||||
<script src="<%= url_for("js/shBrushJScript.js") %>" type="text/javascript"></script>
|
||||
<script src="<%= url_for("js/prettify.js") %>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// set up pretty-printing in static docs generated from .md files
|
||||
$('pre.code.bash').addClass('prettyprint language-bash');
|
||||
$('pre.code.html').addClass('prettyprint language-html');
|
||||
$('pre.code.xml').addClass('prettyprint language-xml');
|
||||
$('pre.code.json').addClass('prettyprint language-json');
|
||||
prettyPrint();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -10,12 +10,14 @@ all calls log both the calling user and the target user.
|
|||
To masquerade, add an as_user_id parameter to any request. It can be either a Canvas user ID, or an SIS user ID
|
||||
(as described in <a href="object_ids.html">SIS IDs</a>):
|
||||
|
||||
curl 'https://<canvas>/api/v1/users/self/activity_stream?as_user_id=sis_user_id:brian' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```bash
|
||||
curl 'https://<canvas>/api/v1/users/self/activity_stream?as_user_id=sis_user_id:brian' \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
Masquerading could be useful in a number of use cases:
|
||||
|
||||
* For developing an admin tool
|
||||
* For accessing APIs that can only be called on self (i.e. the activity stream as shown above)
|
||||
* For a portal type application that's already tightly integrated with an SIS and is managed
|
||||
by the school, to avoid going through the OAuth flow for every student
|
||||
by the school, to avoid going through the OAuth flow for every student
|
||||
|
|
|
@ -219,7 +219,9 @@ recommended.
|
|||
|
||||
OAuth2 Token sent in header:
|
||||
|
||||
curl -H "Authorization: Bearer <ACCESS-TOKEN>" https://canvas.instructure.com/api/v1/courses
|
||||
```bash
|
||||
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://canvas.instructure.com/api/v1/courses"
|
||||
```
|
||||
|
||||
Sending the access token in the query string or POST
|
||||
parameters is also supported, but discouraged as it increases the
|
||||
|
@ -227,7 +229,9 @@ chances of the token being logged or leaked in transit.
|
|||
|
||||
OAuth2 Token sent in query string:
|
||||
|
||||
curl https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>
|
||||
```bash
|
||||
curl "https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>"
|
||||
```
|
||||
|
||||
<a name="using-refresh-tokens"></a>
|
||||
## [Using a Refresh Token to get a new Access Token](#using-refresh-tokens)
|
||||
|
|
|
@ -198,8 +198,7 @@ student to be able to log in but just not participate, leave the student
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
user_id,login_id,authentication_provider_id,password,first_name,last_name,short_name,email,status
|
||||
<pre>user_id,login_id,authentication_provider_id,password,first_name,last_name,short_name,email,status
|
||||
01103,bsmith01,,,Bob,Smith,Bobby Smith,bob.smith@myschool.edu,active
|
||||
13834,jdoe03,google,,John,Doe,,john.doe@myschool.edu,active
|
||||
13aa3,psue01,7,,Peggy,Sue,,peggy.sue@myschool.edu,active
|
||||
|
@ -244,8 +243,7 @@ references it.
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
account_id,parent_account_id,name,status
|
||||
<pre>account_id,parent_account_id,name,status
|
||||
A001,,Humanities,active
|
||||
A002,A001,English,active
|
||||
A003,A001,Spanish,active
|
||||
|
@ -291,8 +289,7 @@ interface, this is called the SIS ID.</td>
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
term_id,name,status,start_date,end_date
|
||||
<pre>term_id,name,status,start_date,end_date
|
||||
T001,Winter2011,active,,
|
||||
T002,Spring2011,active,2013-1-03 00:00:00,2013-05-03 00:00:00-06:00
|
||||
T003,Fall2011,active,,
|
||||
|
@ -359,8 +356,7 @@ override the term end date.</p>
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
course_id,short_name,long_name,account_id,term_id,status
|
||||
<pre>course_id,short_name,long_name,account_id,term_id,status
|
||||
E411208,ENG115,English 115: Intro to English,A002,,active
|
||||
R001104,BIO300,"Biology 300: Rocking it, Bio Style",A004,Fall2011,active
|
||||
A110035,ART105,"Art 105: ""Art as a Medium""",A001,,active
|
||||
|
@ -414,8 +410,7 @@ set, it will override the course and term end dates.</p>
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
section_id,course_id,name,status,start_date,end_date
|
||||
<pre>section_id,course_id,name,status,start_date,end_date
|
||||
S001,E411208,Section 1,active,,
|
||||
S002,E411208,Section 2,active,,
|
||||
S003,R001104,Section 1,active,,
|
||||
|
@ -485,8 +480,7 @@ but will not be able to view or participate in the course until the enrollment i
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
course_id,user_id,role,section_id,status
|
||||
<pre>course_id,user_id,role,section_id,status
|
||||
E411208,01103,student,1B,active
|
||||
E411208,13834,student,2A,active
|
||||
E411208,13aa3,teacher,2A,active
|
||||
|
@ -527,8 +521,7 @@ the root account.</td>
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
group_id,account_id,name,status
|
||||
<pre>group_id,account_id,name,status
|
||||
G411208,A001,Group1,available
|
||||
G411208,,Group2,available
|
||||
G411208,,Group3,deleted
|
||||
|
@ -562,8 +555,7 @@ groups_membership.csv
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
group_id,user_id,status
|
||||
<pre>group_id,user_id,status
|
||||
G411208,U001,accepted
|
||||
G411208,U002,accepted
|
||||
G411208,U003,deleted
|
||||
|
@ -605,8 +597,7 @@ provide more information about the cross-listed course, please do so in courses.
|
|||
|
||||
Sample:
|
||||
|
||||
<pre>
|
||||
xlist_course_id,section_id,status
|
||||
<pre>xlist_course_id,section_id,status
|
||||
E411208,1B,active
|
||||
E411208,2A,active
|
||||
E411208,2A,active
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<h4>Example Request:</h4>
|
||||
<% object.tags(:example_request).each do |tag| %>
|
||||
<h4><%= htmlify_line(tag.name) %></h4>
|
||||
<pre class="example code"><%= html_syntax_highlight(tag.text, :plain) %></pre>
|
||||
<pre class="example code prettyprint"><code class="language-bash"><%= h tag.text.lstrip %></code></pre>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<h4>Example Response:</h4>
|
||||
<% object.tags(:example_response).each do |tag| %>
|
||||
<h4><%= htmlify_line(tag.name) %></h4>
|
||||
<pre class="example code brush:js"><%= html_syntax_highlight(tag.text, :plain) %></pre>
|
||||
<pre class="example code prettyprint"><code class="language-json"><%= h tag.text.lstrip %></code></pre>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,26 +23,26 @@ Instructions
|
|||
|
||||
Here is an example of the minimum JSON that would log 3 minutes of activity for `http://example.com`:
|
||||
|
||||
<pre>
|
||||
```json
|
||||
{
|
||||
id: "12345678-1234-5678-1234-567812345678",
|
||||
actor: {
|
||||
account: {
|
||||
homePage: "http://www.instructure.com/",
|
||||
name: "unique_name_for_user_of_some_kind_maybe_lti_user_id"
|
||||
"id": "12345678-1234-5678-1234-567812345678",
|
||||
"actor": {
|
||||
"account": {
|
||||
"homePage": "http://www.instructure.com/",
|
||||
"name": "unique_name_for_user_of_some_kind_maybe_lti_user_id"
|
||||
}
|
||||
},
|
||||
verb: {
|
||||
id: "http://adlnet.gov/expapi/verbs/interacted",
|
||||
display: {
|
||||
"en-US" => "interacted"
|
||||
"verb": {
|
||||
"id": "http://adlnet.gov/expapi/verbs/interacted",
|
||||
"display": {
|
||||
"en-US": "interacted"
|
||||
}
|
||||
},
|
||||
object: {
|
||||
id: "http://example.com/"
|
||||
"object": {
|
||||
"id": "http://example.com/"
|
||||
},
|
||||
result: {
|
||||
duration: "PT3M0S"
|
||||
"result": {
|
||||
"duration": "PT3M0S"
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue