diff options
Diffstat (limited to 'third_party/highway/docs')
-rw-r--r-- | third_party/highway/docs/.gitignore | 3 | ||||
-rw-r--r-- | third_party/highway/docs/Makefile | 20 | ||||
-rw-r--r-- | third_party/highway/docs/_static/css/dark.css | 622 | ||||
-rw-r--r-- | third_party/highway/docs/_static/css/toggle.css | 77 | ||||
-rw-r--r-- | third_party/highway/docs/_static/js/toggle.js | 38 | ||||
-rw-r--r-- | third_party/highway/docs/_templates/layout.html | 9 | ||||
-rw-r--r-- | third_party/highway/docs/_templates/versions.html | 62 | ||||
-rw-r--r-- | third_party/highway/docs/buildDocs.sh | 156 | ||||
-rw-r--r-- | third_party/highway/docs/conf.py | 159 | ||||
-rw-r--r-- | third_party/highway/docs/images/logo-32x32.ico | bin | 0 -> 15406 bytes | |||
-rw-r--r-- | third_party/highway/docs/images/logo.png | bin | 0 -> 54853 bytes | |||
-rw-r--r-- | third_party/highway/docs/index.rst | 13 | ||||
-rw-r--r-- | third_party/highway/docs/locales/zh/index.rst | 6 | ||||
-rw-r--r-- | third_party/highway/docs/make.bat | 35 | ||||
-rw-r--r-- | third_party/highway/docs/mm-converter.py | 108 |
15 files changed, 1308 insertions, 0 deletions
diff --git a/third_party/highway/docs/.gitignore b/third_party/highway/docs/.gitignore new file mode 100644 index 0000000000..e87b171c2d --- /dev/null +++ b/third_party/highway/docs/.gitignore @@ -0,0 +1,3 @@ +*.swp +/_build +/doctrees diff --git a/third_party/highway/docs/Makefile b/third_party/highway/docs/Makefile new file mode 100644 index 0000000000..d4bb2cbb9e --- /dev/null +++ b/third_party/highway/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/third_party/highway/docs/_static/css/dark.css b/third_party/highway/docs/_static/css/dark.css new file mode 100644 index 0000000000..da2235b5b0 --- /dev/null +++ b/third_party/highway/docs/_static/css/dark.css @@ -0,0 +1,622 @@ +/* links */ + +a, +a:visited { + color: #aaddff; +} + + +/* code directives */ + +.method dt, +.class dt, +.data dt, +.attribute dt, +.function dt, +.classmethod dt, +.exception dt, +.descclassname, +.descname { + background-color: #2d2d2d !important; +} + +.rst-content dl:not(.docutils) dt { + color: #aaddff; + background-color: #2d2d2d; + border-top: solid 3px #525252; + border-left: solid 3px #525252; +} + +em.property { + color: #888888; +} + + +/* tables */ + +.rst-content table.docutils thead { + color: #ddd; +} + +.rst-content table.docutils td { + border: 0px; +} + +.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td { + background-color: #5a5a5a; +} + + +/* inlined code highlights */ + +.xref, +.py-meth, +.rst-content a code { + color: #aaddff !important; + font-weight: normal !important; +} + +.rst-content code { + color: #eee !important; + font-weight: normal !important; +} + +code.literal { + background-color: #2d2d2d !important; + border: 1px solid #6d6d6d !important; +} + +code.docutils.literal.notranslate { + color: #ddd; +} + + +/* notes, warnings, hints */ + +.hint .admonition-title { + background: #2aa87c !important; +} + +.warning .admonition-title { + background: #cc4444 !important; +} + +.admonition-title { + background: #3a7ca8 !important; +} + +.admonition, +.note { + background-color: #2d2d2d !important; +} + + +/* table of contents */ + +.wy-nav-content-wrap { + background-color: rgba(0, 0, 0, 0.6) !important; +} + +.sidebar { + background-color: #191919 !important; +} + +.sidebar-title { + background-color: #2b2b2b !important; +} + +.wy-menu-vertical a { + color: #ddd; +} + +.wy-menu-vertical code.docutils.literal.notranslate { + color: #404040; + background: none !important; + border: none !important; +} + +.wy-nav-content { + background: #3c3c3c; + color: #dddddd; +} + +.wy-menu-vertical li.on a, +.wy-menu-vertical li.current>a { + background: #a3a3a3; + border-bottom: 0px !important; + border-top: 0px !important; +} + +.wy-menu-vertical li.current { + background: #b3b3b3; +} + +.toc-backref { + color: grey !important; +} + +.highlight .hll { + background-color: #49483e +} + +.highlight { + background: #222; + color: #f8f8f2 +} + +.highlight .c { + color: #888 +} + + +/* Comment */ + +.highlight .err { + color: #960050; + background-color: #1e0010 +} + + +/* Error */ + +.highlight .k { + color: #66d9ef +} + + +/* Keyword */ + +.highlight .l { + color: #ae81ff +} + + +/* Literal */ + +.highlight .n { + color: #f8f8f2 +} + + +/* Name */ + +.highlight .o { + color: #f92672 +} + + +/* Operator */ + +.highlight .p { + color: #f8f8f2 +} + + +/* Punctuation */ + +.highlight .ch { + color: #888 +} + + +/* Comment.Hashbang */ + +.highlight .cm { + color: #888 +} + + +/* Comment.Multiline */ + +.highlight .cp { + color: #888 +} + + +/* Comment.Preproc */ + +.highlight .cpf { + color: #888 +} + + +/* Comment.PreprocFile */ + +.highlight .c1 { + color: #888 +} + + +/* Comment.Single */ + +.highlight .cs { + color: #888 +} + + +/* Comment.Special */ + +.highlight .gd { + color: #f92672 +} + + +/* Generic.Deleted */ + +.highlight .ge { + font-style: italic +} + + +/* Generic.Emph */ + +.highlight .gi { + color: #a6e22e +} + + +/* Generic.Inserted */ + +.highlight .gs { + font-weight: bold +} + + +/* Generic.Strong */ + +.highlight .gu { + color: #888 +} + + +/* Generic.Subheading */ + +.highlight .kc { + color: #66d9ef +} + + +/* Keyword.Constant */ + +.highlight .kd { + color: #66d9ef +} + + +/* Keyword.Declaration */ + +.highlight .kn { + color: #f92672 +} + + +/* Keyword.Namespace */ + +.highlight .kp { + color: #66d9ef +} + + +/* Keyword.Pseudo */ + +.highlight .kr { + color: #66d9ef +} + + +/* Keyword.Reserved */ + +.highlight .kt { + color: #66d9ef +} + + +/* Keyword.Type */ + +.highlight .ld { + color: #e6db74 +} + + +/* Literal.Date */ + +.highlight .m { + color: #ae81ff +} + + +/* Literal.Number */ + +.highlight .s { + color: #e6db74 +} + + +/* Literal.String */ + +.highlight .na { + color: #a6e22e +} + + +/* Name.Attribute */ + +.highlight .nb { + color: #f8f8f2 +} + + +/* Name.Builtin */ + +.highlight .nc { + color: #a6e22e +} + + +/* Name.Class */ + +.highlight .no { + color: #66d9ef +} + + +/* Name.Constant */ + +.highlight .nd { + color: #a6e22e +} + + +/* Name.Decorator */ + +.highlight .ni { + color: #f8f8f2 +} + + +/* Name.Entity */ + +.highlight .ne { + color: #a6e22e +} + + +/* Name.Exception */ + +.highlight .nf { + color: #a6e22e +} + + +/* Name.Function */ + +.highlight .nl { + color: #f8f8f2 +} + + +/* Name.Label */ + +.highlight .nn { + color: #f8f8f2 +} + + +/* Name.Namespace */ + +.highlight .nx { + color: #a6e22e +} + + +/* Name.Other */ + +.highlight .py { + color: #f8f8f2 +} + + +/* Name.Property */ + +.highlight .nt { + color: #f92672 +} + + +/* Name.Tag */ + +.highlight .nv { + color: #f8f8f2 +} + + +/* Name.Variable */ + +.highlight .ow { + color: #f92672 +} + + +/* Operator.Word */ + +.highlight .w { + color: #f8f8f2 +} + + +/* Text.Whitespace */ + +.highlight .mb { + color: #ae81ff +} + + +/* Literal.Number.Bin */ + +.highlight .mf { + color: #ae81ff +} + + +/* Literal.Number.Float */ + +.highlight .mh { + color: #ae81ff +} + + +/* Literal.Number.Hex */ + +.highlight .mi { + color: #ae81ff +} + + +/* Literal.Number.Integer */ + +.highlight .mo { + color: #ae81ff +} + + +/* Literal.Number.Oct */ + +.highlight .sa { + color: #e6db74 +} + + +/* Literal.String.Affix */ + +.highlight .sb { + color: #e6db74 +} + + +/* Literal.String.Backtick */ + +.highlight .sc { + color: #e6db74 +} + + +/* Literal.String.Char */ + +.highlight .dl { + color: #e6db74 +} + + +/* Literal.String.Delimiter */ + +.highlight .sd { + color: #e6db74 +} + + +/* Literal.String.Doc */ + +.highlight .s2 { + color: #e6db74 +} + + +/* Literal.String.Double */ + +.highlight .se { + color: #ae81ff +} + + +/* Literal.String.Escape */ + +.highlight .sh { + color: #e6db74 +} + + +/* Literal.String.Heredoc */ + +.highlight .si { + color: #e6db74 +} + + +/* Literal.String.Interpol */ + +.highlight .sx { + color: #e6db74 +} + + +/* Literal.String.Other */ + +.highlight .sr { + color: #e6db74 +} + + +/* Literal.String.Regex */ + +.highlight .s1 { + color: #e6db74 +} + + +/* Literal.String.Single */ + +.highlight .ss { + color: #e6db74 +} + + +/* Literal.String.Symbol */ + +.highlight .bp { + color: #f8f8f2 +} + + +/* Name.Builtin.Pseudo */ + +.highlight .fm { + color: #a6e22e +} + + +/* Name.Function.Magic */ + +.highlight .vc { + color: #f8f8f2 +} + + +/* Name.Variable.Class */ + +.highlight .vg { + color: #f8f8f2 +} + + +/* Name.Variable.Global */ + +.highlight .vi { + color: #f8f8f2 +} + + +/* Name.Variable.Instance */ + +.highlight .vm { + color: #f8f8f2 +} + + +/* Name.Variable.Magic */ + +.highlight .il { + color: #ae81ff +} + + +/* Literal.Number.Integer.Long */ diff --git a/third_party/highway/docs/_static/css/toggle.css b/third_party/highway/docs/_static/css/toggle.css new file mode 100644 index 0000000000..f79376af7d --- /dev/null +++ b/third_party/highway/docs/_static/css/toggle.css @@ -0,0 +1,77 @@ +input[type=checkbox] { + visibility: hidden; + height: 0; + width: 0; + margin: 0; +} + +.rst-versions .rst-current-version { + padding: 10px; + display: flex; + justify-content: space-between; +} + +.rst-versions .rst-current-version .fa-book, +.rst-versions .rst-current-version .fa-v, +.rst-versions .rst-current-version .fa-caret-down { + height: 24px; + line-height: 24px; + vertical-align: middle; +} + +.rst-versions .rst-current-version .fa-element { + width: 80px; + text-align: center; +} + +.rst-versions .rst-current-version .fa-book { + text-align: left; +} + +.rst-versions .rst-current-version .fa-v { + color: #27AE60; + text-align: right; +} + +label { + margin: 0 auto; + display: inline-block; + justify-content: center; + align-items: right; + border-radius: 100px; + position: relative; + cursor: pointer; + text-indent: -9999px; + width: 50px; + height: 21px; + background: #000; +} + +label:after { + border-radius: 50%; + position: absolute; + content: ''; + background: #fff; + width: 15px; + height: 15px; + top: 3px; + left: 3px; + transition: ease-in-out 200ms; +} + +input:checked+label { + background: #3a7ca8; +} + +input:checked+label:after { + left: calc(100% - 5px); + transform: translateX(-100%); +} + +html.transition, +html.transition *, +html.transition *:before, +html.transition *:after { + transition: ease-in-out 200ms !important; + transition-delay: 0 !important; +} diff --git a/third_party/highway/docs/_static/js/toggle.js b/third_party/highway/docs/_static/js/toggle.js new file mode 100644 index 0000000000..7cfe613f60 --- /dev/null +++ b/third_party/highway/docs/_static/js/toggle.js @@ -0,0 +1,38 @@ +document.addEventListener('DOMContentLoaded', function() { + + function toggleCssMode(isDay) { + var mode = (isDay ? "Day" : "Night"); + localStorage.setItem("css-mode", mode); + + var daysheet = $('link[href="_static/pygments.css"]')[0].sheet; + daysheet.disabled = !isDay; + + var nightsheet = $('link[href="_static/css/dark.css"]')[0]; + if (!isDay && nightsheet === undefined) { + var element = document.createElement("link"); + element.setAttribute("rel", "stylesheet"); + element.setAttribute("type", "text/css"); + element.setAttribute("href", "_static/css/dark.css"); + document.getElementsByTagName("head")[0].appendChild(element); + return; + } + if (nightsheet !== undefined) { + nightsheet.sheet.disabled = isDay; + } + } + + var initial = localStorage.getItem("css-mode") != "Night"; + var checkbox = document.querySelector('input[name=mode]'); + + toggleCssMode(initial); + checkbox.checked = initial; + + checkbox.addEventListener('change', function() { + document.documentElement.classList.add('transition'); + window.setTimeout(() => { + document.documentElement.classList.remove('transition'); + }, 1000) + toggleCssMode(this.checked); + }) + +}); diff --git a/third_party/highway/docs/_templates/layout.html b/third_party/highway/docs/_templates/layout.html new file mode 100644 index 0000000000..e8f2b7f759 --- /dev/null +++ b/third_party/highway/docs/_templates/layout.html @@ -0,0 +1,9 @@ +{% extends "!layout.html" %} + {% block footer %} {{ super() }} + + <style> + .wy-nav-content { max-width: none; } + </style> + +{% endblock %} + diff --git a/third_party/highway/docs/_templates/versions.html b/third_party/highway/docs/_templates/versions.html new file mode 100644 index 0000000000..e9abbcdafe --- /dev/null +++ b/third_party/highway/docs/_templates/versions.html @@ -0,0 +1,62 @@ +{% if READTHEDOCS or display_lower_left %} +{# Add rst-badge after rst-versions for small badge style. #} + <div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> Read the Docs</span> + + + <span class="fa fa-element"> + <input class="container_toggle" type="checkbox" id="switch" name="mode"> + <label for="switch"></label> + </span> + + v: {{ current_version }} + <span class="fa fa-caret-down"></span> + </span> + <div class="rst-other-versions"> + {% if languages|length >= 1 %} + <dl> + <dt>{{ _('Languages') }}</dt> + {% for slug, url in languages %} + {% if slug == current_language %} <strong> {% endif %} + <dd><a href="{{ url }}">{{ slug }}</a></dd> + {% if slug == current_language %} </strong> {% endif %} + {% endfor %} + </dl> + {% endif %} + {% if versions|length >= 1 %} + <dl> + <dt>{{ _('Versions') }}</dt> + {% for slug, url in versions %} + {% if slug == current_version %} <strong> {% endif %} + <dd><a href="{{ url }}">{{ slug }}</a></dd> + {% if slug == current_version %} </strong> {% endif %} + {% endfor %} + </dl> + {% endif %} + {% if downloads|length >= 1 %} + <dl> + <dt>{{ _('Downloads') }}</dt> + {% for type, url in downloads %} + <dd><a href="{{ url }}">{{ type }}</a></dd> + {% endfor %} + </dl> + {% endif %} + {% if READTHEDOCS %} + <dl> + <dt>{{ _('On Read the Docs') }}</dt> + <dd> + <a href="//{{ PRODUCTION_DOMAIN }}/projects/{{ slug }}/?fromdocs={{ slug }}">{{ _('Project Home') }}</a> + </dd> + <dd> + <a href="//{{ PRODUCTION_DOMAIN }}/builds/{{ slug }}/?fromdocs={{ slug }}">{{ _('Builds') }}</a> + </dd> + </dl> + {% endif %} + <hr/> + {% trans %}Free document hosting provided by <a href="https://pages.github.com/">GitHub Pages</a>.{% endtrans %} + + </div> + </div> +{% endif %} + diff --git a/third_party/highway/docs/buildDocs.sh b/third_party/highway/docs/buildDocs.sh new file mode 100644 index 0000000000..0cd587794a --- /dev/null +++ b/third_party/highway/docs/buildDocs.sh @@ -0,0 +1,156 @@ +#!/bin/bash +set -x +################################################################################ +# File: buildDocs.sh +# Purpose: Script that builds our documentation using sphinx and updates GitHub +# Pages. This script is executed by: +# .github/workflows/docs_pages_workflow.yml +# +# Authors: Michael Altfield <michael@michaelaltfield.net> +# Created: 2020-07-17 +# Updated: 2020-07-23 +# Version: 0.2 +################################################################################ + +################### +# INSTALL DEPENDS # +################### + +apt-get update +apt-get -y install git rsync pandoc python3-sphinx python3-sphinx-rtd-theme python3-stemmer python3-git python3-pip python3-virtualenv python3-setuptools + +python3 -m pip install --upgrade rinohtype pygments sphinx-rtd-theme sphinx-tabs docutils==0.16 pandoc +python3 -m pip list + +# get rid of all these safe dir warnings +git config --global --add safe.directory '*' + +##################### +# DECLARE VARIABLES # +##################### + +pwd +ls -lah +export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) + +# make a new temp dir which will be our GitHub Pages docroot +docroot=`mktemp -d` + +export REPO_NAME="${GITHUB_REPOSITORY##*/}" + +############## +# BUILD DOCS # +############## + +# first, cleanup any old builds' static assets +make -C docs clean + +# get a list of branches, excluding 'HEAD' and 'gh-pages' +versions="`git for-each-ref '--format=%(refname:lstrip=-1)' refs/remotes/origin/ | grep -viE '^(HEAD|gh-pages)$'`" +ls +for current_version in ${versions}; do + + # make the current language available to conf.py + export current_version + git checkout ${current_version} + + echo "INFO: Building sites for ${current_version}" + + cd docs && python3 mm-converter.py + cd .. + + # skip this branch if it doesn't have our docs dir & sphinx config + if [ ! -e 'docs/conf.py' ]; then + echo -e "\tINFO: Couldn't find 'docs/conf.py' (skipped)" + continue + fi + + languages="en" + for current_language in ${languages}; do + + # make the current language available to conf.py + export current_language + + ########## + # BUILDS # + ########## + echo "INFO: Building for ${current_language}" + + # HTML # + sphinx-build -b html docs/ docs/_build/html/${current_language}/${current_version} -D language="${current_language}" + + # EPUB # + sphinx-build -b epub docs/ docs/_build/epub -D language="${current_language}" + mkdir -p "${docroot}/${current_language}/${current_version}" + cp "docs/_build/epub/target.epub" "${docroot}/${current_language}/${current_version}/${REPO_NAME}_${current_language}_${current_version}.epub" + + # copy the static assets produced by the above build into our docroot + rsync -av "docs/_build/html/" "${docroot}/" + + done + +done + +# return to master branch +git checkout master + +####################### +# Update GitHub Pages # +####################### + +git config --global user.name "${GITHUB_ACTOR}" +git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + +pushd "${docroot}" + +# don't bother maintaining history; just generate fresh +git init +git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +git checkout -b gh-pages + +# add .nojekyll to the root so that github won't 404 on content added to dirs +# that start with an underscore (_), such as our "_content" dir.. +touch .nojekyll + +# add redirect from the docroot to our default docs language/version +cat > index.html <<EOF +<!DOCTYPE html> +<html> + <head> + <title>${REPO_NAME} Docs</title> + <meta http-equiv = "refresh" content="0; url='/${REPO_NAME}/en/master/'" /> + </head> + <body> + <p>Please wait while you're redirected to our <a href="/${REPO_NAME}/en/master/">documentation</a>.</p> + </body> +</html> +EOF + +# Add README +cat > README.md <<EOF +# GitHub Pages Cache + +Nothing to see here. The contents of this branch are essentially a cache that's not intended to be viewed on github.com. + + +If you're looking to update documentation, check the relevant development branch's 'docs/' dir. + +For more information on how this documentation is built using Sphinx, Read the Docs, and GitHub Actions/Pages, see: + + * https://tech.michaelaltfield.net/2020/07/18/sphinx-rtd-github-pages-1 +EOF + +# copy the resulting html pages built from sphinx above to our new git repo +git add . + +# commit all the new files +msg="Updating Docs for commit ${GITHUB_SHA} made on `date -d"@${SOURCE_DATE_EPOCH}" --iso-8601=seconds` from ${GITHUB_REF} by ${GITHUB_ACTOR}" +git commit -am "${msg}" + +# overwrite the contents of the gh-pages branch on our github.com repo +git push deploy gh-pages --force + +popd # return to main repo sandbox root + +# exit cleanly +exit 0 diff --git a/third_party/highway/docs/conf.py b/third_party/highway/docs/conf.py new file mode 100644 index 0000000000..9bd21c3ef5 --- /dev/null +++ b/third_party/highway/docs/conf.py @@ -0,0 +1,159 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# 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('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'HIGHWAY' + +# The full version, including alpha/beta/rc tags +release = 'nightly' +copyright = 'Apache 2' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx_rtd_theme', + 'sphinx.ext.githubpages', + 'sphinx.ext.autosectionlabel', + 'sphinx_tabs.tabs', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# 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'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] +html_logo = 'images/logo.png' +html_favicon = 'images/logo-32x32.ico' +html_theme_options = { + 'logo_only': False, + 'display_version': True, +} +# The master toctree document. +master_doc = 'index' + + # Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +html_extra_path = ["_static/css"] + +html_css_files = ["css/toggle.css"] +html_js_files = ["js/toggle.js"] + +############################ +# SETUP THE RTD LOWER-LEFT # +############################ +try: + html_context +except NameError: + html_context = dict() +html_context['display_lower_left'] = True + +if 'REPO_NAME' in os.environ: + REPO_NAME = os.environ['REPO_NAME'] +else: + REPO_NAME = '' + +# SET CURRENT_LANGUAGE +if 'current_language' in os.environ: + # get the current_language env var set by buildDocs.sh + current_language = os.environ['current_language'] +else: + # the user is probably doing `make html` + # set this build's current language to english + current_language = 'en' + +# tell the theme which language to we're currently building +html_context['current_language'] = current_language + +# SET CURRENT_VERSION +from git import Repo +repo = Repo( search_parent_directories=True ) + +if 'current_version' in os.environ: + # get the current_version env var set by buildDocs.sh + current_version = os.environ['current_version'] +else: + # the user is probably doing `make html` + # set this build's current version by looking at the branch + current_version = repo.active_branch.name + +# tell the theme which version we're currently on ('current_version' affects +# the lower-left rtd menu and 'version' affects the logo-area version) +html_context['current_version'] = current_version +html_context['version'] = current_version + +# POPULATE LINKS TO OTHER LANGUAGES +html_context['languages'] = [ ('en', '/' +REPO_NAME+ '/en/' +current_version+ '/') ] + +languages = [lang.name for lang in os.scandir('locales') if lang.is_dir()] +for lang in languages: + html_context['languages'].append( (lang, '/' +REPO_NAME+ '/' +lang+ '/' +current_version+ '/') ) + +# POPULATE LINKS TO OTHER VERSIONS +html_context['versions'] = list() + +versions = [branch.name for branch in repo.branches] +for version in versions: + html_context['versions'].append( (version, '/' +REPO_NAME+ '/' +current_language+ '/' +version+ '/') ) + +# POPULATE LINKS TO OTHER FORMATS/DOWNLOADS + +# settings for creating PDF with rinoh +rinoh_documents = [( + master_doc, + 'target', + project+ ' Documentation', + '© ' +copyright, +)] +today_fmt = "%B %d, %Y" + +# settings for EPUB +epub_basename = 'target' + +html_context['downloads'] = list() + +html_context['downloads'].append( ('epub', '/' +REPO_NAME+ '/' +current_language+ '/' +current_version+ '/' +REPO_NAME+ '_' +current_language+ '_' +current_version+ '.epub') ) + +########################## +# "EDIT ON GITHUB" LINKS # +########################## + +html_context['display_github'] = True +html_context['github_user'] = 'google' +html_context['github_repo'] = REPO_NAME +html_context['github_version'] = 'master/docs/' + diff --git a/third_party/highway/docs/images/logo-32x32.ico b/third_party/highway/docs/images/logo-32x32.ico Binary files differnew file mode 100644 index 0000000000..d834e41063 --- /dev/null +++ b/third_party/highway/docs/images/logo-32x32.ico diff --git a/third_party/highway/docs/images/logo.png b/third_party/highway/docs/images/logo.png Binary files differnew file mode 100644 index 0000000000..76c166cb9d --- /dev/null +++ b/third_party/highway/docs/images/logo.png diff --git a/third_party/highway/docs/index.rst b/third_party/highway/docs/index.rst new file mode 100644 index 0000000000..61036ba06e --- /dev/null +++ b/third_party/highway/docs/index.rst @@ -0,0 +1,13 @@ +Highway, a C++ library that provides portable SIMD/vector intrinsics +==================================================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + README + quick_reference + design_philosophy + faq + impl_details + release_testing_process
\ No newline at end of file diff --git a/third_party/highway/docs/locales/zh/index.rst b/third_party/highway/docs/locales/zh/index.rst new file mode 100644 index 0000000000..c30fb48bbd --- /dev/null +++ b/third_party/highway/docs/locales/zh/index.rst @@ -0,0 +1,6 @@ +Highway, 为C++提供可移植的SIMD原语 +==================================================================== + +.. toctree:: + :maxdepth: 2 + :caption: 我们正在准备中文支持:)
\ No newline at end of file diff --git a/third_party/highway/docs/make.bat b/third_party/highway/docs/make.bat new file mode 100644 index 0000000000..2119f51099 --- /dev/null +++ b/third_party/highway/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=.
+set BUILDDIR=_build
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+
+:end
+popd
diff --git a/third_party/highway/docs/mm-converter.py b/third_party/highway/docs/mm-converter.py new file mode 100644 index 0000000000..3b2f1ddf6a --- /dev/null +++ b/third_party/highway/docs/mm-converter.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 + +# set correct links (pandoc did not deal with github links properly) + +import os +import re +import subprocess + +regex_pdf_links1 = re.compile(r'`(.*)\<g3doc\/(.*)\.pdf\>`__', + re.M | re.X) # Multiline and Verbose +regex_md_links = re.compile(r'`(.*)\<g3doc\/(.*)\.md\>`__', + re.M | re.X) # Multiline and Verbose +regex_md_links2 = re.compile(r'`(.*)\n(.*)\<g3doc\/(.*)\.md\>`__', + re.M | re.X) # Multiline and Verbose +regex_pdf_links2 = re.compile(r'`(.*)\n\s+(.*)\<g3doc\/(.*)\.pdf\>`__', + re.M | re.X) # Multiline and Verbose + +def remove_links_to_index2(data): + # remove liks to the index, they are useless in py4web docs + data = data + print(re.search(regex_pdf_links2, data)) + return re.sub(regex_pdf_links2, + r':download:`\1 \2<g3doc/\3.pdf>`', + data) + +def remove_links_to_index(data): + # remove liks to the index, they are useless in py4web docs + data = data + print(re.search(regex_pdf_links1, data)) + return re.sub(regex_pdf_links1, + r':download:`\1<g3doc/\2.pdf>`', + data) + +def rewrite_md_links(data): + # remove liks to the index, they are useless in py4web docs + data = data + print(re.search(regex_md_links, data)) + data = re.sub(regex_md_links, + r'`\1<\2.html>`__', + data) + data = re.sub(regex_md_links2, + r'`\1 \2<\3.html>`__', + data) + return data + + +docs_on_pages = [ + 'README.md', + 'quick_reference.md', + 'design_philosophy.md', + 'impl_details.md', + 'faq.md', + 'release_testing_process.md' +] + +def convert2md(file): + print(f" Working on file {file}") + file = os.path.join('g3doc', file) + data = open(file, 'r').read() + write_files(file, data) + +def write_files(file, data): + for extension in ['rst']: + ext_dir = os.getcwd() + md_dir = os.path.join(os.getcwd(), 'g3doc') + if not os.path.isdir(ext_dir): + os.mkdir(ext_dir) + ext_file = os.path.join(ext_dir , os.path.splitext(os.path.basename(file))[0] + "." + extension) + md_file = os.path.join(md_dir , os.path.splitext(os.path.basename(file))[0] + ".md") + print(f'writing {ext_file}') + if os.path.exists(ext_file): + os.unlink(ext_file) + with open(ext_file, 'w') as handler: + write_format(extension, ext_file, handler, md_file, data) + + +def write_format(extension, ext_file, handler, md_file, data): + if extension =='md': + handler.write(data) + elif extension =='rst': + try: + subprocess.call(['pandoc', '-s', md_file, '-f', 'markdown', '-t', 'rst', '-o', ext_file]) + data = open(ext_file, 'r').read() + data = remove_links_to_index(data) + data = remove_links_to_index2(data) + data = rewrite_md_links(data) + handler.write(data) + # Open a file for writing + # with open('tmp.txt', 'w') as f: + # Call the subprocess and redirect the output to the file + # subprocess.call(['awk', '{ gsub(/<g3doc\//, "<"); print }', ext_file], stdout=f) + # os.system('mv tmp.txt ' + ext_file) + + except FileNotFoundError: + print("\n **** ERROR ****: you need the Pandoc module installed!") + exit(0) + elif extension =='html': + try: + subprocess.call(['pandoc', '-s', md_file, '-f', 'markdown', '-t', 'html', '-o', ext_file, '--highlight-style=kate']) + except FileNotFoundError: + print("\n **** ERROR ****: you need the Pandoc module installed!") + exit(0) + + +if __name__ == "__main__": + for doc in docs_on_pages: + print(doc) + convert2md(doc) |