Skip to content

Commit

Permalink
Update toc in front-matter
Browse files Browse the repository at this point in the history
Previously, there were multiple ways for a page to have a toc.
Now, the only way is if `toc: true` is in the front-matter.

This PR makes this change and adds the script that was used
to do so.
  • Loading branch information
jseldess committed Jul 11, 2018
1 parent a2d2d8c commit 84e2044
Show file tree
Hide file tree
Showing 852 changed files with 864 additions and 1,696 deletions.
20 changes: 20 additions & 0 deletions scripts/front-matter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from os import listdir
from os.path import isfile, join

directories = ["../v1.0/", "../v1.1/", "../v1.1/architecture/", "../v1.1/training/", "../v2.0/", "../v2.0/architecture/", "../v2.0/training/", "../v2.1/", "../v2.1/architecture/", "../v2.1/training/"]

for d in directories:
onlyfiles = [f for f in listdir(d) if isfile(join(d, f))]
for file in onlyfiles:
filename = d + file
with open(filename, "r+") as f:
source = f.readlines()
if '<div id="toc"></div>\n' in source:
os.remove(filename)
new_file = open(filename, "a")
for line in source:
if line == "toc: false\n":
new_file.write("toc: true\n")
elif line != '<div id="toc"></div>\n':
new_file.write(line)
3 changes: 1 addition & 2 deletions v1.0/add-column.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: ADD COLUMN
summary: Use the ADD COLUMN statement to add columns to tables.
toc: false
toc: true
---

The `ADD COLUMN` [statement](sql-statements.html) is part of `ALTER TABLE` and adds columns to tables.

<div id="toc"></div>

## Synopsis

Expand Down
3 changes: 1 addition & 2 deletions v1.0/add-constraint.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ADD CONSTRAINT
summary: Use the ADD CONSTRAINT statement to add constraints to columns.
toc: false
toc: true
---

The `ADD CONSTRAINT` [statement](sql-statements.html) is part of `ALTER TABLE` and can add the following [constraints](constraints.html) to columns:
Expand All @@ -13,7 +13,6 @@ The `ADD CONSTRAINT` [statement](sql-statements.html) is part of `ALTER TABLE` a
{{site.data.alerts.callout_info}}
The <a href="primary-key.html">Primary Key</a> and <a href="not-null.html">Not Null</a> constraints can only be applied through <a href="create-table.html"><code>CREATE TABLE</code></a>. The <a href="default-value.html">Default</a> constraint is managed through <a href="alter-column.html"><code>ALTER COLUMN</code>.</a>{{site.data.alerts.end}}

<div id="toc"></div>

## Synopsis

Expand Down
3 changes: 1 addition & 2 deletions v1.0/alter-column.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: ALTER COLUMN
summary: Use the ALTER COLUMN statement to change a column's Default constraint.
toc: false
toc: true
---

The `ALTER COLUMN` [statement](sql-statements.html) is part of `ALTER TABLE` and changes a column's [Default constraint](default-value.html) or drops the [Not Null constraint](not-null.html).

{{site.data.alerts.callout_info}}To manage other constraints, see <a href="add-constraint.html"><code>ADD CONSTRAINT</code></a> and <a href="drop-constraint.html"><code>DROP CONSTRAINT</code></a>{{site.data.alerts.end}}

<div id="toc"></div>

## Synopsis

Expand Down
3 changes: 1 addition & 2 deletions v1.0/alter-view.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: ALTER VIEW
summary: The ALTER VIEW statement changes the name of a view.
toc: false
toc: true
---

The `ALTER VIEW` [statement](sql-statements.html) changes the name of a [view](views.html).

{{site.data.alerts.callout_info}}It is not currently possible to change the <code>SELECT</code> statement executed by a view. Instead, you must drop the existing view and create a new view. Also, it is not currently possible to rename a view that other views depend on, but this ability may be added in the future (see <a href="https://github.com/cockroachdb/cockroach/issues/10083">this issue</a>).{{site.data.alerts.end}}

<div id="toc"></div>

## Required Privileges

Expand Down
3 changes: 1 addition & 2 deletions v1.0/backup.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: BACKUP
summary: Back up your CockroachDB cluster to a cloud storage services such as AWS S3, Google Cloud Storage, or other NFS.
toc: false
toc: true
---

