Add table of contents to docs

This commit is contained in:
Chris Clark
2015-11-19 10:37:08 -08:00
parent f7f2de291f
commit 5fb8d9214f
6 changed files with 73 additions and 8 deletions

View File

@@ -28,6 +28,10 @@ Then see the [documentation](https://github.com/ripple/ripple-lib/blob/develop/d
2. `cd` into the repository and install dependencies with `npm install`
3. `npm test` or `npm test --coverage` (`istanbul` will create coverage reports in coverage/lcov-report/`)
##Generating Documentation
The continuous integration tests require that the documentation stays up-to-date. If you make changes the the JSON schemas, fixtures, or documentation sources, you must update the documentation by running `npm run docgen`.
##More Information
+ [Ripple Dev Portal](https://ripple.com/build/)

View File

@@ -1,5 +1,62 @@
RippleAPI Reference
-------------------
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# RippleAPI Reference
- [Introduction](#introduction)
- [Boilerplate](#boilerplate)
- [Basic Types](#basic-types)
- [Ripple Address](#ripple-address)
- [Account Sequence Number](#account-sequence-number)
- [Currency](#currency)
- [Value](#value)
- [Amount](#amount)
- [Transaction Overview](#transaction-overview)
- [Transaction Types](#transaction-types)
- [Transaction Flow](#transaction-flow)
- [Transaction Fees](#transaction-fees)
- [Transaction Instructions](#transaction-instructions)
- [Transaction ID](#transaction-id)
- [Transaction Specifications](#transaction-specifications)
- [Payment](#payment)
- [Trustline](#trustline)
- [Order](#order)
- [Order Cancellation](#order-cancellation)
- [Settings](#settings)
- [Suspended Payment Creation](#suspended-payment-creation)
- [Suspended Payment Cancellation](#suspended-payment-cancellation)
- [Suspended Payment Execution](#suspended-payment-execution)
- [API Methods](#api-methods)
- [connect](#connect)
- [disconnect](#disconnect)
- [isConnected](#isconnected)
- [getServerInfo](#getserverinfo)
- [getFee](#getfee)
- [getLedgerVersion](#getledgerversion)
- [getTransaction](#gettransaction)
- [getTransactions](#gettransactions)
- [getTrustlines](#gettrustlines)
- [getBalances](#getbalances)
- [getBalanceSheet](#getbalancesheet)
- [getPaths](#getpaths)
- [getOrders](#getorders)
- [getOrderbook](#getorderbook)
- [getSettings](#getsettings)
- [getAccountInfo](#getaccountinfo)
- [getLedger](#getledger)
- [preparePayment](#preparepayment)
- [prepareTrustline](#preparetrustline)
- [prepareOrder](#prepareorder)
- [prepareOrderCancellation](#prepareordercancellation)
- [prepareSettings](#preparesettings)
- [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
- [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
- [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
- [sign](#sign)
- [submit](#submit)
- [generateAddress](#generateaddress)
- [computeLedgerHash](#computeledgerhash)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Introduction

View File

@@ -1,6 +1,3 @@
RippleAPI Reference
-------------------
<% include introduction.md.ejs %>
<% include boilerplate.md.ejs %>
<% include basictypes.md.ejs %>

View File

@@ -34,6 +34,7 @@
"babel-eslint": "^4.1.3",
"babel-loader": "^5.3.2",
"coveralls": "~2.10.0",
"doctoc": "^0.15.0",
"ejs": "^2.3.4",
"eslint": "^1.3.0",
"eslint-plugin-flowtype": "^1.0.0",
@@ -52,6 +53,8 @@
},
"scripts": {
"build": "gulp",
"doctoc": "doctoc docs/index.md --title '# RippleAPI Reference' --github --maxlevel 2",
"docgen": "node --harmony scripts/build_docs.js",
"clean": "rm -rf dist/npm && rm -rf build/flow",
"typecheck": "babel --optional runtime --blacklist flow -d build/flow/ src/ && flow check",
"compile": "babel -D --optional runtime -d dist/npm/ src/",

View File

@@ -1,6 +1,7 @@
'use strict';
const fs = require('fs');
const path = require('path');
const execSync = require('child_process').execSync;
const ejs = require('ejs');
const renderFromPaths =
require('json-schema-to-markdown-table').renderFromPaths;
@@ -39,9 +40,9 @@ function main() {
console.error(error);
process.exit(1);
} else {
const outputPath = process.argv.length > 2 ? process.argv[2] :
path.join(ROOT, 'docs', 'index.md');
const outputPath = path.join(ROOT, 'docs', 'index.md');
fs.writeFileSync(outputPath, output);
execSync('npm run doctoc', {cwd: ROOT});
process.exit(0);
}
});

View File

@@ -37,7 +37,10 @@ integrationtest() {
}
doctest() {
node --harmony scripts/build_docs.js docs/index.md.test
mv docs/index.md docs/index.md.save
npm run docgen
mv docs/index.md docs/index.md.test
mv docs/index.md.save docs/index.md
cmp docs/index.md docs/index.md.test
rm docs/index.md.test
}