Skip to content

Commit

Permalink
docs/js: Split the documentation between the Python and JavaScript APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tavian Barnes committed Aug 20, 2019
1 parent ca91e97 commit e153f70
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 14 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
pip install -r ./docs/requirements.txt
pip install pytest-azurepipelines
npm --prefix ./js install
npm --prefix ./docs install
displayName: 'Install dependencies'

- script: |
Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ __pycache__/

# Sphinx documentation
_build/

# Dependency directories
node_modules/
5 changes: 5 additions & 0 deletions docs/JavaScript/Alignment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Alignment
=========

.. js:autoclass:: Alignment
:members:
5 changes: 5 additions & 0 deletions docs/JavaScript/BiString.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BiString
========

.. js:autoclass:: BiString
:members:
5 changes: 5 additions & 0 deletions docs/JavaScript/BiStringBuilder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BiStringBuilder
===============

.. js:autoclass:: BiStringBuilder
:members:
8 changes: 8 additions & 0 deletions docs/JavaScript/Tokenization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Tokenization
============

.. js:autoclass:: Token
:members:

.. js:autoclass:: Tokenization
:members:
11 changes: 11 additions & 0 deletions docs/JavaScript/Tokenizer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Tokenizer
=========

.. js:autoclass:: Tokenizer
:members:

.. js:autoclass:: RegExpTokenizer
:members:

.. js:autoclass:: SplittingTokenizer
:members:
10 changes: 10 additions & 0 deletions docs/JavaScript/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
JavaScript
==========

.. toctree::

BiString
BiStringBuilder
Alignment
Tokenization
Tokenizer
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/Python/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Python
======

.. toctree::

bistr
BistrBuilder
Alignment
Tokenization
Tokenizer

35 changes: 30 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
from pathlib import Path


# -- Project information -----------------------------------------------------
Expand All @@ -38,6 +37,7 @@
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints',
'sphinx_js',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -46,12 +46,23 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = [
'node_modules',
'_build',
'Thumbs.db',
'.DS_Store',
]


# -- Intersphinx configuration -----------------------------------------------

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}


# -- Autodoc configuration ---------------------------------------------------

autoclass_content = 'both'

autodoc_default_options = {
Expand All @@ -64,6 +75,20 @@
autodoc_inherit_docstrings = False


# -- sphinx-js configuration -------------------------------------------------

npm_bin = str((Path(__file__).parent/'node_modules/.bin').resolve())
os.environ["PATH"] = npm_bin + ":" + os.environ["PATH"]

js_language = 'typescript'

js_source_path = '../js/src'

jsdoc_config_path = '../js/tsconfig.json'

root_for_relative_js_paths = '..'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
15 changes: 6 additions & 9 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ The bistring library provides non-destructive versions of common string processi
Each bistring remembers the original string, and how its substrings map to substrings of the modified version.

.. toctree::
:maxdepth: 2
:caption: Contents:
:maxdepth: 2
:caption: Contents:

Introduction
FAQ
bistr
BistrBuilder
Alignment
Tokenization
Tokenizer
Introduction
FAQ
Python/index
JavaScript/index


Indices and tables
Expand Down
Loading

0 comments on commit e153f70

Please sign in to comment.