{{site.data.alerts.callout_danger}}The <code>BACKUP</code> feature is only available to <a href="https://www.cockroachlabs.com/pricing/">enterprise license</a> users. For non-enterprise backups, see <a href="sql-dump.html"><code>cockroach dump</code></a>.{{site.data.alerts.end}}
Expand All @@ -10,7 +10,6 @@ CockroachDB's `BACKUP` [statement](sql-statements.html) creates full or incremen

Because CockroachDB is designed with high fault tolerance, these backups are designed primarily for disaster recovery (i.e., if your cluster loses a majority of its nodes) through [`RESTORE`](restore.html). Isolated issues (such as small-scale node outages) do not require any intervention.

<div id="toc"></div>

## Functional Details

Expand Down
3 changes: 1 addition & 2 deletions v1.0/begin-transaction.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: BEGIN
summary: Initiate a SQL transaction with the BEGIN statement in CockroachDB.
toc: false
toc: true
---

The `BEGIN` [statement](sql-statements.html) initiates a [transaction](transactions.html), which either successfully executes all of the statements it contains or none at all.

{{site.data.alerts.callout_danger}}When using transactions, your application should include logic to <a href="transactions.html#transaction-retries">retry transactions</a> that are aborted to break a dependency cycle between concurrent transactions.{{site.data.alerts.end}}

<div id="toc"></div>

## Synopsis

Expand Down
3 changes: 1 addition & 2 deletions v1.0/bool.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: BOOL
summary: The BOOL data type stores Boolean values of false or true.
toc: false
toc: true
---

The `BOOL` [data type](data-types.html) stores a Boolean value of `false` or `true`.

<div id="toc"></div>

## Aliases

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-c++-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
title: Build a C++ App with CockroachDB
summary: Learn how to use CockroachDB from a simple C++ application with a low-level client driver.
toc: false
toc: true
twitter: false
---

This tutorial shows you how build a simple C++ application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the [C++ libpqxx driver](https://github.com/jtv/libpqxx), so that driver is featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-clojure-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
title: Build a Clojure App with CockroachDB
summary: Learn how to use CockroachDB from a simple Clojure application with a low-level client driver.
toc: false
toc: true
twitter: false
---

This tutorial shows you how build a simple Clojure application with CockroachDB using [leiningen](https://leiningen.org/) and a PostgreSQL-compatible driver. We've tested and can recommend the [Clojure java.jdbc driver](http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html) in conjunction with the [PostgreSQL JDBC driver](https://jdbc.postgresql.org/), so that driver is featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-go-app-with-cockroachdb-gorm.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Go App with CockroachDB
summary: Learn how to use CockroachDB from a simple Go application with the GORM ORM.
toc: false
toc: true
twitter: false
---

Expand All @@ -14,7 +14,6 @@ This tutorial shows you how build a simple Go application with CockroachDB using

{{site.data.alerts.callout_success}}For a more realistic use of GORM with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-go-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Go App with CockroachDB
summary: Learn how to use CockroachDB from a simple Go application with the Go pq driver.
toc: false
toc: true
twitter: false
---

Expand All @@ -12,7 +12,6 @@ twitter: false

This tutorial shows you how build a simple Go application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Go pq driver](https://godoc.org/github.com/lib/pq) and the [GORM ORM](http://jinzhu.me/gorm/), so those are featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-java-app-with-cockroachdb-hibernate.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Java App with CockroachDB
summary: Learn how to use CockroachDB from a simple Java application with the Hibernate ORM.
toc: false
toc: true
twitter: false
---

Expand All @@ -14,7 +14,6 @@ This tutorial shows you how build a simple Java application with CockroachDB usi

{{site.data.alerts.callout_success}}For a more realistic use of Hibernate with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-java-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Java App with CockroachDB
summary: Learn how to use CockroachDB from a simple Java application with the jdbc driver.
toc: false
toc: true
twitter: false
---

Expand All @@ -12,7 +12,6 @@ twitter: false

This tutorial shows you how build a simple Java application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Java jdbc driver](https://jdbc.postgresql.org/) and the [Hibernate ORM](http://hibernate.org/), so those are featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-nodejs-app-with-cockroachdb-sequelize.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Node.js App with CockroachDB
summary: Learn how to use CockroachDB from a simple Node.js application with the Sequelize ORM.
toc: false
toc: true
twitter: false
---

Expand All @@ -14,7 +14,6 @@ This tutorial shows you how build a simple Node.js application with CockroachDB

{{site.data.alerts.callout_success}}For a more realistic use of Sequelize with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-nodejs-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Node.js App with CockroachDB
summary: Learn how to use CockroachDB from a simple Node.js application with the Node.js pg driver.
toc: false
toc: true
twitter: false
---

Expand All @@ -12,7 +12,6 @@ twitter: false

This tutorial shows you how build a simple Node.js application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Node.js pg driver](https://www.npmjs.com/package/pg) and the [Sequelize ORM](http://docs.sequelizejs.com/en/v3/), so those are featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-php-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
title: Build a PHP App with CockroachDB
summary: Learn how to use CockroachDB from a simple PHP application with a low-level client driver.
toc: false
toc: true
twitter: false
---

This tutorial shows you how build a simple PHP application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the [php-pgsql driver](http://php.net/manual/en/book.pgsql.php), so that driver is featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-python-app-with-cockroachdb-sqlalchemy.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Python App with CockroachDB
summary: Learn how to use CockroachDB from a simple Python application with the SQLAlchemy ORM.
toc: false
toc: true
twitter: false
---

Expand All @@ -14,7 +14,6 @@ This tutorial shows you how build a simple Python application with CockroachDB u

{{site.data.alerts.callout_success}}For a more realistic use of SQLAlchemy with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-python-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Python App with CockroachDB
summary: Learn how to use CockroachDB from a simple Python application with the psycopg2 driver.
toc: false
toc: true
asciicast: true
twitter: false
---
Expand All @@ -13,7 +13,6 @@ twitter: false

This tutorial shows you how build a simple Python application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Python psycopg2 driver](http://initd.org/psycopg/docs/) and the [SQLAlchemy ORM](https://docs.sqlalchemy.org/en/latest/), so those are featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-ruby-app-with-cockroachdb-activerecord.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Ruby App with CockroachDB
summary: Learn how to use CockroachDB from a simple Ruby application with the ActiveRecord ORM.
toc: false
toc: true
twitter: false
---

Expand All @@ -14,7 +14,6 @@ This tutorial shows you how build a simple Ruby application with CockroachDB usi

{{site.data.alerts.callout_success}}For a more realistic use of ActiveRecord with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-ruby-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build a Ruby App with CockroachDB
summary: Learn how to use CockroachDB from a simple Ruby application with the pg client driver.
toc: false
toc: true
twitter: false
---

Expand All @@ -12,7 +12,6 @@ twitter: false

This tutorial shows you how build a simple Ruby application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Ruby pg driver](https://rubygems.org/gems/pg) and the [ActiveRecord ORM](http://guides.rubyonrails.org/active_record_basics.html), so those are featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/build-a-rust-app-with-cockroachdb.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
title: Build a Rust App with CockroachDB
summary: Learn how to use CockroachDB from a simple Rust application with a low-level client driver.
toc: false
toc: true
twitter: false
---

This tutorial shows you how build a simple Rust application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the <a href="https://crates.io/crates/postgres/" data-proofer-ignore>Rust postgres driver</a>, so that driver is featured here.

<div id="toc"></div>

## Before You Begin

Expand Down
3 changes: 1 addition & 2 deletions v1.0/bytes.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: BYTES
summary: The BYTES data type stores binary strings of variable length.
toc: false
toc: true
---

The `BYTES` [data type](data-types.html) stores binary strings of variable length.

<div id="toc"></div>

## Aliases

Expand Down
3 changes: 1 addition & 2 deletions v1.0/check.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: CHECK Constraint
summary: The CHECK constraint specifies that values for the column in INSERT or UPDATE statements must satisfy a Boolean expression.
toc: false
toc: true
---

The `CHECK` [constraint](constraints.html) specifies that values for the column in [`INSERT`](insert.html) or [`UPDATE`](update.html) statements must return `TRUE` or `NULL` for a Boolean expression. If any values return `FALSE`, the entire statement is rejected.

<div id="toc"></div>

## Details

Expand Down
Loading

0 comments on commit 84e2044

Please sign in to comment.