diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..013dd2021d --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[report] +show_missing = True diff --git a/.csslintrc b/.csslintrc index 76f68b04c3..24a4db2dc9 100644 --- a/.csslintrc +++ b/.csslintrc @@ -1,6 +1,6 @@ ---exclude-list = mkdocs/themes/mkdocs/css/bootstrap-custom.min.css, +--exclude-list = mkdocs/themes/mkdocs/css/bootstrap.min.css, mkdocs/themes/readthedocs/css/bootstrap-custom.min.css, - mkdocs/themes/mkdocs/css/font-awesome-4.5.0.css, + mkdocs/themes/mkdocs/css/font-awesome.min.css, mkdocs/themes/readthedocs/css/font-awesome-4.5.0.css, mkdocs/themes/mkdocs/css/highlight.css, mkdocs/themes/readthedocs/css/highlight.css, diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..8c0ef430ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.js] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..bf92e55929 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +mkdocs/contrib/search/lunr-language/** linguist-vendored +mkdocs/themes/mkdocs/js/** linguist-vendored +mkdocs/themes/mkdocs/js/base.js linguist-vendored=false +mkdocs/themes/mkdocs/css/** linguist-vendored +mkdocs/themes/mkdocs/css/base.css linguist-vendored=false +mkdocs/themes/readthedocs/js/** linguist-vendored +mkdocs/themes/readthedocs/js/theme.js linguist-vendored=false +mkdocs/themes/readthedocs/css/** linguist-vendored +mkdocs/themes/readthedocs/css/theme_extra.css linguist-vendored=false diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml new file mode 100644 index 0000000000..3cc3f4f8d1 --- /dev/null +++ b/.github/workflows/deploy-release.yml @@ -0,0 +1,33 @@ +name: deploy-release + +on: + push: + tags: + - '*' + +jobs: + + pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel babel + - name: Compile localization message files + run: | + python setup.py compile_catalog -t mkdocs + python setup.py compile_catalog -t readthedocs + - name: Build + run: | + python setup.py bdist_wheel sdist --formats gztar + - name: Publish + if: success() + uses: pypa/gh-action-pypi-publish@v1.4.1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000000..0e25a42080 --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,122 @@ +name: CI + +on: + push: + branches: + - master + tags: + - '**' + pull_request: + branches: + - '**' + +jobs: + test: + strategy: + fail-fast: false + max-parallel: 4 + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + include: + - python-version: 3.6 + tox-env: py36 + - python-version: 3.7 + tox-env: py37 + - python-version: 3.8 + tox-env: py38 + - python-version: 3.9 + tox-env: py39 + - python-version: pypy3 + tox-env: pypy3 + env: + TOXENV: ${{ matrix.tox-env }}-{unittests,min-req,integration,integration-no-babel} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip tox coverage codecov + - name: Run tox + run: | + python -m tox --discover $(which python) + shell: bash + - name: Upload Codecov Results + if: success() + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests + name: ${{ matrix.os }}/${{ matrix.tox-env }} + fail_ci_if_error: false + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip tox + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 14 + - name: Install Node dependencies + run: | + npm install -g markdownlint-cli jshint csslint + - name: Check with flake8 + if: always() + run: python -m tox -e flake8 + - name: Check with markdown-lint + if: always() + run: python -m tox -e markdown-lint + - name: Check with jshint + if: always() + run: python -m tox -e jshint + - name: Check with csslint + if: always() + run: python -m tox -e csslint + - name: Check with codespell + if: always() + run: python -m tox -e codespell + + translation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install Python dependencies + run: | + python -m pip install -r requirements/project.txt + - name: Check if Portable Object Templates should have been updated + run: | + python setup.py extract_messages -t mkdocs + python setup.py extract_messages -t readthedocs + git diff -G "msgid" --exit-code mkdocs/themes/*/*.pot + shell: bash + - id: files + uses: jitterbit/get-changed-files@v1 + - name: Check if Portable Object translation files should be updated on mkdocs version change + run: | + for locale in $(ls mkdocs/themes/mkdocs/locales/); do python setup.py update_catalog -t mkdocs -l ${locale}; done + for locale in $(ls mkdocs/themes/readthedocs/locales/); do python setup.py update_catalog -t readthedocs -l ${locale}; done + for changed_file in ${{ steps.files.outputs.all }}; do + # echo "inspecting changed file: ${changed_file}"; + if [[ "${changed_file}" == "mkdocs/__init__.py" ]]; then + # echo "mkdocs version changed!"; + git diff -G "msgid" --exit-code || exit 1 + git diff -G "msgstr" --exit-code || exit 2 + fi + done + shell: bash diff --git a/.gitignore b/.gitignore index 3ba0914fa8..434f12880a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,68 @@ -site/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python env/ +build/ +develop-eggs/ dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports htmlcov/ .tox/ -mkdocs.egg-info/ -*.pyc .coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo + +# Scrapy stuff: +.scrapy + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# virtualenv +venv/ +ENV/ + +# MkDocs documentation +site/ diff --git a/.jshintignore b/.jshintignore index 7980294a25..645160a8f9 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,7 +1,8 @@ mkdocs/themes/**/js/highlight.pack.js mkdocs/themes/**/js/jquery-**.min.js -mkdocs/themes/**/js/bootstrap-**.min.js +mkdocs/themes/**/js/bootstrap.min.js mkdocs/themes/**/js/modernizr-**.min.js -mkdocs/contrib/legacy_search/templates/search/require.js -mkdocs/contrib/legacy_search/templates/search/mustache.min.js -mkdocs/contrib/legacy_search/templates/search/lunr.min.js +mkdocs/themes/readthedocs/js/theme.js +mkdocs/contrib/search/templates/search/lunr.js +mkdocs/contrib/search/lunr-language/lunr.**.js +mkdocs/contrib/search/lunr-language/tinyseg.js diff --git a/.markdownlintrc b/.markdownlintrc new file mode 100644 index 0000000000..8a3a069d5d --- /dev/null +++ b/.markdownlintrc @@ -0,0 +1,19 @@ +{ + // Enable all markdownlint rules + "default": true, + + // Disable line length check for tables and code blocks + "MD013": { "line_length": 80, "code_blocks": false, "tables": false }, + + // Set Ordered list item prefix to "ordered" (use 1. 2. 3. not 1. 1. 1.) + "MD029": { "style": "ordered" }, + + // Set list indent level to 4 which Python-Markdown requires + "MD007": { "indent": 4 }, + + // Exclude code block style + "MD046": false, + + // Allow inline HTML + "MD033": false +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 44b3122550..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,79 +0,0 @@ -sudo: false -language: python -dist: trusty - -matrix: - include: - # Default Python - - env: TOXENV=flake8 - - env: TOXENV=markdown-lint - before_install: gem install mdl - - env: TOXENV=linkchecker - - env: TOXENV=jshint - before_install: npm install -g jshint - - env: TOXENV=csslint - before_install: npm install -g csslint - # Python version specific - - python: '2.7' - env: TOXENV=py27-integration - - python: '2.7' - env: TOXENV=py27-min-req - - python: '2.7' - env: TOXENV=py27-unittests - - python: '3.3' - env: TOXENV=py33-integration - - python: '3.3' - env: TOXENV=py33-min-req - - python: '3.3' - env: TOXENV=py33-unittests - - python: '3.4' - env: TOXENV=py34-integration - - python: '3.4' - env: TOXENV=py34-min-req - - python: '3.4' - env: TOXENV=py34-unittests - - python: '3.5' - env: TOXENV=py35-integration - - python: '3.5' - env: TOXENV=py35-min-req - - python: '3.5' - env: TOXENV=py35-unittests - - python: '3.6' - env: TOXENV=py36-integration - - python: '3.6' - env: TOXENV=py36-min-req - - python: '3.6' - env: TOXENV=py36-unittests - - python: 'pypy' - env: TOXENV=pypy-integration - - python: 'pypy' - env: TOXENV=pypy-min-req - - python: 'pypy' - env: TOXENV=pypy-unittests - - python: 'pypy3' - env: TOXENV=pypy3-integration - - python: 'pypy3' - env: TOXENV=pypy3-min-req - - python: 'pypy3' - env: TOXENV=pypy3-unittests - -install: - - pip install codecov - - pip install tox - -script: - - git clean -f -d -x - - tox - -after_success: codecov - -deploy: - provider: pypi - user: mkdocsdeploy - distributions: "sdist bdist_wheel" - password: - secure: b4f6y1xw5B/RXXnOu6JIaNcgOBZ0/CkNaMeEXsoQSewYZNwobLPYALY9WaaOblarwrVa5NRD3e4x6SoL1/1NzQxfhCNMn7L82sssmtevnK+mSuUp4IZQa8WKyz+xLfnk28TlHgQbctAU9NaeQ6GuEflTRD7Bp8+xJ1C7h+yBUnw= - on: - tags: true - repo: mkdocs/mkdocs - condition: "$TOXENV = py27-integration" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77de742d97..527abf61f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,4 +3,4 @@ See the contributing guide in the documentation for an introduction to contributing to MkDocs. - + diff --git a/LICENSE b/LICENSE index cf6234d238..7bb507395f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2014, Tom Christie. All rights reserved. +Copyright © 2014-present, Tom Christie. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following diff --git a/MANIFEST.in b/MANIFEST.in index 0a3afb3544..032a060c09 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include README.md include LICENSE -recursive-include mkdocs *.ico *.js *.css *.png *.html *.eot *.svg *.ttf *.woff *.woff2 *.xml *.mustache *mkdocs_theme.yml +recursive-include mkdocs *.ico *.js *.css *.png *.html *.eot *.svg *.ttf *.woff *.woff2 *.xml *.mustache *mkdocs_theme.yml *.mo recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/README.md b/README.md index 98211a1271..ee05b63392 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,79 @@ # MkDocs -Project documentation with Markdown. - ---- +> *Project documentation with Markdown* [![PyPI Version][pypi-v-image]][pypi-v-link] -[![Build Status][travis-image]][travis-link] -[![Windows Build Status][appveyor-image]][appveyor-link] +[![Build Status][GHAction-image]][GHAction-link] [![Coverage Status][codecov-image]][codecov-link] -[![Landscale Code Health][landscape-image]][landscape-link] -- View the [MkDocs documentation][mkdocs]. -- Project [release notes][release-notes]. -- Visit the [MkDocs wiki](https://github.com/mkdocs/mkdocs/wiki) for community - resources, including third party themes and a list of MkDocs users. -- IRC channel: `#mkdocs` on freenode. -- Discussions and support: +MkDocs is a **fast**, **simple** and **downright gorgeous** static site +generator that's geared towards building project documentation. Documentation +source files are written in Markdown, and configured with a single YAML +configuration file. It is designed to be easy to use and can be extended with +third-party themes, plugins, and Markdown extensions. -## Code of Conduct +Please see the [Documentation][mkdocs] for an introductory tutorial and a full +user guide. + +## Features + +- Build static HTML files from Markdown files. +- Use Plugins and Markdown Extensions to enhance MkDocs. +- Use the built-in themes, third party themes or create your own. +- Publish your documentation anywhere that static files can be served. +- Much more! + +## Support + +If you need help with MkDocs, do not hesitate to get in contact with us! + +- For questions and high-level discussions, use **[Discussions]** on GitHub. + - For small questions, a good alternative is the **[Chat room]** on + Gitter/Matrix (**new!**) +- To report a bug or make a feature request, open an **[Issue]** on GitHub. + +Please note that we may only provide +support for problems/questions regarding core features of MkDocs. Any +questions or bug reports about features of third-party themes, plugins, +extensions or similar should be made to their respective projects. +But, such questions are *not* banned from the [chat room]. -Everyone interacting in the MkDocs project's codebases, issue trackers, chat -rooms, and mailing lists is expected to follow the [PyPA Code of Conduct]. +Make sure to stick around to answer some questions as well! -[appveyor-image]: https://img.shields.io/appveyor/ci/d0ugal/mkdocs/master.png -[appveyor-link]: https://ci.appveyor.com/project/d0ugal/mkdocs -[codecov-image]: http://codecov.io/github/mkdocs/mkdocs/coverage.svg?branch=master -[codecov-link]: http://codecov.io/github/mkdocs/mkdocs?branch=master -[landscape-image]: https://landscape.io/github/mkdocs/mkdocs/master/landscape.svg?style=flat-square -[landscape-link]: https://landscape.io/github/mkdocs/mkdocs/master -[pypi-v-image]: https://img.shields.io/pypi/v/mkdocs.png -[pypi-v-link]: https://pypi.python.org/pypi/mkdocs -[travis-image]: https://img.shields.io/travis/mkdocs/mkdocs/master.png -[travis-link]: https://travis-ci.org/mkdocs/mkdocs +## Links -[mkdocs]: http://www.mkdocs.org -[release-notes]: http://www.mkdocs.org/about/release-notes/ +- [Official Documentation][mkdocs] +- [Latest Release Notes][release-notes] +- [MkDocs Wiki][wiki] (Third-party themes, recipes, plugins and more) +## Contributing to MkDocs + +The MkDocs project welcomes, and depends on, contributions from developers and +users in the open source community. Please see the [Contributing Guide] for +information on how you can help. + +## Code of Conduct + +Everyone interacting in the MkDocs project's codebases, issue trackers, and +discussion forums is expected to follow the [PyPA Code of Conduct]. + + +[codecov-image]: https://codecov.io/github/mkdocs/mkdocs/coverage.svg?branch=master +[codecov-link]: https://codecov.io/github/mkdocs/mkdocs?branch=master +[pypi-v-image]: https://img.shields.io/pypi/v/mkdocs.svg +[pypi-v-link]: https://pypi.org/project/mkdocs/ +[GHAction-image]: https://github.com/mkdocs/mkdocs/workflows/CI/badge.svg?branch=master&event=push +[GHAction-link]: https://github.com/mkdocs/mkdocs/actions?query=event%3Apush+branch%3Amaster + +[mkdocs]: https://www.mkdocs.org +[Issue]: https://github.com/mkdocs/mkdocs/issues +[Discussions]: https://github.com/mkdocs/mkdocs/discussions +[Chat room]: https://gitter.im/mkdocs/community +[release-notes]: https://www.mkdocs.org/about/release-notes/ +[wiki]: https://github.com/mkdocs/mkdocs/wiki +[Contributing Guide]: https://www.mkdocs.org/about/contributing/ [PyPA Code of Conduct]: https://www.pypa.io/en/latest/code-of-conduct/ + +## License + +[BSD-2-Clause](https://github.com/mkdocs/mkdocs/blob/master/LICENSE) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 249cbd25f5..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -build: false -environment: - matrix: - - TOXENV: py27-integration - - TOXENV: py27-min-req - - TOXENV: py27-unittests - - TOXENV: py33-integration - - TOXENV: py33-min-req - - TOXENV: py33-unittests - - TOXENV: py34-integration - - TOXENV: py34-min-req - - TOXENV: py34-unittests - - TOXENV: py35-integration - - TOXENV: py35-min-req - - TOXENV: py35-unittests - - TOXENV: py36-integration - - TOXENV: py36-min-req - - TOXENV: py36-unittests - - TOXENV: flake8 -init: - - "ECHO %TOXENV%" -install: - - "c:\\python27\\Scripts\\pip install tox" -test_script: - - "git clean -f -d -x" - - "c:\\python27\\Scripts\\tox --version" - - "c:\\python27\\Scripts\\pip --version" - - "c:\\python27\\Scripts\\tox" diff --git a/docs/about/contributing.md b/docs/about/contributing.md index 5d4337efbc..670379cf7e 100644 --- a/docs/about/contributing.md +++ b/docs/about/contributing.md @@ -10,6 +10,10 @@ ways, a few examples are: - Documentation improvements - Bug reports and patch reviews +For information about available communication channels please refer to the +[README](https://github.com/mkdocs/mkdocs/blob/master/README.md) file in our +GitHub repository. + ## Code of Conduct Everyone interacting in the MkDocs project's codebases, issue trackers, chat @@ -49,21 +53,61 @@ to the git repository. ## Running the tests -To run the tests, it is recommended that you use [Tox]. This just needs -to be pip installed and then the test suite can be ran for MkDocs but running -the command `tox` in the root of your MkDocs repository. +To run the tests, it is recommended that you use [tox]. + +Install Tox using [pip] by running the command `pip install tox`. +Then the test suite can be run for MkDocs by running the command `tox` in the +root of your MkDocs repository. It will attempt to run the tests against all of the Python versions we support. So don't be concerned if you are missing some and they fail. The rest -will be verified by [Travis] when you submit a pull request. +will be verified by [Github Actions] when you submit a pull request. + +## Translating themes + +To localize a theme to your favorite language, follow the guide on [Translating +Themes]. We welcome translation Pull Requests! ## Submitting Pull Requests -Once you are happy with your changes or you are ready for some feedback, push +If you're considering a large code contribution to MkDocs, please prefer to +open an issue first to get early feedback on the idea. + +Once you think the code is ready to be reviewed, push it to your fork and send a pull request. For a change to be accepted it will most likely need to have tests and documentation if it is a new feature. -[virtualenv]: https://virtualenv.pypa.io/en/latest/userguide.html +### Submitting changes to the builtin themes + +When installed with `i18n` support (`pip install mkdocs[i18n]`), MkDocs allows +themes to support being translated into various languages (referred to as +locales) if they respect [Jinja's i18n extension] by wrapping text placeholders +with `{% trans %}` and `{% endtrans %}` tags. + +Each time a translatable text placeholder is added, removed or changed in a +theme template, the theme's Portable Object Template (`pot`) file needs to be +updated by running the `extract_messages` command. For example, to update the +`pot` file of the `mkdocs` theme, run the following command: + +```bash +python setup.py extract_messages -t mkdocs +``` + +The updated `pot` file should be included in a PR with the updated template. +The updated `pot` file will allow translation contributors to propose the +translations needed for their preferred language. See the guide on [Translating +Themes] for details. + +!!! Note + + Contributors are not expected to provide translations with their changes to + a theme's templates. However, they are expected to include an updated `pot` + file so that everything is ready for translators to do their job. + +[virtualenv]: https://virtualenv.pypa.io/en/latest/user_guide.html +[pip]: https://pip.pypa.io/en/stable/ [tox]: https://tox.readthedocs.io/en/latest/ -[travis]: https://travis-ci.org/repositories +[Github Actions]: https://docs.github.com/actions [PyPA Code of Conduct]: https://www.pypa.io/en/latest/code-of-conduct/ +[Translating Themes]: ../dev-guide/translations.md +[Jinja's i18n extension]: https://jinja.palletsprojects.com/en/latest/extensions/#i18n-extension diff --git a/docs/about/release-notes.md b/docs/about/release-notes.md index bce82aacc2..64aee9f6c3 100644 --- a/docs/about/release-notes.md +++ b/docs/about/release-notes.md @@ -11,7 +11,7 @@ To upgrade MkDocs to the latest version, use pip: You can determine your currently installed version using `mkdocs --version`: $ mkdocs --version - mkdocs, version 0.15.2 + mkdocs, version 1.0 from /path/to/mkdocs (Python 3.6) ## Maintenance team @@ -21,6 +21,690 @@ The current and past members of the MkDocs team. * [@d0ugal](https://github.com/d0ugal/) * [@waylan](https://github.com/waylan/) +## Version 1.2.3 (2021-10-12) + +* Built-in themes now also support these languages: + * Simplified Chinese (#2497) + * Japanese (#2525) + * Brazilian Portuguese (#2535) + * Spanish (#2545, previously #2396) + +* Third-party plugins will take precedence over built-in plugins with the same + name (#2591) + +* Bugfix: Fix ability to load translations for some languages: + core support (#2565) and search plugin support with fallbacks (#2602) + +* Bugfix (regression in 1.2): Prevent directory traversal in the dev server + (#2604) + +* Bugfix (regression in 1.2): Prevent webserver warnings from being treated as + a build failure in strict mode (#2607) + +* Bugfix: Correctly print colorful messages in the terminal on Windows (#2606) + +* Bugfix: Python version 3.10 was displayed incorrectly in `--version` (#2618) + +Other small improvements; see +[commit log](https://github.com/mkdocs/mkdocs/compare/1.2.2...1.2.3). + +## Version 1.2.2 (2021-07-18) + +* Bugfix (regression in 1.2): Fix serving files/paths with Unicode characters + (#2464) + +* Bugfix (regression in 1.2): Revert livereload file watching to use polling + observer (#2477) + + This had to be done to reasonably support usages that span virtual + filesystems such as non-native Docker and network mounts. + + This goes back to the polling approach, very similar to that was always used + prior, meaning most of the same downsides with latency and CPU usage. + +* Revert from 1.2: Remove the requirement of a `site_url` config and the + restriction on `use_directory_urls` (#2490) + +* Bugfix (regression in 1.2): Don't require trailing slash in the URL when + serving a directory index in `mkdocs serve` server (#2507) + + Instead of showing a 404 error, detect if it's a directory and redirect to a + path with a trailing slash added, like before. + +* Bugfix: Fix `gh_deploy` with config-file in the current directory (#2481) + +* Bugfix: Fix reversed breadcrumbs in "readthedocs" theme (#2179) + +* Allow "mkdocs.yaml" as the file name when '--config' is not passed (#2478) + +* Stop treating ";" as a special character in URLs: urlparse -> urlsplit (#2502) + +* Improve build performance for sites with many pages (partly already done in + 1.2) (#2407) + +## Version 1.2.1 (2021-06-09) + +* Bugfix (regression in 1.2): Ensure 'gh-deploy' always pushes. + +## Version 1.2 (2021-06-04) + +### Major Additions to Version 1.2 + +#### Support added for Theme Localization (#2299) + +The `mkdocs` and `readthedocs` themes now support language localization using +the `theme.locale` parameter, which defaults to `en` (English). The only other +supported languages in this release are `fr` (French) and `es` (Spanish). For +details on using the provided translations, see the [user +guide](../user-guide/localizing-your-theme.md). Note that translation will not +happen by default. Users must first install the necessary dependencies with +the following command: + +```bash +pip install mkdocs[i18n] +``` + +Translation contributions are welcome and detailed in the [Translation +Guide](../dev-guide/translations.md). + +Developers of third party themes may want to review the relevant section of +the [Theme Development +Guide](../dev-guide/themes.md#supporting-theme-localizationtranslation). + +Contributors who are updating the templates to the built-in themes should +review the [Contributing +Guide](contributing.md#submitting-changes-to-the-builtin-themes). + +The `lang` setting of the `search` plugin now defaults to the language +specified in `theme.locale`. + +#### Support added for Environment Variables in the configuration file (#1954) + +Environments variables may now be specified in the configuration file with the +`!ENV` tag. The value of the variable will be parsed by the YAML parser and +converted to the appropriate type. + +```yaml +somekey: !ENV VAR_NAME +otherkey: !ENV [VAR_NAME, FALLBACK_VAR, 'default value'] +``` + +See [Environment Variables](../user-guide/configuration.md#environment-variables) +in the Configuration documentation for details. + +#### Support added for Configuration Inheritance (#2218) + +A configuration file may now inherit from a parent configuration file. In the +primary file set the `INHERIT` key to the relative path of the parent file. + +```yaml +INHERIT: path/to/base.yml +``` + +The two files will then be deep merged. See +[Configuration Inheritance](../user-guide/configuration.md#configuration-inheritance) +for details. + +#### Update `gh-deploy` command (#2170) + +The vendored (and modified) copy of ghp_import has been replaced with a +dependency on the upstream library. As of version 1.0.0, [ghp-import] includes a +Python API which makes it possible to call directly. + +MkDocs can now benefit from recent bug fixes and new features, including the following: + +* A `.nojekyll` file is automatically included when deploying to GitHub Pages. +* The `--shell` flag is now available, which reportedly works better on Windows. +* Git author and committer environment variables should be respected (#1383). + +[ghp-import]: https://github.com/c-w/ghp-import/ + +#### Rework auto-reload and HTTP server for `mkdocs serve` (#2385) + +`mkdocs serve` now uses a new underlying server + file watcher implementation, +based on [http.server] from standard library and [watchdog]. It provides similar +functionality to the previously used [livereload] library (which is now dropped +from dependencies, along with [tornado]). + +This makes reloads more responsive and consistent in terms of timing. Multiple +rapid file changes no longer cause the site to repeatedly rebuild (issue #2061). + +Almost every aspect of the server is slightly different, but actual visible +changes are minor. The logging outputs are only *similar* to the old ones. +Degradations in behavior are not expected, and should be reported if found. + +[http.server]: https://docs.python.org/3/library/http.server.html +[watchdog]: https://pypi.org/project/watchdog/ +[livereload]: https://pypi.org/project/livereload/ +[tornado]: https://pypi.org/project/tornado/ + +##### Offset the local site root according to the sub-path of the `site_url` (#2424) + +When using `mkdocs serve` and having the `site_url` specified as e.g. +`http://example.org/sub/path/`, now the root of the locally served site +becomes `http://127.0.0.1:8000/sub/path/` and all document paths are offset +accordingly. + +#### A `build_error` event was added (#2103) + +Plugin developers can now use the `on_build_error` hook +to execute code when an exception is raised while building the site. + +See [`on_build_error`](../dev-guide/plugins.md#on_build_error) +in the Plugins documentation for details. + +#### Three new exceptions: BuildError PluginError and Abort (#2103) + +MkDocs now has tree new exceptions defined in `mkdocs.exceptions`: +`BuildError`, `PluginError`, and `Abort`: + +* `PluginError` can be raised from a plugin + to stop the build and log an error message *without traceback*. +* `BuildError` should not be used by third-party plugins developers + and is reserved for internal use only. +* `Abort` is used internally to abort the build and display an error + without a traceback. + +See [`Handling errors`](../dev-guide/plugins.md#handling-errors) +in the Plugins documentation for details. + +#### Search Indexing Strategy configuration + +Users can now specify which strategy they wish to use when indexing +their site for search. A user can select between the following options: + +* **full**: Adds page title, section headings, and full page text to the +search index. +* **sections**: Adds page titles and section headings only to the search +index. +* **titles**: Adds only the page titles to the search index. + +See [`Search Indexing`](../user-guide/configuration.md#indexing) in the +configuration documentation for details. + +### Backward Incompatible Changes in 1.2 + +* The [site_url](../user-guide/configuration.md#site_url) configuration option + is now **required**. If it is not set, a warning will be issued. In a future + release an error will be raised (#2189). + + The [use_directory_urls](../user-guide/configuration.md#use_directory_urls) + configuration option will be forced to `false` if + [site_url](../user-guide/configuration.md#site_url) is set to an empty + string. In that case, if `use_directory_urls` is not explicitly set to + `false`, a warning will be issued (#2189). + + !!! note + This was reverted in release 1.2.2 + +* The `google_analytics` configuration option is deprecated as Google appears to + be fazing it out in favor of its new Google Analytics 4 property. See the + documentation for your theme for alternatives which can be configured as part + of your theme configuration. For example, the [mkdocs][mkdocs-theme] and + [readthedocs][rtd-theme] themes have each added a new `theme.analytics.gtag` + configuration option which uses the new Google Analytics 4 property. See + Google's documentation on how to [Upgrade to a Google Analytics 4 + property][ga4]. Then set `theme.analytics.gtag` to the "G-" ID and delete the + `google_analytics` configuration option which contains a "UA-" ID. So long + as the old "UA-" ID and new "G-" ID are properly linked in your Google + account, and you are using the "G-" ID, the data will be made available in + both the old and new formats by Google Analytics. See #2252. + +* A theme's files are now excluded from the list of watched files by default + when using the `--livereload` server. This new default behavior is what most + users need and provides better performance when editing site content. + Theme developers can enable the old behavior with the `--watch-theme` + option. (#2092). + +* The `mkdocs` theme now removes the sidebar when printing a page. This frees + up horizontal space for better rendering of content like tables (#2193). + +* The `mkdocs.config.DEFAULT_SCHEMA` global variable has been replaced with the + function `mkdocs.config.defaults.get_schema()`, which ensures that each + instance of the configuration is unique (#2289). + +* The `mkdocs.utils.warning_filter` is deprecated and now does nothing. Plugins + should remove any reference to is as it may be deleted in a future release. + To ensure any warnings get counted, simply log them to the `mkdocs` log (i.e.: + `mkdocs.plugins.pluginname`). + +* The `on_serve` event (which receives the `server` object and the `builder` + function) is affected by the server rewrite. `server` is now a + `mkdocs.livereload.LiveReloadServer` instead of `livereload.server.Server`. + The typical action that plugins can do with these is to call + `server.watch(some_dir, builder)`, which basically adds that directory to + watched directories, causing the site to be rebuilt on file changes. That + still works, but passing any other function to `watch` is deprecated and shows + a warning. This 2nd parameter is already optional, and will accept only this + exact `builder` function just for compatibility. + +* The `python` method of the `plugins.search.prebuild_index` configuration + option is pending deprecation as of version 1.2. It is expected that in + version 1.3 it will raise a warning if used and in version 1.4 it will raise + an error. Users are encouraged to use an alternate method to generate a + prebuilt index for search. + +* The `lunr` and `lunr[languages]` dependencies are no longer installed by + default. The dependencies are only needed for the rare user who pre-builds the + search index and uses the `python` option, which is now pending deprecation. + If you use this feature, then you will need to manually install `lunr` and + `lunr[languages]`. A warning is issued if the dependencies are needed but not + installed. + +[mkdocs-theme]: ../user-guide/choosing-your-theme.md#mkdocs +[rtd-theme]: ../user-guide/choosing-your-theme.md#readthedocs +[ga4]: https://support.google.com/analytics/answer/9744165?hl=en + +### Other Changes and Additions to Version 1.2 + +* Bugfix: Properly process navigation child items in `_get_by_type` when + filtering for sections (#2203). +* Official support for Python 3.9 has been added and support for Python 3.5 + has been dropped. +* Bugfix: Fixes an issue that would result in a partially cut-off navigation + item in the ReadTheDocs theme (#2297). +* Structure Files object now has a `remove` method to help plugin developers + manipulate the Files tree. The corresponding `src_paths` has become a + property to accommodate this possible dynamic behavior. See #2305. +* Updated highlight.js to 10.5.0. See #2313. +* Bugfix: Search plugin now works with Japanese language. See #2178. +* Documentation has been refactored (#1629). +* Restore styling of tables in the `readthedocs` theme (#2028). +* Ensure `site_url` ends with a slash (#1785). +* Correct documentation of `pages` template context variable (#1736). +* The `lunr` dependency has been updated to 0.5.9, and `lunr.js` to + the corresponding 2.3.9 version (#2306). +* Color is now used in log messages to identify errors, warnings and debug + messages. +* Bugfix: Identify homepage when `use_directory_urls` is `False` (#2362). + +## Version 1.1.2 (2020-05-14) + +* Bugfix: Normalize IP addresses and change unsupported address error to a + warning (#2108). + +## Version 1.1.1 (2020-05-12) + +* Bugfix: Allow compressed sitemap to be deterministic by supporting the + `SOURCE_DATE_EPOCH` environment variable (#2100). +* Bugfix: Use `README.md` as `index.html` even if `use_directory_urls` is false + (#2081). +* Bugfix: Ignore links which start with a backslash (#1680). +* Bugfix: Pass `builder` to the `on_serve` event so that it can be passed to + `server.watch` by plugins (#1952). +* Bugfix: Use `lunr[languages]==0.5.8` to avoid `nltk` incompatibilities (#2062). +* Bugfix: Ensure wheel is Python 3 only (#2021). +* Bugfix: Clean up `dev_addr` validation and disallow `0.0.0.0` (#2022). +* Add support for `min_search_length` parameter for search plugin (#2014). +* Bugfix: `readthedocs` theme `code` colors (#2027). + +## Version 1.1 (2020-02-22) + +### Major Additions to Version 1.1 + +#### Support for Lunr.py as `prebuild_index` engine + +Mkdocs now supports pre-building indices using [Lunr.py][lunrpy-docs], a pure +Python implementation of Lunr.js, allowing the user to avoid installing a +NodeJS environment if so desired. For more information please read the +[`prebuild_index` documentation][prebuildindex-docs]. + +[lunrpy-docs]: http://lunr.readthedocs.io/ +[prebuildindex-docs]: ../../user-guide/configuration/#prebuild_index + +#### `readthedocs` theme updated with upstream (#588 and #1374) + +The `readthedocs` theme now more closely matches the [upstream] Sphinx theme +(version 0.4.1). A number of new theme configuration settings were added which +mirror the upstream configuration options. See the [theme +documentation][rtd-docs] for details. + +[upstream]: https://github.com/rtfd/sphinx_rtd_theme/ +[rtd-docs]: ../user-guide/choosing-your-theme.md#readthedocs + +#### Update `mkdocs` theme to Bootswatch 4.1.3 (#1563) + +The `mkdocs` theme now supports all the features of [Bootswatch 4.1]. +Additionally, 2 filenames were changed in this update. If you are using a theme +which inherits from the `mkdocs` theme, the theme developer may need to update +these filenames as follows. + +```text +css/bootstrap-custom.min.css => css/bootstrap.min.css +js/bootstrap-3.0.3.min.js => js/bootstrap.min.js +``` + +[Bootswatch 4.1]: https://getbootstrap.com/docs/4.1/getting-started/introduction/ + +#### Improved configuration support on the command line (#1401) + +The `build`, `serve`, and `gh-deploy` subcommands now support flags to control +whether [directory URLs][directory-urls] should be created: +`--use-directory-urls` / `--no-directory-urls`. In addition, the `gh-deploy` +subcommand now supports all the configuration options that `build` and `serve` +do, adding `--strict`, `--theme`, `--theme-dir`, and `--site-dir`. + +[directory-urls]: ../user-guide/configuration.md#use_directory_urls + +#### Updated lunr-languages support (#1729) + +The `lunr-languages` plugin has been updated to 1.4.0, adding support for +Arabic (`ar`) and Vietnamese (`vi`) languages. In addition, the Dutch and +Japanese language codes have been changed to their standard values: `nl` and +`ja`, respectively. The old language codes (`du` and `jp`) remain as aliases but +may be removed in a future version of MkDocs. + +### Other Changes and Additions to Version 1.1 + +* Bugfix: Ensure nested dot files in themes are ignored and document behavior (#1981). +* Update minimum dependency to Markdown 3.2.1. +* Updated minimum dependency to Jinja 2.10.1 to address security + concerns (#1780). +* Update to lunr.js 2.3.8 (#1989). +* Add support for Python 3.8. +* Drop support for Python 3.4. +* Drop support for Python 2.7. MkDocs is PY3 only now (#1926). +* Bugfix: Select appropriate asyncio event loop on Windows for Python 3.8+ (#1885). +* Bugfix: Ensure nested index pages do not get identified as the homepage (#1919). +* Bugfix: Properly identify deployment version (#1879). +* Bugfix: Properly build `ValidationError` message for `custom_dir` (#1849). +* Bugfix: Exclude Markdown files and READMEs from theme (#1766). +* Bugfix: Account for encoded URLs (#1670). +* Bugfix: Ensure theme files do not override `docs_dir` files (#1671). +* Bugfix: Do not normalize URL fragments (#1655). +* Bugfix: Skip external URLs in sitemap.xml (#1742). +* Bugfix: Ensure theme files do not override docs_dir files on Windows (#1876) +* Add canonical tag to `readthedocs` theme (#1669). +* Improved error message for when `git` is not available. +* Add support for `nav_style` theme option for the `mkdocs` theme (#1930). +* Bugfix: Long/nested dropdowns now behave more consistently for the `mkdocs` + theme (#1234). +* Bugfix: Multi-row nav headers in the `mkdocs` theme no longer obscure the + document content (#716). +* Add support for `navigation_depth` theme option for the `mkdocs` theme (#1970). +* `level` attribute in `page.toc` items is now 1-indexed to match the level in + `` tags (#1970). + +## Version 1.0.4 (2018-09-07) + +* Bugfix: Ignore absolute links in Markdown (#1621). + +## Version 1.0.3 (2018-08-29) + +* Bugfix: Warn on relative paths in navigation (#1604). +* Bugfix: Handle empty `theme_config.yml` files correctly (#1602). + +## Version 1.0.2 (2018-08-22) + +* Bugfix: Provide absolute `base_url` to error templates (#1598). + +## Version 1.0.1 (2018-08-13) + +* Bugfix: Prevent page reload when [Enter] is pressed in search box (#1589). +* Bugfix: Avoid calling `search` until all assets are ready (#1584). +* Bugfix: Exclude `README.md` if `index.md` is present (#1580). +* Bugfix: Fix `readthedocs` theme navigation bug with homepage (#1576). + +## Version 1.0 (2018-08-03) + +### Major Additions to Version 1.0 + +#### Internal Refactor of Pages, Files, and Navigation + +Internal handling of pages, files and navigation has been completely refactored. +The changes included in the refactor are summarized below. + +* Support for hidden pages. All Markdown pages are now included in the build + regardless of whether they are included in the navigation configuration + (#699). +* The navigation can now include links to external sites (#989 #1373 & #1406). +* Page data (including titles) is properly determined for all pages before any + page is rendered (#1347). +* Automatically populated navigation now sorts index pages to the top. In other + words, The index page will be listed as the first child of a directory, while + all other documents are sorted alphanumerically by file name after the index + page (#73 & #1042). +* A `README.md` file is now treated as an index file within a directory and + will be rendered to `index.html` (#608). +* The URLs for all files are computed once and stored in a files collection. + This ensures all internal links are always computed correctly regardless of + the configuration. This also allows all internal links to be validated, not + just links to other Markdown pages. (#842 & #872). +* A new [url] template filter smartly ensures all URLs are relative to the + current page (#1526). +* An [on_files] plugin event has been added, which could be used to include + files not in the `docs_dir`, exclude files, redefine page URLs (i.e. + implement extensionless URLs), or to manipulate files in various other ways. + +[on_files]: ../dev-guide/plugins.md#on_files + +##### Backward Incompatible Changes + +As part of the internal refactor, a number of backward incompatible changes have +been introduced, which are summarized below. + +###### URLs have changed when `use_directory_urls` is `False` + +Previously, all Markdown pages would be have their filenames altered to be index +pages regardless of how the [use_directory_urls] setting was configured. +However, the path munging is only needed when `use_directory_urls` is set to +`True` (the default). The path mangling no longer happens when +`use_directory_urls` is set to `False`, which will result in different URLs for +all pages that were not already index files. As this behavior only effects a +non-default configuration, and the most common user-case for setting the option +to `False` is for local file system (`file://`) browsing, its not likely to +effect most users. However, if you have `use_directory_urls` set to `False` +for a MkDocs site hosted on a web server, most of your URLs will now be broken. +As you can see below, the new URLs are much more sensible. + +| Markdown file | Old URL | New URL | +| --------------- | -------------------- | -------------- | +| `index.md` | `index.html` | `index.html` | +| `foo.md` | `foo/index.html` | `foo.html` | +| `foo/bar.md` | `foo/bar/index.html` | `foo/bar.html` | + +Note that there has been no change to URLs or file paths when +`use_directory_urls` is set to `True` (the default), except that MkDocs more +consistently includes an ending slash on all internally generated URLs. + +[use_directory_urls]: ../user-guide/configuration.md#use_directory_urls + +###### The `pages` configuration setting has been renamed to `nav` + +The `pages` configuration setting is deprecated and will issue a warning if set +in the configuration file. The setting has been renamed `nav`. To update your +configuration, simply rename the setting to `nav`. In other words, if your +configuration looked like this: + +```yaml +pages: + - Home: index.md + - User Guide: user-guide.md +``` + +Simply edit the configuration as follows: + +```yaml +nav: + - Home: index.md + - User Guide: user-guide.md +``` + +In the current release, any configuration which includes a `pages` setting, but +no `nav` setting, the `pages` configuration will be copied to `nav` and a +warning will be issued. However, in a future release, that may no longer happen. +If both `pages` and `nav` are defined, the `pages` setting will be ignored. + +###### Template variables and `base_url` + +In previous versions of MkDocs some URLs expected the [base_url] template +variable to be prepended to the URL and others did not. That inconsistency has +been removed in that no URLs are modified before being added to the template +context. + +For example, a theme template might have previously included a link to +the `site_name` as: + +```django +{{ config.site_name }} +``` + +And MkDocs would magically return a URL for the homepage which was relative to +the current page. That "magic" has been removed and the [url] template filter +should be used: + +```django +{{ config.site_name }} +``` + +This change applies to any navigation items and pages, as well as the +`page.next_page` and `page.previous_page` attributes. For the time being, the +`extra_javascript` and `extra_css` variables continue to work as previously +(without the `url` template filter), but they have been deprecated and the +corresponding configuration values (`config.extra_javascript` and +`config.extra_css` respectively) should be used with the filter instead. + +```django +{% for path in config['extra_css'] %} + +{% endfor %} +``` + +Note that navigation can now include links to external sites. Obviously, the +`base_url` should not be prepended to these items. However, the `url` template +filter is smart enough to recognize the URL is absolute and does not alter it. +Therefore, all navigation items can be passed to the filter and only those that +need to will be altered. + +```django +{% for nav_item in nav %} + {{ nav_item.title }} +{% endfor %} +``` + +[base_url]: ../dev-guide/themes.md#base_url +[url]: ../dev-guide/themes.md#url + +#### Path Based Settings are Relative to Configuration File (#543) + +Previously any relative paths in the various configuration options were +resolved relative to the current working directory. They are now resolved +relative to the configuration file. As the documentation has always encouraged +running the various MkDocs commands from the directory that contains the +configuration file (project root), this change will not affect most users. +However, it will make it much easier to implement automated builds or otherwise +run commands from a location other than the project root. + +Simply use the `-f/--config-file` option and point it at the configuration file: + +```sh +mkdocs build --config-file /path/to/my/config/file.yml +``` + +As previously, if no file is specified, MkDocs looks for a file named +`mkdocs.yml` in the current working directory. + +#### Added support for YAML Meta-Data (#1542) + +Previously, MkDocs only supported MultiMarkdown style meta-data, which does not +recognize different data types and is rather limited. MkDocs now also supports +YAML style meta-data in Markdown documents. MkDocs relies on the the presence or +absence of the deliminators (`---` or `...`) to determine whether YAML style +meta-data or MultiMarkdown style meta-data is being used. + +Previously MkDocs would recognize MultiMarkdown style meta-data between the +deliminators. Now, if the deliminators are detected, but the content between the +deliminators is not valid YAML meta-data, MkDocs does not attempt to parse the +content as MultiMarkdown style meta-data. Therefore, MultiMarkdown's style +meta-data must not include the deliminators. See the [MultiMarkdown style +meta-data documentation] for details. + +Prior to version 0.17, MkDocs returned all meta-data values as a list of strings +(even a single line would return a list of one string). In version 0.17, that +behavior was changed to return each value as a single string (multiple lines +were joined), which some users found limiting (see #1471). That behavior +continues for MultiMarkdown style meta-data in the current version. However, +YAML style meta-data supports the full range of "safe" YAML data types. +Therefore, it is recommended that any complex meta-data make use of the YAML +style (see the [YAML style meta-data documentation] for details). In fact, a +future version of MkDocs may deprecate support for MultiMarkdown style +meta-data. + +[MultiMarkdown style meta-data documentation]: ../user-guide/writing-your-docs.md#multimarkdown-style-meta-data +[YAML style meta-data documentation]: ../user-guide/writing-your-docs.md#yaml-style-meta-data + +#### Refactor Search Plugin + +The search plugin has been completely refactored to include support for the +following features: + +* Use a web worker in the browser with a fallback (#1396). +* Optionally pre-build search index locally (#859 & #1061). +* Upgrade to lunr.js 2.x (#1319). +* Support search in languages other than English (#826). +* Allow the user to define the word separators (#867). +* Only run searches for queries of length > 2 (#1127). +* Remove dependency on require.js (#1218). +* Compress the search index (#1128). + +Users can review the [configuration options][search config] available and theme +authors should review how [search and themes] interact. + +[search config]: ../user-guide/configuration.md#search +[search and themes]: ../dev-guide/themes.md#search_and_themes + +#### `theme_dir` Configuration Option fully Deprecated + +As of version 0.17, the [custom_dir] option replaced the deprecated `theme_dir` +option. If users had set the `theme_dir` option, MkDocs version 0.17 copied the +value to the `theme.custom_dir` option and a warning was issued. As of version +1.0, the value is no longer copied and an error is raised. + +### Other Changes and Additions to Version 1.0 + +* Keyboard shortcuts changed to not conflict with commonly used accessibility + shortcuts (#1502.) +* User friendly YAML parse errors (#1543). +* Officially support Python 3.7. +* A missing theme configuration file now raises an error. +* Empty `extra_css` and `extra_javascript` settings no longer raise a warning. +* Add highlight.js configuration settings to built-in themes (#1284). +* Close search modal when result is selected (#1527). +* Add a level attribute to AnchorLinks (#1272). +* Add MkDocs version check to gh-deploy script (#640). +* Improve Markdown extension error messages. (#782). +* Drop official support for Python 3.3 and set `tornado>=5.0` (#1427). +* Add support for GitLab edit links (#1435). +* Link to GitHub issues from release notes (#644). +* Expand {sha} and {version} in gh-deploy commit message (#1410). +* Compress `sitemap.xml` (#1130). +* Defer loading JS scripts (#1380). +* Add a title attribute to the search input (#1379). +* Update RespondJS to latest version (#1398). +* Always load Google Analytics over HTTPS (#1397). +* Improve scrolling frame rate (#1394). +* Provide more version info. (#1393). +* Refactor `writing-your-docs.md` (#1392). +* Workaround Safari bug when zooming to < 100% (#1389). +* Remove addition of `clicky` class to body and animations. (#1387). +* Prevent search plugin from re-injecting `extra_javascript` files (#1388). +* Refactor `copy_media_files` util function for more flexibility (#1370). +* Remove PyPI Deployment Docs (#1360). +* Update links to Python-Markdown library (#1360). +* Document how to generate manpages for MkDocs commands (#686). + +## Version 0.17.5 (2018-07-06) + +* Bugfix: Fix Python 3.7 and PEP 479 incompatibility (#1518). + +## Version 0.17.4 (2018-06-08) + +* Bugfix: Add multi-level nesting support to sitemap.xml (#1482). + +## Version 0.17.3 (2018-03-07) + +* Bugfix: Set dependency `tornado>=4.1,<5.0` due to changes in 5.0 (#1428). + ## Version 0.17.2 (2017-11-15) * Bugfix: Correct `extra_*` config setting regressions (#1335 & #1336). @@ -44,12 +728,14 @@ own custom behaviors. See the included documentation for a full explanation of the API. The previously built-in search functionality has been removed and wrapped in a -plugin (named "search") with no changes in behavior. If no plugins setting is -defined in the config, then the `search` plugin will be included by default. -See the [configuration][plugin_config] documentation for information on -overriding the default. - -[Plugin API]: ../user-guide/plugins.md +plugin (named "search") with no changes in behavior. When MkDocs builds, the +search index is now written to `search/search_index.json` instead of +`mkdocs/search_index.json`. If no plugins setting is defined in the config, +then the `search` plugin will be included by default. See the +[configuration][plugin_config] documentation for information on overriding the +default. + +[Plugin API]: ../dev-guide/plugins.md [plugin_config]: ../user-guide/configuration.md#plugins #### Theme Customization. (#1164) @@ -58,7 +744,7 @@ Support had been added to provide theme specific customizations. Theme authors can define default options as documented in [Theme Configuration]. A theme can now inherit from another theme, define various static templates to be rendered, and define arbitrary default variables to control behavior in the templates. -The theme configuration is defined in a configuruation file named +The theme configuration is defined in a configuration file named `mkdocs_theme.yml` which should be placed at the root of your template files. A warning will be raised if no configuration file is found and an error will be raised in a future release. @@ -86,7 +772,7 @@ theme: See the [theme] configuration option documentation for details. -[Theme Configuration]: ../user-guide/custom-themes.md#theme-configuration +[Theme Configuration]: ../dev-guide/themes.md#theme-configuration [theme]: ../user-guide/configuration.md#theme [custom_dir]: ../user-guide/configuration.md#custom_dir @@ -104,7 +790,7 @@ template exists. ##### Context Variables Page specific variable names in the template context have been refactored as -defined in [Custom Themes](../user-guide/custom-themes/#page). The +defined in [Custom Themes](../dev-guide/themes.md#page). The old variable names issued a warning in version 0.16, but have been removed in version 1.0. @@ -122,14 +808,14 @@ user created and third-party templates: | previous_page | [page.previous_page]| | next_page | [page.next_page] | -[page]: ../user-guide/custom-themes/#page -[page.title]: ../user-guide/custom-themes/#pagetitle -[page.content]: ../user-guide/custom-themes/#pagecontent -[page.toc]: ../user-guide/custom-themes/#pagetoc -[page.meta]: ../user-guide/custom-themes/#pagemeta -[page.canonical_url]: ../user-guide/custom-themes/#pagecanonical_url -[page.previous_page]: ../user-guide/custom-themes/#pageprevious_page -[page.next_page]: ../user-guide/custom-themes/#pagenext_page +[page]: ../dev-guide/themes.md#page +[page.title]: ../dev-guide/themes.md#pagetitle +[page.content]: ../dev-guide/themes.md#pagecontent +[page.toc]: ../dev-guide/themes.md#pagetoc +[page.meta]: ../dev-guide/themes.md#pagemeta +[page.canonical_url]: ../dev-guide/themes.md#pagecanonical_url +[page.previous_page]: ../dev-guide/themes.md#pageprevious_page +[page.next_page]: ../dev-guide/themes.md#pagenext_page Additionally, a number of global variables have been altered and/or removed and user created and third-party templates should be updated as outlined below: @@ -155,12 +841,12 @@ and user created and third-party templates should be updated as outlined below: In previous versions of MkDocs, if the `extra_css` or `extra_javascript` config settings were empty, MkDocs would scan the `docs_dir` and auto-populate each setting with all of the CSS and JavaScript files found. On version 0.16 this -behavior was deprecated and a warning was issued. In 1.0 any unlisted CSS and +behavior was deprecated and a warning was issued. In 0.17 any unlisted CSS and JavaScript files will not be included in the HTML templates, however, a warning will be issued. In other words, they will still be copied to the `site-dir`, but they will not have any effect on the theme if they are not explicitly listed. -All CSS and javaScript files in the `docs_dir` should be explicitly listed in +All CSS and JavaScript files in the `docs_dir` should be explicitly listed in the `extra_css` or `extra_javascript` config settings going forward. ### Other Changes and Additions to Version 0.17.0 @@ -209,7 +895,7 @@ the `extra_css` or `extra_javascript` config settings going forward. ##### Page Context Page specific variable names in the template context have been refactored as -defined in [Custom Themes](../user-guide/custom-themes/#page). The +defined in [Custom Themes](../dev-guide/themes.md#page). The old variable names will issue a warning but continue to work for version 0.16, but may be removed in a future version. @@ -227,14 +913,14 @@ user created and third-party templates: | previous_page | [page.previous_page]| | next_page | [page.next_page] | -[page]: ../user-guide/custom-themes/#page -[page.title]: ../user-guide/custom-themes/#pagetitle -[page.content]: ../user-guide/custom-themes/#pagecontent -[page.toc]: ../user-guide/custom-themes/#pagetoc -[page.meta]: ../user-guide/custom-themes/#pagemeta -[page.canonical_url]: ../user-guide/custom-themes/#pagecanonical_url -[page.previous_page]: ../user-guide/custom-themes/#pageprevious_page -[page.next_page]: ../user-guide/custom-themes/#pagenext_page +[page]: ../dev-guide/themes.md#page +[page.title]: ../dev-guide/themes.md#pagetitle +[page.content]: ../dev-guide/themes.md#pagecontent +[page.toc]: ../dev-guide/themes.md#pagetoc +[page.meta]: ../dev-guide/themes.md#pagemeta +[page.canonical_url]: ../dev-guide/themes.md#pagecanonical_url +[page.previous_page]: ../dev-guide/themes.md#pageprevious_page +[page.next_page]: ../dev-guide/themes.md#pagenext_page ##### Global Context @@ -323,7 +1009,7 @@ overriding blocks in the same manner as the built-in themes. Third party themes are encouraged to wrap the various pieces of their templates in blocks in order to support such customization. -[blocks]: ../user-guide/styling-your-docs/#overriding-template-blocks +[blocks]: ../user-guide/customizing-your-theme.md#overriding-template-blocks #### Auto-Populated `extra_css` and `extra_javascript` Deprecated. (#986) @@ -336,7 +1022,7 @@ included in the HTML templates. In other words, they will still be copied to the `site-dir`, but they will not have any effect on the theme if they are not explicitly listed. -All CSS and javaScript files in the `docs_dir` should be explicitly listed in +All CSS and JavaScript files in the `docs_dir` should be explicitly listed in the `extra_css` or `extra_javascript` config settings going forward. #### Support for dirty builds. (#990) @@ -367,7 +1053,7 @@ the `docs_dir` is set to the directory which contains your config file rather than a child directory. You will need to rearrange you directory structure to better conform with the documented [layout]. -[layout]: ../user-guide/writing-your-docs/#file-layout +[layout]: ../user-guide/writing-your-docs.md#file-layout ### Other Changes and Additions to Version 0.16.0 @@ -434,19 +1120,19 @@ details about these specific themes. * [MkDocs Bootstrap] * [MkDocs Bootswatch] -[MkDocs Bootstrap]: http://mkdocs.github.io/mkdocs-bootstrap/ -[MkDocs Bootswatch]: http://mkdocs.github.io/mkdocs-bootswatch/ +[MkDocs Bootstrap]: https://mkdocs.github.io/mkdocs-bootstrap/ +[MkDocs Bootswatch]: https://mkdocs.github.io/mkdocs-bootswatch/ They will be included with MkDocs by default until a future release. After that they will be installable with pip: `pip install mkdocs-bootstrap` and `pip install mkdocs-bootswatch` -See the documentation for [Styling your docs] for more information about using +See the documentation for [Customizing Your Theme] for more information about using and customizing themes and [Custom themes] for creating and distributing new themes -[Styling your docs]: /user-guide/styling-your-docs.md -[Custom themes]: /user-guide/custom-themes.md +[Customizing Your Theme]: ../user-guide/customizing-your-theme.md +[Custom themes]: ../dev-guide/themes.md ### Other Changes and Additions to Version 0.15.0 @@ -467,9 +1153,9 @@ themes * Bugfix: Provide filename to Read the Docs. (#721 and RTD#1480) * Bugfix: Silence Click's unicode_literals warning. (#708) -[site_description]: /user-guide/configuration.md#site_description -[site_author]: /user-guide/configuration.md#site_author -[ReadTheDocs]: /user-guide/styling-your-docs.md#readthedocs +[site_description]: ../user-guide/configuration.md#site_description +[site_author]: ../user-guide/configuration.md#site_author +[ReadTheDocs]: ../user-guide/choosing-your-theme.md#readthedocs ## Version 0.14.0 (2015-06-09) @@ -527,7 +1213,7 @@ This new file is created on every MkDocs build (with `mkdocs build`) and no configuration is needed to enable it. [future release]: https://github.com/mkdocs/mkdocs/pull/481 -[site_dir]: /user-guide/configuration.md#site_dir +[site_dir]: ../user-guide/configuration.md#site_dir #### Change the pages configuration @@ -535,8 +1221,8 @@ Provide a [new way] to define pages, and specifically [nested pages], in the mkdocs.yml file and deprecate the existing approach, support will be removed with MkDocs 1.0. -[new way]: /user-guide/writing-your-docs.md#configure-pages-and-navigation -[nested pages]: /user-guide/writing-your-docs.md#multilevel-documentation +[new way]: ../user-guide/writing-your-docs.md#configure-pages-and-navigation +[nested pages]: ../user-guide/writing-your-docs.md#multilevel-documentation #### Warn users about the removal of builtin themes @@ -553,8 +1239,8 @@ JavaScript library [lunr.js]. It has been added to both the `mkdocs` and `readthedocs` themes. See the custom theme documentation on [supporting search] for adding it to your own themes. -[lunr.js]: http://lunrjs.com/ -[supporting search]: /user-guide/styling-your-docs.md#search-and-themes +[lunr.js]: https://lunrjs.com/ +[supporting search]: ../dev-guide/themes.md#search-and-themes #### New Command Line Interface @@ -582,10 +1268,10 @@ can also use Jinja2 syntax and take advantage of the [global variables]. By default MkDocs will use this approach to create a sitemap for the documentation. -[extra_javascript]: /user-guide/configuration.md#extra_javascript -[extra_css]: /user-guide/configuration.md#extra_css -[extra_templates]: /user-guide/configuration.md#extra_templates -[global variables]: /user-guide/styling-your-docs.md#global-context +[extra_javascript]: ../user-guide/configuration.md#extra_javascript +[extra_css]: ../user-guide/configuration.md#extra_css +[extra_templates]: ../user-guide/configuration.md#extra_templates +[global variables]: ../dev-guide/themes.md#global-context ### Other Changes and Additions to Version 0.13.0 @@ -602,9 +1288,9 @@ documentation. called index.md (#535) * Bugfix: Fix errors with Unicode filenames (#542). -[extra config]: /user-guide/configuration.md#extra -[Markdown extension configuration options]: /user-guide/configuration.md#markdown_extensions -[wheels]: http://pythonwheels.com/ +[extra config]: ../user-guide/configuration.md#extra +[Markdown extension configuration options]: ../user-guide/configuration.md#markdown_extensions +[wheels]: https://pythonwheels.com/ ## Version 0.12.2 (2015-04-22) @@ -632,7 +1318,7 @@ documentation. * Add favicon support to the ReadTheDocs theme HTML. (#422) * Automatically refresh the browser when files are edited. (#163) * Bugfix: Never re-write URLs in code blocks. (#240) -* Bugfix: Don't copy ditfiles when copying media from the `docs_dir`. (#254) +* Bugfix: Don't copy dotfiles when copying media from the `docs_dir`. (#254) * Bugfix: Fix the rendering of tables in the ReadTheDocs theme. (#106) * Bugfix: Add padding to the bottom of all bootstrap themes. (#255) * Bugfix: Fix issues with nested Markdown pages and the automatic pages diff --git a/docs/css/extra.css b/docs/css/extra.css index 29f4d9a440..cf2d58e530 100644 --- a/docs/css/extra.css +++ b/docs/css/extra.css @@ -25,3 +25,25 @@ code.no-highlight { dd { padding-left: 20px; } + +/* Homepage */ + +body.homepage div.jumbotron { + margin-top: 1.5rem; + padding-top: 1rem; + padding-bottom: 0; +} + +body.homepage div.jumbotron div.card { + margin-bottom: 2rem; +} + +body.homepage>div.container>div.row>div.col-md-3 { + display: none; +} + +body.homepage>div.container>div.row>div.col-md-9 { + margin-left: 0; + flex: 0 0 100%; + max-width: 100%; +} diff --git a/docs/dev-guide/index.md b/docs/dev-guide/index.md new file mode 100644 index 0000000000..b91d76a5db --- /dev/null +++ b/docs/dev-guide/index.md @@ -0,0 +1,16 @@ +# Developer Guide + +Extending MkDocs + +--- + +The MkDocs Developer Guide provides documentation for developers of third +party themes and plugins. Please see the [Contributing Guide] for information +on contributing to MkDocs itself. You can jump directly to a page listed +below, or use the *next* and *previous* buttons in the navigation bar at the +top of the page to move through the documentation in order. + +- [Themes](themes.md) +- [Plugins](plugins.md) + +[Contributing Guide]: ../about/contributing.md diff --git a/docs/user-guide/plugins.md b/docs/dev-guide/plugins.md similarity index 63% rename from docs/user-guide/plugins.md rename to docs/dev-guide/plugins.md index def5e6b760..79ed297950 100644 --- a/docs/user-guide/plugins.md +++ b/docs/dev-guide/plugins.md @@ -14,7 +14,8 @@ appropriate package name and install it using `pip`: pip install mkdocs-foo-plugin Once a plugin has been successfully installed, it is ready to use. It just needs -to be [enabled](#using-plugins) in the configuration file. +to be [enabled](#using-plugins) in the configuration file. The [MkDocs Plugins] +wiki page has a growing list of plugins that you can install and use. ## Using Plugins @@ -59,7 +60,7 @@ points to it. ### BasePlugin -A subclass of `mkdocs.pluhgins.BasePlugin` should define the behavior of the plugin. +A subclass of `mkdocs.plugins.BasePlugin` should define the behavior of the plugin. The class generally consists of actions to perform on specific events in the build process as well as a configuration scheme for the plugin. @@ -67,19 +68,46 @@ All `BasePlugin` subclasses contain the following attributes: #### config_scheme -: A tuple of configuration validation class instances (to be defined in a subclass). +: A tuple of configuration validation instances. Each item must consist of a + two item tuple in which the first item is the string name of the + configuration option and the second item is an instance of + `mkdocs.config.config_options.BaseConfigOption` or any of its subclasses. + + For example, the following `config_scheme` defines three configuration options: `foo`, which accepts a string; `bar`, which accepts an integer; and `baz`, which accepts a boolean value. + + class MyPlugin(mkdocs.plugins.BasePlugin): + config_scheme = ( + ('foo', mkdocs.config.config_options.Type(str, default='a default value')), + ('bar', mkdocs.config.config_options.Type(int, default=0)), + ('baz', mkdocs.config.config_options.Type(bool, default=True)) + ) + + When the user's configuration is loaded, the above scheme will be used to + validate the configuration and fill in any defaults for settings not + provided by the user. The validation classes may be any of the classes + provided in `mkdocs.config.config_options` or a third party subclass defined + in the plugin. + + Any settings provided by the user which fail validation or are not defined + in the `config_scheme` will raise a `mkdocs.config.base.ValidationError`. #### config -: A dictionary of configuration options for the plugin which is populated by the - `load_config` method. +: A dictionary of configuration options for the plugin, which is populated by + the `load_config` method after configuration validation has completed. Use + this attribute to access options provided by the user. + + def on_pre_build(self, config): + if self.config['bool_option']: + # implement "bool_option" functionality here... All `BasePlugin` subclasses contain the following method(s): #### load_config(options) -: Loads configuration from a dictionary of options. Returns a tuple of `(errors, - warnings)`. +: Loads configuration from a dictionary of options. Returns a tuple of + `(errors, warnings)`. This method is called by MkDocs during configuration + validation and should not need to be called by the plugin. #### on_<event_name>() @@ -122,11 +150,12 @@ entire site. : The `serve` event is only called when the `serve` command is used during development. It is passed the `Server` instance which can be modified before it is activated. For example, additional files or directories could be added - to the list of "watched" filed for auto-reloading. + to the list of "watched" files for auto-reloading. Parameters: : __server:__ `livereload.Server` instance : __config:__ global configuration object + : __builder:__ a callable which gets passed to each call to `server.watch` Returns: : `livereload.Server` instance @@ -151,14 +180,30 @@ entire site. Parameters: : __config:__ global configuration object +##### on_files + +: The `files` event is called after the files collection is populated from the + `docs_dir`. Use this event to add, remove, or alter files in the + collection. Note that Page objects have not yet been associated with the + file objects in the collection. Use [Page Events] to manipulate page + specific data. + + Parameters: + : __files:__ global files collection + : __config:__ global configuration object + + Returns: + : global files collection + ##### on_nav : The `nav` event is called after the site navigation is created and can be used to alter the site navigation. Parameters: - : __site_navigation:__ global navigation object + : __nav:__ global navigation object : __config:__ global configuration object + : __files:__ global files collection Returns: : global navigation object @@ -166,12 +211,12 @@ entire site. ##### on_env : The `env` event is called after the Jinja template environment is created - and can be used to alter the Jinja environment. + and can be used to alter the [Jinja environment](https://jinja.palletsprojects.com/en/latest/api/#jinja2.Environment). Parameters: : __env:__ global Jinja environment : __config:__ global configuration object - : __site_navigation:__ global navigation object + : __files:__ global files collection Returns: : global Jinja Environment @@ -184,6 +229,17 @@ entire site. Parameters: : __config:__ global configuration object +##### on_build_error + +: The `build_error` event is called after an exception of any kind + is caught by MkDocs during the build process. + Use this event to clean things up before MkDocs terminates. Note that any other + events which were scheduled to run after the error will have been skipped. See + [Handling Errors] for more details. + + Parameters: + : __error:__ exception raised + #### Template Events Template events are called once for each non-page template. Each template event @@ -194,15 +250,15 @@ called after the [env] event and before any [page events]. ##### on_pre_template : The `pre_template` event is called immediately after the subject template is - loaded and can be used to alter the content of the template. + loaded and can be used to alter the template. Parameters: - : __template__: the template contents as string + : __template__: a Jinja2 [Template] object : __template_name__: string filename of template : __config:__ global configuration object Returns: - : template contents as string + : a Jinja2 [Template] object ##### on_template_context @@ -236,8 +292,8 @@ called after the [env] event and before any [page events]. #### Page Events Page events are called once for each Markdown page included in the site. All -page events are called after the [post_template] event and before the [post_build] -event. +page events are called after the [post_template] event and before the +[post_build] event. ##### on_pre_page @@ -247,7 +303,7 @@ event. Parameters: : __page:__ `mkdocs.nav.Page` instance : __config:__ global configuration object - : __site_navigation:__ global navigation object + : __files:__ global files collection Returns: : `mkdocs.nav.Page` instance @@ -275,7 +331,7 @@ event. : __markdown:__ Markdown source text of page as string : __page:__ `mkdocs.nav.Page` instance : __config:__ global configuration object - : __site_navigation:__ global navigation object + : __files:__ global files collection Returns: : Markdown source text of page as string @@ -290,7 +346,7 @@ event. : __html:__ HTML rendered from Markdown source as string : __page:__ `mkdocs.nav.Page` instance : __config:__ global configuration object - : __site_navigation:__ global navigation object + : __files:__ global files collection Returns: : HTML rendered from Markdown source as string @@ -304,31 +360,88 @@ event. : __context__: dict of template context variables : __page:__ `mkdocs.nav.Page` instance : __config:__ global configuration object - : __site_navigation:__ global navigation object + : __nav:__ global navigation object Returns: : dict of template context variables ##### on_post_page -: The `post_template` event is called after the template is rendered, but +: The `post_page` event is called after the template is rendered, but before it is written to disc and can be used to alter the output of the page. If an empty string is returned, the page is skipped and nothing is written to disc. Parameters: - : __output_content:__ output of rendered template as string + : __output:__ output of rendered template as string : __page:__ `mkdocs.nav.Page` instance : __config:__ global configuration object - : __site_navigation:__ global navigation object Returns: : output of rendered template as string +### Handling Errors + +MkDocs defines four error types: + +#### `mkdocs.exceptions.MkDocsException` + +: The base class which all MkDocs exceptions inherit from. This should + not be raised directly. One of the subclasses should be raised instead. + +#### `mkdocs.exceptions.ConfigurationError` + +: This error is raised by configuration validation when a validation error + is encountered. This error should be raised by any configuration options + defined in a plugin's [config_scheme]. + +#### `mkdocs.exceptions.BuildError` + +: This error may be raised by MkDocs during the build process. Plugins should + not raise this error. + +#### `mkdocs.exceptions.PluginError` + +: A subclass of `mkdocs.exceptions.BuildError` which can be raised by plugin + events. + +Unexpected and uncaught exceptions will interrupt the build process and produce +typical Python tracebacks, which are useful for debugging your code. However, +users generally find tracebacks overwhelming and often miss the helpful error +message. Therefore, MkDocs will catch any of the errors listed above, retrieve +the error message, and exit immediately with only the helpful message displayed +to the user. + +Therefore, you might want to catch any exceptions within your plugin and raise a +`PluginError`, passing in your own custom-crafted message, so that the build +process is aborted with a helpful message. + +The [on_build_error] event will be triggered for any exception. + +For example: + +```python +from mkdocs.exceptions import PluginError +from mkdocs.plugins import BasePlugin + + +class MyPlugin(BasePlugin): + def on_post_page(self, output, page, config, **kwargs): + try: + # some code that could throw a KeyError + ... + except KeyError as error: + raise PluginError(str(error)) + + def on_build_error(self, error): + # some code to clean things up + ... +``` + ### Entry Point Plugins need to be packaged as Python libraries (distributed on PyPI separate -from MkDocs) and each must register as a Plugin via a setuptools entry_point. +from MkDocs) and each must register as a Plugin via a setuptools `entry_points`. Add the following to your `setup.py` script: ```python @@ -344,7 +457,7 @@ The `pluginname` would be the name used by users (in the config file) and (`from path.to.some_plugin import SomePluginClass`) where `SomePluginClass` is a subclass of [BasePlugin] which defines the plugin behavior. Naturally, multiple Plugin classes could exist in the same module. Simply define each as a separate -entry_point. +entry point. ```python entry_points={ @@ -356,17 +469,22 @@ entry_points={ ``` Note that registering a plugin does not activate it. The user still needs to -tell MkDocs to use if via the config. +tell MkDocs to use it via the config. [BasePlugin]:#baseplugin -[config]: configuration.md#plugins +[config]: ../user-guide/configuration.md#plugins [entry point]: #entry-point [env]: #on_env [events]: #events -[extra_templates]: configuration.md#extra_templates +[extra_templates]: ../user-guide/configuration.md#extra_templates [Global Events]: #global-events [Page Events]: #page-events [post_build]: #on_post_build [post_template]: #on_post_template -[static_templates]: configuration.md#static_templates +[static_templates]: ../user-guide/configuration.md#static_templates [Template Events]: #template-events +[MkDocs Plugins]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins +[on_build_error]: #on_build_error +[Handling Errors]: #handling-errors +[config_scheme]: #config_scheme +[Template]: http://code.nabla.net/doc/jinja2/api/jinja2/environment/jinja2.environment.Template.html diff --git a/docs/dev-guide/themes.md b/docs/dev-guide/themes.md new file mode 100644 index 0000000000..9e72171603 --- /dev/null +++ b/docs/dev-guide/themes.md @@ -0,0 +1,1154 @@ +# Developing Themes + +A guide to creating and distributing custom themes. + +--- + +!!! Note + + If you are looking for existing third party themes, they are listed in the + MkDocs [community wiki]. If you want to share a theme you create, you + should list it on the Wiki. + +When creating a new theme, you can either follow the steps in this guide to +create one from scratch or you can download the `mkdocs-basic-theme` as a +basic, yet complete, theme with all the boilerplate required. **You can find +this base theme on [GitHub][basic theme]**. It contains detailed comments in +the code to describe the different features and their usage. + +[community wiki]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes +[basic theme]: https://github.com/mkdocs/mkdocs-basic-theme + +## Creating a custom theme + +The bare minimum required for a custom theme is a `main.html` [Jinja2 +template] file which is placed in a directory that is *not* a child of the +[docs_dir]. Within `mkdocs.yml`, set the [`theme.custom_dir`][custom_dir] +option to the path of the directory containing `main.html`. The path should be +relative to the configuration file. For example, given this example project +layout: + +```no-highlight +mkdocs.yml +docs/ + index.md + about.md +custom_theme/ + main.html + ... +``` + +... you would include the following settings in `mkdocs.yml` to use the custom theme +directory: + +```yaml +theme: + name: null + custom_dir: 'custom_theme/' +``` + +!!! Note + + Generally, when building your own custom theme, the theme.[name] + configuration setting would be set to `null`. However, if the + theme.[custom_dir] configuration value is used in combination with an + existing theme, the theme.[custom_dir] can be used to replace only specific + parts of a built-in theme. For example, with the above layout and if you set + `name: "mkdocs"` then the `main.html` file in the theme.[custom_dir] would + replace the file of the same name in the `mkdocs` theme but otherwise the + `mkdocs` theme would remain unchanged. This is useful if you want to make + small adjustments to an existing theme. + + For more specific information, see [Customizing Your Theme]. + +!!! Warning + + A theme's [configuration] defined in a `mkdocs_theme.yml` file is not loaded + from `theme.custom_dir`. When an entire theme exists in `theme.custom_dir` + and `theme.name` is set to `null`, then the entire theme configuration must + be defined in the [theme] configuration option in the `mkdocs.yml` file. + + However, when a theme is [packaged] up for distribution, and loaded using + the `theme.name` configuration option, then a `mkdocs_theme.yml` file + is required for the theme. + +[Customizing Your Theme]: ../user-guide/customizing-your-theme.md#using-the-theme-custom_dir +[custom_dir]: ../user-guide/configuration.md#custom_dir +[name]: ../user-guide/configuration.md#name +[docs_dir]: ../user-guide/configuration.md#docs_dir +[configuration]: #theme-configuration +[packaged]: #packaging-themes +[theme]: ../user-guide/configuration.md#theme + +## Basic theme + +The simplest `main.html` file is the following: + +```django + + + + {% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }} + + + {{ page.content }} + + +``` + +The body content from each page specified in `mkdocs.yml` is inserted using the +`{{ page.content }}` tag. Style-sheets and scripts can be brought into this +theme as with a normal HTML file. Navbars and tables of contents can also be +generated and included automatically, through the `nav` and `toc` objects, +respectively. If you wish to write your own theme, it is recommended to start +with one of the [built-in themes] and modify it accordingly. + +!!! Note + + As MkDocs uses [Jinja] as its template engine, you have access to all the + power of Jinja, including [template inheritance]. You may notice that the + themes included with MkDocs make extensive use of template inheritance and + blocks, allowing users to easily override small bits and pieces of the + templates from the theme [custom_dir]. Therefore, the built-in themes are + implemented in a `base.html` file, which `main.html` extends. Although not + required, third party template authors are encouraged to follow a similar + pattern and may want to define the same [blocks] as are used in the built-in + themes for consistency. + +[Jinja]: http://jinja.pocoo.org/ +[template inheritance]: http://jinja.pocoo.org/docs/dev/templates/#template-inheritance +[theme_dir]: ../user-guide/customizing-your-theme.md#using-the-theme_dir +[blocks]: ../user-guide/customizing-your-theme.md#overriding-template-blocks + +## Theme Files + +There are various files which a theme treats special in some way. Any other +files are simply copied from the theme directory to the same path in the +`site_dir` when the site it built. For example image and CSS files have no +special significance and are copied as-is. Note, however, that if the user +provides a file with the same path in their `docs_dir`, then the user's file +will replace the theme file. + +### Template Files + +Any files with the `.html` extension are considered to be template files and are +not copied from the theme directory or any subdirectories. Also, any files +listed in [static_templates] are treated as templates regardless of their file +extension. + +[static_templates]: #static_templates + +### Theme Meta Files + +The various files required for packaging a theme are also ignored. Specifically, +the `mkdocs_theme.yml` configuration file and any Python files. + +### Dot Files + +Theme authors can explicitly force MkDocs to ignore files by starting a file or +directory name with a dot. Any of the following files would be ignored: + +```text +.ignored.txt +.ignored/file.txt +foo/.ignored.txt +foo/.ignored/file.txt +``` + +### Documentation Files + +All documentation files are ignored. Specifically, any Markdown files (using any +of the file extensions supported by MKDocs). Additionally, any README files +which may exist in the theme directories are ignored. + +## Template Variables + +Each template in a theme is built with a template context. These are the +variables that are available to themes. The context varies depending on the +template that is being built. At the moment templates are either built with +the global context or with a page specific context. The global context is used +for HTML pages that don't represent an individual Markdown document, for +example a 404.html page or search.html. + +### Global Context + +The following variables are available globally on any template. + +#### config + +The `config` variable is an instance of MkDocs' config object generated from the +`mkdocs.yml` config file. While you can use any config option, some commonly +used options include: + +* [config.site_name](../user-guide/configuration.md#site_name) +* [config.site_url](../user-guide/configuration.md#site_url) +* [config.site_author](../user-guide/configuration.md#site_author) +* [config.site_description](../user-guide/configuration.md#site_description) +* [config.theme.locale](../user-guide/configuration.md#locale) (See also + [Theme Configuration](#locale) below) +* [config.extra_javascript](../user-guide/configuration.md#extra_javascript) +* [config.extra_css](../user-guide/configuration.md#extra_css) +* [config.repo_url](../user-guide/configuration.md#repo_url) +* [config.repo_name](../user-guide/configuration.md#repo_name) +* [config.copyright](../user-guide/configuration.md#copyright) +* [config.google_analytics](../user-guide/configuration.md#google_analytics) + +#### nav + +The `nav` variable is used to create the navigation for the documentation. The +`nav` object is an iterable of [navigation objects](#navigation-objects) as +defined by the [nav] configuration setting. + +[nav]: ../user-guide/configuration.md#nav + +In addition to the iterable of [navigation objects](#navigation-objects), the +`nav` object contains the following attributes: + +##### nav.homepage + +The [page](#page) object for the homepage of the site. + +##### nav.pages + +A flat list of all [page](#page) objects contained in the navigation. This list +is not necessarily a complete list of all site pages as it does not contain +pages which are not included in the navigation. This list does match the list +and order of pages used for all "next page" and "previous page" links. For a +list of all pages, use the [pages](#pages) template variable. + +##### Nav Example + +Following is a basic usage example which outputs the first and second level +navigation as a nested list. + +```django +{% if nav|length>1 %} +
    + {% for nav_item in nav %} + {% if nav_item.children %} +
  • {{ nav_item.title }} + +
  • + {% else %} + + {% endif %} + {% endfor %} +
+{% endif %} +``` + +#### base_url + +The `base_url` provides a relative path to the root of the MkDocs project. While +this can be used directly by prepending it to a local relative URL, it is best +to use the [url](#url) template filter, which is smarter about how it applies +`base_url`. + +#### mkdocs_version + +Contains the current MkDocs version. + +#### build_date_utc + +A Python datetime object that represents the date and time the documentation +was built in UTC. This is useful for showing how recently the documentation +was updated. + +#### pages + +A flat list of `File` objects for *all* pages in the project. This list can +contain pages not included in the global [navigation](#nav) and may not match +the order of pages within that navigation. The [page](#page) object for each +`File` can be accessed from `file.page`. + +#### page + +In templates which are not rendered from a Markdown source file, the `page` +variable is `None`. In templates which are rendered from a Markdown source file, +the `page` variable contains a `page` object. The same `page` objects are used +as `page` [navigation objects](#navigation-objects) in the global +[navigation](#nav) and in the [pages](#pages) template variable. + +All `page` objects contain the following attributes: + +##### page.title + +Contains the Title for the current page. + +##### page.content + +The rendered Markdown as HTML, this is the contents of the documentation. + +##### page.toc + +An iterable object representing the Table of contents for a page. Each item in +the `toc` is an `AnchorLink` which contains the following attributes: + +* `AnchorLink.title`: The text of the item. +* `AnchorLink.url`: The hash fragment of a URL pointing to the item. +* `AnchorLink.level`: The zero-based level of the item. +* `AnchorLink.children`: An iterable of any child items. + +The following example would display the top two levels of the Table of Contents +for a page. + +```django + +``` + +##### page.meta + +A mapping of the metadata included at the top of the markdown page. In this +example we define a `source` property above the page title. + +```no-highlight +source: generics.py + mixins.py + +# Page title + +Content... +``` + +A template can access this metadata for the page with the `meta.source` +variable. This could then be used to link to source files related to the +documentation page. + +```django +{% for filename in page.meta.source %} + + {{ filename }} + +{% endfor %} +``` + +##### page.url + +The URL of the page relative to the MkDocs `site_dir`. It is expected that this +be used with the [url](#url) filter to ensure the URL is relative to the current +page. + +```django +{{ page.title }} +``` + +[base_url]: #base_url + +##### page.abs_url + +The absolute URL of the page from the server root as determined by the value +assigned to the [site_url] configuration setting. The value includes any +subdirectory included in the `site_url`, but not the domain. [base_url] should +not be used with this variable. + +For example, if `site_url: https://example.com/`, then the value of +`page.abs_url` for the page `foo.md` would be `/foo/`. However, if +`site_url: https://example.com/bar/`, then the value of `page.abs_url` for the +page `foo.md` would be `/bar/foo/`. + +[site_url]: ../user-guide/configuration.md#site_url + +##### page.canonical_url + +The full, canonical URL to the current page as determined by the value assigned +to the [site_url] configuration setting. The value includes the domain and any +subdirectory included in the `site_url`. [base_url] should not be used with this +variable. + +##### page.edit_url + +The full URL to the source page in the source repository. Typically used to +provide a link to edit the source page. [base_url] should not be used with this +variable. + +##### page.is_homepage + +Evaluates to `True` for the homepage of the site and `False` for all other +pages. This can be used in conjunction with other attributes of the `page` +object to alter the behavior. For example, to display a different title +on the homepage: + +```django +{% if not page.is_homepage %}{{ page.title }} - {% endif %}{{ site_name }} +``` + +##### page.previous_page + +The page object for the previous page or `None`. The value will be `None` if the +current page is the first item in the site navigation or if the current page is +not included in the navigation at all. When the value is a page object, the +usage is the same as for `page`. + +##### page.next_page + +The page object for the next page or `None`. The value will be `None` if the +current page is the last item in the site navigation or if the current page is +not included in the navigation at all. When the value is a page object, the +usage is the same as for `page`. + +##### page.parent + +The immediate parent of the page in the [site navigation](#nav). `None` if the +page is at the top level. + +##### page.children + +Pages do not contain children and the attribute is always `None`. + +##### page.active + +When `True`, indicates that this page is the currently viewed page. Defaults +to `False`. + +##### page.is_section + +Indicates that the navigation object is a "section" object. Always `False` for +page objects. + +##### page.is_page + +Indicates that the navigation object is a "page" object. Always `True` for +page objects. + +##### page.is_link + +Indicates that the navigation object is a "link" object. Always `False` for +page objects. + +### Navigation Objects + +Navigation objects contained in the [nav](#nav) template variable may be one of +[section](#section) objects, [page](#page) objects, and [link](#link) objects. +While section objects may contain nested navigation objects, pages and links do +not. + +Page objects are the full page object as used for the current [page](#page) with +all of the same attributes available. Section and Link objects contain a subset +of those attributes as defined below: + +#### Section + +A `section` navigation object defines a named section in the navigation and +contains a list of child navigation objects. Note that sections do not contain +URLs and are not links of any kind. However, by default, MkDocs sorts index +pages to the top and the first child might be used as the URL for a section if a +theme chooses to do so. + + The following attributes are available on `section` objects: + +##### section.title + +The title of the section. + +##### section.parent + +The immediate parent of the section or `None` if the section is at the top +level. + +##### section.children + +An iterable of all child navigation objects. Children may include nested +sections, pages and links. + +##### section.active + +When `True`, indicates that a child page of this section is the current page and +can be used to highlight the section as the currently viewed section. Defaults +to `False`. + +##### section.is_section + +Indicates that the navigation object is a "section" object. Always `True` for +section objects. + +##### section.is_page + +Indicates that the navigation object is a "page" object. Always `False` for +section objects. + +##### section.is_link + +Indicates that the navigation object is a "link" object. Always `False` for +section objects. + +#### Link + +A `link` navigation object contains a link which does not point to an internal +MkDocs page. The following attributes are available on `link` objects: + +##### link.title + +The title of the link. This would generally be used as the label of the link. + +##### link.url + +The URL that the link points to. The URL should always be an absolute URLs and +should not need to have `base_url` prepended. + +##### link.parent + +The immediate parent of the link. `None` if the link is at the top level. + +##### link.children + +Links do not contain children and the attribute is always `None`. + +##### link.active + +External links cannot be "active" and the attribute is always `False`. + +##### link.is_section + +Indicates that the navigation object is a "section" object. Always `False` for +link objects. + +##### link.is_page + +Indicates that the navigation object is a "page" object. Always `False` for +link objects. + +##### link.is_link + +Indicates that the navigation object is a "link" object. Always `True` for +link objects. + +### Extra Context + +Additional variables can be passed to the template with the +[`extra`](../user-guide/configuration.md#extra) configuration option. This is a +set of key value pairs that can make custom templates far more flexible. + +For example, this could be used to include the project version of all pages +and a list of links related to the project. This can be achieved with the +following `extra` configuration: + +```yaml +extra: + version: 0.13.0 + links: + - https://github.com/mkdocs + - https://docs.readthedocs.org/en/latest/builds.html#mkdocs + - https://www.mkdocs.org/ +``` + +And then displayed with this HTML in the custom theme. + +```django +{{ config.extra.version }} + +{% if config.extra.links %} +
    + {% for link in config.extra.links %} +
  • {{ link }}
  • + {% endfor %} +
+{% endif %} +``` + +## Template Filters + +In addition to [Jinja's default filters], the following custom filters are +available to use in MkDocs templates: + +### url + +Normalizes a URL. Absolute URLs are passed through unaltered. If the URL is +relative and the template context includes a page object, then the URL is +returned relative to the page object. Otherwise, the URL is returned with +[base_url](#base_url) prepended. + +```django +{{ page.title }} +``` + +### tojson + +Safety convert a Python object to a value in a JavaScript script. + +```django + +``` + +## Search and themes + +As of MkDocs version *0.17* client side search support has been added to MkDocs +via the `search` plugin. A theme needs to provide a few things for the plugin to +work with the theme. + +While the `search` plugin is activated by default, users can disable the plugin +and themes should account for this. It is recommended that theme templates wrap +search specific markup with a check for the plugin: + +```django +{% if 'search' in config['plugins'] %} + search stuff here... +{% endif %} +``` + +At its most basic functionality, the search plugin will simply provide an index +file which is no more than a JSON file containing the content of all pages. +The theme would need to implement its own search functionality client-side. +However, with a few settings and the necessary templates, the plugin can provide +a complete functioning client-side search tool based on [lunr.js]. + +The following HTML needs to be added to the theme so that the provided +JavaScript is able to properly load the search scripts and make relative links +to the search results from the current page. + +```django + +``` + +With properly configured settings, the following HTML in a template will add a +full search implementation to your theme. + +```django +

Search Results

+ +
+ +
+ +
+ Sorry, page not found. +
+``` + +The JavaScript in the plugin works by looking for the specific ID's used in the +above HTML. The form input for the user to type the search query must be +identified with `id="mkdocs-search-query"` and the div where the results will be +placed must be identified with `id="mkdocs-search-results"`. + +The plugin supports the following options being set in the [theme's +configuration file], `mkdocs_theme.yml`: + +### include_search_page + +Determines whether the search plugin expects the theme to provide a dedicated +search page via a template located at `search/search.html`. + +When `include_search_page` is set to `true`, the search template will be built +and available at `search/search.html`. This method is used by the `readthedocs` +theme. + +When `include_search_page` is set to `false` or not defined, it is expected that +the theme provide some other mechanisms for displaying search results. For +example, the `mkdocs` theme displays results on any page via a modal. + +### search_index_only + +Determines whether the search plugin should only generate a search index or a +complete search solution. + +When `search_index_only` is set to `false`, then the search plugin modifies the +Jinja environment by adding its own `templates` directory (with a lower +precedence than the theme) and adds its scripts to the `extra_javascript` config +setting. + +When `search_index_only` is set to `true` or not defined, the search plugin +makes no modifications to the Jinja environment. A complete solution using the +provided index file is the responsibility of the theme. + +The search index is written to a JSON file at `search/search_index.json` in the +[site_dir]. The JSON object contained within the file may contain up to three +objects. + +```json +{ + config: {...}, + data: [...], + index: {...} +} +``` + +If present, the `config` object contains the key/value pairs of config options +defined for the plugin in the user's `mkdocs.yml` config file under +`plugings.search`. The `config` object was new in MkDocs version *1.0*. + +The `data` object contains a list of document objects. Each document object is +made up of a `location` (URL), a `title`, and `text` which can be used to create +a search index and/or display search results. + +If present, the `index` object contains a pre-built index which offers +performance improvements for larger sites. Note that the pre-built index is only +created if the user explicitly enables the [prebuild_index] config option. +Themes should expect the index to not be present, but can choose to use the +index when it is available. The `index` object was new in MkDocs version *1.0*. + +[Jinja2 template]: http://jinja.pocoo.org/docs/dev/ +[built-in themes]: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/themes +[theme's configuration file]: #theme-configuration +[lunr.js]: https://lunrjs.com/ +[site_dir]: ../user-guide/configuration.md#site_dir +[prebuild_index]: ../user-guide/configuration.md#prebuild_index +[Jinja's default filters]: https://jinja.palletsprojects.com/en/latest/templates/#builtin-filters + +## Packaging Themes + +MkDocs makes use of [Python packaging] to distribute themes. This comes with a +few requirements. + +To see an example of a package containing one theme, see the [MkDocs Bootstrap +theme] and to see a package that contains many themes, see the [MkDocs +Bootswatch theme]. + +!!! Note + + It is not strictly necessary to package a theme, as the entire theme + can be contained in the `custom_dir`. If you have created a "one-off theme," + that should be sufficient. However, if you intend to distribute your theme + for others to use, packaging the theme has some advantages. By packaging + your theme, your users can more easily install it, they can rely on a default + [configuration] being defined, and they can then take advantage of the + [custom_dir] to make tweaks to your theme to better suit their needs. + +[Python packaging]: https://packaging.python.org/en/latest/ +[MkDocs Bootstrap theme]: https://mkdocs.github.io/mkdocs-bootstrap/ +[MkDocs Bootswatch theme]: https://mkdocs.github.io/mkdocs-bootswatch/ + +### Package Layout + +The following layout is recommended for themes. Two files at the top level +directory called `MANIFEST.in` and `setup.py` beside the theme directory which +contains an empty `__init__.py` file, a theme configuration file +(`mkdocs-theme.yml`), and your template and media files. + +```no-highlight +. +|-- MANIFEST.in +|-- theme_name +| |-- __init__.py +| |-- mkdocs-theme.yml +| |-- main.html +| |-- styles.css +`-- setup.py +``` + +The `MANIFEST.in` file should contain the following contents but with +theme_name updated and any extra file extensions added to the include. + +```no-highlight +recursive-include theme_name *.ico *.js *.css *.png *.html *.eot *.svg *.ttf *.woff +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] +``` + +The `setup.py` should include the following text with the modifications +described below. + +```python +from setuptools import setup, find_packages + +VERSION = '0.0.1' + +setup( + name="mkdocs-themename", + version=VERSION, + url='', + license='', + description='', + author='', + author_email='', + packages=find_packages(), + include_package_data=True, + entry_points={ + 'mkdocs.themes': [ + 'themename = theme_name', + ] + }, + zip_safe=False +) +``` + +Fill in the URL, license, description, author and author email address. + +The name should follow the convention `mkdocs-themename` (like +`mkdocs-bootstrap` and `mkdocs-bootswatch`), starting with MkDocs, using +hyphens to separate words and including the name of your theme. + +Most of the rest of the file can be left unedited. The last section we need to +change is the entry_points. This is how MkDocs finds the theme(s) you are +including in the package. The name on the left is the one that users will use +in their mkdocs.yml and the one on the right is the directory containing your +theme files. + +The directory you created at the start of this section with the main.html file +should contain all of the other theme files. The minimum requirement is that +it includes a `main.html` for the theme. It **must** also include a +`__init__.py` file which should be empty, this file tells Python that the +directory is a package. + +### Theme Configuration + +A packaged theme is required to include a configuration file named +`mkdocs_theme.yml` which is placed in the root of your template files. The file +should contain default configuration options for the theme. However, if the +theme offers no configuration options, the file is still required and can be +left blank. A theme which is not packaged does not need a `mkdocs_theme.yml` +file as that file is not loaded from `theme.custom_dir`. + +The theme author is free to define any arbitrary options deemed necessary and +those options will be made available in the templates to control behavior. +For example, a theme might want to make a sidebar optional and include the +following in the `mkdocs_theme.yml` file: + +```yaml +show_sidebar: true +``` + +Then in a template, that config option could be referenced: + +```django +{% if config.theme.show_sidebar %} + +{% endif %} +``` + +And the user could override the default in their project's `mkdocs.yml` config +file: + +```yaml +theme: + name: themename + show_sidebar: false +``` + +In addition to arbitrary options defined by the theme, MkDocs defines a few +special options which alters its behavior: + +!!! block "" + + #### locale + + This option mirrors the [theme] config option of the same name. If this + value is not defined in the `mkdocs_theme.yml` file and the user does not + set it in `mkdocs.yml` then it will default to `en` (English). The value + is expected to match the language used in the text provided by the theme + (such a "next" and "previous" links) and should be used as the value of + the `` tag's `lang` attribute. See [Supporting theme localization/ + translation](#supporting-theme-localizationtranslation) for more + information. + + Note that during configuration validation, the provided string is converted + to a `Locale` object. The object contains `Locale.language` and + `Locale.territory` attributes and will resolve as a string from within a + template. Therefore, the following will work fine: + + + + If the locale was set to `fr_CA` (Canadian French), then the above template + would render as: + + + + If you did not want the territory attribute to be included, then reference + the `language` attribute directly: + + + + That would render as: + + + + #### static_templates + + This option mirrors the [theme] config option of the same name and allows + some defaults to be set by the theme. Note that while the user can add + templates to this list, the user cannot remove templates included in the + theme's config. + + #### extends + + Defines a parent theme that this theme inherits from. The value should be + the string name of the parent theme. Normal [Jinja inheritance rules] + apply. + +Plugins may also define some options which allow the theme to inform a plugin +about which set of plugin options it expects. See the documentation for any +plugins you may wish to support in your theme. + +### Distributing Themes + +With the above changes, your theme should now be ready to install. This can be +done with pip, using `pip install .` if you are still in the same directory as +the setup.py. + +Most Python packages, including MkDocs, are distributed on PyPI. To do this, +you should run the following command. + +```no-highlight +python setup.py register +``` + +If you don't have an account setup, you should be prompted to create one. + +For a much more detailed guide, see the official Python packaging +documentation for [Packaging and Distributing Projects]. + +[Packaging and Distributing Projects]: https://packaging.python.org/en/latest/distributing/ +[theme]: ../user-guide/configuration.md#theme +[Jinja inheritance rules]: https://jinja.palletsprojects.com/en/latest/templates/#template-inheritance + +## Supporting theme Localization/Translation + +While the built-in themes provide support for [localization/translation] of +templates, custom themes and third-party themes may choose not to. Regardless, +the [`locale`](#locale) setting of the `theme` configuration option is always +present and is relied upon by other parts of the system. Therefore, it is +recommended that all third-party themes use the same setting for designating a +language regardless of the system they use for translation. In that way, users +will experience consistent behavior regardless of the theme they may choose. + +The method for managing translations is up to the developers of a theme. +However, if a theme developer chooses to use the same mechanisms used by the +built-in themes, the sections below outline how to enable and make use of the +same commands utilized by MkDocs. + +[localization/translation]: ../user-guide/localizing-your-theme.md +[Theme Configuration]: #theme-configuration + +### Enabling the Localization/Translation commands + +MkDocs includes some helper commands which are light wrappers around [pybabel's +commands][pybabel]. To use the commands on your own theme, add the following to +your theme's `setup.py` script: + +```python +from mkdocs.commands.setup import babel_cmdclass + +setup( + ... + cmdclass=babel_cmdclass +) +``` + +Note that `cmdclass=babel_cmdclass` was added an a parameter passed to +the `setup` function. + +!!! warning + As **pybabel is not installed by default** and most users will not have + pybabel installed, theme developers and/or translators should make sure to + have installed the necessary dependencies + (using `pip install mkdocs[i18n]`) in order for the commands to be + available for use. + +[pybabel]: https://babel.pocoo.org/en/latest/setup.html + +### Using the Localization/Translation commands + +Since the translation commands are embedded in the `setup.py` script of your +custom theme they should be called from the root of your theme's working +tree as follows: + +```bash +python setup.py [OPTIONS] +``` + +Each command provides a detailed list of options available with the `-h/--help` +option. + +For an overview of the workflow used by MkDocs to translate the built-in +themes, see the appropriate [section] of the Contributing Guide and the +[Translation Guide]. + +Default values for many of the options to the commands can be defined in a +`setup.cfg` file. Create a section using the command name as the section name, +and the long option name as the key. See MkDocs' own [setup.cfg] file for an +example. + +A summary of changes/additions to the behavior and options of the upstream +[pybabel commands][pybabel] are summarized below. + +[section]: ../about/contributing.md#submitting-changes-to-the-builtin-themes +[Translation Guide]: translations.md +[setup.cfg]: https://github.com/mkdocs/mkdocs/blob/master/setup.cfg + +#### compile_catalog + +The `-t/--theme` option has been added to this command. The `theme` specified +must be a `theme` defined as a entry point in the same `setup.py` script. Other +themes will not be recognized. If only one `theme` has been defined as an entry +point, then that `theme` will be used as the default if none is specified by +this option. If more than one `theme` is defined as entry points, then no +default is set and a `theme` must be specified by this option. The command only +operates on one theme at a time. Therefore, the command needs to be run once +for each theme included in a package. + +When a `theme` is specified, the directory of that `theme` as defined in the +entry point is used to define a default value of the `-d/--directory` option. +The `--directory` option is set to `{theme_dir}/locales`. If a `directory` is +passed to the `--directory` option, then the `theme` option is ignored. + +#### extract_messages + +The `-t/--theme` option has been added to this command. The `theme` specified +must be a `theme` defined as a entry point in the same `setup.py` script. Other +themes will not be recognized. If only one `theme` has been defined as an entry +point, then that `theme` will be used as the default if none is specified by +this option. If more than one `theme` is defined as entry points, then no +default is set and a `theme` must be specified by this option. The command only +operates on one theme at a time. Therefore, the command needs to be run once +for each theme included in a package. + +When a `theme` is specified, the directory of that `theme` as defined in the +entry point is used to define a default value for the `--input-dirs` and +`--output-file` options. The `--input-dirs` option is set to the `theme` +directory and `--output-file` is set to `{theme_dir}/{domain}.pot`. If a path +is provided to either option, then the `theme` option is ignored for that +option. + +The `--domain` option has been added to this command and can be used to +override the `domain` used for the `output-file` based on the `theme`. +Defaults to `messages`. + +The `-F/--mapping-file` option defaults to the [mapping file] used by MkDocs' +built-in themes. However, if that mapping file does not meet your theme's needs +to can override it by providing your own and passing the path of that file into +the option. + +[mapping file]: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/themes/babel.cfg + +#### init_catalog + +The `-t/--theme` option has been added to this command. The `theme` specified +must be a `theme` defined as a entry point in the same `setup.py` script. Other +themes will not be recognized. If only one `theme` has been defined as an entry +point, then that `theme` will be used as the default if none is specified by +this option. If more than one `theme` is defined as entry points, then no +default is set and a `theme` must be specified by this option. The command only +operates on one theme at a time. Therefore, the command needs to be run once +for each theme included in a package. + +When a `theme` is specified, the directory of that `theme` as defined in the +entry point is used to define a default value for the `-i/--input-file` and +`-d/--output-dir` options. The `--input-file` option is set to +`{theme_dir}/{domain}.pot` (`domain` defaults to `messages`) and `--output-dir` +is set to `{theme_dir}/locales`. If a path is provided to either option, then +the `theme` option is ignored for that option. + +#### update_catalog + +The `-t/--theme` option has been added to this command. The `theme` specified +must be a `theme` defined as a entry point in the same `setup.py` script. Other +themes will not be recognized. If only one `theme` has been defined as an entry +point, then that `theme` will be used as the default if none is specified by +this option. If more than one `theme` is defined as entry points, then no +default is set and a `theme` must be specified by this option. The command only +operates on one theme at a time. Therefore, the command needs to be run once +for each theme included in a package. + +When a `theme` is specified, the directory of that `theme` as defined in the +entry point is used to define a default value for the `-i/--input-file` and +`-d/--output-dir` options. The `--input-file` option is set to +`{theme_dir}/{domain}.pot` (`domain` defaults to `messages`) and `--output-dir` +is set to `{theme_dir}/locales`. If a path is provided to either option, then +the `theme` option is ignored for that option. + +### Example custom theme Localization/Translation workflow + +!!! note + + If your theme inherits from an existing theme which already provides + translation catalogs, your theme's translations will be merged with the + parent theme's translations during a MkDocs build. + + This means that you only need to concentrate on the added translations. + Yet, you will still benefit from the translations of the parent theme. At + the same time, you may override any of parent theme's translations! + +Let's suppose that you're working on your own fork of the +[mkdocs-basic-theme][basic theme] and want to add translations to it. + +You would first modify the `setup.py` like this: + +```diff +--- a/setup.py ++++ b/setup.py +@@ -1,4 +1,5 @@ + from setuptools import setup, find_packages ++from mkdocs.commands.setup import babel_cmdclass + + VERSION = '1.1' + +@@ -18,5 +19,6 @@ setup( + 'basictheme = basic_theme', + ] + }, +- zip_safe=False ++ zip_safe=False, ++ cmdclass=babel_cmdclass + ) +``` + +Next, you would edit the templates by wrapping text in your HTML sources with +`{% trans %}` and `{% endtrans %}` as follows: + +```diff +--- a/basic_theme/base.html ++++ b/basic_theme/base.html +@@ -88,7 +88,7 @@ + + + +-

This is an example theme for MkDocs.

++

{% trans %}This is an example theme for MkDocs.{% endtrans %}

+ +

+ It is designed to be read by looking at the theme HTML which is heavily +``` + +Then you would follow the [Translation Guide] as usual to get your translations +running. + +### Packaging Translations with your theme + +While the Portable Object Template (`pot`) file created by the +`extract_messages` command and the Portable Object (`po`) files created by the +`init_catalog` and `update_catalog` commands are useful for creating and +editing translations, they are not used by MkDocs directly and do not need to +be included in a packaged release of a theme. When MkDocs builds a site with +translations, it only makes use of the binary `mo` files(s) for the specified +locale. Therefore, when [packaging a theme], you would need to make the +following addition to your `MANIFEST.in` file: + +``` no-highlight +recursive-include theme_name *.mo +``` + +Then, before building your Python package, you will want to ensure that the +binary `mo` file for each locale is up-to-date by running the `compile_catalog` +command for each locale. MkDocs expects the binary `mo` files to be located at +`locales//LC_MESSAGES/messages.mo`, which the `compile_catalog` +command automatically does for you. See [Testing theme translations] for +details. + +!!! note + + As outlined in our [Translation Guide], the MkDocs project has chosen to + include the `pot` and `po` files in our code repository, but not the + `mo` files. This requires us to always run `compile_catalog` before + packaging a new release regardless of whether any changes were made to a + translation or not. However, you may chose an alternate workflow for your + theme. At a minimum, you need to ensure that up-to-date `mo` files are + included at the correct location in each release. However, you may use a + different process for generating those `mo` files if you chose to do so. + +[packaging a theme]: #packaging-themes +[Testing theme translations]: translations.md#testing-theme-translations diff --git a/docs/dev-guide/translations.md b/docs/dev-guide/translations.md new file mode 100644 index 0000000000..554b06fef0 --- /dev/null +++ b/docs/dev-guide/translations.md @@ -0,0 +1,217 @@ +# Translations + +Theme localization guide. + +--- + +The [built-in themes] that are included with MkDocs provide support for +translations. This is a guide for translators, which documents the process for +contributing new translations and/or updating existing translations. For +guidance on modifying the existing themes, see the [Contributing Guide][update +themes]. To enable a specific translation see the documentation about the +specific theme you are using in the [User Guide][built-in themes]. For +translations of third-party themes, please see the documentation for those +themes. For a third-party theme to make use of MkDocs' translation tools and +methods, that theme must be properly [configured] to make use of those tools. + +!!! note + + Translations only apply to text contained within a theme's template, such + as "next" and "previous" links. The Markdown content of a page is not + translated. If you wish to create multilingual documentation, you need to + combine theme localization with a third-party + internationalization/localization plugin. + +[built-in themes]: ../user-guide/choosing-your-theme.md +[update themes]: ../about/contributing.md#submitting-changes-to-the-builtin-themes +[configured]: themes.md#supporting-theme-localizationtranslation + +## Localization tooling prerequisites + +Theme localization makes use of the [babel][babel] project for generation and +compilation of localization files. Custom commands are available from the +MkDocs' `setup.py` script as described below to assist with the process of +updating and contributing translations. You will need to be working from the +git working tree on your local machine to make use of the helper scripts. + +See the [Contributing Guide] for direction on how to [Install for Development] +and [Submit a Pull Request]. The instructions in this document assume that you +are working from a properly configured development environment. + +Make sure translation requirements are installed in your environment: + +```bash +pip install mkdocs[i18n] +``` + +[babel]: http://babel.pocoo.org/en/latest/cmdline.html +[Contributing Guide]: ../about/contributing.md +[Install for Development]: ../about/contributing.md#installing-for-development +[Submit a Pull Request]: ../about/contributing.md#submitting-pull-requests + +## Adding language translations to themes + +If your favorite language locale is not yet supported on one (or both) of the +built-in themes (`mkdocs` and `readthedocs`), you can easily contribute a +translation by following the steps below. + +Here is a quick summary of what you'll need to do: + +1. [Initialize new localization + catalogs](#initializing-the-localization-catalogs) for your language (if a + translation for your locale already exists, follow the instructions for + [updating theme localization + files](/user-guide/custom-themes/#localizing-themes) instead). +2. [Add a translation](#translating-the-mkdocs-themes) for every text + placeholder in the localized catalogs. +3. [Locally serve and test](#testing-theme-translations) the translated themes + for your language. +4. [Update the documentation](#updating-theme-documentation) about + supported translations for each translated theme. +5. [Contribute your translation](#contributing-translations) through a + Pull Request. + +!!! note + + Translation locales are usually identified using the [ISO-639-1] (2-letter) + language codes. While territory/region/county codes are also supported, + location specific translations should only be added after the general + language translation has been completed and the regional dialect requires + use of a term which differs from the general language translation. + +[ISO-639-1]: https://en.wikipedia.org/wiki/ISO_639-1 + +### Initializing the localization catalogs + +The templates for each theme contain text placeholders that have been extracted +into a Portable Object Template (`messages.pot`) file, which is present in each +theme's folder. + +Initializing a catalog consists of running a command which will create a +directory structure for your desired language and prepare a Portable Object +(`messages.po`) file derived from the `pot` file of the theme. + +Use the `init_catalog` command on each theme (`-t `) and provide the +appropriate language code (`-l `). For example, to add a translation +for the Spanish `es` language to the `mkdocs` theme, run the following command: + +```bash +python setup.py init_catalog -t mkdocs -l es +``` + +The above command will create the following file structure: + +```text +mkdocs/themes/mkdocs/locales +├── es +│   └── LC_MESSAGES +│   └── messages.po +``` + +You can now move on to the next step and [add a +translation](#translating-the-mkdocs-themes) for every text placeholder in the +localized catalog. + +## Updating a theme translation + +If a theme's `messages.pot` template file has been [updated][update themes] +since the `messages.po` was last updated for your locale, follow the steps +below to update the theme's `messages.po` file: + +1. [Update the theme's translation catalog](#updating-the-translation-catalogs) + to refresh the translatable text placeholders of each theme. +2. [Translate](#translating-the-mkdocs-themes) the newly added translatable + text placeholders on every `messages.po` catalog file language you can. +3. [Locally serve and test](#testing-theme-translations) the translated themes + for your language. +4. [Contribute your translation](#contributing-translations) through a + Pull Request. + +### Updating the translation catalogs + +This step should be completed after a theme template have been [updated][update +themes] for each language that you are comfortable contributing a translation +for. + +To update the `fr` translation catalog of the `mkdocs` theme, use the following +command: + +```bash +python setup.py update_catalog -t mkdocs -l fr +``` + +You can now move on to the next step and [add a translation] for every updated +text placeholder in the localized catalog. + +[add a translation]: #translating-the-mkdocs-themes + +### Translating the MkDocs themes + +Now that your localized `messages.po` files are ready, all you need to do is +add a translation in each `msgstr` item for each `msgid` item in the file. + +```text +msgid "Next" +msgstr "Siguiente" +``` + +!!! Warning + Do not modify the `msgid` as it is common to all translations. Just add + its translation in the `msgstr` item. + +Once you have finished translating all of the terms listed in the `po` file, +you'll want to [test your localized theme](#testing-theme-translations). + +### Testing theme translations + +To test a theme with translations, you need to first compile the `messages.po` +files of your theme into `messages.mo` files. The following command will compile +the `es` translation for the `mkdocs` theme. + +```bash +python setup.py compile_catalog -t mkdocs -l es +``` + +The above command results in the following file structure: + +```text +mkdocs/themes/mkdocs/locales +├── es +│   └── LC_MESSAGES +│   ├── messages.mo +│   └── messages.po +``` + +Note that the compiled `messages.mo` file was generated based on the +`messages.po` file that you just edited. + +Then modify the `mkdocs.yml` file at the root of the project to test the new +and/or updated locale: + +```yaml +theme: + name: mkdocs + locale: es +``` + +Finally, run `mkdocs serve` to check out your new localized version of the theme. + +!!! Note + The build and release process takes care of compiling and distributing + all locales to end users so you only have to worry about contributing the + actual text translation `messages.po` files (the rest is ignored by git). + + After you have finished testing your work, be sure to undo the change to + the `locale` setting in the `mkdocs.yml` file before submitting your + changes. + +## Updating theme documentation + +Update the lists of supported translations for each translated theme located at +[Choosing your theme](../user-guide/choosing-your-theme.md) +(`docs/user-guide/choosing-your-theme.md`), in their __`locale`__ options. + +## Contributing translations + +It is now time for you to [contribute](../about/contributing.md) your nice work +to the project. Thank you! diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000000..cbcd0b53d0 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,222 @@ +# Getting Started with MkDocs + +An introductory tutorial! + +--- + +## Installation + +To install MkDocs, run the following command from the command line: + +```bash +pip install mkdocs +``` + +For more details, see the [Installation Guide]. + +## Creating a new project + +Getting started is super easy. To create a new project, run the following +command from the command line: + +```bash +mkdocs new my-project +cd my-project +``` + +Take a moment to review the initial project that has been created for you. + +![The initial MkDocs layout](img/initial-layout.png) + +There's a single configuration file named `mkdocs.yml`, and a folder named +`docs` that will contain your documentation source files (`docs` is +the default value for the [docs_dir] configuration setting). Right now the `docs` +folder just contains a single documentation page, named `index.md`. + +MkDocs comes with a built-in dev-server that lets you preview your documentation +as you work on it. Make sure you're in the same directory as the `mkdocs.yml` +configuration file, and then start the server by running the `mkdocs serve` +command: + +```bash +$ mkdocs serve +INFO - Building documentation... +INFO - Cleaning site directory +[I 160402 15:50:43 server:271] Serving on http://127.0.0.1:8000 +[I 160402 15:50:43 handlers:58] Start watching changes +[I 160402 15:50:43 handlers:60] Start detecting changes +``` + +Open up `http://127.0.0.1:8000/` in your browser, and you'll see the default +home page being displayed: + +![The MkDocs live server](img/screenshot.png) + +The dev-server also supports auto-reloading, and will rebuild your documentation +whenever anything in the configuration file, documentation directory, or theme +directory changes. + +Open the `docs/index.md` document in your text editor of choice, change the +initial heading to `MkLorum`, and save your changes. Your browser will +auto-reload and you should see your updated documentation immediately. + +Now try editing the configuration file: `mkdocs.yml`. Change the +[`site_name`][site_name] setting to `MkLorum` and save the file. + +```yaml +site_name: MkLorum +site_url: https://example.com/ +``` + +Your browser should immediately reload, and you'll see your new site name take +effect. + +![The site_name setting](img/site-name.png) + +!!! note + + The [`site_name`][site_name] and [`site_url`][site_url] configuration + options are the only two required options in your configuration file. When + you create a new project, the `site_url` option is assigned the placeholder + value: `https://example.com`. If the final location is known, you can change + the setting now to point to it. Or you may choose to leave it alone for now. + Just be sure to edit it before you deploy your site to a production server. + +## Adding pages + +Now add a second page to your documentation: + +```bash +curl 'https://jaspervdj.be/lorem-markdownum/markdown.txt' > docs/about.md +``` + +As our documentation site will include some navigation headers, you may want to +edit the configuration file and add some information about the order, title, and +nesting of each page in the navigation header by adding a [`nav`][nav] +setting: + +```yaml +site_name: MkLorum +site_url: https://example.com/ +nav: + - Home: index.md + - About: about.md +``` + +Save your changes and you'll now see a navigation bar with `Home` and `About` +items on the left as well as `Search`, `Previous`, and `Next` items on the +right. + +![Screenshot](img/multipage.png) + +Try the menu items and navigate back and forth between pages. Then click on +`Search`. A search dialog will appear, allowing you to search for any text on +any page. Notice that the search results include every occurrence of the search +term on the site and links directly to the section of the page in which the +search term appears. You get all of that with no effort or configuration on your +part! + +![Screenshot](img/search.png) + +## Theming our documentation + +Now change the configuration file to alter how the documentation is displayed by +changing the theme. Edit the `mkdocs.yml` file and add a [`theme`][theme] setting: + +```yaml +site_name: MkLorum +site_url: https://example.com/ +nav: + - Home: index.md + - About: about.md +theme: readthedocs +``` + +Save your changes, and you'll see the ReadTheDocs theme being used. + +![Screenshot](img/readthedocs.png) + +## Changing the Favicon Icon + +By default, MkDocs uses the [MkDocs favicon] icon. To use a different icon, create +an `img` subdirectory in the `docs` directory and copy your custom `favicon.ico` +file to that directory. MkDocs will automatically detect and use that file as your +favicon icon. + +[MkDocs favicon]: img/favicon.ico + +## Building the site + +That's looking good. You're ready to deploy the first pass of your `MkLorum` +documentation. First build the documentation: + +```bash +mkdocs build +``` + +This will create a new directory, named `site`. Take a look inside the +directory: + +```bash +$ ls site +about fonts index.html license search.html +css img js mkdocs sitemap.xml +``` + +Notice that your source documentation has been output as two HTML files named +`index.html` and `about/index.html`. You also have various other media that's +been copied into the `site` directory as part of the documentation theme. You +even have a `sitemap.xml` file and `mkdocs/search_index.json`. + +If you're using source code control such as `git` you probably don't want to +check your documentation builds into the repository. Add a line containing +`site/` to your `.gitignore` file. + +```bash +echo "site/" >> .gitignore +``` + +If you're using another source code control tool you'll want to check its +documentation on how to ignore specific directories. + +## Other Commands and Options + +There are various other commands and options available. For a complete list of +commands, use the `--help` flag: + +```bash +mkdocs --help +``` + +To view a list of options available on a given command, use the `--help` flag +with that command. For example, to get a list of all options available for the +`build` command run the following: + +```bash +mkdocs build --help +``` + +## Deploying + +The documentation site that you just built only uses static files so you'll be +able to host it from pretty much anywhere. Simply upload the contents of the +entire `site` directory to wherever you're hosting your website from and +you're done. For specific instructions on a number of common hosts, see the +[Deploying your Docs][deploy] page. + +## Getting help + +See the [User Guide] for more complete documentation of all of MkDocs' features. + +To get help with MkDocs, please use the [GitHub discussions] or [GitHub issues]. + +[Installation Guide]: user-guide/installation.md +[docs_dir]: user-guide/configuration.md#docs_dir +[deploy]: user-guide/deploying-your-docs.md +[nav]: user-guide/configuration.md#nav +[GitHub discussions]: https://github.com/mkdocs/mkdocs/discussions +[GitHub issues]: https://github.com/mkdocs/mkdocs/issues +[site_name]: user-guide/configuration.md#site_name +[site_url]: user-guide/configuration.md#site_url +[theme]: user-guide/configuration.md#theme +[User Guide]: user-guide/index.md diff --git a/docs/img/initial-layout.png b/docs/img/initial-layout.png index d5fe0ac258..e11b4248d7 100644 Binary files a/docs/img/initial-layout.png and b/docs/img/initial-layout.png differ diff --git a/docs/img/mkdocs.png b/docs/img/mkdocs.png index 9d3a3211c3..b9011a29fb 100644 Binary files a/docs/img/mkdocs.png and b/docs/img/mkdocs.png differ diff --git a/docs/img/multipage.png b/docs/img/multipage.png index 906fa8f2d2..57fcbe8d4d 100644 Binary files a/docs/img/multipage.png and b/docs/img/multipage.png differ diff --git a/docs/img/readthedocs.png b/docs/img/readthedocs.png index ffad9f72ba..c88bffd022 100644 Binary files a/docs/img/readthedocs.png and b/docs/img/readthedocs.png differ diff --git a/docs/img/screenshot.png b/docs/img/screenshot.png index 95f3176fdd..9eae03eb07 100644 Binary files a/docs/img/screenshot.png and b/docs/img/screenshot.png differ diff --git a/docs/img/search.png b/docs/img/search.png index 91ed676ca2..555fecdbbd 100644 Binary files a/docs/img/search.png and b/docs/img/search.png differ diff --git a/docs/img/site-name.png b/docs/img/site-name.png index 82f38a3dae..6c338374a3 100644 Binary files a/docs/img/site-name.png and b/docs/img/site-name.png differ diff --git a/docs/img/win-py-install.png b/docs/img/win-py-install.png index 88d0a45bfa..736c764b65 100644 Binary files a/docs/img/win-py-install.png and b/docs/img/win-py-install.png differ diff --git a/docs/index.md b/docs/index.md index d7e3eb8aec..f58af71789 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,344 +4,87 @@ Project documentation with Markdown. --- -## Overview - MkDocs is a **fast**, **simple** and **downright gorgeous** static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML -configuration file. - -### Host anywhere - -MkDocs builds completely static HTML sites that you can host on GitHub pages, -Amazon S3, or [anywhere][deploy] else you choose. - -### Great themes available - -There's a stack of good looking themes available for MkDocs. Choose between -the built in themes: [mkdocs] and [readthedocs], select one of the 3rd -party themes in the [MkDocs wiki], or [build your own]. - -### Preview your site as you work - -The built-in dev-server allows you to preview your documentation as you're -writing it. It will even auto-reload and refresh your browser whenever you save -your changes. - -### Easy to customize - -Get your project documentation looking just the way you want it by customizing -the theme. - ---- - -## Installation - -### Install with a Package Manager - -If you have and use a package manager (such as [apt-get], [dnf], [homebrew], -[yum], [chocolatey], etc.) to install packages on your system, then you may -want to search for a "MkDocs" package and, if a recent version is available, -install it with your package manager (check your system's documentation for -details). That's it, you're done! Skip down to [Getting Started](#getting-started). - -If your package manager does not have a recent "MkDocs" package, you can still -use your package manager to install "Python" and "pip". Then you can use pip to -[install MkDocs](#installing-mkdocs). - -[apt-get]: https://help.ubuntu.com/community/AptGet/Howto -[homebrew]: http://brew.sh/ -[dnf]: http://dnf.readthedocs.io/en/latest/index.html -[yum]: http://yum.baseurl.org/ -[chocolatey]: https://chocolatey.org/ - -### Manual Installation - -In order to manually install MkDocs you'll need [Python] installed on your -system, as well as the Python package manager, [pip]. You can check if you have -these already installed from the command line: - -```bash -$ python --version -Python 2.7.2 -$ pip --version -pip 1.5.2 -``` - -MkDocs supports Python versions 2.7, 3.3, 3.4, 3.5 and pypy. - -#### Installing Python - -Install [Python] by downloading an installer appropriate for your system from -[python.org] and running it. - -!!! Note - - If you are installing Python on Windows, be sure to check the box to have - Python added to your PATH if the installer offers such an option (it's - normally off by default). - - ![Add Python to PATH](img/win-py-install.png) - -[python.org]: https://www.python.org/downloads/ - -#### Installing pip - -If you're using a recent version of Python, the Python package manager, [pip], -is most likely installed by default. However, you may need to upgrade pip to the -lasted version: - -```bash -pip install --upgrade pip -``` - -If you need to install [pip] for the first time, download [get-pip.py]. -Then run the following command to install it: - -```bash -python get-pip.py -``` - -#### Installing MkDocs - -Install the `mkdocs` package using pip: - -```bash -pip install mkdocs -``` - -You should now have the `mkdocs` command installed on your system. Run `mkdocs ---version` to check that everything worked okay. - -```bash -$ mkdocs --version -mkdocs, version 0.15.3 -``` - -!!! Note - If you are using Windows, some of the above commands may not work - out-of-the-box. - - A quick solution may be to preface every Python command with `python -m` - like this: - - python -m pip install mkdocs - python -m mkdocs - - For a more permanent solution, you may need to edit your `PATH` environment - variable to include the `Scripts` directory of your Python installation. - Recent versions of Python include a script to do this for you. Navigate to - your Python installation directory (for example `C:\Python34\`), open the - `Tools`, then `Scripts` folder, and run the `win_add2path.py` file by double - clicking on it. Alternatively, you can [download][a2p] the script and run it - (`python win_add2path.py`). - -[a2p]: https://svn.python.org/projects/python/trunk/Tools/scripts/win_add2path.py - ---- - -## Getting Started - -Getting started is super easy. - -```bash -mkdocs new my-project -cd my-project -``` - -Take a moment to review the initial project that has been created for you. - -![The initial MkDocs layout](img/initial-layout.png) - -There's a single configuration file named `mkdocs.yml`, and a folder named -`docs` that will contain your documentation source files. Right now the `docs` -folder just contains a single documentation page, named `index.md`. - -MkDocs comes with a built-in dev-server that lets you preview your documentation -as you work on it. Make sure you're in the same directory as the `mkdocs.yml` -configuration file, and then start the server by running the `mkdocs serve` -command: - -```bash -$ mkdocs serve -INFO - Building documentation... -INFO - Cleaning site directory -[I 160402 15:50:43 server:271] Serving on http://127.0.0.1:8000 -[I 160402 15:50:43 handlers:58] Start watching changes -[I 160402 15:50:43 handlers:60] Start detecting changes -``` - -Open up `http://127.0.0.1:8000/` in your browser, and you'll see the default -home page being displayed: - -![The MkDocs live server](img/screenshot.png) - -The dev-server also supports auto-reloading, and will rebuild your documentation -whenever anything in the configuration file, documentation directory, or theme -directory changes. - -Open the `docs/index.md` document in your text editor of choice, change the -initial heading to `MkLorum`, and save your changes. Your browser will -auto-reload and you should see your updated documentation immediately. - -Now try editing the configuration file: `mkdocs.yml`. Change the -[`site_name`][site_name] setting to `MkLorum` and save the file. - -```yaml -site_name: MkLorum -``` - -Your browser should immediately reload, and you'll see your new site name take -effect. - -![The site_name setting](img/site-name.png) - -## Adding pages - -Now add a second page to your documentation: - -```bash -curl 'https://jaspervdj.be/lorem-markdownum/markdown.txt' > docs/about.md -``` - -As our documentation site will include some navigation headers, you may want to -edit the configuration file and add some information about the order, title, and -nesting of each page in the navigation header by adding a [`pages`][pages] -setting: - -```yaml -site_name: MkLorum -pages: - - Home: index.md - - About: about.md -``` - -Save your changes and you'll now see a navigation bar with `Home` and `About` -items on the left as well as `Search`, `Previous`, and `Next` items on the -right. - -![Screenshot](img/multipage.png) - -Try the menu items and navigate back and forth between pages. Then click on -`Search`. A search dialog will appear, allowing you to search for any text on -any page. Notice that the search results include every occurrence of the search -term on the site and links directly to the section of the page in which the -search term appears. You get of all that with no effort or configuration on your -part! - -![Screenshot](img/search.png) - -## Theming our documentation - -Now change the configuration file to alter how the documentation is displayed by -changing the theme. Edit the `mkdocs.yml` file and add a [`theme`][theme] setting: - -```yaml -site_name: MkLorum -pages: - - Home: index.md - - About: about.md -theme: readthedocs -``` - -Save your changes, and you'll see the ReadTheDocs theme being used. - -![Screenshot](img/readthedocs.png) - -## Changing the Favicon Icon - -By default, MkDocs uses the [MkDocs favicon] icon. To use a different icon, create -an `img` subdirectory in your `docs_dir` and copy your custom `favicon.ico` file -to that directory. MkDocs will automatically detect and use that file as your -favicon icon. - -[MkDocs favicon]: /img/favicon.ico - -## Building the site - -That's looking good. You're ready to deploy the first pass of your `MkLorum` -documentation. First build the documentation: - -```bash -mkdocs build -``` - -This will create a new directory, named `site`. Take a look inside the -directory: - -```bash -$ ls site -about fonts index.html license search.html -css img js mkdocs sitemap.xml -``` - -Notice that your source documentation has been output as two HTML files named -`index.html` and `about/index.html`. You also have various other media that's -been copied into the `site` directory as part of the documentation theme. You -even have a `sitemap.xml` file and `mkdocs/search_index.json`. - -If you're using source code control such as `git` you probably don't want to -check your documentation builds into the repository. Add a line containing -`site/` to your `.gitignore` file. - -```bash -echo "site/" >> .gitignore -``` - -If you're using another source code control tool you'll want to check its -documentation on how to ignore specific directories. - -After some time, files may be removed from the documentation but they will still -reside in the `site` directory. To remove those stale files, just run `mkdocs` -with the `--clean` switch. - -```bash -mkdocs build --clean -``` - -## Other Commands and Options - -There are various other commands and options available. For a complete list of -commands, use the `--help` flag: - -```bash -mkdocs --help -``` - -To view a list of options available on a given command, use the `--help` flag -with that command. For example, to get a list of all options available for the -`build` command run the following: - -```bash -mkdocs build --help -``` - -## Deploying - -The documentation site that you just built only uses static files so you'll be -able to host it from pretty much anywhere. [GitHub project pages] and [Amazon -S3] may be good hosting options, depending upon your needs. Upload the contents -of the entire `site` directory to wherever you're hosting your website from and -you're done. For specific instructions on a number of common hosts, see the -[Deploying your Docs][deploy] page. - -## Getting help - -To get help with MkDocs, please use the [discussion group], [GitHub issues] or -the MkDocs IRC channel `#mkdocs` on freenode. - -[deploy]: user-guide/deploying-your-docs/ -[mkdocs]: user-guide/styling-your-docs/#mkdocs -[readthedocs]: user-guide/styling-your-docs/#readthedocs -[MkDocs wiki]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes -[build your own]: user-guide/custom-themes/ -[Amazon S3]: http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html -[get-pip.py]: https://bootstrap.pypa.io/get-pip.py -[pages]: user-guide/configuration/#pages -[discussion group]: https://groups.google.com/forum/#!forum/mkdocs -[GitHub issues]: https://github.com/mkdocs/mkdocs/issues -[GitHub project pages]: https://help.github.com/articles/creating-project-pages-manually/ -[pip]: http://pip.readthedocs.io/en/stable/installing/ -[Python]: https://www.python.org/ -[site_name]: user-guide/configuration/#site_name -[theme]: user-guide/configuration/#theme \ No newline at end of file +configuration file. Start by reading the [introductory tutorial], then check the +[User Guide] for more information. + +[introductory tutorial]: getting-started.md +[User Guide]: user-guide/index.md + +

+ +
+

Features

+ +
+
+
+
+

Great themes available

+

+ There's a stack of good looking themes available for + MkDocs. Choose between the built in themes: mkdocs and readthedocs, + select one of the third-party themes listed on the MkDocs + Themes wiki page, or build your + own. +

+
+
+
+
+
+
+

Easy to customize

+

+ Get your project documentation looking just the way you want it by + customizing your + theme and/or installing some plugins. Modify + Markdown's behavior with Markdown + extensions. Many configuration options are + available. +

+
+
+
+
+ +
+
+
+
+

Preview your site as you work

+

+ The built-in dev-server allows you to preview your documentation + as you're writing it. It will even auto-reload and refresh your + browser whenever you save your changes. +

+
+
+
+
+
+
+

Host anywhere

+

+ MkDocs builds completely static HTML sites that you can host on + GitHub pages, Amazon S3, or anywhere else you + choose. +

+
+
+
+
+
diff --git a/docs/user-guide/choosing-your-theme.md b/docs/user-guide/choosing-your-theme.md new file mode 100644 index 0000000000..f167b7396e --- /dev/null +++ b/docs/user-guide/choosing-your-theme.md @@ -0,0 +1,200 @@ +# Choosing your Theme + +Selecting and configuring a theme. + +--- + +MkDocs includes two built-in themes ([mkdocs](#mkdocs) and +[readthedocs](#readthedocs)), as documented below. However, many [third party +themes] are available to choose from as well. + +To choose a theme, set the [theme] configuration option in your `mkdocs.yml` +config file. + +```yaml +theme: + name: readthedocs +``` + +## mkdocs + +The default theme, which was built as a custom [Bootstrap] theme, supports most +every feature of MkDocs. + +![mkdocs](../img/mkdocs.png) + +In addition to the default [theme configuration options][theme], the `mkdocs` theme +supports the following options: + +* __`highlightjs`__: Enables highlighting of source code in code blocks using + the [highlight.js] JavaScript library. Default: `True`. + +* __`hljs_style`__: The highlight.js library provides 79 different [styles] + (color variations) for highlighting source code in code blocks. Set this to + the name of the desired style. Default: `github`. + +* __`hljs_languages`__: By default, highlight.js only supports 23 common + languages. List additional languages here to include support for them. + + theme: + name: mkdocs + highlightjs: true + hljs_languages: + - yaml + - rust + +* __`analytics`__: Defines configuration options for an analytics service. + Currently, only Google Analytics v4 is supported via the `gtag` option. + + * __`gtag`__: To enable Google Analytics, set to a Google Analytics v4 + tracking ID, which uses the `G-` format. See Google's documentation to + [Set up Analytics for a website and/or app (GA4)][setup-GA4] or to + [Upgrade to a Google Analytics 4 property][upgrade-GA4]. + + theme: + name: mkdocs + analytics: + gtag: G-ABC123 + + When set to the default (`null`) Google Analytics is disabled for the + site. + +* __`shortcuts`__: Defines keyboard shortcut keys. + + theme: + name: mkdocs + shortcuts: + help: 191 # ? + next: 78 # n + previous: 80 # p + search: 83 # s + + All values must be numeric key codes. It is best to use keys which are + available on all keyboards. You may use to determine + the key code for a given key. + + * __`help`__: Display a help modal which lists the keyboard shortcuts. + Default: `191` (?) + + * __`next`__: Navigate to the "next" page. Default: `78` (n) + + * __`previous`__: Navigate to the "previous" page. Default: `80` (p) + + * __`search`__: Display the search modal. Default: `83` (s) + +* __`navigation_depth`__: The maximum depth of the navigation tree in the + sidebar. Default: `2`. + +* __`nav_style`__: This adjusts the visual style for the top navigation bar; by + default, this is set to `primary` (the default), but it can also be set to + `dark` or `light`. + + theme: + name: mkdocs + nav_style: dark + +* __`locale`__{ #mkdocs-locale }: The locale (language/location) used to + build the theme. If your locale is not yet supported, it will fallback + to the default. + + The following locales are supported by this theme: + + * `en`: English (default) + * `fr`: French + * `es`: Spanish + * `ja`: Japanese + * `pt_BR`: Portuguese (Brazil) + * `zh_CN`: Simplified Chinese + + See the guide on [localizing your theme] for more information. + +## readthedocs + +A clone of the default theme used by the [Read the Docs] service, which offers +the same restricted feature-set as its parent theme. Like its parent theme, only +two levels of navigation are supported. + +![ReadTheDocs](../img/readthedocs.png) + +In addition to the default [theme configuration options][theme], the `readthedocs` +theme supports the following options: + +* __`highlightjs`__: Enables highlighting of source code in code blocks using + the [highlight.js] JavaScript library. Default: `True`. + +* __`hljs_languages`__: By default, highlight.js only supports 23 common + languages. List additional languages here to include support for them. + + theme: + name: readthedocs + highlightjs: true + hljs_languages: + - yaml + - rust + +* __`analytics`__: Defines configuration options for an analytics service. + Currently, only Google Analytics v4 is supported via the `gtag` option. + + * __`gtag`__: To enable Google Analytics, set to a Google Analytics v4 + tracking ID, which uses the `G-` format. See Google's documentation to + [Set up Analytics for a website and/or app (GA4)][setup-GA4] or to + [Upgrade to a Google Analytics 4 property][upgrade-GA4]. + + theme: + name: readthedocs + analytics: + gtag: G-ABC123 + + When set to the default (`null`) Google Analytics is disabled for the + +* __`include_homepage_in_sidebar`__: Lists the homepage in the sidebar menu. As + MkDocs requires that the homepage be listed in the `nav` configuration + option, this setting allows the homepage to be included or excluded from + the sidebar. Note that the site name/logo always links to the homepage. + Default: `True`. + +* __`prev_next_buttons_location`__: One of `bottom`, `top`, `both` , or `none`. + Displays the “Next” and “Previous” buttons accordingly. Default: `bottom`. + +* __`navigation_depth`__: The maximum depth of the navigation tree in the + sidebar. Default: `4`. + +* __`collapse_navigation`__: Only include the page section headers in the + sidebar for the current page. Default: `True`. + +* __`titles_only`__: Only include page titles in the sidebar, excluding all + section headers for all pages. Default: `False`. + +* __`sticky_navigation`__: If True, causes the sidebar to scroll with the main + page content as you scroll the page. Default: `True`. + +* __`locale`__{ #readthedocs-locale }: The locale (language/location) used to + build the theme. If your locale is not yet supported, it will fallback + to the default. + + The following locales are supported by this theme: + + * `en`: English (default) + * `fr`: French + * `es`: Spanish + * `ja`: Japanese + * `pt_BR`: Portuguese (Brazil) + * `zh_CN`: Simplified Chinese + + See the guide on [localizing your theme] for more information. + +## Third Party Themes + +A list of third party themes can be found in the MkDocs [community wiki]. If you +have created your own, please feel free to add it to the list. + +[third party themes]: #third-party-themes +[theme]: configuration.md#theme +[Bootstrap]: https://getbootstrap.com/ +[highlight.js]: https://highlightjs.org/ +[styles]: https://highlightjs.org/static/demo/ +[setup-GA4]: https://support.google.com/analytics/answer/9304153?hl=en&ref_topic=9303319 +[upgrade-GA4]: https://support.google.com/analytics/answer/9744165?hl=en&ref_topic=9303319 +[Read the Docs]: https://readthedocs.org/ +[community wiki]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes +[localizing your theme]: localizing-your-theme.md diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index 018fd6e31a..d7da01eaa6 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -6,11 +6,12 @@ Guide to all available configuration settings. ## Introduction -Project settings are always configured by using a YAML configuration file in the -project directory named `mkdocs.yml`. +Project settings are configured by default using a YAML configuration file in +the project directory named `mkdocs.yml`. You can specify another path for it +by using the `-f`/`--config-file` option (see `mkdocs build --help`). -As a minimum this configuration file must contain the `site_name` setting. All -other settings are optional. +As a minimum, this configuration file must contain the `site_name` and +`site_url` settings. All other settings are optional. ## Project information @@ -28,14 +29,22 @@ variable. ### site_url -Set the canonical URL of the site. This will add a link tag with the canonical -URL to the generated HTML header. +Set the canonical URL of the site. This will add a `link` tag with the +`canonical` URL to the `head` section of each HTML page. If the 'root' of the +MkDocs site will be within a subdirectory of a domain, be sure to include that +subdirectory in the setting (`https://example.com/foo/`). + +This setting is also used for `mkdocs serve`: the server will be mounted onto a +path taken from the path component of the URL, e.g. `some/page.md` will be +served from `http://127.0.0.1:8000/foo/some/page/` to mimic the expected remote +layout. **default**: `null` ### repo_url -When set, provides a link to your GitHub or Bitbucket repository on each page. +When set, provides a link to your repository (GitHub, Bitbucket, GitLab, ...) +on each page. ```yaml repo_url: https://github.com/example/repository/ @@ -45,14 +54,14 @@ repo_url: https://github.com/example/repository/ ### repo_name -When set, provides a link to your GitHub or Bitbucket repository on each page. +When set, provides the name for the link to your repository on each page. -**default**: `'GitHub'` or `'Bitbucket'` if the `repo_url` matches those -domains, otherwise `null` +**default**: `'GitHub'`, `'Bitbucket'` or `'GitLab'` if the `repo_url` matches +those domains, otherwise the hostname from the `repo_url`. ### edit_uri -Path from the base `repo_url` to the docs directory when directly viewing a +The path from the base `repo_url` to the docs directory when directly viewing a page, accounting for specifics of the repository host (e.g. GitHub, Bitbucket, etc), the branch, and the docs directory itself. MkDocs concatenates `repo_url` and `edit_uri`, and appends the input path of the page. @@ -86,14 +95,14 @@ edit_uri: root/path/docs/ ``` !!! note - On a few known hosts (specifically GitHub and Bitbucket), the `edit_uri` is - derived from the 'repo_url' and does not need to be set manually. Simply - defining a `repo_url` will automatically populate the `edit_uri` config - setting. + On a few known hosts (specifically GitHub, Bitbucket and GitLab), the + `edit_uri` is derived from the 'repo_url' and does not need to be set + manually. Simply defining a `repo_url` will automatically populate the + `edit_uri` configs setting. - For example, for a GitHub-hosted repository, the `edit_uri` would be - automatically set as `edit/master/docs/` (Note the `edit` path and `master` - branch). + For example, for a GitHub- or GitLab-hosted repository, the `edit_uri` + would be automatically set as `edit/master/docs/` (Note the `edit` path + and `master` branch). For a Bitbucket-hosted repository, the equivalent `edit_uri` would be automatically set as `src/default/docs/` (note the `src` path and `default` @@ -105,15 +114,16 @@ edit_uri: root/path/docs/ string to disable the automatic setting. !!! warning - On GitHub, the default "edit" path (`edit/master/docs/`) opens the page in - the online GitHub editor. This functionality requires that the user have and - be logged in to a GitHub account. Otherwise, the user will be redirected to - a login/signup page. Alternatively, use the "blob" path + On GitHub and GitLab, the default "edit" path (`edit/master/docs/`) opens + the page in the online editor. This functionality requires that the user + have and be logged in to a GitHub/GitLab account. Otherwise, the user will + be redirected to a login/signup page. Alternatively, use the "blob" path (`blob/master/docs/`) to open a read-only view, which supports anonymous access. -**default**: `edit/master/docs/` or `src/default/docs/` for GitHub or Bitbucket -repos, respectively, if `repo_url` matches those domains, otherwise `null` +**default**: `edit/master/docs/` for GitHub and GitLab repos or +`src/default/docs/` for a Bitbucket repo, if `repo_url` matches those domains, +otherwise `null` ### site_description @@ -134,52 +144,77 @@ Set the copyright information to be included in the documentation by the theme. **default**: `null` -### google_analytics - -Set the Google analytics tracking configuration. - -```yaml -google_analytics: ['UA-36723568-3', 'mkdocs.org'] -``` - -**default**: `null` - ### remote_branch -Set the remote branch to commit to when using `gh-deploy` to deploy to Github +Set the remote branch to commit to when using `gh-deploy` to deploy to GitHub Pages. This option can be overridden by a command line option in `gh-deploy`. **default**: `gh-pages` ### remote_name -Set the remote name to push to when using `gh-deploy` to deploy to Github Pages. +Set the remote name to push to when using `gh-deploy` to deploy to GitHub Pages. This option can be overridden by a command line option in `gh-deploy`. **default**: `origin` ## Documentation layout -### pages +### nav + +This setting is used to determine the format and layout of the global navigation +for the site. A minimal navigation configuration could look like this: + +```yaml +nav: + - 'index.md' + - 'about.md' +``` + +All paths must be relative to the `mkdocs.yml` configuration file. See the +section on [configuring pages and navigation] for a more detailed breakdown, +including how to create sub-sections. + +Navigation items may also include links to external sites. While titles are +optional for internal links, they are required for external links. An external +link may be a full URL or a relative URL. Any path which is not found in the +files is assumed to be an external link. See the section about [Meta-Data] on +how MkDocs determines the page title of a document. + +```yaml +nav: + - Introduction: 'index.md' + - 'about.md' + - 'Issue Tracker': 'https://example.com/' +``` + +In the above example, the first two items point to local files while the third +points to an external site. -This setting is used to determine the set of pages that should be built for the -documentation. For example, the following would create Introduction, User Guide -and About pages, given the three source files `index.md`, `user-guide.md` and -`about.md`, respectively. +However, sometimes the MkDocs site is hosted in a subdirectory of a project's +site and you may want to link to other parts of the same site without including +the full domain. In that case, you may use an appropriate relative URL. ```yaml -pages: - - 'Introduction': 'index.md' +site_url: https://example.com/foo/ + +nav: + - Home: '../' - 'User Guide': 'user-guide.md' - - 'About': 'about.md' + - 'Bug Tracker': '/bugs/' ``` -See the section on [configuring pages and navigation] for a more detailed -breakdown, including how to create sub-sections. +In the above example, two different styles of external links are used. First, +note that the `site_url` indicates that the MkDocs site is hosted in the `/foo/` +subdirectory of the domain. Therefore, the `Home` navigation item is a relative +link that steps up one level to the server root and effectively points to +`https://example.com/`. The `Bug Tracker` item uses an absolute path from the +server root and effectively points to `https://example.com/bugs/`. Of course, the +`User Guide` points to a local MkDocs page. -**default**: By default `pages` will contain an alphanumerically sorted, nested +**default**: By default `nav` will contain an alphanumerically sorted, nested list of all the Markdown files found within the `docs_dir` and its -sub-directories. If none are found it will be `[]` (an empty list). +sub-directories. Index files will always be listed first within a sub-section. ## Build directories @@ -189,13 +224,14 @@ Sets the theme and theme specific configuration of your documentation site. May be either a string or a set of key/value pairs. If a string, it must be the string name of a known installed theme. For a list -of available themes visit [styling your docs]. +of available themes visit [Choosing Your Theme]. An example set of key/value pairs might look something like this: ```yaml theme: name: mkdocs + locale: en custom_dir: my_theme_customizations/ static_templates: - sitemap.html @@ -209,19 +245,25 @@ If a set of key/value pairs, the following nested keys can be defined: #### name: The string name of a known installed theme. For a list of available themes - visit [styling your docs]. + visit [Choosing Your Theme]. + + #### locale: + + A code representing the language of your site. See [Localizing your theme] + for details. #### custom_dir: - A directory to custom a theme. This can either be a relative directory, in - which case it is resolved relative to the directory containing your - configuration file, or it can be an absolute directory path. + A directory containing a custom theme. This can either be a relative + directory, in which case it is resolved relative to the directory containing + your configuration file or it can be an absolute directory path from the + root of your local file system. - See [styling your docs][theme_dir] for details if you would like to tweak an + See [Customizing Your Theme][theme_dir] for details if you would like to tweak an existing theme. - See [custom themes] if you would like to build your own theme from the - ground up. + See the [Theme Developer Guide] if you would like to build your own theme + from the ground up. #### static_templates: @@ -238,19 +280,19 @@ If a set of key/value pairs, the following nested keys can be defined: ### docs_dir -Lets you set the directory containing the documentation source markdown files. -This can either be a relative directory, in which case it is resolved relative -to the directory containing your configuration file, or it can be an absolute -directory path from the root of your local file system. +The directory containing the documentation source markdown files. This can +either be a relative directory, in which case it is resolved relative to the +directory containing your configuration file, or it can be an absolute directory +path from the root of your local file system. **default**: `'docs'` ### site_dir -Lets you set the directory where the output HTML and other files are created. -This can either be a relative directory, in which case it is resolved relative -to the directory containing your configuration file, or it can be an absolute -directory path from the root of your local file system. +The directory where the output HTML and other files are created. This can either +be a relative directory, in which case it is resolved relative to the directory +containing your configuration file, or it can be an absolute directory path from +the root of your local file system. **default**: `'site'` @@ -290,14 +332,14 @@ See the example in [extra_css] for usage. Set a list of templates in your `docs_dir` to be built by MkDocs. To see more about writing templates for MkDocs read the documentation about [custom themes] -and specifically the section about the [variables that are available] to +and specifically the section about the [available variables] to templates. See the example in [extra_css] for usage. **default**: `[]` (an empty list). ### extra -A set of key value pairs, where the values can be any valid YAML construct, that +A set of key-value pairs, where the values can be any valid YAML construct, that will be passed to the template. This allows for great flexibility when creating custom themes. @@ -309,7 +351,7 @@ extra: version: 1.0 ``` -**default**: By default `extra` will be an empty key value mapping. +**default**: By default `extra` will be an empty key-value mapping. ## Preview controls @@ -321,27 +363,26 @@ documentation. The following table demonstrates how the URLs used on the site differ when setting `use_directory_urls` to `true` or `false`. -Source file | Generated HTML | use_directory_urls: true | use_directory_urls: false ------------- | -------------------- | ------------------------ | ------------------------ -index.md | index.html | / | /index.html -api-guide.md | api-guide/index.html | /api-guide/ | /api-guide/index.html -about.md | about/index.html | /about/ | /about/index.html +Source file | use_directory_urls: true | use_directory_urls: false +---------------- | ------------------------- | ------------------------- +index.md | / | /index.html +api-guide.md | /api-guide/ | /api-guide.html +about/license.md | /about/license/ | /about/license.html The default style of `use_directory_urls: true` creates more user friendly URLs, and is usually what you'll want to use. -The alternate style can occasionally be useful if you want your documentation to -remain properly linked when opening pages directly from the file system, because -it create links that point directly to the target *file* rather than the target +The alternate style can be useful if you want your documentation to remain +properly linked when opening pages directly from the file system, because it +creates links that point directly to the target *file* rather than the target *directory*. **default**: `true` ### strict -Determines if a broken link to a page within the documentation is considered a -warning or an error (link to a page not listed in the pages setting). Set to -true to halt processing when a broken link is found, false prints a warning. +Determines how warnings are handled. Set to `true` to halt processing when a +warning is raised. Set to `false` to print a warning and continue processing. **default**: `false` @@ -351,10 +392,12 @@ Determines the address used when running `mkdocs serve`. Must be of the format `IP:PORT`. Allows a custom default to be set without the need to pass it through the -`--dev_addr` option every time the `mkdocs serve` command is called. +`--dev-addr` option every time the `mkdocs serve` command is called. **default**: `'127.0.0.1:8000'` +See also: [site_url](#site_url). + ## Formatting options ### markdown_extensions @@ -410,6 +453,22 @@ markdown_extensions: - sane_lists ``` +In the above examples, each extension is a list item (starts with a `-`). As an +alternative, key/value pairs can be used instead. However, in that case an empty +value must be provided for extensions for which no options are defined. +Therefore, the last example above could also be defined as follows: + +```yaml +markdown_extensions: + smarty: {} + toc: + permalink: True + sane_lists: {} +``` + +This alternative syntax is required if you intend to override some options via +[inheritance]. + !!! note "See Also:" The Python-Markdown documentation provides a [list of extensions][exts] which are available out-of-the-box. For a list of configuration options @@ -424,7 +483,7 @@ markdown_extensions: ### plugins A list of plugins (with optional configuration settings) to use when building -the site . See the [Plugins] documentation for full details. +the site. See the [Plugins] documentation for full details. If the `plugins` config setting is defined in the `mkdocs.yml` config file, then any defaults (such as `search`) are ignored and you need to explicitly re-enable @@ -436,6 +495,32 @@ plugins: - your_other_plugin ``` +To define options for a given plugin, use a nested set of key/value pairs: + +```yaml +plugins: + - search + - your_other_plugin: + option1: value + option2: other value +``` + +In the above examples, each plugin is a list item (starts with a `-`). As an +alternative, key/value pairs can be used instead. However, in that case an empty +value must be provided for plugins for which no options are defined. Therefore, +the last example above could also be defined as follows: + +```yaml +plugins: + search: {} + your_other_plugin: + option1: value + option2: other value +``` + +This alternative syntax is required if you intend to override some options via +[inheritance]. + To completely disable all plugins, including any defaults, set the `plugins` setting to an empty list: @@ -445,15 +530,309 @@ plugins: [] **default**: `['search']` (the "search" plugin included with MkDocs). -[custom themes]: custom-themes.md -[variables that are available]: custom-themes.md#template-variables -[pymdk-extensions]: https://pythonhosted.org/Markdown/extensions/index.html -[pymkd]: https://pythonhosted.org/Markdown/ -[smarty]: https://pythonhosted.org/Markdown/extensions/smarty.html -[exts]:https://pythonhosted.org/Markdown/extensions/index.html -[3rd]: https://github.com/waylan/Python-Markdown/wiki/Third-Party-Extensions +#### Search + +A search plugin is provided by default with MkDocs which uses [lunr.js] as a +search engine. The following config options are available to alter the behavior +of the search plugin: + +##### **separator** + +A regular expression which matches the characters used as word separators when +building the index. By default whitespace and the hyphen (`-`) are used. To add +the dot (`.`) as a word separator you might do this: + +```yaml +plugins: + - search: + separator: '[\s\-\.]+' +``` + + **default**: `'[\s\-]+'` + +##### **min_search_length** + +An integer value that defines the minimum length for a search query. By default +searches shorter than 3 chars in length are ignored as search result quality with +short search terms are poor. However, for some use cases (such as documentation +about Message Queues which might generate searches for 'MQ') it may be preferable +to set a shorter limit. + +```yaml +plugins: + - search: + min_search_length: 2 +``` + + **default**: 3 + +##### **lang** + +A list of languages to use when building the search index as identified by their +[ISO 639-1] language codes. With [Lunr Languages], the following languages are +supported: + +* `ar`: Arabic +* `da`: Danish +* `nl`: Dutch +* `en`: English +* `fi`: Finnish +* `fr`: French +* `de`: German +* `hu`: Hungarian +* `it`: Italian +* `ja`: Japanese +* `no`: Norwegian +* `pt`: Portuguese +* `ro`: Romanian +* `ru`: Russian +* `es`: Spanish +* `sv`: Swedish +* `th`: Thai +* `tr`: Turkish +* `vi`: Vietnamese + +You may [contribute additional languages]. + +!!! Warning + + While search does support using multiple languages together, it is best not + to add additional languages unless you really need them. Each additional + language adds significant bandwidth requirements and uses more browser + resources. Generally, it is best to keep each instance of MkDocs to a single + language. + +!!! Note + + Lunr Languages does not currently include support for Chinese or other Asian + languages. However, some users have reported decent results using Japanese. + +**default**: The value of `theme.locale` if set, otherwise `[en]`. + +##### **prebuild_index** + +Optionally generates a pre-built index of all pages, which provides some +performance improvements for larger sites. Before enabling, confirm that the +theme you are using explicitly supports using a prebuilt index (the builtin +themes do). Set to `true` to enable. + +!!! warning + + This option requires that [Node.js] be installed and the command `node` be + on the system path. If the call to `node` fails for any reason, a warning + is issued and the build continues uninterrupted. You may use the `--strict` + flag when building to cause such a failure to raise an error instead. + +!!! Note + + On smaller sites, using a pre-built index is not recommended as it creates a + significant increase is bandwidth requirements with little to no noticeable + improvement to your users. However, for larger sites (hundreds of pages), + the bandwidth increase is relatively small and your users will notice a + significant improvement in search performance. + +**default**: `False` + +[Node.js]: https://nodejs.org/ + +##### **indexing** + +Configures what strategy the search indexer will use when building the index +for your pages. This property is particularly useful if your project is large +in scale, and the index takes up an enormous amount of disk space. + +```yaml +plugins: + - search: + indexing: 'full' +``` + +###### Options + +|Option|Description| +|------|-----------| +|`full`|Indexes the title, section headings, and full text of each page.| +|`sections`|Indexes the title and section headings of each page.| +|`titles`|Indexes only the title of each page.| + +**default**: `full` + +## Environment Variables + +In most cases, the value of a configuration option is set directly in the +configuration file. However, as an option, the value of a configuration option +may be set to the value of an environment variable using the `!ENV` tag. For +example, to set the value of the `site_name` option to the value of the +variable `SITE_NAME` the YAML file may contain the following: + +```yaml +site_name: !ENV SITE_NAME +``` + +If the environment variable is not defined, then the configuration setting +would be assigned a `null` (or `None` in Python) value. A default value can be +defined as the last value in a list. Like this: + +```yaml +site_name: !ENV [SITE_NAME, 'My default site name'] +``` + +Multiple fallback variables can be used as well. Note that the last value is +not an environment variable, but must be a value to use as a default if none +of the specified environment variables are defined. + +```yaml +site_name: !ENV [SITE_NAME, OTHER_NAME, 'My default site name'] +``` + +Simple types defined within an environment variable such as string, bool, +integer, float, datestamp and null are parsed as if they were defined directly +in the YAML file, which means that the value will be converted to the +appropriate type. However, complex types such as lists and key/value pairs +cannot be defined within a single environment variable. + +For more details, see the [pyyaml_env_tag](https://github.com/waylan/pyyaml-env-tag) +project. + +## Configuration Inheritance + +Generally, a single file would hold the entire configuration for a site. +However, some organizations may maintain multiple sites which all share a common +configuration across them. Rather than maintaining separate configurations for +each, the common configuration options can be defined in a parent configuration +while which each site's primary configuration file inherits. + +To define the parent for a configuration file, set the `INHERIT` (all caps) key +to the path of the parent file. The path must be relative to the location of the +primary file. + +For configuration options to be merged with a parent configuration, those +options must be defined as key/value pairs. Specifically, the +[markdown_extensions] and [plugins] options must use the alternative syntax +which does not use list items (lines which start with `-`). + +For example, suppose the common (parent) configuration is defined in `base.yml`: + +```yaml +theme: + name: mkdocs + locale: en + highlightjs: true + +markdown_extensions: + toc: + permalink: true + admonition: {} +``` + +Then, for the "foo" site, the primary configuration file would be defined at +`foo/mkdocs.yml`: + +```yml +INHERIT: ../base.yml +site_name: Foo Project +site_url: https://example.com/foo +``` + +When running `mkdocs build`, the file at `foo/mkdocs.yml` would be passed in as +the configuration file. MkDocs will then parse that file, retrieve and parse the +parent file `base.yml` and deep merge the two. This would result in MkDocs +receiving the following merged configuration: + +```yaml +site_name: Foo Project +site_url: https://example.com/foo + +theme: + name: mkdocs + locale: en + highlightjs: true + +markdown_extensions: + toc: + permalink: true + admonition: {} +``` + +Deep merging allows you to add and/or override various values in your primary +configuration file. For example, suppose for one site you wanted to add support +for definition lists, use a different symbol for permalinks, and define a +different separator. In that site's primary configuration file you could do: + +```yaml +INHERIT: ../base.yml +site_name: Bar Project +site_url: https://example.com/bar + +markdown_extensions: + def_list: {} + toc: + permalink:  + separator: "_" +``` + +In that case, the above configuration would be deep merged with `base.yml` and +result in the following configuration: + +```yaml +site_name: Bar Project +site_url: https://example.com/bar + +theme: + name: mkdocs + locale: en + highlightjs: true + +markdown_extensions: + def_list: {} + toc: + permalink:  + separator: "_" + admonition: {} +``` + +Notice that the `admonition` extension was retained from the parent +configuration, the `def_list` extension was added, the value of +`toc.permalink` was replaced, and the value of `toc.separator` was added. + +You can replace or merge the value of any key. However, any non-key is always +replaced. Therefore, you cannot append items to a list. You must redefine the +entire list. + +As the [nav] configuration is made up of nested lists, this means that you +cannot merge navigation items. Of course, you can replace the entire `nav` +configuration with a new one. However, it is generally expected that the entire +navigation would be defined in the primary configuration file for a project. + +!!! warning + + As a reminder, all path based configuration options must be relative to the + primary configuration file and MkDocs does not alter the paths when merging. + Therefore, defining paths in a parent file which is inherited by multiple + different sites may not work as expected. It is generally best to define + path based options in the primary configuration file only. + +[Theme Developer Guide]: ../dev-guide/themes.md +[variables that are available]: ../dev-guide/themes.md#template-variables +[pymdk-extensions]: https://python-markdown.github.io/extensions/ +[pymkd]: https://python-markdown.github.io/ +[smarty]: https://python-markdown.github.io/extensions/smarty/ +[exts]: https://python-markdown.github.io/extensions/ +[3rd]: https://github.com/Python-Markdown/markdown/wiki/Third-Party-Extensions [configuring pages and navigation]: writing-your-docs.md#configure-pages-and-navigation -[theme_dir]: styling-your-docs.md#using-the-theme_dir -[styling your docs]: styling-your-docs.md +[theme_dir]: customizing-your-theme.md#using-the-theme_dir +[choosing your theme]: choosing-your-theme.md +[Localizing your theme]: localizing-your-theme.md [extra_css]: #extra_css -[Plugins]: plugins.md +[Plugins]: ../dev-guide/plugins.md +[lunr.js]: https://lunrjs.com/ +[ISO 639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +[Lunr Languages]: https://github.com/MihaiValentin/lunr-languages#lunr-languages----- +[contribute additional languages]: https://github.com/MihaiValentin/lunr-languages/blob/master/CONTRIBUTING.md +[Node.js]: https://nodejs.org/ +[Lunr.py]: http://lunr.readthedocs.io/ +[Lunr.py's issues]: https://github.com/yeraydiazdiaz/lunr.py/issues +[markdown_extensions]: #markdown_extensions +[plugins]: #plugins +[nav]: #nav +[inheritance]: #configuration-inheritance diff --git a/docs/user-guide/custom-themes.md b/docs/user-guide/custom-themes.md deleted file mode 100644 index 34da869d62..0000000000 --- a/docs/user-guide/custom-themes.md +++ /dev/null @@ -1,582 +0,0 @@ -# Custom themes - -A guide to creating and distributing custom themes. - ---- - -!!! Note - - If you are looking for third party themes, they are listed in the MkDocs - [community wiki](https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes). If - you want to share a theme you create, you should list it on the Wiki. - -When creating a new theme, you can either follow the steps in this guide to -create one from scratch or you can download the `mkdocs-basic-theme` as a -basic, yet complete, theme with all the boilerplate required. **You can find -this base theme on [GitHub](https://github.com/mkdocs/mkdocs-basic-theme)**. -It contains detailed comments in the code to describe the different features -and their usage. - -## Creating a custom theme - -The bare minimum required for a custom theme is a `main.html` [Jinja2 template] -file. This should be placed in a directory which will be the `theme_dir` and it -should be created next to the `mkdocs.yml` configuration file. Within -`mkdocs.yml`, specify the theme `custom_dir` option and set it to the name of -the directory containing `main.html`. For example, given this example project -layout: - - mkdocs.yml - docs/ - index.md - about.md - custom_theme/ - main.html - ... - -You would include the following settings in `mkdocs.yml` to use the custom theme -directory: - - theme: - name: null - custom_dir: 'custom_theme' - -!!! Note - - Generally, when building your own custom theme, the theme `name` - configuration setting would be set to `null`. However, if used in - combination with the `custom_dir` configuration value a custom theme can be - used to replace only specific parts of a built-in theme. For example, with - the above layout and if you set `name: "mkdocs"` then the `main.html` file - in the `custom_dir` would replace that in the theme but otherwise the - `mkdocs` theme would remain the same. This is useful if you want to make - small adjustments to an existing theme. - - For more specific information, see [styling your docs]. - -[styling your docs]: ./styling-your-docs.md#using-the-theme-custom_dir - -## Basic theme - -The simplest `main.html` file is the following: - -```django - - - - {% if page_title %}{{ page_title }} - {% endif %}{{ site_name }} - - - {{ content }} - - -``` - -Article content from each page specified in `mkdocs.yml` is inserted using the -`{{ content }}` tag. Style-sheets and scripts can be brought into this theme as -with a normal HTML file. Navbars and tables of contents can also be generated -and included automatically, through the `nav` and `toc` objects, respectively. -If you wish to write your own theme, it is recommended to start with one of -the [built-in themes] and modify it accordingly. - -!!! Note - - As MkDocs uses [Jinja] as its template engine, you have access to all the - power of Jinja, including [template inheritance]. You may notice that the - themes included with MkDocs make extensive use of template inheritance and - blocks, allowing users to easily override small bits and pieces of the - templates from the theme [custom_dir]. Therefore, the built-in themes are - implemented in a `base.html` file, which `main.html` extends. Although not - required, third party template authors are encouraged to follow a similar - pattern and may want to define the same [blocks] as are used in the built-in - themes for consistency. - -[Jinja]: http://jinja.pocoo.org/ -[template inheritance]: http://jinja.pocoo.org/docs/dev/templates/#template-inheritance -[theme_dir]: ./styling-your-docs.md#using-the-theme_dir -[blocks]: ./styling-your-docs.md#overriding-template-blocks - -## Template Variables - -Each template in a theme is built with a template context. These are the -variables that are available to themes. The context varies depending on the -template that is being built. At the moment templates are either built with -the global context or with a page specific context. The global context is used -for HTML pages that don't represent an individual Markdown document, for -example a 404.html page or search.html. - -### Global Context - -The following variables are available globally on any template. - -#### config - -The `config` variable is an instance of MkDocs' config object generated from the -`mkdocs.yml` config file. While you can use any config option, some commonly -used options include: - -* [config.site_name](./configuration.md#site_name) -* [config.site_url](./configuration.md#site_url) -* [config.site_author](./configuration.md#site_author) -* [config.site_description](./configuration.md#site_description) -* [config.repo_url](./configuration.md#repo_url) -* [config.repo_name](./configuration.md#repo_name) -* [config.copyright](./configuration.md#copyright) -* [config.google_analytics](./configuration.md#google_analytics) - -#### nav - -The `nav` variable is used to create the navigation for the documentation. -Following is a basic usage example which outputs the first and second level -navigation as a nested list. - -```django -{% if nav|length>1 %} -
    - {% for nav_item in nav %} - {% if nav_item.children %} -
  • {{ nav_item.title }} - -
  • - {% else %} - - {% endif %} - {% endfor %} -
-{% endif %} -``` - -The `nav` object also contains a `homepage` object, which points to the `page` -object of the homepage. For example, you may want to access `nav.homepage.url`. - -#### base_url - -The `base_url` provides a relative path to the root of the MkDocs project. -This makes it easy to include links to static assets in your theme. For -example, if your theme includes a `js` folder, to include `theme.js` from that -folder on all pages you would do this: - -```django - -``` - -#### extra_css - -Contains a list of URLs to the style-sheets listed in the [extra_css] -config setting. Unlike the config setting, which contains local paths, this -variable contains absolute paths from the homepage. - -[extra_css]: configuration.md#extra_css - -#### extra_javascript - -Contains a list of URLs to the scripts listed in the [extra_javascript] config -setting. Unlike the config setting, which contains local paths, this variable -contains absolute paths from the homepage. - -[extra_javascript]: configuration.md#extra_javascript - -#### mkdocs_version - -Contains the current MkDocs version. - -#### build_date_utc - -A Python datetime object that represents the date and time the documentation -was built in UTC. This is useful for showing how recently the documentation -was updated. - -#### page - -In templates which are not rendered from a Markdown source file, the `page` -variable is `None`. In templates which are rendered from a Markdown source file, -the `page` variable contains a page object with the following attributes: - -##### page.title - -Contains the Title for the current page. - -##### page.content - -The rendered Markdown as HTML, this is the contents of the documentation. - -##### page.toc - -An object representing the Table of contents for a page. Displaying the table -of contents as a simple list can be achieved like this. - -```django - -``` - -##### page.meta - -A mapping of the metadata included at the top of the markdown page. In this -example we define a `source` property above the page title. - -```no-highlight -source: generics.py - mixins.py - -# Page title - -Content... -``` - -A template can access this metadata for the page with the `meta.source` -variable. This could then be used to link to source files related to the -documentation page. - -```django -{% for filename in page.meta.source %} - - {{ filename }} - -{% endfor %} -``` - -##### page.canonical_url - -The full, canonical URL to the current page. This includes the `site_url` from -the configuration. - -##### page.edit_url - -The full URL to the input page in the source repository. Typically used to -provide a link to edit the source page. - -##### page.url - -The URL to the current page not including the `site_url` from the configuration. - -##### page.is_homepage - -Evaluates to `True` for the homepage of the site and `False` for all other -pages. This can be used in conjunction with other attributes of the `page` -object to alter the behavior. For example, to display a different title -on the homepage: - -```django -{% if not page.is_homepage %}{{ page.title }} - {% endif %}{{ site_name }} -``` - -##### page.previous_page - -The page object for the previous page. The usage is the same as for -`page`. - -##### page.next_page - -The page object for the next page.The usage is the same as for `page`. - -### Extra Context - -Additional variables can be passed to the template with the -[`extra`](/user-guide/configuration.md#extra) configuration option. This is a -set of key value pairs that can make custom templates far more flexible. - -For example, this could be used to include the project version of all pages -and a list of links related to the project. This can be achieved with the -following `extra` configuration: - -```yaml -extra: - version: 0.13.0 - links: - - https://github.com/mkdocs - - https://docs.readthedocs.org/en/latest/builds.html#mkdocs - - http://www.mkdocs.org/ -``` - -And then displayed with this HTML in the custom theme. - -```django -{{ config.extra.version }} - -{% if config.extra.links %} -
    - {% for link in config.extra.links %} -
  • {{ link }}
  • - {% endfor %} -
-{% endif %} -``` - -## Search and themes - -As of MkDocs `0.17` client side search support has been added to MkDocs via the -`search` plugin. A theme needs to provide a few things for the plugin to work -with the theme. - -While the `search` plugin is activated by default, users can disable the plugin -and themes should acount for this. It is recomended that theme templates wrap -search specific markup with a check for the plugin: - -```django -{% if 'search' in config['plugins'] %} - search stuff here... -{% endif %} -``` - -At its most basic functionality, the search plugin will simply provide an index -file which is no more than a JSON file containing the content of all pages. -The theme would need to implement its own search functionality client-side. -However, with a few settings and the necessary templates, the plugin can provide -a complete functioning client-side search tool based on [lunr.js]. - -The following options can be set in the [theme's configuration file], -`mkdocs_theme.yml`: - -### include_search_page - -Determines whether the search plugin expects the theme to provide a dedicated -search page via a template located at `search/search.html`. - -When `include_search_page` is set to `true`, the search template will be built -and available at `search/search.html`. This method is used by the `readthedocs` -theme. - -When `include_search_page` is set to `false` or not defined, it is expected that -the theme provide some other mechanisms for displaying search results. For -example, the `mkdocs` theme displays results on any page via a modal. - -### search_index_only - -Determines whether the search plugin should only generate a search index or a -complete search solution. - -When `search_index_only` is set to `true` or not defined, the search plugin -makes no modifications to the Jinja environment. A complete solution using the -provided index file is the responsability of the theme. - -When `search_index_only` is set to `false`, then the search plugin modifies the -Jinja environment by adding its own `temaplates` directory (with a lower -precedence than the theme) and adds its scripts to the `extra_javascript` config -setting. - -The following HTML needs to be added to the theme so that the provided -JavaScript is able to properly load Lunr.js and make relative links to the -search results from the current page. - -```django - -``` - -!!! note - - The provided JavaScript will download the search index. For larger - documentation projects this can be a heavy operation. In those cases, it - is suggested that you either use `search_index_only: true` to only include - search on one page or load the JavaScript on an event like a form submit. - -The following HTML in a `search/search.html` template will add a full search -implementation to your theme. - -```django -

Search Results

- -
- -
- -
- Sorry, page not found. -
-``` - -The JavaScript in the plugin works by looking for the specific ID's used in the -above HTML. The input for the user to type the search query must have the ID -`mkdocs-search-query` and `mkdocs-search-results` is the div where the results -will be placed. - -[Jinja2 template]: http://jinja.pocoo.org/docs/dev/ -[built-in themes]: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/themes -[theme's configuration file]: #theme-configuration -[lunr.js]: http://lunrjs.com/ - -## Packaging Themes - -MkDocs makes use of [Python packaging] to distribute themes. This comes with a -few requirements. - -To see an example of a package containing one theme, see the [MkDocs Bootstrap -theme] and to see a package that contains many themes, see the [MkDocs -Bootswatch theme]. - -!!! Note - - It is not strictly necessary to package a theme, as the entire theme - can be contained in the `custom_dir`. If you have created a "one-off theme," - that should be sufficient. However, if you intend to distribute your theme - for others to use, packaging the theme has some advantages. By packaging - your theme, your users can more easily install it and they can then take - advantage of the [custom_dir] to make tweaks to your theme to better suit - their needs. - -[Python packaging]: https://packaging.python.org/en/latest/ -[MkDocs Bootstrap theme]: http://mkdocs.github.io/mkdocs-bootstrap/ -[MkDocs Bootswatch theme]: http://mkdocs.github.io/mkdocs-bootswatch/ - -### Package Layout - -The following layout is recommended for themes. Two files at the top level -directory called `MANIFEST.in` and `setup.py` beside the theme directory which -contains an empty `__init__.py` file, a theme configuration file -(`mkdocs-theme.yml`), and your template and media files. - -```no-highlight -. -|-- MANIFEST.in -|-- theme_name -| |-- __init__.py -| |-- mkdocs-theme.yml -| |-- main.html -| |-- styles.css -`-- setup.py -``` - -The `MANIFEST.in` file should contain the following contents but with -theme_name updated and any extra file extensions added to the include. - -```no-highlight -recursive-include theme_name *.ico *.js *.css *.png *.html *.eot *.svg *.ttf *.woff -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] -``` - -The `setup.py` should include the following text with the modifications -described below. - -```python -from setuptools import setup, find_packages - -VERSION = '0.0.1' - - -setup( - name="mkdocs-themename", - version=VERSION, - url='', - license='', - description='', - author='', - author_email='', - packages=find_packages(), - include_package_data=True, - entry_points={ - 'mkdocs.themes': [ - 'themename = theme_name', - ] - }, - zip_safe=False -) -``` - -Fill in the URL, license, description, author and author email address. - -The name should follow the convention `mkdocs-themename` (like `mkdocs- -bootstrap` and `mkdocs-bootswatch`), starting with MkDocs, using hyphens to -separate words and including the name of your theme. - -Most of the rest of the file can be left unedited. The last section we need to -change is the entry_points. This is how MkDocs finds the theme(s) you are -including in the package. The name on the left is the one that users will use -in their mkdocs.yml and the one on the right is the directory containing your -theme files. - -The directory you created at the start of this section with the main.html file -should contain all of the other theme files. The minimum requirement is that -it includes a `main.html` for the theme. It **must** also include a -`__init__.py` file which should be empty, this file tells Python that the -directory is a package. - -### Theme Configuration - -A packaged theme is required to include a configuration file named -`mkdocs_theme.yml` which is placed in the root of your template files. The file -should contain default configuration options for the theme. However, if the -theme offers no configuration options, the file is still required and can be -left blank. - -The theme author is free to define any arbitrary options deemed necessary and -those options will be made available in the templates to control behavior. -For example, a theme might want to make a sidebar optional and include the -following in the `mkdocs_theme.yml` file: - -```yaml -show_sidebar: true -``` - -Then in a template, that config option could be referenced: - -```django -{% if config.theme.show_sidebar %} - -{% endif %} -``` - -And the user could override the default in their project's `mkdocs.yml` config -file: - -```yaml -theme: - name: themename - show_sidebar: false -``` - -In addition to arbitrary options defined by the theme, MkDocs defines a few -special options which alters its behavior: - -!!! block "" - - #### static_templates - - This option mirrors the [theme] config option of the same name and allows - some defaults to be set by the theme. Note that while the user can add - templates to this list, the user cannot remove templates included in the - theme's config. - - #### extends - - Defines a parent theme that this theme inherits from. The value should be - the string name of the parent theme. Normal Jinja inheritance rules apply. - -Plugins may also define some options which allow the theme to inform a plugin -about which set of plugin options it expects. See the documentation for any -plugins you may wish to support in your theme. - -### Distributing Themes - -With the above changes, your theme should now be ready to install. This can be -done with pip, using `pip install .` if you are still in the same directory as -the setup.py. - -Most Python packages, including MkDocs, are distributed on PyPI. To do this, -you should run the following command. - -```no-highlight -python setup.py register -``` - -If you don't have an account setup, you should be prompted to create one. - -For a much more detailed guide, see the official Python packaging -documentation for [Packaging and Distributing Projects]. - -[Packaging and Distributing Projects]: https://packaging.python.org/en/latest/distributing/ -[theme]: ./configuration/#theme diff --git a/docs/user-guide/styling-your-docs.md b/docs/user-guide/customizing-your-theme.md similarity index 59% rename from docs/user-guide/styling-your-docs.md rename to docs/user-guide/customizing-your-theme.md index 4837e8f6d4..0011b565b2 100644 --- a/docs/user-guide/styling-your-docs.md +++ b/docs/user-guide/customizing-your-theme.md @@ -1,65 +1,23 @@ -# Styling your docs +# Customizing Your Theme -How to style and theme your documentation. +Altering a theme to suit your needs. --- -MkDocs includes a couple [built-in themes] as well as various [third party -themes], all of which can easily be customized with [extra CSS or -JavaScript][docs_dir] or overridden from the [theme directory][theme_dir]. You -can also create your own [custom theme] from the ground up for your -documentation. +If you would like to make a few tweaks to an existing theme, there is no need +to create your own theme from scratch. For minor tweaks which only require +some CSS and/or JavaScript, you can [use the docs_dir](#using-the-docs_dir). +However, for more complex customizations, including overriding templates, you +will need to [use the theme custom_dir](#using-the-theme-custom_dir) setting. -To use a theme that is included in MkDocs, simply add this to your -`mkdocs.yml` config file. - - theme: readthedocs - -Replace [`readthedocs`](#readthedocs) with any of the [built-in themes] listed below. - -To create a new custom theme see the [Custom Themes][custom theme] page, or to -more heavily customize an existing theme, see -the [Customizing a Theme][customize] section below. - -## Built-in themes - -### mkdocs - -The default theme, which was built as a custom [Bootstrap] theme, supports most -every feature of MkDocs. It only supports the default -[theme configuration options]. - -![mkdocs](/img/mkdocs.png) - -### readthedocs - -A clone of the default theme used by the [Read the Docs] service. This theme -only supports features in its parent theme and does not support any MkDocs -[theme configuration options] in addition to the defaults. - -![ReadTheDocs](http://docs.readthedocs.io/en/latest/_images/screen_mobile.png) - -### Third Party Themes - -A list of third party themes can be found in the MkDocs [community wiki]. If you -have created your own, please feel free to add it to the list. - -## Customizing a Theme - -If you would like to make a few tweaks to an existing theme, there is no need to -create your own theme from scratch. For minor tweaks which only require some CSS -and/or JavaScript, you can use the [docs_dir]. However, for more complex -customizations, including overriding templates, you will need to use the theme -[custom_dir] setting. - -### Using the docs_dir +## Using the docs_dir The [extra_css] and [extra_javascript] configuration options can be used to make tweaks and customizations to existing themes. To use these, you simply need to include either CSS or JavaScript files within your [documentation directory]. -For example, to change the colour of the headers in your documentation, create +For example, to change the color of the headers in your documentation, create a file called `extra.css` and place it next to the documentation Markdown. In that file add the following CSS. @@ -88,25 +46,25 @@ changes were automatically picked up and the documentation will be updated. library, you may have better success including the library by using the theme [custom_dir]. -### Using the theme custom_dir +## Using the theme custom_dir -The theme.[custom_dir] configuration option can be used to point to a directory -of files which override the files in a parent theme. The parent theme would be -the theme defined in the theme.[name] configuration option. Any file in the -`custom_dir` with the same name as a file in the parent theme will replace the -file of the same name in the parent theme. Any additional files in the -`custom_dir` will be added to the parent theme. The contents of the `custom_dir` -should mirror the directory structure of the parent theme. You may include -templates, JavaScript files, CSS files, images, fonts, or any other media -included in a theme. +The [`theme.custom_dir`][custom_dir] configuration option can be used to point +to a directory of files which override the files in a parent theme. The parent +theme would be the theme defined in the [`theme.name`][name] configuration +option. Any file in the `custom_dir` with the same name as a file in the +parent theme will replace the file of the same name in the parent theme. Any +additional files in the `custom_dir` will be added to the parent theme. The +contents of the `custom_dir` should mirror the directory structure of the +parent theme. You may include templates, JavaScript files, CSS files, images, +fonts, or any other media included in a theme. !!! Note - For this to work, the theme `name` setting must be set to a known installed theme. - If the `name` setting is instead set to `null` (or not defined), then there - is no theme to override and the contents of the `custom_dir` must be a - complete, standalone theme. See [Custom Themes][custom theme] for more - information. + For this to work, the `theme.name` setting must be set to a known + installed theme. If the `name` setting is instead set to `null` (or not + defined), then there is no theme to override and the contents of the + `custom_dir` must be a complete, standalone theme. See the [Theme + Developer Guide][custom theme] for more information. For example, the [mkdocs] theme ([browse source]), contains the following directory structure (in part): @@ -138,12 +96,12 @@ And then point your `mkdocs.yml` configuration file at the new directory: ```yaml theme: name: mkdocs - custom_dir: custom_theme + custom_dir: custom_theme/ ``` To override the 404 error page ("file not found"), add a new template file named `404.html` to the `custom_theme` directory. For information on what can be -included in a template, review the documentation for building a [custom theme]. +included in a template, review the [Theme Developer Guide][custom theme]. To override the favicon, you can add a new icon file at `custom_theme/img/favicon.ico`. @@ -167,13 +125,13 @@ Your directory structure should now look like this: !!! Note - Any files included in the parent theme (defined in `name`) but not included - in the `custom_dir` will still be utilized. The `custom_dir` will only - override/replace files in the parent theme. If you want to remove files, or - build a theme from scratch, then you should review the documentation for - building a [custom theme]. + Any files included in the parent theme (defined in `name`) but not + included in the `custom_dir` will still be utilized. The `custom_dir` will + only override/replace files in the parent theme. If you want to remove + files, or build a theme from scratch, then you should review the [Theme + Developer Guide][custom theme]. -#### Overriding Template Blocks +### Overriding Template Blocks The built-in themes implement many of their parts inside template blocks which can be individually overridden in the `main.html` template. Simply create a @@ -185,13 +143,13 @@ template would contain the following: ```django {% extends "base.html" %} -{% block title %} +{% block htmltitle %} Custom title goes here {% endblock %} ``` -In the above example, the title block defined in your custom `main.html` file -will be used in place of the default title block defined in the parent theme. +In the above example, the `htmltitle` block defined in your custom `main.html` file +will be used in place of the default `htmltitle` block defined in the parent theme. You may re-define as many blocks as you desire, as long as those blocks are defined in the parent. For example, you could replace the Google Analytics script with one for a different service or replace the search feature with your @@ -208,7 +166,7 @@ following blocks: * `extrahead`: An empty block in the `` to insert custom tags/scripts/etc. * `site_name`: Contains the site name in the navigation bar. * `site_nav`: Contains the site navigation in the navigation bar. -* `search_box`: Contains the search box in the navigation bar. +* `search_button`: Contains the search box in the navigation bar. * `next_prev`: Contains the next and previous buttons in the navigation bar. * `repo`: Contains the repository link in the navigation bar. * `content`: Contains the page content and table of contents for the page. @@ -219,7 +177,7 @@ work with the structure of the site. See [Template Variables] for a list of variables you can use within your custom blocks. For a more complete explanation of blocks, consult the [Jinja documentation]. -#### Combining the custom_dir and Template Blocks +### Combining the custom_dir and Template Blocks Adding a JavaScript library to the `custom_dir` will make it available, but won't include it in the pages generated by MkDocs. Therefore, a link needs to @@ -258,24 +216,16 @@ Now the generated pages will include links to the template provided libraries as well as the library included in the `custom_dir`. The same would be required for any additional CSS files included in the `custom_dir`. -[browse source]: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/themes/mkdocs -[built-in themes]: #built-in-themes -[Bootstrap]: http://getbootstrap.com/ -[theme configuration options]: configuration.md#theme -[Read the Docs]: https://readthedocs.org/ -[community wiki]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes -[custom theme]: ./custom-themes.md -[customize]: #customizing-a-theme -[docs_dir]: #using-the-docs_dir -[documentation directory]: ./configuration/#docs_dir +[custom theme]: ../dev-guide/themes.md [extra_css]: ./configuration.md#extra_css [extra_javascript]: ./configuration.md#extra_javascript -[Jinja documentation]: http://jinja.pocoo.org/docs/dev/templates/#template-inheritance -[mkdocs]: #mkdocs +[documentation directory]: ./configuration.md#docs_dir [ReadTheDocs]: ./deploying-your-docs.md#readthedocs -[Template Variables]: ./custom-themes.md#template-variables -[custom_dir]: ./configuration/#custom_dir -[name]: ./configuration/#name -[third party themes]: #third-party-themes +[custom_dir]: ./configuration.md#custom_dir +[name]: ./configuration.md#name +[mkdocs]: ./choosing-your-theme.md#mkdocs +[browse source]: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/themes/mkdocs +[Template Variables]: ../dev-guide/themes.md#template-variables +[Jinja documentation]: http://jinja.pocoo.org/docs/dev/templates/#template-inheritance [super block]: http://jinja.pocoo.org/docs/dev/templates/#super-blocks -[base_url]: ./custom-themes.md#base_url +[base_url]: ../dev-guide/themes.md#base_url diff --git a/docs/user-guide/deploying-your-docs.md b/docs/user-guide/deploying-your-docs.md index 9fc9736827..2cadef36fb 100644 --- a/docs/user-guide/deploying-your-docs.md +++ b/docs/user-guide/deploying-your-docs.md @@ -7,17 +7,25 @@ A basic guide to deploying your docs to various hosting providers ## GitHub Pages If you host the source code for a project on [GitHub], you can easily use -[GitHub Pages] to host the documentation for your project. After you `checkout` -the primary working branch (usually `master`) of the git repository where you +[GitHub Pages] to host the documentation for your project. There are two basic +types of GitHub Pages sites: [Project Pages] sites, and [User and Organization +Pages] sites. They are nearly identical but have some important differences, +which require a different work flow when deploying. + +### Project Pages + +Project Pages sites are simpler as the site files get deployed to a branch +within the project repository (`gh-pages` by default). After you `checkout` the +primary working branch (usually `master`) of the git repository where you maintain the source documentation for your project, run the following command: ```sh mkdocs gh-deploy ``` -That's it! Behind the scenes, MkDocs will build your docs and use the [ghp-import] -tool to commit them to the gh-pages branch and push the gh-pages branch to -GitHub. +That's it! Behind the scenes, MkDocs will build your docs and use the +[ghp-import] tool to commit them to the `gh-pages` branch and push the +`gh-pages` branch to GitHub. Use `mkdocs gh-deploy --help` to get a full list of options available for the `gh-deploy` command. @@ -29,12 +37,80 @@ files locally. !!! warning - You should never edit files in your gh-pages branch by hand if you're using - the `gh-deploy` command because you will lose your work. + You should never edit files in your pages repository by hand if you're using + the `gh-deploy` command because you will lose your work the next time you + run the command. + +### Organization and User Pages + +User and Organization Pages sites are not tied to a specific project, and the +site files are deployed to the `master` branch in a dedicated repository named +with the GitHub account name. Therefore, you need working copies of two +repositories on our local system. For example, consider the following file +structure: + +```no-highlight +my-project/ + mkdocs.yml + docs/ +orgname.github.io/ +``` + +After making and verifying updates to your project you need to change +directories to the `orgname.github.io` repository and call the +`mkdocs gh-deploy` command from there: + +```sh +cd ../orgname.github.io/ +mkdocs gh-deploy --config-file ../my-project/mkdocs.yml --remote-branch master +``` + +Note that you need to explicitly point to the `mkdocs.yml` configuration file as +it is no longer in the current working directory. You also need to inform the +deploy script to commit to the `master` branch. You may override the default +with the [remote_branch] configuration setting, but if you forget to change +directories before running the deploy script, it will commit to the `master` +branch of your project, which you probably don't want. + +Be aware that you will not be able to review the built site before it is pushed +to GitHub. Therefore, you may want to verify any changes you make to the docs +beforehand by using the `build` or `serve` commands and reviewing the built +files locally. + +!!! warning + + You should never edit files in your pages repository by hand if you're using + the `gh-deploy` command because you will lose your work the next time you + run the command. + +### Custom Domains + +GitHub Pages includes support for using a [Custom Domain] for your site. In +addition to the steps documented by GitHub, you need to take one additional step +so that MkDocs will work with your custom domain. You need to add a `CNAME` file +to the root of your [docs_dir]. The file must contain a single bare domain or +subdomain on a single line (see MkDocs' own [CNAME file] as an example). You may +create the file manually, or use GitHub's web interface to set up the custom +domain (under Settings / Custom Domain). If you use the web interface, GitHub +will create the `CNAME` file for you and save it to the root of your "pages" +branch. So that the file does not get removed the next time you deploy, you need +to copy the file to your `docs_dir`. With the file properly included in your +`docs_dir`, MkDocs will include the file in your built site and push it to your +"pages" branch each time you run the `gh-deploy` command. + +If you are having problems getting a custom domain to work, see GitHub's +documentation on [Troubleshooting custom domains]. [GitHub]: https://github.com/ [GitHub Pages]: https://pages.github.com/ +[Project Pages]: https://help.github.com/articles/user-organization-and-project-pages/#project-pages-sites +[User and Organization Pages]: https://help.github.com/articles/user-organization-and-project-pages/#user-and-organization-pages-sites [ghp-import]: https://github.com/davisp/ghp-import +[remote_branch]: ./configuration.md#remote_branch +[Custom Domain]: https://help.github.com/articles/adding-or-removing-a-custom-domain-for-your-github-pages-site +[docs_dir]: ./configuration.md#docs_dir +[CNAME file]: https://github.com/mkdocs/mkdocs/blob/master/docs/CNAME +[Troubleshooting custom domains]: https://help.github.com/articles/troubleshooting-custom-domains/ ## Read the Docs @@ -54,45 +130,9 @@ public repository. specific themes and will not work with MkDocs. [rtd]: https://readthedocs.org/ -[instructions]: https://read-the-docs.readthedocs.io/en/latest/getting_started.html#in-markdown -[features]: http://read-the-docs.readthedocs.io/en/latest/features.html -[theme]: /user-guide/styling-your-docs.md - -## PyPI - -If you maintain a [Python] project which is hosted on the [Python Package -Index][PyPI] (PyPI), you can use the hosting provided at [pythonhosted.org] to -host documentation for your project. Run the following commands from your -project's root directory to upload your documentation: - -```sh -mkdocs build -python setup.py upload_docs --upload-dir=site -``` - -Your documentation will be hosted at `https://pythonhosted.org//` -where `` is the name you used to register your project with PyPI. - -There are a few prerequisites for the above to work: - -1. You must be using [Setuptools] in your `setup.py` script ([Distutils] does - not offer an `upload_docs` command). -1. Your project must already be registered with PyPI (use `python setup.py - register`). -1. Your `mkdocs.yml` config file and your "docs" directory (value assigned to - the [docs_dir] configuration option) are presumed to be in the root directory - of your project alongside your `setup.py` script. -1. It is assumed that the default value (`"site"`) is assigned to the [site_dir] - configuration option in your `mkdocs.yaml` config file. If you have set a - different value, assign that value to the `--upload-dir` option. - -[Python]: http://www.python.org/ -[PyPI]: https://pypi.python.org/pypi -[pythonhosted.org]: https://pythonhosted.org/ -[Setuptools]: https://pythonhosted.org/setuptools/ -[Distutils]: https://docs.python.org/2/distutils/ -[docs_dir]: configuration.md#docs_dir -[site_dir]: configuration.md#site_dir +[instructions]: https://docs.readthedocs.io/en/stable/intro/getting-started-with-mkdocs.html +[features]: https://docs.readthedocs.io/en/latest/features.html +[theme]: ./choosing-your-theme.md#readthedocs ## Other Providers @@ -129,6 +169,58 @@ your hosts' file system. See your host's documentation for specifics. You will likely want to search their documentation for "ftp" or "uploading site". +## Local Files + +Rather than hosting your documentation on a server, you may instead distribute +the files directly, which can then be viewed in a browser using the `file://` +scheme. + +Note that, due to the security settings of all modern browsers, some things +will not work the same and some features may not work at all. In fact, a few +settings will need to be customized in very specific ways. + +- [site_url]: + + The `site_url` must be set to an empty string, which instructs MkDocs to + build your site so that it will work with the `file://` scheme. + + site_url: "" + +- [use_directory_urls]: + + Set `use_directory_urls` to `false`. Otherwise, internal links between + pages will not work properly. + + use_directory_urls: false + +- [search]: + + You will need to either disable the search plugin, or use a third-party + search plugin which is specifically designed to work with the `file://` + scheme. To disable all plugins, set the `plugins` setting to an empty list. + + plugins: [] + + If you have other plugins enabled, simply ensure that `search` is not + included in the list. + +When writing your documentation, it is imperative that all internal links use +relative URLs as [documented][internal links]. Remember, each reader of your +documentation will be using a different device and the files will likely be in a +different location on that device. + +If you expect your documentation to be viewed off-line, you may also need to be +careful about which themes you choose. Many themes make use of CDNs for various +support files, which require a live Internet connection. You will need to choose +a theme which includes all support files directly in the theme. + +When you build your site (using the `mkdocs build` command), all of the files +are written to the directory assigned to the [site_dir] configuration option +(defaults to `"site"`) in your `mkdocs.yaml` config file. Generally, you will +simply need to copy the contents of that directory and distribute it to your +readers. Alternatively, you may choose to use a third party tool to convert the +HTML files to some other documentation format. + ## 404 Pages When MkDocs builds the documentation it will include a 404.html file in the @@ -137,4 +229,8 @@ deploying to [GitHub](#github-pages) but only on a custom domain. Other web servers may be configured to use it but the feature won't always be available. See the documentation for your server of choice for more information. -[site_dir]: ./configuration/#site_dir +[site_dir]: ./configuration.md#site_dir +[site_url]: ./configuration.md#site_url +[use_directory_urls]: ./configuration.md#use_directory_urls +[search]: ./configuration.md#search +[internal links]: ./writing-your-docs.md#internal-links diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md new file mode 100644 index 0000000000..7e8dfa9a11 --- /dev/null +++ b/docs/user-guide/index.md @@ -0,0 +1,19 @@ +# User Guide + +Building Documentation with MkDocs + +--- + +The MkDocs Developer Guide provides documentation for users of MkDocs. See +[Getting Started] for an introductory tutorial. You can jump directly to a +page listed below, or use the *next* and *previous* buttons in the navigation +bar at the top of the page to move through the documentation in order. + +- [Installation](installation.md) +- [Writing Your Docs](writing-your-docs.md) +- [Choosing Your Theme](choosing-your-theme.md) +- [Customizing Your Theme](customizing-your-theme.md) +- [Configuration](configuration.md) +- [Deploying Your Docs](deploying-your-docs.md) + +[Getting Started]: ../getting-started.md diff --git a/docs/user-guide/installation.md b/docs/user-guide/installation.md new file mode 100644 index 0000000000..996979e45f --- /dev/null +++ b/docs/user-guide/installation.md @@ -0,0 +1,104 @@ +# MkDocs Installation + +A detailed guide. + +--- + +## Requirements + +MkDocs requires a recent version of [Python] and the Python package +manager, [pip], to be installed on your system. + +You can check if you already have these installed from the command line: + +```bash +$ python --version +Python 3.8.2 +$ pip --version +pip 20.0.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8) +``` + +If you already have those packages installed, you may skip down to [Installing +MkDocs](#installing-mkdocs). + +### Installing Python + +Install [Python] using your package manager of choice, or by downloading an +installer appropriate for your system from [python.org] and running it. + +!!! Note + + If you are installing Python on Windows, be sure to check the box to have + Python added to your PATH if the installer offers such an option (it's + normally off by default). + + ![Add Python to PATH](../img/win-py-install.png) + +### Installing pip + +If you're using a recent version of Python, the Python package manager, [pip], +is most likely installed by default. However, you may need to upgrade pip to the +lasted version: + +```bash +pip install --upgrade pip +``` + +If you need to install pip for the first time, download [get-pip.py]. +Then run the following command to install it: + +```bash +python get-pip.py +``` + +## Installing MkDocs + +Install the `mkdocs` package using pip: + +```bash +pip install mkdocs +``` + +You should now have the `mkdocs` command installed on your system. Run `mkdocs +--version` to check that everything worked okay. + +```bash +$ mkdocs --version +mkdocs, version 1.2.0 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8) +``` + +!!! Note + If you would like manpages installed for MkDocs, the [click-man] tool can + generate and install them for you. Simply run the following two commands: + + pip install click-man + click-man --target path/to/man/pages mkdocs + + See the [click-man documentation] for an explanation of why manpages are + not automatically generated and installed by pip. + +!!! Note + If you are using Windows, some of the above commands may not work + out-of-the-box. + + A quick solution may be to preface every Python command with `python -m` + like this: + + python -m pip install mkdocs + python -m mkdocs + + For a more permanent solution, you may need to edit your `PATH` environment + variable to include the `Scripts` directory of your Python installation. + Recent versions of Python include a script to do this for you. Navigate to + your Python installation directory (for example `C:\Python38\`), open the + `Tools`, then `Scripts` folder, and run the `win_add2path.py` file by double + clicking on it. Alternatively, you can download the [script][a2p] and run it + (`python win_add2path.py`). + +[Python]: https://www.python.org/ +[python.org]: https://www.python.org/downloads/ +[pip]: https://pip.readthedocs.io/en/stable/installing/ +[get-pip.py]: https://bootstrap.pypa.io/get-pip.py +[click-man]: https://github.com/click-contrib/click-man +[click-man documentation]: https://github.com/click-contrib/click-man#automatic-man-page-installation-with-setuptools-and-pip +[a2p]: https://github.com/python/cpython/blob/master/Tools/scripts/win_add2path.py diff --git a/docs/user-guide/localizing-your-theme.md b/docs/user-guide/localizing-your-theme.md new file mode 100644 index 0000000000..2e5eba8ad4 --- /dev/null +++ b/docs/user-guide/localizing-your-theme.md @@ -0,0 +1,67 @@ +# Localizing Your Theme + +Display your theme in your preferred language. + +--- + +!!! Note + + Theme localization only translates the text elements of the theme itself + (such as "next" and "previous" links), not the actual content of your + documentation. If you wish to create multilingual documentation, you need + to combine theme localization as described here with a third-party + internationalization/localization plugin. + +## Installation + +For theme localization to work, you must use a theme which supports it and +enable `i18n` (internationalization) support by installing `mkdocs[i18n]`: + +```bash +pip install mkdocs[i18n] +``` + +## Supported locales + +In most cases a locale is designated by the [ISO-639-1] (2-letter) abbreviation +for your language. However, a locale may also include a territory (or region or +county) code as well. The language and territory must be separated by an +underscore. For example, some possible locales for English might include `en`, +`en_AU`, `en_GB`, and `en_US`. + +For a list of locales supported by the theme you are using, see that theme's +documentation. + +- [mkdocs] +- [readthedocs] + +!!! Warning + + If you configure a language locale which is not yet supported by the theme + that you are using, MkDocs will fall back to the theme's default locale. + +## Usage + +To specify the locale that MkDocs should use, set the [locale] +parameter of the [theme] configuration option to the appropriate code. + +For example, to build the `mkdocs` theme in French you would use the following +in your `mkdocs.yml` configuration file: + +```yaml + theme: + name: mkdocs + locale: fr +``` + +## Contributing theme translations + +If a theme has not yet been translated into your language, feel free to +contribute a translation using the [Translation Guide]. + +[Translation Guide]: ../dev-guide/translations.md +[mkdocs]: choosing-your-theme.md#mkdocs-locale +[readthedocs]: choosing-your-theme.md#readthedocs-locale +[locale]: configuration.md#locale +[theme]: configuration.md#theme +[ISO-639-1]: https://en.wikipedia.org/wiki/ISO_639-1 diff --git a/docs/user-guide/writing-your-docs.md b/docs/user-guide/writing-your-docs.md index ec8390c8a8..ad228fb4ca 100644 --- a/docs/user-guide/writing-your-docs.md +++ b/docs/user-guide/writing-your-docs.md @@ -1,67 +1,16 @@ # Writing your docs -How to write and layout your markdown source files. +How to layout and write your Markdown source files. --- -## Configure Pages and Navigation - -The [pages configuration](/user-guide/configuration.md#pages) in your -`mkdocs.yml` defines which pages are built by MkDocs and how they appear in the -documentation navigation. If not provided, the pages configuration will be -automatically created by discovering all the Markdown files in the -[documentation directory](/user-guide/configuration.md#docs_dir). An -automatically created pages configuration will always be sorted -alphanumerically by file name. You will need to manually define your pages -configuration if you would like your pages sorted differently. - -A simple pages configuration looks like this: - -```no-highlight -pages: -- 'index.md' -- 'about.md' -``` - -With this example we will build two pages at the top level and they will -automatically have their titles inferred from the filename. Assuming `docs_dir` -has the default value, `docs`, the source files for this documentation would be -`docs/index.md` and `docs/about.md`. To provide a custom name for these pages, -they can be added before the filename. - -```no-highlight -pages: -- Home: 'index.md' -- About: 'about.md' -``` - -### Multilevel documentation - -Subsections can be created by listing related pages together under a section -title. For example: - -```no-highlight -pages: -- Home: 'index.md' -- User Guide: - - 'Writing your docs': 'user-guide/writing-your-docs.md' - - 'Styling your docs': 'user-guide/styling-your-docs.md' -- About: - - 'License': 'about/license.md' - - 'Release Notes': 'about/release-notes.md' -``` - -With the above configuration we have three top level sections: Home, User Guide -and About. Then under User Guide we have two pages, Writing your docs and -Styling your docs. Under the About section we also have two pages, License and -Release Notes. - ## File layout -Your documentation source should be written as regular Markdown files, and -placed in a directory somewhere in your project. Normally this directory will be -named `docs` and will exist at the top level of your project, alongside the -`mkdocs.yml` configuration file. +Your documentation source should be written as regular Markdown files (see +[Writing with Markdown](#writing-with-markdown) below), and placed in the +[documentation directory](configuration.md#docs_dir). By default, this directory +will be named `docs` and will exist at the top level of your project, alongside +the `mkdocs.yml` configuration file. The simplest project you can create will look something like this: @@ -71,11 +20,20 @@ docs/ index.md ``` -By convention your project homepage should always be named `index`. Any of the -following extensions may be used for your Markdown source files: `markdown`, -`mdown`, `mkdn`, `mkd`, `md`. +By convention your project homepage should be named `index.md` (see [Index +pages](#index-pages) below for details). Any of the following file +extensions may be used for your Markdown source files: `markdown`, `mdown`, +`mkdn`, `mkd`, `md`. All Markdown files included in your documentation +directory will be rendered in the built site regardless of any settings. + +!!! note + + Files and directories with names which begin with a dot (for example: + `.foo.md` or `.bar/baz.md`) are ignored by MkDocs, which matches the + behavior of most web servers. There is no option to override this + behavior. -You can also create multi-page documentation, by creating several markdown +You can also create multi-page documentation, by creating several Markdown files: ```no-highlight @@ -116,47 +74,239 @@ nested URLs, like so: /license/ ``` -## Linking documents +Any files which are not identified as Markdown files (by their file extension) +within the [documentation directory](configuration.md#docs_dir) are copied by +MkDocs to the built site unaltered. See +[how to link to images and media](#linking-to-images-and-media) below for details. + +### Index pages + +When a directory is requested, by default, most web servers will return an index +file (usually named `index.html`) contained within that directory if one exists. +For that reason, the homepage in all of the examples above has been named +`index.md`, which MkDocs will render to `index.html` when building the site. + +Many repository hosting sites provide special treatment for README files by +displaying the contents of the README file when browsing the contents of a +directory. Therefore, MkDocs will allow you to name your index pages as +`README.md` instead of `index.md`. In that way, when users are browsing your +source code, the repository host can display the index page of that directory as +it is a README file. However, when MkDocs renders your site, the file will be +renamed to `index.html` so that the server will serve it as a proper index file. + +If both an `index.md` file and a `README.md` file are found in the same +directory, then the `index.md` file is used and the `README.md` file is +ignored. + +### Configure Pages and Navigation + +The [nav](configuration.md#nav) configuration setting in your `mkdocs.yml` file +defines which pages are included in the global site navigation menu as well as +the structure of that menu. If not provided, the navigation will be +automatically created by discovering all the Markdown files in the +[documentation directory](configuration.md#docs_dir). An automatically created +navigation configuration will always be sorted alphanumerically by file name +(except that index files will always be listed first within a sub-section). You +will need to manually define your navigation configuration if you would like +your navigation menu sorted differently. + +A minimal navigation configuration could look like this: + +```no-highlight +nav: + - 'index.md' + - 'about.md' +``` + +All paths in the navigation configuration must be relative to the `docs_dir` +configuration option. If that option is set to the default value, `docs`, the +source files for the above configuration would be located at `docs/index.md` and +`docs/about.md`. + +The above example will result in two navigation items being created at the top +level and with their titles inferred from the contents of the Markdown file or, +if no title is defined within the file, of the file name. To override the title +in the `nav` setting add a title right before the filename. + +```no-highlight +nav: + - Home: 'index.md' + - About: 'about.md' +``` + +Note that if a title is defined for a page in the navigation, that title will be +used throughout the site for that page and will override any title defined +within the page itself. + +Navigation sub-sections can be created by listing related pages together under a +section title. For example: + +```no-highlight +nav: + - Home: 'index.md' + - 'User Guide': + - 'Writing your docs': 'writing-your-docs.md' + - 'Styling your docs': 'styling-your-docs.md' + - About: + - 'License': 'license.md' + - 'Release Notes': 'release-notes.md' +``` + +With the above configuration we have three top level items: "Home", "User Guide" +and "About." "Home" is a link to the homepage for the site. Under the "User +Guide" section two pages are listed: "Writing your docs" and "Styling your +docs." Under the "About" section two more pages are listed: "License" and +"Release Notes." + +Note that a section cannot have a page assigned to it. Sections are only +containers for child pages and sub-sections. You may nest sections as deeply as +you like. However, be careful that you don't make it too difficult for your +users to navigate through the site navigation by over-complicating the nesting. +While sections may mirror your directory structure, they do not have to. + +Any pages not listed in your navigation configuration will still be rendered and +included with the built site, however, they will not be linked from the global +navigation and will not be included in the `previous` and `next` links. Such +pages will be "hidden" unless linked to directly. + +## Writing with Markdown + +MkDocs pages must be authored in [Markdown][md], a lightweight markup language +which results in easy-to-read, easy-to-write plain text documents that can be +converted to valid HTML documents in a predictable manner. + +MkDocs uses the [Python-Markdown] library to render Markdown documents to HTML. +Python-Markdown is almost completely compliant with the [reference +implementation][md], although there are a few very minor [differences]. + +In addition to the base Markdown [syntax] which is common across all Markdown +implementations, MkDocs includes support for extending the Markdown syntax with +Python-Markdown [extensions]. See the MkDocs' [markdown_extensions] +configuration setting for details on how to enable extensions. + +MkDocs includes some extensions by default, which are highlighted below. + +[Python-Markdown]: https://python-markdown.github.io/ +[md]: https://daringfireball.net/projects/markdown/ +[differences]: https://python-markdown.github.io/#differences +[syntax]: https://daringfireball.net/projects/markdown/syntax +[extensions]: https://python-markdown.github.io/extensions/ +[markdown_extensions]: configuration.md#markdown_extensions + +### Internal links MkDocs allows you to interlink your documentation by using regular Markdown -hyperlinks. +[links]. However, there are a few additional benefits to formatting those links +specifically for MkDocs as outlined below. + +[links]: https://daringfireball.net/projects/markdown/syntax#link -### Internal hyperlinks +#### Linking to pages When linking between pages in the documentation you can simply use the regular -Markdown hyperlinking syntax, including the relative path to the Markdown +Markdown [linking][links] syntax, including the *relative path* to the Markdown document you wish to link to. - Please see the [project license](license.md) for further details. +```no-highlight +Please see the [project license](license.md) for further details. +``` -When the MkDocs build runs, these hyperlinks will automatically be transformed -into a hyperlink to the appropriate HTML page. +When the MkDocs build runs, these Markdown links will automatically be +transformed into an HTML hyperlink to the appropriate HTML page. -When working on your documentation you should be able to open the linked -Markdown document in a new editor window simply by clicking on the link. +!!! warning + Using absolute paths with links is not officially supported. Relative paths + are adjusted by MkDocs to ensure they are always relative to the page. Absolute + paths are not modified at all. This means that your links using absolute paths + might work fine in your local environment but they might break once you deploy + them to your production server. If the target documentation file is in another directory you'll need to make -sure to include any relative directory path in the hyperlink. +sure to include any relative directory path in the link. - Please see the [project license](../about/license.md) for further details. +```no-highlight +Please see the [project license](../about/license.md) for further details. +``` -You can also link to a section within a target documentation page by using an -anchor link. The generated HTML will correctly transform the path portion of the -hyperlink, and leave the anchor portion intact. +The [toc] extension is used by MkDocs to generate an ID for every header in your +Markdown documents. You can use that ID to link to a section within a target +document by using an anchor link. The generated HTML will correctly transform +the path portion of the link, and leave the anchor portion intact. + +```no-highlight +Please see the [project license](about.md#license) for further details. +``` - Please see the [project license](about.md#license) for further details. +Note that IDs are created from the text of a header. All text is converted to +lowercase and any disallowed characters, including white-space, are converted to +dashes. Consecutive dashes are then reduced to a single dash. -## Images and media +There are a few configuration settings provided by the toc extension which you +can set in your `mkdocs.yml` configuration file to alter the default behavior: + +`permalink`: + +: Generate permanent links at the end of each header. Default: `False`. + + When set to True the paragraph symbol (¶ or `¶`) is used as the + link text. When set to a string, the provided string is used as the link + text. For example, to use the hash symbol (`#`) instead, do: + + markdown_extensions: + - toc: + permalink: "#" + +`baselevel`: + +: Base level for headers. Default: `1`. + + This setting allows the header levels to be automatically adjusted to fit + within the hierarchy of your HTML templates. For example, if the Markdown + text for a page should not contain any headers higher than level 2 (`

`), + do: + + markdown_extensions: + - toc: + baselevel: 2 + + Then any headers in your document would be increased by 1. For example, the + header `# Header` would be rendered as a level 2 header (`

`) in the HTML + output. + +`separator`: + +: Word separator. Default: `-`. + + Character which replaces white-space in generated IDs. If you prefer + underscores, then do: + + markdown_extensions: + - toc: + separator: "_" + +Note that if you would like to define multiple of the above settings, you must +do so under a single `toc` entry in the `markdown_extensions` configuration +option. + +```yml +markdown_extensions: + - toc: + permalink: "#" + baselevel: 2 + separator: "_" +``` + +[toc]: https://python-markdown.github.io/extensions/toc/ + +#### Linking to images and media As well as the Markdown source files, you can also include other file types in your documentation, which will be copied across when generating your documentation site. These might include images and other media. For example, if your project documentation needed to include a [GitHub pages -CNAME -file](https://help.github.com/articles/using-a-custom-domain-with-github-pages/) -and a PNG formatted screenshot image then your file layout might look as -follows: +CNAME file] and a PNG formatted screenshot image then your file layout might +look as follows: ```no-highlight mkdocs.yml @@ -180,15 +330,142 @@ Cupcake indexer is a snazzy new project for indexing small cakes. *Above: Cupcake indexer in progress* ``` -You image will now be embedded when you build the documentation, and should also -be previewed if you're working on the documentation with a Markdown editor. +Your image will now be embedded when you build the documentation, and should +also be previewed if you're working on the documentation with a Markdown editor. + +[GitHub pages CNAME file]: https://help.github.com/articles/using-a-custom-domain-with-github-pages/ + +#### Linking from raw HTML + +Markdown allows document authors to fall back to raw HTML when the Markdown +syntax does not meets the author's needs. MkDocs does not limit Markdown in this +regard. However, as all raw HTML is ignored by the Markdown parser, MkDocs is +not able to validate or convert links contained in raw HTML. When including +internal links within raw HTML, you will need to manually format the link +appropriately for the rendered document. + +### Meta-Data + +MkDocs includes support for both YAML and MultiMarkdown style meta-data (often +called front-matter). Meta-data consists of a series of keywords and values +defined at the beginning of a Markdown document, which are stripped from the +document prior to it being processing by Python-Markdown. The key/value pairs +are passed by MkDocs to the page template. Therefore, if a theme includes +support, the values of any keys can be displayed on the page or used to control +the page rendering. See your theme's documentation for information about which +keys may be supported, if any. + +In addition to displaying information in a template, MkDocs includes support for +a few predefined meta-data keys which can alter the behavior of MkDocs for that +specific page. The following keys are supported: + +`template`: + +: The template to use with the current page. + + By default, MkDocs uses the `main.html` template of a theme to render + Markdown pages. You can use the `template` meta-data key to define a + different template file for that specific page. The template file must be + available on the path(s) defined in the theme's environment. + +`title`: + +: The "title" to use for the document. -## Markdown extensions + MkDocs will attempt to determine the title of a document in the following + ways, in order: -MkDocs supports the following Markdown extensions. + 1. A title defined in the [nav] configuration setting for a document. + 2. A title defined in the `title` meta-data key of a document. + 3. A level 1 Markdown header on the first line of the document body. + Please note that [Setext-style] headers are not supported. + 4. The filename of a document. + + Upon finding a title for a page, MkDoc does not continue checking any + additional sources in the above list. + +[Setext-style]: https://daringfireball.net/projects/markdown/syntax#header + +#### YAML Style Meta-Data + +YAML style meta-data consists of [YAML] key/value pairs wrapped in YAML style +deliminators to mark the start and/or end of the meta-data. The first line of +a document must be `---`. The meta-data ends at the first line containing an +end deliminator (either `---` or `...`). The content between the deliminators is +parsed as [YAML]. + +```no-highlight +--- +title: My Document +summary: A brief description of my document. +authors: + - Waylan Limberg + - Tom Christie +date: 2018-07-10 +some_url: https://example.com +--- +This is the first paragraph of the document. +``` + +YAML is able to detect data types. Therefore, in the above example, the values +of `title`, `summary` and `some_url` are strings, the value of `authors` is a +list of strings and the value of `date` is a `datetime.date` object. Note that +the YAML keys are case sensitive and MkDocs expects keys to be all lowercase. +The top level of the YAML must be a collection of key/value pairs, which results +in a Python `dict` being returned. If any other type is returned or the YAML +parser encounters an error, then MkDocs does not recognize the section as +meta-data, the page's `meta` attribute will be empty, and the section is not +removed from the document. + +#### MultiMarkdown Style Meta-Data + +MultiMarkdown style meta-data uses a format first introduced by the +[MultiMarkdown] project. The data consists of a series of keywords and values +defined at the beginning of a Markdown document, like this: + +```no-highlight +Title: My Document +Summary: A brief description of my document. +Authors: Waylan Limberg + Tom Christie +Date: January 23, 2018 +blank-value: +some_url: https://example.com + +This is the first paragraph of the document. +``` + +The keywords are case-insensitive and may consist of letters, numbers, +underscores and dashes and must end with a colon. The values consist of anything +following the colon on the line and may even be blank. + +If a line is indented by 4 or more spaces, that line is assumed to be an +additional line of the value for the previous keyword. A keyword may have as +many lines as desired. All lines are joined into a single string. + +The first blank line ends all meta-data for the document. Therefore, the first +line of a document must not be blank. + +!!! note + + MkDocs does not support YAML style deliminators (`---` or `...`) for + MultiMarkdown style meta-data. In fact, MkDocs relies on the the presence or + absence of the deliminators to determine whether YAML style meta-data or + MultiMarkdown style meta-data is being used. If the deliminators are + detected, but the content between the deliminators is not valid YAML + meta-data, MkDocs does not attempt to parse the content as MultiMarkdown + style meta-data. + +[YAML]: http://yaml.org +[MultiMarkdown]: http://fletcherpenney.net/MultiMarkdown_Syntax_Guide#metadata +[nav]: configuration.md#nav ### Tables +The [tables] extension adds a basic table syntax to Markdown which is popular +across multiple implementations. The syntax is rather simple and is generally +only useful for simple tabular data. + A simple table looks like this: ```no-highlight @@ -216,12 +493,24 @@ Left | Center | Right Left | Center | Right ``` +Note that table cells cannot contain any block level elements and cannot contain +multiple lines of text. They can, however, include inline Markdown as defined in +Markdown's [syntax] rules. + +Additionally, a table must be surrounded by blank lines. There must be a blank +line before and after the table. + +[tables]: https://python-markdown.github.io/extensions/tables/ + ### Fenced code blocks +The [fenced code blocks] extension adds an alternate method of defining code +blocks without indentation. + The first line should contain 3 or more backtick (`` ` ``) characters, and the last line should contain the same number of backtick characters (`` ` ``): -~~~no-highlight +````no-highlight ``` Fenced code blocks are like Standard Markdown’s regular code blocks, except that @@ -229,14 +518,19 @@ they’re not indented and instead rely on start and end fence lines to delimit the code block. ``` -~~~ +```` With this approach, the language can optionally be specified on the first line -after the backticks: +after the backticks which informs any syntax highlighters of the language used: -~~~no-highlight +````no-highlight ```python def fn(): pass ``` -~~~ +```` + +Note that fenced code blocks can not be indented. Therefore, they cannot be +nested inside list items, blockquotes, etc. + +[fenced code blocks]: https://python-markdown.github.io/extensions/fenced_code_blocks/ diff --git a/mdl_ruleset.rb b/mdl_ruleset.rb deleted file mode 100644 index e0312822f7..0000000000 --- a/mdl_ruleset.rb +++ /dev/null @@ -1,4 +0,0 @@ -all # Use all markdownlint rules - -# Disable line length check for tables and code blocks -rule 'MD013', :line_length => 80, :code_blocks => false, :tables => false diff --git a/mkdocs.yml b/mkdocs.yml index 66664b8d49..bfaeb5588a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,20 +1,37 @@ site_name: MkDocs -site_url: http://www.mkdocs.org +site_url: https://www.mkdocs.org/ site_description: Project documentation with Markdown. site_author: MkDocs Team repo_url: https://github.com/mkdocs/mkdocs/ edit_uri: "" -pages: +theme: + name: mkdocs + locale: en + analytics: {gtag: 'G-274394082'} + highlightjs: true + hljs_languages: + - yaml + - django + +nav: - Home: index.md + - Getting Started: getting-started.md - User Guide: + - Overview: user-guide/index.md + - Installation: user-guide/installation.md - Writing Your Docs: user-guide/writing-your-docs.md - - Styling Your Docs: user-guide/styling-your-docs.md + - Choosing Your Theme: user-guide/choosing-your-theme.md + - Customizing Your Theme: user-guide/customizing-your-theme.md + - Localizing Your Theme: user-guide/localizing-your-theme.md - Configuration: user-guide/configuration.md - Deploying Your Docs: user-guide/deploying-your-docs.md - - Custom Themes: user-guide/custom-themes.md - - Plugins: user-guide/plugins.md + - Developer Guide: + - Overview: dev-guide/index.md + - Themes: dev-guide/themes.md + - Translations: dev-guide/translations.md + - Plugins: dev-guide/plugins.md - About: - Release Notes: about/release-notes.md - Contributing: about/contributing.md @@ -27,10 +44,18 @@ markdown_extensions: - toc: permalink:  - admonition + - attr_list - def_list + - mdx_gh_links: + user: mkdocs + repo: mkdocs copyright: Copyright © 2014 Tom Christie, Maintained by the MkDocs Team. -google_analytics: ['UA-27795084-5', 'mkdocs.org'] plugins: - search + - redirects: + redirect_maps: + user-guide/plugins.md: dev-guide/plugins.md + user-guide/custom-themes.md: dev-guide/themes.md + user-guide/styling-your-docs.md: user-guide/choosing-your-theme.md diff --git a/mkdocs/__init__.py b/mkdocs/__init__.py index 191e8c7e7a..69760b0649 100644 --- a/mkdocs/__init__.py +++ b/mkdocs/__init__.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals # For acceptable version formats, see https://www.python.org/dev/peps/pep-0440/ -__version__ = '0.17.2' +__version__ = '1.2.3' diff --git a/mkdocs/__main__.py b/mkdocs/__main__.py index 8a0ce35407..4afd164b14 100644 --- a/mkdocs/__main__.py +++ b/mkdocs/__main__.py @@ -1,47 +1,120 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals +import os +import sys import logging import click -import socket +import textwrap +import shutil from mkdocs import __version__ from mkdocs import utils -from mkdocs import exceptions from mkdocs import config from mkdocs.commands import build, gh_deploy, new, serve -log = logging.getLogger(__name__) -# Disable the warning that Click displays (as of Click version 5.0) when users -# use unicode_literals in Python 2. -# See http://click.pocoo.org/dev/python3/#unicode-literals for more details. -click.disable_unicode_literals_warning = True +if sys.platform.startswith("win"): + try: + import colorama + except ImportError: + pass + else: + colorama.init() + +log = logging.getLogger(__name__) -class State(object): +class ColorFormatter(logging.Formatter): + colors = { + 'CRITICAL': 'red', + 'ERROR': 'red', + 'WARNING': 'yellow', + 'DEBUG': 'blue' + } + + text_wrapper = textwrap.TextWrapper( + width=shutil.get_terminal_size(fallback=(0, 0)).columns, + replace_whitespace=False, + break_long_words=False, + break_on_hyphens=False, + initial_indent=' '*12, + subsequent_indent=' '*12 + ) + + def format(self, record): + message = super().format(record) + prefix = f'{record.levelname:<8} - ' + if record.levelname in self.colors: + prefix = click.style(prefix, fg=self.colors[record.levelname]) + if self.text_wrapper.width: + # Only wrap text if a terminal width was detected + msg = '\n'.join( + self.text_wrapper.fill(line) + for line in message.splitlines() + ) + # Prepend prefix after wrapping so that color codes don't affect length + return prefix + msg[12:] + return prefix + message + + +class State: ''' Maintain logging level.''' def __init__(self, log_name='mkdocs', level=logging.INFO): self.logger = logging.getLogger(log_name) + # Don't restrict level on logger; use handler + self.logger.setLevel(1) self.logger.propagate = False - stream = logging.StreamHandler() - formatter = logging.Formatter("%(levelname)-7s - %(message)s ") - stream.setFormatter(formatter) - self.logger.addHandler(stream) - self.logger.setLevel(level) + self.stream = logging.StreamHandler() + self.stream.setFormatter(ColorFormatter()) + self.stream.setLevel(level) + self.stream.name = 'MkDocsStreamHandler' + self.logger.addHandler(self.stream) pass_state = click.make_pass_decorator(State, ensure=True) +clean_help = "Remove old files from the site_dir before building (the default)." +config_help = "Provide a specific MkDocs config" +dev_addr_help = ("IP address and port to serve documentation locally (default: " + "localhost:8000)") +strict_help = ("Enable strict mode. This will cause MkDocs to abort the build " + "on any warnings.") +theme_help = "The theme to use when building your documentation." +theme_choices = utils.get_theme_names() +site_dir_help = "The directory to output the result of the documentation build." +use_directory_urls_help = "Use directory URLs when building pages (the default)." +reload_help = "Enable the live reloading in the development server (this is the default)" +no_reload_help = "Disable the live reloading in the development server." +dirty_reload_help = "Enable the live reloading in the development server, but only re-build files that have changed" +commit_message_help = ("A commit message to use when committing to the " + "Github Pages remote branch. Commit {sha} and MkDocs {version} are available as expansions") +remote_branch_help = ("The remote branch to commit to for Github Pages. This " + "overrides the value specified in config") +remote_name_help = ("The remote name to commit to for Github Pages. This " + "overrides the value specified in config") +force_help = "Force the push to the repository." +ignore_version_help = "Ignore check that build is not being deployed with an older version of MkDocs." +watch_theme_help = ("Include the theme in list of files to watch for live reloading. " + "Ignored when live reload is not used.") +shell_help = "Use the shell when invoking Git." + + +def add_options(opts): + def inner(f): + for i in reversed(opts): + f = i(f) + return f + + return inner + def verbose_option(f): def callback(ctx, param, value): state = ctx.ensure_object(State) if value: - state.logger.setLevel(logging.DEBUG) + state.stream.setLevel(logging.DEBUG) return click.option('-v', '--verbose', is_flag=True, expose_value=False, @@ -53,7 +126,7 @@ def quiet_option(f): def callback(ctx, param, value): state = ctx.ensure_object(State) if value: - state.logger.setLevel(logging.ERROR) + state.stream.setLevel(logging.ERROR) return click.option('-q', '--quiet', is_flag=True, expose_value=False, @@ -61,36 +134,29 @@ def callback(ctx, param, value): callback=callback)(f) -def common_options(f): - f = verbose_option(f) - f = quiet_option(f) - return f +common_options = add_options([quiet_option, verbose_option]) +common_config_options = add_options([ + click.option('-f', '--config-file', type=click.File('rb'), help=config_help), + # Don't override config value if user did not specify --strict flag + # Conveniently, load_config drops None values + click.option('-s', '--strict', is_flag=True, default=None, help=strict_help), + click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help), + # As with --strict, set the default to None so that this doesn't incorrectly + # override the config file + click.option('--use-directory-urls/--no-directory-urls', is_flag=True, default=None, help=use_directory_urls_help) +]) +PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}" -clean_help = "Remove old files from the site_dir before building (the default)." -config_help = "Provide a specific MkDocs config" -dev_addr_help = ("IP address and port to serve documentation locally (default: " - "localhost:8000)") -strict_help = ("Enable strict mode. This will cause MkDocs to abort the build " - "on any warnings.") -theme_dir_help = "The theme directory to use when building your documentation." -theme_help = "The theme to use when building your documentation." -theme_choices = utils.get_theme_names() -site_dir_help = "The directory to output the result of the documentation build." -reload_help = "Enable the live reloading in the development server (this is the default)" -no_reload_help = "Disable the live reloading in the development server." -dirty_reload_help = "Enable the live reloading in the development server, but only re-build files that have changed" -commit_message_help = ("A commit message to use when commiting to the " - "Github Pages remote branch") -remote_branch_help = ("The remote branch to commit to for Github Pages. This " - "overrides the value specified in config") -remote_name_help = ("The remote name to commit to for Github Pages. This " - "overrides the value specified in config") -force_help = "Force the push to the repository." +PKG_DIR = os.path.dirname(os.path.abspath(__file__)) @click.group(context_settings={'help_option_names': ['-h', '--help']}) -@click.version_option(__version__, '-V', '--version') +@click.version_option( + __version__, + '-V', '--version', + message=f'%(prog)s, version %(version)s from { PKG_DIR } (Python { PYTHON_VERSION })' +) @common_options def cli(): """ @@ -99,87 +165,48 @@ def cli(): @cli.command(name="serve") -@click.option('-f', '--config-file', type=click.File('rb'), help=config_help) @click.option('-a', '--dev-addr', help=dev_addr_help, metavar='') -@click.option('-s', '--strict', is_flag=True, help=strict_help) -@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help) -@click.option('-e', '--theme-dir', type=click.Path(), help=theme_dir_help) @click.option('--livereload', 'livereload', flag_value='livereload', help=reload_help, default=True) @click.option('--no-livereload', 'livereload', flag_value='no-livereload', help=no_reload_help) @click.option('--dirtyreload', 'livereload', flag_value='dirty', help=dirty_reload_help) +@click.option('--watch-theme', help=watch_theme_help, is_flag=True) +@common_config_options @common_options -def serve_command(dev_addr, config_file, strict, theme, theme_dir, livereload): +def serve_command(dev_addr, livereload, **kwargs): """Run the builtin development server""" - - logging.getLogger('tornado').setLevel(logging.WARNING) - - # Don't override config value if user did not specify --strict flag - # Conveniently, load_config drops None values - strict = strict or None - - try: - serve.serve( - config_file=config_file, - dev_addr=dev_addr, - strict=strict, - theme=theme, - theme_dir=theme_dir, - livereload=livereload - ) - except (exceptions.ConfigurationError, socket.error) as e: # pragma: no cover - # Avoid ugly, unhelpful traceback - raise SystemExit('\n' + str(e)) + serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs) @cli.command(name="build") @click.option('-c', '--clean/--dirty', is_flag=True, default=True, help=clean_help) -@click.option('-f', '--config-file', type=click.File('rb'), help=config_help) -@click.option('-s', '--strict', is_flag=True, help=strict_help) -@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help) -@click.option('-e', '--theme-dir', type=click.Path(), help=theme_dir_help) +@common_config_options @click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help) @common_options -def build_command(clean, config_file, strict, theme, theme_dir, site_dir): +def build_command(clean, **kwargs): """Build the MkDocs documentation""" - - # Don't override config value if user did not specify --strict flag - # Conveniently, load_config drops None values - strict = strict or None - - try: - build.build(config.load_config( - config_file=config_file, - strict=strict, - theme=theme, - theme_dir=theme_dir, - site_dir=site_dir - ), dirty=not clean) - except exceptions.ConfigurationError as e: # pragma: no cover - # Avoid ugly, unhelpful traceback - raise SystemExit('\n' + str(e)) + build.build(config.load_config(**kwargs), dirty=not clean) @cli.command(name="gh-deploy") @click.option('-c', '--clean/--dirty', is_flag=True, default=True, help=clean_help) -@click.option('-f', '--config-file', type=click.File('rb'), help=config_help) @click.option('-m', '--message', help=commit_message_help) @click.option('-b', '--remote-branch', help=remote_branch_help) @click.option('-r', '--remote-name', help=remote_name_help) @click.option('--force', is_flag=True, help=force_help) +@click.option('--ignore-version', is_flag=True, help=ignore_version_help) +@click.option('--shell', is_flag=True, help=shell_help) +@common_config_options +@click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help) @common_options -def gh_deploy_command(config_file, clean, message, remote_branch, remote_name, force): +def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_version, shell, **kwargs): """Deploy your documentation to GitHub Pages""" - try: - cfg = config.load_config( - config_file=config_file, - remote_branch=remote_branch, - remote_name=remote_name - ) - build.build(cfg, dirty=not clean) - gh_deploy.gh_deploy(cfg, message=message, force=force) - except exceptions.ConfigurationError as e: # pragma: no cover - # Avoid ugly, unhelpful traceback - raise SystemExit('\n' + str(e)) + cfg = config.load_config( + remote_branch=remote_branch, + remote_name=remote_name, + **kwargs + ) + build.build(cfg, dirty=not clean) + gh_deploy.gh_deploy(cfg, message=message, force=force, ignore_version=ignore_version, shell=shell) @cli.command(name="new") diff --git a/mkdocs/commands/babel.py b/mkdocs/commands/babel.py new file mode 100644 index 0000000000..bbfa9e8252 --- /dev/null +++ b/mkdocs/commands/babel.py @@ -0,0 +1,104 @@ +from distutils.errors import DistutilsOptionError +from os import path +from pkg_resources import EntryPoint +from babel.messages import frontend as babel + + +DEFAULT_MAPPING_FILE = path.normpath(path.join( + path.abspath(path.dirname(__file__)), '../themes/babel.cfg' +)) + + +class ThemeMixin: + def get_theme_dir(self): + ''' Validate theme option and return path to theme's root obtained from entry point. ''' + entry_points = EntryPoint.parse_map(self.distribution.entry_points, self.distribution) + if 'mkdocs.themes' not in entry_points: + raise DistutilsOptionError("no mkdocs.themes are defined in entry_points") + if self.theme is None and len(entry_points['mkdocs.themes']) == 1: + # Default to the only theme defined in entry_points as none specified. + self.theme = tuple(entry_points['mkdocs.themes'].keys())[0] + if self.theme not in entry_points['mkdocs.themes']: + raise DistutilsOptionError("you must specify a valid theme name to work on") + theme = entry_points['mkdocs.themes'][self.theme] + return path.dirname(theme.resolve().__file__) + + +class compile_catalog(babel.compile_catalog, ThemeMixin): + user_options = babel.compile_catalog.user_options + [ + ("theme=", "t", "theme name to work on"), + ] + + def initialize_options(self): + super().initialize_options() + self.theme = None + + def finalize_options(self): + if not self.directory: + theme_dir = self.get_theme_dir() + self.directory = f"{theme_dir}/locales" + super().finalize_options() + + +class extract_messages(babel.extract_messages, ThemeMixin): + user_options = babel.extract_messages.user_options + [ + ("domain=", "d", "domains of the POT output file"), + ("theme=", "t", "theme name to work on"), + ] + + def initialize_options(self): + super().initialize_options() + self.domain = "messages" + self.theme = None + + def finalize_options(self): + if not self.version: + version = self.distribution.get_version() + self.version = ".".join([i for i in version.split(".") if "dev" not in i]) + if not self.mapping_file: + self.mapping_file = DEFAULT_MAPPING_FILE + if not self.input_paths or not self.output_file: + theme_dir = self.get_theme_dir() + if not self.input_paths: + self.input_paths = theme_dir + if not self.output_file: + self.output_file = f"{theme_dir}/{self.domain}.pot" + super().finalize_options() + + +class init_catalog(babel.init_catalog, ThemeMixin): + user_options = babel.init_catalog.user_options + [ + ("theme=", "t", "theme name to work on"), + ] + + def initialize_options(self): + super().initialize_options() + self.theme = None + + def finalize_options(self): + if not self.input_file or not self.output_dir: + theme_dir = self.get_theme_dir() + if not self.input_file: + self.input_file = f"{theme_dir}/{self.domain}.pot" + if not self.output_dir: + self.output_dir = f"{theme_dir}/locales" + super().finalize_options() + + +class update_catalog(babel.update_catalog, ThemeMixin): + user_options = babel.update_catalog.user_options + [ + ("theme=", "t", "theme name to work on"), + ] + + def initialize_options(self): + super().initialize_options() + self.theme = None + + def finalize_options(self): + if not self.input_file or not self.output_dir: + theme_dir = self.get_theme_dir() + if not self.input_file: + self.input_file = f"{theme_dir}/{self.domain}.pot" + if not self.output_dir: + self.output_dir = f"{theme_dir}/locales" + super().finalize_options() diff --git a/mkdocs/commands/build.py b/mkdocs/commands/build.py index 826db880b1..1fd3182644 100644 --- a/mkdocs/commands/build.py +++ b/mkdocs/commands/build.py @@ -1,20 +1,19 @@ -# coding: utf-8 - -from __future__ import unicode_literals -from datetime import datetime -from calendar import timegm -import io import logging import os +import gzip +from urllib.parse import urlsplit from jinja2.exceptions import TemplateNotFound import jinja2 -from mkdocs import nav, utils +from mkdocs import utils +from mkdocs.exceptions import BuildError, Abort +from mkdocs.structure.files import Files, get_files +from mkdocs.structure.nav import get_navigation import mkdocs -class DuplicateFilter(object): +class DuplicateFilter: ''' Avoid logging duplicate messages. ''' def __init__(self): self.msgs = set() @@ -29,260 +28,311 @@ def filter(self, record): log.addFilter(DuplicateFilter()) -def get_context(nav, config, page=None): +def get_context(nav, files, config, page=None, base_url=''): """ - Given the SiteNavigation and config, generate the context which is relevant - to app pages. + Return the template context for a given page or template. """ - if nav is None: - return {'page', page} + if page is not None: + base_url = utils.get_relative_url('.', page.url) - extra_javascript = utils.create_media_urls(nav, config['extra_javascript']) + extra_javascript = utils.create_media_urls(config['extra_javascript'], page, base_url) - extra_css = utils.create_media_urls(nav, config['extra_css']) + extra_css = utils.create_media_urls(config['extra_css'], page, base_url) - # Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds. - # See https://reproducible-builds.org/specs/source-date-epoch/ - timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', timegm(datetime.utcnow().utctimetuple()))) + if isinstance(files, Files): + files = files.documentation_pages() return { 'nav': nav, - # base_url should never end with a slash. - 'base_url': nav.url_context.make_relative('/').rstrip('/'), + 'pages': files, + + 'base_url': base_url, 'extra_css': extra_css, 'extra_javascript': extra_javascript, 'mkdocs_version': mkdocs.__version__, - 'build_date_utc': datetime.utcfromtimestamp(timestamp), + 'build_date_utc': utils.get_build_datetime(), 'config': config, 'page': page, } -def build_template(template_name, env, config, site_navigation=None): - """ Build a template using the theme environment. """ - - log.debug("Building template: %s", template_name) - - try: - template = env.get_template(template_name) - except TemplateNotFound: - log.info("Template skipped: '{}'. Not found in template directories.".format(template_name)) - return +def _build_template(name, template, files, config, nav): + """ + Return rendered output for given template as a string. + """ # Run `pre_template` plugin events. template = config['plugins'].run_event( - 'pre_template', template, template_name=template_name, config=config + 'pre_template', template, template_name=name, config=config ) - context = get_context(site_navigation, config) + if utils.is_error_template(name): + # Force absolute URLs in the nav of error pages and account for the + # possibility that the docs root might be different than the server root. + # See https://github.com/mkdocs/mkdocs/issues/77. + # However, if site_url is not set, assume the docs root and server root + # are the same. See https://github.com/mkdocs/mkdocs/issues/1598. + base_url = urlsplit(config['site_url'] or '/').path + else: + base_url = utils.get_relative_url('.', name) + + context = get_context(nav, files, config, base_url=base_url) # Run `template_context` plugin events. context = config['plugins'].run_event( - 'template_context', context, template_name=template_name, config=config + 'template_context', context, template_name=name, config=config ) - output_content = template.render(context) + output = template.render(context) # Run `post_template` plugin events. - output_content = config['plugins'].run_event( - 'post_template', output_content, template_name=template_name, config=config + output = config['plugins'].run_event( + 'post_template', output, template_name=name, config=config ) - if output_content.strip(): - output_path = os.path.join(config['site_dir'], template_name) - utils.write_file(output_content.encode('utf-8'), output_path) - else: - log.info("Template skipped: '{}'. Generated empty output.".format(template_name)) + return output -def build_error_template(template, env, config, site_navigation): - """ - Build error template. +def _build_theme_template(template_name, env, files, config, nav): + """ Build a template using the theme environment. """ - Force absolute URLs in the nav of error pages and account for the - possability that the docs root might be different than the server root. - See https://github.com/mkdocs/mkdocs/issues/77 - """ + log.debug(f"Building theme template: {template_name}") - site_navigation.url_context.force_abs_urls = True - default_base = site_navigation.url_context.base_path - site_navigation.url_context.base_path = utils.urlparse(config['site_url']).path + try: + template = env.get_template(template_name) + except TemplateNotFound: + log.warning(f"Template skipped: '{template_name}' not found in theme directories.") + return - build_template(template, env, config, site_navigation) + output = _build_template(template_name, template, files, config, nav) - # Reset nav behavior to the default - site_navigation.url_context.force_abs_urls = False - site_navigation.url_context.base_path = default_base + if output.strip(): + output_path = os.path.join(config['site_dir'], template_name) + utils.write_file(output.encode('utf-8'), output_path) + + if template_name == 'sitemap.xml': + log.debug(f"Gzipping template: {template_name}") + gz_filename = f'{output_path}.gz' + with open(gz_filename, 'wb') as f: + timestamp = utils.get_build_timestamp() + with gzip.GzipFile(fileobj=f, filename=gz_filename, mode='wb', mtime=timestamp) as gz_buf: + gz_buf.write(output.encode('utf-8')) + else: + log.info(f"Template skipped: '{template_name}' generated empty output.") -def _build_page(page, config, site_navigation, env, dirty=False): - """ Build a Markdown page and pass to theme template. """ +def _build_extra_template(template_name, files, config, nav): + """ Build user templates which are not part of the theme. """ - # Run the `pre_page` plugin event - page = config['plugins'].run_event( - 'pre_page', page, config=config, site_navigation=site_navigation - ) + log.debug(f"Building extra template: {template_name}") - page.read_source(config=config) + file = files.get_file_from_path(template_name) + if file is None: + log.warning(f"Template skipped: '{template_name}' not found in docs_dir.") + return - # Run `page_markdown` plugin events. - page.markdown = config['plugins'].run_event( - 'page_markdown', page.markdown, page=page, config=config, site_navigation=site_navigation - ) + try: + with open(file.abs_src_path, 'r', encoding='utf-8', errors='strict') as f: + template = jinja2.Template(f.read()) + except Exception as e: + log.warning(f"Error reading template '{template_name}': {e}") + return - page.render(config, site_navigation) + output = _build_template(template_name, template, files, config, nav) - # Run `page_content` plugin events. - page.content = config['plugins'].run_event( - 'page_content', page.content, page=page, config=config, site_navigation=site_navigation - ) + if output.strip(): + utils.write_file(output.encode('utf-8'), file.abs_dest_path) + else: + log.info(f"Template skipped: '{template_name}' generated empty output.") - context = get_context(site_navigation, config, page) - # Allow 'template:' override in md source files. - if 'template' in page.meta: - template = env.get_template(page.meta['template']) - else: - template = env.get_template('main.html') +def _populate_page(page, config, files, dirty=False): + """ Read page content from docs_dir and render Markdown. """ - # Run `page_context` plugin events. - context = config['plugins'].run_event( - 'page_context', context, page=page, config=config, site_navigation=site_navigation - ) + try: + # When --dirty is used, only read the page if the file has been modified since the + # previous build of the output. + if dirty and not page.file.is_modified(): + return + + # Run the `pre_page` plugin event + page = config['plugins'].run_event( + 'pre_page', page, config=config, files=files + ) - # Render the template. - output_content = template.render(context) + page.read_source(config) - # Run `post_page` plugin events. - output_content = config['plugins'].run_event( - 'post_page', output_content, page=page, config=config - ) + # Run `page_markdown` plugin events. + page.markdown = config['plugins'].run_event( + 'page_markdown', page.markdown, page=page, config=config, files=files + ) - # Write the output file. - if output_content.strip(): - utils.write_file(output_content.encode('utf-8'), page.abs_output_path) - else: - log.info("Page skipped: '{}'. Generated empty output.".format(page.title)) + page.render(config, files) + # Run `page_content` plugin events. + page.content = config['plugins'].run_event( + 'page_content', page.content, page=page, config=config, files=files + ) + except Exception as e: + message = f"Error reading page '{page.file.src_path}':" + # Prevent duplicated the error message because it will be printed immediately afterwards. + if not isinstance(e, BuildError): + message += f" {e}" + log.error(message) + raise -def build_extra_templates(extra_templates, config, site_navigation=None): - """ Build user templates which are not part of the theme. """ - log.debug("Building extra_templates pages") +def _build_page(page, config, doc_files, nav, env, dirty=False): + """ Pass a Page to theme template and write output to site_dir. """ - for extra_template in extra_templates: + try: + # When --dirty is used, only build the page if the file has been modified since the + # previous build of the output. + if dirty and not page.file.is_modified(): + return - input_path = os.path.join(config['docs_dir'], extra_template) + log.debug(f"Building page {page.file.src_path}") - with io.open(input_path, 'r', encoding='utf-8') as template_file: - template = jinja2.Template(template_file.read()) + # Activate page. Signals to theme that this is the current page. + page.active = True - # Run `pre_template` plugin events. - template = config['plugins'].run_event( - 'pre_template', template, template_name=extra_template, config=config - ) + context = get_context(nav, doc_files, config, page) - context = get_context(site_navigation, config) + # Allow 'template:' override in md source files. + if 'template' in page.meta: + template = env.get_template(page.meta['template']) + else: + template = env.get_template('main.html') - # Run `template_context` plugin events. + # Run `page_context` plugin events. context = config['plugins'].run_event( - 'template_context', context, template_name=extra_template, config=config + 'page_context', context, page=page, config=config, nav=nav ) - output_content = template.render(context) + # Render the template. + output = template.render(context) - # Run `post_template` plugin events. - output_content = config['plugins'].run_event( - 'post_template', output_content, template_name=extra_template, config=config + # Run `post_page` plugin events. + output = config['plugins'].run_event( + 'post_page', output, page=page, config=config ) - if output_content.strip(): - output_path = os.path.join(config['site_dir'], extra_template) - utils.write_file(output_content.encode('utf-8'), output_path) + # Write the output file. + if output.strip(): + utils.write_file(output.encode('utf-8', errors='xmlcharrefreplace'), page.file.abs_dest_path) else: - log.info("Template skipped: '{}'. Generated empty output.".format(extra_template)) + log.info(f"Page skipped: '{page.file.src_path}'. Generated empty output.") + # Deactivate page + page.active = False + except Exception as e: + message = f"Error building page '{page.file.src_path}':" + # Prevent duplicated the error message because it will be printed immediately afterwards. + if not isinstance(e, BuildError): + message += f" {e}" + log.error(message) + raise -def build_pages(config, dirty=False): - """ Build all pages and write them into the build directory. """ - site_navigation = nav.SiteNavigation(config) +def build(config, live_server=False, dirty=False): + """ Perform a full site build. """ - # Run `nav` plugin events. - site_navigation = config['plugins'].run_event('nav', site_navigation, config=config) + logger = logging.getLogger('mkdocs') - env = config['theme'].get_env() + # Add CountHandler for strict mode + warning_counter = utils.CountHandler() + warning_counter.setLevel(logging.WARNING) + if config['strict']: + logging.getLogger('mkdocs').addHandler(warning_counter) - # Run `env` plugin events. - env = config['plugins'].run_event( - 'env', env, config=config, site_navigation=site_navigation - ) + try: + from time import time + start = time() - for template in config['theme'].static_templates: - if utils.is_error_template(template): - build_error_template(template, env, config, site_navigation) - else: - build_template(template, env, config, site_navigation) + # Run `config` plugin events. + config = config['plugins'].run_event('config', config) - build_extra_templates(config['extra_templates'], config, site_navigation) + # Run `pre_build` plugin events. + config['plugins'].run_event('pre_build', config=config) - log.debug("Building markdown pages.") - for page in site_navigation.walk_pages(): - try: - # When --dirty is used, only build the page if the markdown has been modified since the - # previous build of the output. - if dirty and (utils.modified_time(page.abs_input_path) < utils.modified_time(page.abs_output_path)): - continue + if not dirty: + log.info("Cleaning site directory") + utils.clean_directory(config['site_dir']) + else: # pragma: no cover + # Warn user about problems that may occur with --dirty option + log.warning("A 'dirty' build is being performed, this will likely lead to inaccurate navigation and other" + " links within your site. This option is designed for site development purposes only.") - log.debug("Building page %s", page.input_path) - _build_page(page, config, site_navigation, env) - except Exception: - log.error("Error building page %s", page.input_path) - raise + if not live_server: # pragma: no cover + log.info(f"Building documentation to directory: {config['site_dir']}") + if dirty and site_directory_contains_stale_files(config['site_dir']): + log.info("The directory contains stale files. Use --clean to remove them.") + # First gather all data from all files/pages to ensure all data is consistent across all pages. -def build(config, live_server=False, dirty=False): - """ Perform a full site build. """ + files = get_files(config) + env = config['theme'].get_env() + files.add_files_from_theme(env, config) - # Run `config` plugin events. - config = config['plugins'].run_event('config', config) + # Run `files` plugin events. + files = config['plugins'].run_event('files', files, config=config) - # Run `pre_build` plugin events. - config['plugins'].run_event('pre_build', config) + nav = get_navigation(files, config) - if not dirty: - log.info("Cleaning site directory") - utils.clean_directory(config['site_dir']) - else: - # Warn user about problems that may occur with --dirty option - log.warning("A 'dirty' build is being performed, this will likely lead to inaccurate navigation and other" - " links within your site. This option is designed for site development purposes only.") - - if not live_server: - log.info("Building documentation to directory: %s", config['site_dir']) - if dirty and site_directory_contains_stale_files(config['site_dir']): - log.info("The directory contains stale files. Use --clean to remove them.") - - # Reversed as we want to take the media files from the builtin theme - # and then from the custom theme_dir so that the custom versions take - # precedence. - for theme_dir in reversed(config['theme'].dirs): - log.debug("Copying static assets from %s", theme_dir) - utils.copy_media_files( - theme_dir, config['site_dir'], exclude=['*.py', '*.pyc', '*.html', 'mkdocs_theme.yml'], dirty=dirty + # Run `nav` plugin events. + nav = config['plugins'].run_event('nav', nav, config=config, files=files) + + log.debug("Reading markdown pages.") + for file in files.documentation_pages(): + log.debug(f"Reading: {file.src_path}") + _populate_page(file.page, config, files, dirty) + + # Run `env` plugin events. + env = config['plugins'].run_event( + 'env', env, config=config, files=files ) - log.debug("Copying static assets from the docs dir.") - utils.copy_media_files(config['docs_dir'], config['site_dir'], dirty=dirty) + # Start writing files to site_dir now that all data is gathered. Note that order matters. Files + # with lower precedence get written first so that files with higher precedence can overwrite them. + + log.debug("Copying static assets.") + files.copy_static_files(dirty=dirty) + + for template in config['theme'].static_templates: + _build_theme_template(template, env, files, config, nav) + + for template in config['extra_templates']: + _build_extra_template(template, files, config, nav) + + log.debug("Building markdown pages.") + doc_files = files.documentation_pages() + for file in doc_files: + _build_page(file.page, config, doc_files, nav, env, dirty) + + # Run `post_build` plugin events. + config['plugins'].run_event('post_build', config=config) + + counts = warning_counter.get_counts() + if counts: + msg = ', '.join([f'{v} {k.lower()}s' for k, v in counts]) + raise Abort(f'\nAborted with {msg} in strict mode!') + + log.info('Documentation built in %.2f seconds', time() - start) - build_pages(config, dirty=dirty) + except Exception as e: + # Run `build_error` plugin events. + config['plugins'].run_event('build_error', error=e) + if isinstance(e, BuildError): + log.error(str(e)) + raise Abort('\nAborted with a BuildError!') + raise - # Run `post_build` plugin events. - config['plugins'].run_event('post_build', config) + finally: + logger.removeHandler(warning_counter) def site_directory_contains_stale_files(site_directory): diff --git a/mkdocs/commands/gh_deploy.py b/mkdocs/commands/gh_deploy.py index 13d359cff1..59f81e2dcc 100644 --- a/mkdocs/commands/gh_deploy.py +++ b/mkdocs/commands/gh_deploy.py @@ -1,10 +1,12 @@ -from __future__ import unicode_literals import logging import subprocess import os +import re +from packaging import version import mkdocs -from mkdocs.utils import ghp_import +import ghp_import +from mkdocs.exceptions import Abort log = logging.getLogger(__name__) @@ -12,15 +14,22 @@ def _is_cwd_git_repo(): - proc = subprocess.Popen(['git', 'rev-parse', '--is-inside-work-tree'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + try: + proc = subprocess.Popen( + ['git', 'rev-parse', '--is-inside-work-tree'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + except FileNotFoundError: + log.error("Could not find git - is it installed and on your path?") + raise Abort('Deployment Aborted!') proc.communicate() return proc.wait() == 0 -def _get_current_sha(): +def _get_current_sha(repo_path): - proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], + proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], cwd=repo_path or None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, _ = proc.communicate() @@ -32,7 +41,7 @@ def _get_remote_url(remote_name): # No CNAME found. We will use the origin URL to determine the GitHub # pages location. - remote = "remote.%s.url" % remote_name + remote = f"remote.{remote_name}.url" proc = subprocess.Popen(["git", "config", "--get", remote], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -49,48 +58,87 @@ def _get_remote_url(remote_name): return host, path -def gh_deploy(config, message=None, force=False): +def _check_version(branch): + + proc = subprocess.Popen(['git', 'show', '-s', '--format=%s', f'refs/heads/{branch}'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + stdout, _ = proc.communicate() + msg = stdout.decode('utf-8').strip() + m = re.search(r'\d+(\.\d+)+((a|b|rc)\d+)?(\.post\d+)?(\.dev\d+)?', msg, re.X | re.I) + previousv = version.parse(m.group()) if m else None + currentv = version.parse(mkdocs.__version__) + if not previousv: + log.warning('Version check skipped: No version specified in previous deployment.') + elif currentv > previousv: + log.info( + f'Previous deployment was done with MkDocs version {previousv}; ' + f'you are deploying with a newer version ({currentv})' + ) + elif currentv < previousv: + log.error( + f'Deployment terminated: Previous deployment was made with MkDocs version {previousv}; ' + f'you are attempting to deploy with an older version ({currentv}). Use --ignore-version ' + 'to deploy anyway.' + ) + raise Abort('Deployment Aborted!') + + +def gh_deploy(config, message=None, force=False, ignore_version=False, shell=False): if not _is_cwd_git_repo(): log.error('Cannot deploy - this directory does not appear to be a git ' 'repository') - if message is None: - sha = _get_current_sha() - message = default_message.format(version=mkdocs.__version__, sha=sha) - remote_branch = config['remote_branch'] remote_name = config['remote_name'] + if not ignore_version: + _check_version(remote_branch) + + if message is None: + message = default_message + sha = _get_current_sha(os.path.dirname(config.config_file_path)) + message = message.format(version=mkdocs.__version__, sha=sha) + log.info("Copying '%s' to '%s' branch and pushing to GitHub.", config['site_dir'], config['remote_branch']) - result, error = ghp_import.ghp_import(config['site_dir'], message, remote_name, - remote_branch, force) - if not result: - log.error("Failed to deploy to GitHub with error: \n%s", error) - raise SystemExit(1) + try: + ghp_import.ghp_import( + config['site_dir'], + mesg=message, + remote=remote_name, + branch=remote_branch, + push=True, + force=force, + use_shell=shell, + nojekyll=True + ) + except ghp_import.GhpError as e: + log.error("Failed to deploy to GitHub with error: \n{}".format(e.message)) + raise Abort('Deployment Aborted!') + + cname_file = os.path.join(config['site_dir'], 'CNAME') + # Does this repository have a CNAME set for GitHub pages? + if os.path.isfile(cname_file): + # This GitHub pages repository has a CNAME configured. + with(open(cname_file, 'r')) as f: + cname_host = f.read().strip() + log.info(f'Based on your CNAME file, your documentation should be ' + f'available shortly at: http://{cname_host}') + log.info('NOTE: Your DNS records must be configured appropriately for ' + 'your CNAME URL to work.') + return + + host, path = _get_remote_url(remote_name) + + if host is None: + # This could be a GitHub Enterprise deployment. + log.info('Your documentation should be available shortly.') else: - cname_file = os.path.join(config['site_dir'], 'CNAME') - # Does this repository have a CNAME set for GitHub pages? - if os.path.isfile(cname_file): - # This GitHub pages repository has a CNAME configured. - with(open(cname_file, 'r')) as f: - cname_host = f.read().strip() - log.info('Based on your CNAME file, your documentation should be ' - 'available shortly at: http://%s', cname_host) - log.info('NOTE: Your DNS records must be configured appropriately for ' - 'your CNAME URL to work.') - return - - host, path = _get_remote_url(remote_name) - - if host is None: - # This could be a GitHub Enterprise deployment. - log.info('Your documentation should be available shortly.') - else: - username, repo = path.split('/', 1) - if repo.endswith('.git'): - repo = repo[:-len('.git')] - url = 'https://%s.github.io/%s/' % (username, repo) - log.info('Your documentation should shortly be available at: ' + url) + username, repo = path.split('/', 1) + if repo.endswith('.git'): + repo = repo[:-len('.git')] + url = f'https://{username}.github.io/{repo}/' + log.info(f"Your documentation should shortly be available at: {url}") diff --git a/mkdocs/commands/new.py b/mkdocs/commands/new.py index 094b0ba191..32c906fcec 100644 --- a/mkdocs/commands/new.py +++ b/mkdocs/commands/new.py @@ -1,21 +1,17 @@ -# coding: utf-8 -from __future__ import unicode_literals - -import io import logging import os config_text = 'site_name: My Docs\n' index_text = """# Welcome to MkDocs -For full documentation visit [mkdocs.org](http://mkdocs.org). +For full documentation visit [mkdocs.org](https://www.mkdocs.org). ## Commands * `mkdocs new [dir-name]` - Create a new project. * `mkdocs serve` - Start the live-reloading docs server. * `mkdocs build` - Build the documentation site. -* `mkdocs help` - Print this help message. +* `mkdocs -h` - Print help message and exit. ## Project layout @@ -39,16 +35,18 @@ def new(output_dir): return if not os.path.exists(output_dir): - log.info('Creating project directory: %s', output_dir) + log.info(f'Creating project directory: {output_dir}') os.mkdir(output_dir) - log.info('Writing config file: %s', config_path) - io.open(config_path, 'w', encoding='utf-8').write(config_text) + log.info(f'Writing config file: {config_path}') + with open(config_path, 'w', encoding='utf-8') as f: + f.write(config_text) if os.path.exists(index_path): return - log.info('Writing initial docs: %s', index_path) + log.info(f'Writing initial docs: {index_path}') if not os.path.exists(docs_dir): os.mkdir(docs_dir) - io.open(index_path, 'w', encoding='utf-8').write(index_text) + with open(index_path, 'w', encoding='utf-8') as f: + f.write(index_text) diff --git a/mkdocs/commands/serve.py b/mkdocs/commands/serve.py index 11941158fc..4ba7fb4cc9 100644 --- a/mkdocs/commands/serve.py +++ b/mkdocs/commands/serve.py @@ -1,88 +1,19 @@ -from __future__ import unicode_literals - import logging import shutil import tempfile +from urllib.parse import urlsplit +from os.path import isdir, isfile, join -from os.path import isfile, join from mkdocs.commands.build import build from mkdocs.config import load_config +from mkdocs.exceptions import Abort +from mkdocs.livereload import LiveReloadServer log = logging.getLogger(__name__) -def _get_handler(site_dir, StaticFileHandler): - - from tornado.template import Loader - - class WebHandler(StaticFileHandler): - - def write_error(self, status_code, **kwargs): - - if status_code in (404, 500): - error_page = '{}.html'.format(status_code) - if isfile(join(site_dir, error_page)): - self.write(Loader(site_dir).load(error_page).generate()) - else: - super(WebHandler, self).write_error(status_code, **kwargs) - - return WebHandler - - -def _livereload(host, port, config, builder, site_dir): - - # We are importing here for anyone that has issues with livereload. Even if - # this fails, the --no-livereload alternative should still work. - from livereload import Server - import livereload.handlers - - class LiveReloadServer(Server): - - def get_web_handlers(self, script): - handlers = super(LiveReloadServer, self).get_web_handlers(script) - # replace livereload handler - return [(handlers[0][0], _get_handler(site_dir, livereload.handlers.StaticFileHandler), handlers[0][2],)] - - server = LiveReloadServer() - - # Watch the documentation files, the config file and the theme files. - server.watch(config['docs_dir'], builder) - server.watch(config['config_file_path'], builder) - - for d in config['theme'].dirs: - server.watch(d, builder) - - # Run `serve` plugin events. - server = config['plugins'].run_event('serve', server, config=config) - - server.serve(root=site_dir, host=host, port=port, restart_delay=0) - - -def _static_server(host, port, site_dir): - - # Importing here to seperate the code paths from the --livereload - # alternative. - from tornado import ioloop - from tornado import web - - application = web.Application([ - (r"/(.*)", _get_handler(site_dir, web.StaticFileHandler), { - "path": site_dir, - "default_filename": "index.html" - }), - ]) - application.listen(port=port, address=host) - - log.info('Running at: http://%s:%s/', host, port) - log.info('Hold ctrl+c to quit.') - try: - ioloop.IOLoop.instance().start() - except KeyboardInterrupt: - log.info('Stopping server...') - - def serve(config_file=None, dev_addr=None, strict=None, theme=None, - theme_dir=None, livereload='livereload'): + theme_dir=None, livereload='livereload', watch_theme=False, **kwargs): """ Start the MkDocs development server @@ -92,7 +23,12 @@ def serve(config_file=None, dev_addr=None, strict=None, theme=None, """ # Create a temporary build directory, and set some options to serve it - tempdir = tempfile.mkdtemp() + # PY2 returns a byte string by default. The Unicode prefix ensures a Unicode + # string is returned. And it makes MkDocs temp dirs easier to identify. + site_dir = tempfile.mkdtemp(prefix='mkdocs_') + + def mount_path(config): + return urlsplit(config['site_url'] or '/').path def builder(): log.info("Building documentation...") @@ -101,11 +37,12 @@ def builder(): dev_addr=dev_addr, strict=strict, theme=theme, - theme_dir=theme_dir + theme_dir=theme_dir, + site_dir=site_dir, + **kwargs ) # Override a few config settings after validation - config['site_dir'] = tempdir - config['site_url'] = 'http://{0}/'.format(config['dev_addr']) + config['site_url'] = 'http://{}{}'.format(config['dev_addr'], mount_path(config)) live_server = livereload in ['dirty', 'livereload'] dirty = livereload == 'dirty' @@ -117,10 +54,38 @@ def builder(): config = builder() host, port = config['dev_addr'] + server = LiveReloadServer(builder=builder, host=host, port=port, root=site_dir, mount_path=mount_path(config)) + + def error_handler(code): + if code in (404, 500): + error_page = join(site_dir, f'{code}.html') + if isfile(error_page): + with open(error_page, 'rb') as f: + return f.read() + + server.error_handler = error_handler if livereload in ['livereload', 'dirty']: - _livereload(host, port, config, builder, tempdir) - else: - _static_server(host, port, tempdir) + # Watch the documentation files, the config file and the theme files. + server.watch(config['docs_dir']) + server.watch(config['config_file_path']) + + if watch_theme: + for d in config['theme'].dirs: + server.watch(d) + + # Run `serve` plugin events. + server = config['plugins'].run_event('serve', server, config=config, builder=builder) + + try: + server.serve() + except KeyboardInterrupt: + log.info("Shutting down...") + finally: + server.shutdown() + except OSError as e: # pragma: no cover + # Avoid ugly, unhelpful traceback + raise Abort(str(e)) finally: - shutil.rmtree(tempdir) + if isdir(site_dir): + shutil.rmtree(site_dir) diff --git a/mkdocs/commands/setup.py b/mkdocs/commands/setup.py new file mode 100644 index 0000000000..b0512d0d84 --- /dev/null +++ b/mkdocs/commands/setup.py @@ -0,0 +1,15 @@ +try: + from mkdocs.commands.babel import ( + compile_catalog, + extract_messages, + init_catalog, + update_catalog + ) + babel_cmdclass = { + 'compile_catalog': compile_catalog, + 'extract_messages': extract_messages, + 'init_catalog': init_catalog, + 'update_catalog': update_catalog, + } +except ImportError: + babel_cmdclass = {} diff --git a/mkdocs/config/__init__.py b/mkdocs/config/__init__.py index 3f8314f3fa..b9780de655 100644 --- a/mkdocs/config/__init__.py +++ b/mkdocs/config/__init__.py @@ -1,6 +1,4 @@ from mkdocs.config.base import load_config, Config -from mkdocs.config.defaults import DEFAULT_SCHEMA __all__ = [load_config.__name__, - Config.__name__, - 'DEFAULT_SCHEMA'] + Config.__name__] diff --git a/mkdocs/config/base.py b/mkdocs/config/base.py index afcec0a987..f06e3c034d 100644 --- a/mkdocs/config/base.py +++ b/mkdocs/config/base.py @@ -1,6 +1,9 @@ -from __future__ import unicode_literals import logging import os +import sys +from yaml import YAMLError +from collections import UserDict +from contextlib import contextmanager from mkdocs import exceptions from mkdocs import utils @@ -13,7 +16,7 @@ class ValidationError(Exception): """Raised during the validation process of the config on errors.""" -class Config(utils.UserDict): +class Config(UserDict): """ MkDocs Configuration dict @@ -21,13 +24,21 @@ class Config(utils.UserDict): for running validation on the structure and contents. """ - def __init__(self, schema): + def __init__(self, schema, config_file_path=None): """ The schema is a Python dict which maps the config name to a validator. """ self._schema = schema self._schema_keys = set(dict(schema).keys()) + # Ensure config_file_path is a Unicode string + if config_file_path is not None and not isinstance(config_file_path, str): + try: + # Assume config_file_path is encoded with the file system encoding. + config_file_path = config_file_path.decode(encoding=sys.getfilesystemencoding()) + except UnicodeDecodeError: + raise ValidationError("config_file_path is not a Unicode string.") + self.config_file_path = config_file_path self.data = {} self.user_configs = [] @@ -57,7 +68,7 @@ def _validate(self): for key in (set(self.keys()) - self._schema_keys): warnings.append(( - key, "Unrecognised configuration name: {0}".format(key) + key, f"Unrecognised configuration name: {key}" )) return failed, warnings @@ -109,44 +120,75 @@ def validate(self): return failed, warnings def load_dict(self, patch): + """ Load config options from a dictionary. """ if not isinstance(patch, dict): raise exceptions.ConfigurationError( "The configuration is invalid. The expected type was a key " "value mapping (a python dict) but we got an object of type: " - "{0}".format(type(patch))) + "{}".format(type(patch))) self.user_configs.append(patch) self.data.update(patch) def load_file(self, config_file): - return self.load_dict(utils.yaml_load(config_file)) + """ Load config options from the open file descriptor of a YAML file. """ + try: + return self.load_dict(utils.yaml_load(config_file)) + except YAMLError as e: + # MkDocs knows and understands ConfigurationErrors + raise exceptions.ConfigurationError( + f"MkDocs encountered an error parsing the configuration file: {e}" + ) +@contextmanager def _open_config_file(config_file): + """ + A context manager which yields an open file descriptor ready to be read. - # Default to the standard config filename. - if config_file is None: - config_file = os.path.abspath('mkdocs.yml') - - # If closed file descriptor, get file path to reopen later. - if hasattr(config_file, 'closed') and config_file.closed: - config_file = config_file.name + Accepts a filename as a string, an open or closed file descriptor, or None. + When None, it defaults to `mkdocs.yml` in the CWD. If a closed file descriptor + is received, a new file descriptor is opened for the same file. - log.debug("Loading configuration file: {0}".format(config_file)) + The file descriptor is automatically closed when the context manager block is existed. + """ + # Default to the standard config filename. + if config_file is None: + paths_to_try = ['mkdocs.yml', 'mkdocs.yaml'] # If it is a string, we can assume it is a path and attempt to open it. - if isinstance(config_file, utils.string_types): - if os.path.exists(config_file): - config_file = open(config_file, 'rb') + elif isinstance(config_file, str): + paths_to_try = [config_file] + # If closed file descriptor, get file path to reopen later. + elif getattr(config_file, 'closed', False): + paths_to_try = [config_file.name] + else: + paths_to_try = None + + if paths_to_try: + # config_file is not a file descriptor, so open it as a path. + for path in paths_to_try: + path = os.path.abspath(path) + log.debug(f"Loading configuration file: {path}") + try: + config_file = open(path, 'rb') + break + except FileNotFoundError: + continue else: raise exceptions.ConfigurationError( - "Config file '{0}' does not exist.".format(config_file)) - - # Ensure file descriptor is at begining - config_file.seek(0) + f"Config file '{paths_to_try[0]}' does not exist.") + else: + log.debug(f"Loading configuration file: {config_file}") + # Ensure file descriptor is at beginning + config_file.seek(0) - return config_file + try: + yield config_file + finally: + if hasattr(config_file, 'close'): + config_file.close() def load_config(config_file=None, **kwargs): @@ -167,35 +209,36 @@ def load_config(config_file=None, **kwargs): if value is None: options.pop(key) - config_file = _open_config_file(config_file) - options['config_file_path'] = getattr(config_file, 'name', '') + with _open_config_file(config_file) as fd: + options['config_file_path'] = getattr(fd, 'name', '') + + # Initialize the config with the default schema. + from mkdocs.config.defaults import get_schema + cfg = Config(schema=get_schema(), config_file_path=options['config_file_path']) + # load the config file + cfg.load_file(fd) - # Initialise the config with the default schema . - from mkdocs import config - cfg = Config(schema=config.DEFAULT_SCHEMA) - # First load the config file - cfg.load_file(config_file) # Then load the options to overwrite anything in the config. cfg.load_dict(options) errors, warnings = cfg.validate() for config_name, warning in warnings: - log.warning("Config value: '%s'. Warning: %s", config_name, warning) + log.warning(f"Config value: '{config_name}'. Warning: {warning}") for config_name, error in errors: - log.error("Config value: '%s'. Error: %s", config_name, error) + log.error(f"Config value: '{config_name}'. Error: {error}") for key, value in cfg.items(): - log.debug("Config value: '%s' = %r", key, value) + log.debug(f"Config value: '{key}' = {value!r}") if len(errors) > 0: - raise exceptions.ConfigurationError( - "Aborted with {0} Configuration Errors!".format(len(errors)) + raise exceptions.Abort( + "Aborted with {} Configuration Errors!".format(len(errors)) ) elif cfg['strict'] and len(warnings) > 0: - raise exceptions.ConfigurationError( - "Aborted with {0} Configuration Warnings in 'strict' mode!".format(len(warnings)) + raise exceptions.Abort( + "Aborted with {} Configuration Warnings in 'strict' mode!".format(len(warnings)) ) return cfg diff --git a/mkdocs/config/config_options.py b/mkdocs/config/config_options.py index 87c09a82d3..f0ec7d2cb6 100644 --- a/mkdocs/config/config_options.py +++ b/mkdocs/config/config_options.py @@ -1,14 +1,15 @@ -from __future__ import unicode_literals - -from collections import Sequence import os from collections import namedtuple +from collections.abc import Sequence +from urllib.parse import urlsplit, urlunsplit +import ipaddress +import markdown from mkdocs import utils, theme, plugins from mkdocs.config.base import Config, ValidationError -class BaseConfigOption(object): +class BaseConfigOption: def __init__(self): self.warnings = [] @@ -41,7 +42,7 @@ def run_validation(self, value): def post_validation(self, config, key_name): """ After all options have passed validation, perform a post-validation - process to do any additional changes dependant on other config values. + process to do any additional changes dependent on other config values. The post-validation process method should be implemented by subclasses. """ @@ -75,7 +76,7 @@ def __init__(self, *config_options, **kwargs): self.required = kwargs.get('required', False) def __repr__(self): - return '{}: {}'.format(self.__class__.__name__, self.item_config) + return f'{self.__class__.__name__}: {self.item_config}' def run_validation(self, value): if value is None: @@ -85,12 +86,10 @@ def run_validation(self, value): return () if not isinstance(value, Sequence): - raise ValidationError('Expected a sequence of mappings, but a %s ' - 'was given.' % type(value)) - result = [] - for item in value: - result.append(self.item_config.validate(item)) - return result + raise ValidationError(f'Expected a sequence of mappings, but a ' + f'{type(value)} was given.') + + return [self.item_config.validate(item) for item in value] class OptionallyRequired(BaseConfigOption): @@ -100,7 +99,7 @@ class OptionallyRequired(BaseConfigOption): """ def __init__(self, default=None, required=False): - super(OptionallyRequired, self).__init__() + super().__init__() self.default = default self.required = required @@ -139,15 +138,14 @@ class Type(OptionallyRequired): """ def __init__(self, type_, length=None, **kwargs): - super(Type, self).__init__(**kwargs) + super().__init__(**kwargs) self._type = type_ self.length = length def run_validation(self, value): if not isinstance(value, self._type): - msg = ("Expected type: {0} but received: {1}" - .format(self._type, type(value))) + msg = f"Expected type: {self._type} but received: {type(value)}" elif self.length is not None and len(value) != self.length: msg = ("Expected type: {0} with length {2} but received: {1} with " "length {3}").format(self._type, value, self.length, @@ -158,44 +156,94 @@ def run_validation(self, value): raise ValidationError(msg) +class Choice(OptionallyRequired): + """ + Choice Config Option + + Validate the config option against a strict set of values. + """ + + def __init__(self, choices, **kwargs): + super().__init__(**kwargs) + try: + length = len(choices) + except TypeError: + length = 0 + + if not length or isinstance(choices, str): + raise ValueError(f'Expected iterable of choices, got {choices}') + + self.choices = choices + + def run_validation(self, value): + if value not in self.choices: + msg = f"Expected one of: {self.choices} but received: {value}" + else: + return value + + raise ValidationError(msg) + + class Deprecated(BaseConfigOption): + """ + Deprecated Config Option + + Raises a warning as the option is deprecated. Uses `message` for the + warning. If `move_to` is set to the name of a new config option, the value + is moved to the new option on pre_validation. If `option_type` is set to a + ConfigOption instance, then the value is validated against that type. + """ - def __init__(self, moved_to=None): - super(Deprecated, self).__init__() + def __init__(self, moved_to=None, message='', option_type=None): + super().__init__() self.default = None self.moved_to = moved_to + self.message = message or ( + 'The configuration option {} has been deprecated and ' + 'will be removed in a future release of MkDocs.' + ) + self.option = option_type or BaseConfigOption() + self.warnings = self.option.warnings def pre_validation(self, config, key_name): + self.option.pre_validation(config, key_name) - if config.get(key_name) is None or self.moved_to is None: - return + if config.get(key_name) is not None: + self.warnings.append(self.message.format(key_name)) - warning = ('The configuration option {0} has been deprecated and will ' - 'be removed in a future release of MkDocs.') - self.warnings.append(warning) + if self.moved_to is not None: + if '.' not in self.moved_to: + target = config + target_key = self.moved_to + else: + move_to, target_key = self.moved_to.rsplit('.', 1) - if '.' not in self.moved_to: - target = config - target_key = self.moved_to - else: - move_to, target_key = self.moved_to.rsplit('.', 1) + target = config + for key in move_to.split('.'): + target = target.setdefault(key, {}) - target = config - for key in move_to.split('.'): - target = target.setdefault(key, {}) + if not isinstance(target, dict): + # We can't move it for the user + return - if not isinstance(target, dict): - # We can't move it for the user - return + target[target_key] = config.pop(key_name) - target[target_key] = config.pop(key_name) + def validate(self, value): + return self.option.validate(value) + + def post_validation(self, config, key_name): + self.option.post_validation(config, key_name) + + def reset_warnings(self): + self.option.reset_warnings() + self.warnings = self.option.warnings class IpAddress(OptionallyRequired): """ IpAddress Config Option - Validate that an IP address is in an apprioriate format + Validate that an IP address is in an appropriate format """ def run_validation(self, value): @@ -204,17 +252,34 @@ def run_validation(self, value): except Exception: raise ValidationError("Must be a string of format 'IP:PORT'") + if host != 'localhost': + try: + # Validate and normalize IP Address + host = str(ipaddress.ip_address(host)) + except ValueError as e: + raise ValidationError(e) + try: port = int(port) except Exception: - raise ValidationError("'{0}' is not a valid port".format(port)) + raise ValidationError(f"'{port}' is not a valid port") class Address(namedtuple('Address', 'host port')): def __str__(self): - return '{0}:{1}'.format(self.host, self.port) + return f'{self.host}:{self.port}' return Address(host, port) + def post_validation(self, config, key_name): + host = config[key_name].host + if key_name == 'dev_addr' and host in ['0.0.0.0', '::']: + self.warnings.append( + ("The use of the IP address '{}' suggests a production environment " + "or the use of a proxy to connect to the MkDocs server. However, " + "the MkDocs' server is intended for local development purposes only. " + "Please use a third party production-ready server instead.").format(host) + ) + class URL(OptionallyRequired): """ @@ -223,20 +288,23 @@ class URL(OptionallyRequired): Validate a URL by requiring a scheme is present. """ - def __init__(self, default='', required=False): - super(URL, self).__init__(default, required) + def __init__(self, default='', required=False, is_dir=False): + self.is_dir = is_dir + super().__init__(default, required) def run_validation(self, value): if value == '': return value try: - parsed_url = utils.urlparse(value) + parsed_url = urlsplit(value) except (AttributeError, TypeError): raise ValidationError("Unable to parse the URL.") - if parsed_url.scheme: - return value + if parsed_url.scheme and parsed_url.netloc: + if self.is_dir and not parsed_url.path.endswith('/'): + parsed_url = parsed_url._replace(path=f'{parsed_url.path}/') + return urlunsplit(parsed_url) raise ValidationError( "The URL isn't valid, it should include the http:// (scheme)") @@ -251,7 +319,7 @@ class RepoURL(URL): """ def post_validation(self, config, key_name): - repo_host = utils.urlparse(config['repo_url']).netloc.lower() + repo_host = urlsplit(config['repo_url']).netloc.lower() edit_uri = config.get('edit_uri') # derive repo_name from repo_url if unset @@ -260,12 +328,14 @@ def post_validation(self, config, key_name): config['repo_name'] = 'GitHub' elif repo_host == 'bitbucket.org': config['repo_name'] = 'Bitbucket' + elif repo_host == 'gitlab.com': + config['repo_name'] = 'GitLab' else: config['repo_name'] = repo_host.split('.')[0].title() # derive edit_uri from repo_name if unset if config['repo_url'] is not None and edit_uri is None: - if repo_host == 'github.com': + if repo_host == 'github.com' or repo_host == 'gitlab.com': edit_uri = 'edit/master/docs/' elif repo_host == 'bitbucket.org': edit_uri = 'src/default/docs/' @@ -288,15 +358,22 @@ class FilesystemObject(Type): Base class for options that point to filesystem objects. """ def __init__(self, exists=False, **kwargs): - super(FilesystemObject, self).__init__(type_=utils.string_types, **kwargs) + super().__init__(type_=str, **kwargs) self.exists = exists + self.config_dir = None + + def pre_validation(self, config, key_name): + self.config_dir = os.path.dirname(config.config_file_path) if config.config_file_path else None def run_validation(self, value): - value = super(FilesystemObject, self).run_validation(value) + value = super().run_validation(value) + if self.config_dir and not os.path.isabs(value): + value = os.path.join(self.config_dir, value) if self.exists and not self.existence_test(value): - raise ValidationError("The path {path} isn't an existing {name}.". - format(path=value, name=self.name)) - return os.path.abspath(value) + raise ValidationError(f"The path {value} isn't an existing {self.name}.") + value = os.path.abspath(value) + assert isinstance(value, str) + return value class Dir(FilesystemObject): @@ -309,12 +386,14 @@ class Dir(FilesystemObject): name = 'directory' def post_validation(self, config, key_name): + if config.config_file_path is None: + return # Validate that the dir is not the parent dir of the config file. - if os.path.dirname(config['config_file_path']) == config[key_name]: + if os.path.dirname(config.config_file_path) == config[key_name]: raise ValidationError( ("The '{0}' should not be the parent directory of the config " - "file. Use a child directory instead so that the config file " + "file. Use a child directory instead so that the '{0}' " "is a sibling of the config file.").format(key_name)) @@ -337,7 +416,7 @@ class SiteDir(Dir): def post_validation(self, config, key_name): - super(SiteDir, self).post_validation(config, key_name) + super().post_validation(config, key_name) # Validate that the docs_dir and site_dir don't contain the # other as this will lead to copying back and forth on each @@ -347,36 +426,17 @@ def post_validation(self, config, key_name): ("The 'docs_dir' should not be within the 'site_dir' as this " "can mean the source files are overwritten by the output or " "it will be deleted if --clean is passed to mkdocs build." - "(site_dir: '{0}', docs_dir: '{1}')" + "(site_dir: '{}', docs_dir: '{}')" ).format(config['site_dir'], config['docs_dir'])) elif (config['site_dir'] + os.sep).startswith(config['docs_dir'].rstrip(os.sep) + os.sep): raise ValidationError( ("The 'site_dir' should not be within the 'docs_dir' as this " "leads to the build directory being copied into itself and " "duplicate nested files in the 'site_dir'." - "(site_dir: '{0}', docs_dir: '{1}')" + "(site_dir: '{}', docs_dir: '{}')" ).format(config['site_dir'], config['docs_dir'])) -class ThemeDir(Dir): - """ - ThemeDir Config Option. Deprecated - """ - - def pre_validation(self, config, key_name): - - if config.get(key_name) is None: - return - - warning = ('The configuration option {0} has been deprecated and will ' - 'be removed in a future release of MkDocs.') - self.warnings.append(warning) - - def post_validation(self, config, key_name): - # The validation in the parent class this inherits from is not relevant here. - pass - - class Theme(BaseConfigOption): """ Theme Config Option @@ -385,14 +445,14 @@ class Theme(BaseConfigOption): """ def __init__(self, default=None): - super(Theme, self).__init__() + super().__init__() self.default = default def validate(self, value): if value is None and self.default is not None: value = {'name': self.default} - if isinstance(value, utils.string_types): + if isinstance(value, str): value = {'name': value} themes = utils.get_theme_names() @@ -403,156 +463,71 @@ def validate(self, value): return value raise ValidationError( - "Unrecognised theme name: '{0}'. The available installed themes " - "are: {1}".format(value['name'], ', '.join(themes)) + f"Unrecognised theme name: '{value['name']}'. " + f"The available installed themes are: {', '.join(themes)}" ) raise ValidationError("No theme name set.") - raise ValidationError('Invalid type "{0}". Expected a string or key/value pairs.'.format(type(value))) + raise ValidationError(f'Invalid type "{type(value)}". Expected a string or key/value pairs.') def post_validation(self, config, key_name): theme_config = config[key_name] - # TODO: Remove when theme_dir is fully deprecated. - if config['theme_dir'] is not None: - if 'custom_dir' not in theme_config: - # Only pass in 'theme_dir' if it is set and 'custom_dir' is not set. - theme_config['custom_dir'] = config['theme_dir'] - if not any(['theme' in c for c in config.user_configs]): - # If the user did not define a theme, but did define theme_dir, then remove default set in validate. - theme_config['name'] = None - if not theme_config['name'] and 'custom_dir' not in theme_config: raise ValidationError("At least one of 'theme.name' or 'theme.custom_dir' must be defined.") # Ensure custom_dir is an absolute path if 'custom_dir' in theme_config and not os.path.isabs(theme_config['custom_dir']): - theme_config['custom_dir'] = os.path.abspath(theme_config['custom_dir']) + config_dir = os.path.dirname(config.config_file_path) + theme_config['custom_dir'] = os.path.join(config_dir, theme_config['custom_dir']) - config[key_name] = theme.Theme(**theme_config) + if 'custom_dir' in theme_config and not os.path.isdir(theme_config['custom_dir']): + raise ValidationError("The path set in {name}.custom_dir ('{path}') does not exist.". + format(path=theme_config['custom_dir'], name=key_name)) + if 'locale' in theme_config and not isinstance(theme_config['locale'], str): + raise ValidationError("'{name}.locale' must be a string.".format(name=theme_config['name'])) -class Extras(OptionallyRequired): - """ - Extras Config Option - - Validate the extra configs are a list and issue a warning for any files - found in the docs_dir which are not listed here. - - TODO: Delete this in a future release and use - `config_options.Type(list, default=[])` instead. - """ - - def __init__(self, file_match=None, **kwargs): - super(Extras, self).__init__(**kwargs) - self.file_match = file_match - - def run_validation(self, value): - if isinstance(value, list): - return value - else: - raise ValidationError( - "Expected a list, got {0}".format(type(value))) - - def walk_docs_dir(self, docs_dir): - if self.file_match is None: - raise StopIteration - - for (dirpath, dirs, filenames) in os.walk(docs_dir, followlinks=True): - dirs.sort() - for filename in sorted(filenames): - fullpath = os.path.join(dirpath, filename) - - # Some editors (namely Emacs) will create temporary symlinks - # for internal magic. We can just ignore these files. - if os.path.islink(fullpath): - local_fullpath = os.path.join(dirpath, os.readlink(fullpath)) - if not os.path.exists(local_fullpath): - continue - - relpath = os.path.normpath(os.path.relpath(fullpath, docs_dir)) - if self.file_match(relpath): - yield relpath - - def post_validation(self, config, key_name): - # Only issue warnings for missing files if the setting is empty - # as autopopulating only used to work if the setting was empty. - if not config[key_name]: - actual_files = list(self.walk_docs_dir(config['docs_dir'])) - if actual_files: - self.warnings.append(( - "Some files in your 'docs_dir' are not listed in the '{0}' " - "config setting and will be ignored by the theme. Add the " - "following files to the '{0}' config setting if you want " - "them to have an effect on the theme: ['{1}']" - ).format(key_name, "', '".join(actual_files))) + config[key_name] = theme.Theme(**theme_config) -class Pages(OptionallyRequired): +class Nav(OptionallyRequired): """ - Pages Config Option + Nav Config Option - Validate the pages config. Automatically add all markdown files if empty. + Validate the Nav config. Automatically add all markdown files if empty. """ def __init__(self, **kwargs): - super(Pages, self).__init__(**kwargs) + super().__init__(**kwargs) self.file_match = utils.is_markdown_file def run_validation(self, value): if not isinstance(value, list): - raise ValidationError( - "Expected a list, got {0}".format(type(value))) + raise ValidationError(f"Expected a list, got {type(value)}") if len(value) == 0: return - config_types = set(type(l) for l in value) - if config_types.issubset({utils.text_type, dict, str}): + config_types = {type(item) for item in value} + if config_types.issubset({str, dict}): return value - raise ValidationError("Invalid pages config. {0} {1}".format( - config_types, {utils.text_type, dict} + raise ValidationError("Invalid pages config. {} {}".format( + config_types, {str, dict} )) - def walk_docs_dir(self, docs_dir): - - if self.file_match is None: - raise StopIteration - - for (dirpath, dirs, filenames) in os.walk(docs_dir, followlinks=True): - dirs.sort() - for filename in sorted(filenames): - fullpath = os.path.join(dirpath, filename) - - # Some editors (namely Emacs) will create temporary symlinks - # for internal magic. We can just ignore these files. - if os.path.islink(fullpath): - local_fullpath = os.path.join(dirpath, os.readlink(fullpath)) - if not os.path.exists(local_fullpath): - continue - - relpath = os.path.normpath(os.path.relpath(fullpath, docs_dir)) - if self.file_match(relpath): - yield relpath - def post_validation(self, config, key_name): - - if config[key_name] is not None: - return - - pages = [] - - for filename in self.walk_docs_dir(config['docs_dir']): - - if os.path.splitext(filename)[0] == 'index': - pages.insert(0, filename) - else: - pages.append(filename) - - config[key_name] = utils.nest_paths(pages) + # TODO: remove this when `pages` config setting is fully deprecated. + if key_name == 'pages' and config['pages'] is not None: + if config['nav'] is None: + # copy `pages` config to new 'nav' config setting + config['nav'] = config['pages'] + warning = ("The 'pages' configuration option has been deprecated and will " + "be removed in a future release of MkDocs. Use 'nav' instead.") + self.warnings.append(warning) class Private(OptionallyRequired): @@ -570,39 +545,57 @@ class MarkdownExtensions(OptionallyRequired): """ Markdown Extensions Config Option - A list of extensions. If a list item contains extension configs, - those are set on the private setting passed to `configkey`. The - `builtins` keyword accepts a list of extensions which cannot be - overriden by the user. However, builtins can be duplicated to define - config options for them if desired. - """ + A list or dict of extensions. Each list item may contain either a string or a one item dict. + A string must be a valid Markdown extension name with no config options defined. The key of + a dict item must be a valid Markdown extension name and the value must be a dict of config + options for that extension. Extension configs are set on the private setting passed to + `configkey`. The `builtins` keyword accepts a list of extensions which cannot be overridden by + the user. However, builtins can be duplicated to define config options for them if desired. """ def __init__(self, builtins=None, configkey='mdx_configs', **kwargs): - super(MarkdownExtensions, self).__init__(**kwargs) + super().__init__(**kwargs) self.builtins = builtins or [] self.configkey = configkey self.configdata = {} + def validate_ext_cfg(self, ext, cfg): + if not isinstance(ext, str): + raise ValidationError(f"'{ext}' is not a valid Markdown Extension name.") + if not cfg: + return + if not isinstance(cfg, dict): + raise ValidationError(f"Invalid config options for Markdown Extension '{ext}'.") + self.configdata[ext] = cfg + def run_validation(self, value): - if not isinstance(value, (list, tuple)): + if not isinstance(value, (list, tuple, dict)): raise ValidationError('Invalid Markdown Extensions configuration') extensions = [] - for item in value: - if isinstance(item, dict): - if len(item) > 1: - raise ValidationError('Invalid Markdown Extensions configuration') - ext, cfg = item.popitem() + if isinstance(value, dict): + for ext, cfg in value.items(): + self.validate_ext_cfg(ext, cfg) extensions.append(ext) - if cfg is None: - continue - if not isinstance(cfg, dict): - raise ValidationError('Invalid config options for Markdown ' - "Extension '{0}'.".format(ext)) - self.configdata[ext] = cfg - elif isinstance(item, utils.string_types): - extensions.append(item) - else: - raise ValidationError('Invalid Markdown Extensions configuration') - return utils.reduce_list(self.builtins + extensions) + else: + for item in value: + if isinstance(item, dict): + if len(item) > 1: + raise ValidationError('Invalid Markdown Extensions configuration') + ext, cfg = item.popitem() + self.validate_ext_cfg(ext, cfg) + extensions.append(ext) + elif isinstance(item, str): + extensions.append(item) + else: + raise ValidationError('Invalid Markdown Extensions configuration') + + extensions = utils.reduce_list(self.builtins + extensions) + + # Confirm that Markdown considers extensions to be valid + try: + markdown.Markdown(extensions=extensions, extension_configs=self.configdata) + except Exception as e: + raise ValidationError(e.args[0]) + + return extensions def post_validation(self, config, key_name): config[self.configkey] = self.configdata @@ -612,50 +605,59 @@ class Plugins(OptionallyRequired): """ Plugins config option. - A list of plugins. If a plugin defines config options those are used when + A list or dict of plugins. If a plugin defines config options those are used when initializing the plugin class. """ def __init__(self, **kwargs): - super(Plugins, self).__init__(**kwargs) + super().__init__(**kwargs) self.installed_plugins = plugins.get_plugins() + self.config_file_path = None + + def pre_validation(self, config, key_name): + self.config_file_path = config.config_file_path def run_validation(self, value): - if not isinstance(value, (list, tuple)): - raise ValidationError('Invalid Plugins configuration. Expected a list of plugins') + if not isinstance(value, (list, tuple, dict)): + raise ValidationError('Invalid Plugins configuration. Expected a list or dict.') plgins = plugins.PluginCollection() - for item in value: - if isinstance(item, dict): - if len(item) > 1: - raise ValidationError('Invalid Plugins configuration') - name, cfg = item.popitem() - cfg = cfg or {} # Users may define a null (None) config - if not isinstance(cfg, dict): - raise ValidationError('Invalid config options for ' - 'the "{0}" plugin.'.format(name)) + if isinstance(value, dict): + for name, cfg in value.items(): plgins[name] = self.load_plugin(name, cfg) - elif isinstance(item, utils.string_types): - plgins[item] = self.load_plugin(item, {}) - else: - raise ValidationError('Invalid Plugins configuration') + else: + for item in value: + if isinstance(item, dict): + if len(item) > 1: + raise ValidationError('Invalid Plugins configuration') + name, cfg = item.popitem() + item = name + else: + cfg = {} + plgins[item] = self.load_plugin(item, cfg) return plgins def load_plugin(self, name, config): + if not isinstance(name, str): + raise ValidationError(f"'{name}' is not a valid plugin name.") if name not in self.installed_plugins: - raise ValidationError('The "{0}" plugin is not installed'.format(name)) + raise ValidationError(f'The "{name}" plugin is not installed') + + config = config or {} # Users may define a null (None) config + if not isinstance(config, dict): + raise ValidationError(f"Invalid config options for the '{name}' plugin.") Plugin = self.installed_plugins[name].load() if not issubclass(Plugin, plugins.BasePlugin): - raise ValidationError('{0}.{1} must be a subclass of {2}.{3}'.format( + raise ValidationError('{}.{} must be a subclass of {}.{}'.format( Plugin.__module__, Plugin.__name__, plugins.BasePlugin.__module__, plugins.BasePlugin.__name__)) plugin = Plugin() - errors, warnings = plugin.load_config(config) + errors, warnings = plugin.load_config(config, self.config_file_path) self.warnings.extend(warnings) errors_message = '\n'.join( - "Plugin value: '{}'. Error: {}".format(x, y) + f"Plugin '{name}' value: '{x}'. Error: {y}" for x, y in errors ) if errors_message: diff --git a/mkdocs/config/defaults.py b/mkdocs/config/defaults.py index 7a82a5b7cd..bf04804282 100644 --- a/mkdocs/config/defaults.py +++ b/mkdocs/config/defaults.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - -from mkdocs import utils from mkdocs.config import config_options # NOTE: The order here is important. During validation some config options @@ -9,112 +6,118 @@ # Once we drop Python 2.6 support, this could be an OrderedDict, however, it # isn't really needed either as we always sequentially process the schema other -# than at initialisation when we grab the full set of keys for convenience. - -DEFAULT_SCHEMA = ( - - # Reserved for internal use, stores the mkdocs.yml config file. - ('config_file_path', config_options.Type(utils.string_types)), +# than at initialization when we grab the full set of keys for convenience. + - # The title to use for the documentation - ('site_name', config_options.Type(utils.string_types, required=True)), - - # Defines the structure of the navigation and which markdown files are - # included in the build. - ('pages', config_options.Pages()), - - # The full URL to where the documentation will be hosted - ('site_url', config_options.URL()), - - # A description for the documentation project that will be added to the - # HTML meta tags. - ('site_description', config_options.Type(utils.string_types)), - # The name of the author to add to the HTML meta tags - ('site_author', config_options.Type(utils.string_types)), - - # The MkDocs theme for the documentation. - ('theme', config_options.Theme(default='mkdocs')), - - # The directory containing the documentation markdown. - ('docs_dir', config_options.Dir(default='docs', exists=True)), - - # The directory where the site will be built to - ('site_dir', config_options.SiteDir(default='site')), - - # The directory of a theme to use if not using one of the builtin MkDocs - # themes. - ('theme_dir', config_options.ThemeDir(exists=True)), - - # A copyright notice to add to the footer of documentation. - ('copyright', config_options.Type(utils.string_types)), - - # set of values for Google analytics containing the account IO and domain, - # this should look like, ['UA-27795084-5', 'mkdocs.org'] - ('google_analytics', config_options.Type(list, length=2)), - - # The address on which to serve the live reloading docs server. - ('dev_addr', config_options.IpAddress(default='127.0.0.1:8000')), - - # If `True`, use `/index.hmtl` style files with hyperlinks to - # the directory.If `False`, use `.html style file with - # hyperlinks to the file. - # True generates nicer URLs, but False is useful if browsing the output on - # a filesystem. - ('use_directory_urls', config_options.Type(bool, default=True)), - - # Specify a link to the project source repo to be included - # in the documentation pages. - ('repo_url', config_options.RepoURL()), - - # A name to use for the link to the project source repo. - # Default, If repo_url is unset then None, otherwise - # "GitHub" or "Bitbucket" for known url or Hostname for unknown urls. - ('repo_name', config_options.Type(utils.string_types)), - - # Specify a URI to the docs dir in the project source repo, relative to the - # repo_url. When set, a link directly to the page in the source repo will - # be added to the generated HTML. If repo_url is not set also, this option - # is ignored. - ('edit_uri', config_options.Type(utils.string_types)), - - # Specify which css or javascript files from the docs directory should be - # additionally included in the site. - ('extra_css', config_options.Extras(file_match=utils.is_css_file, default=[])), - ('extra_javascript', config_options.Extras( - file_match=utils.is_javascript_file, default=[])), - - # Similar to the above, but each template (HTML or XML) will be build with - # Jinja2 and the global context. - ('extra_templates', config_options.Type(list, default=[])), - - # PyMarkdown extension names. - ('markdown_extensions', config_options.MarkdownExtensions( - builtins=['toc', 'tables', 'fenced_code'], - configkey='mdx_configs', default=[])), - - # PyMarkdown Extension Configs. For internal use only. - ('mdx_configs', config_options.Private()), - - # enabling strict mode causes MkDocs to stop the build when a problem is - # encountered rather than display an error. - ('strict', config_options.Type(bool, default=False)), - - # the remote branch to commit to when using gh-deploy - ('remote_branch', config_options.Type( - utils.string_types, default='gh-pages')), - - # the remote name to push to when using gh-deploy - ('remote_name', config_options.Type(utils.string_types, default='origin')), - - # extra is a mapping/dictionary of data that is passed to the template. - # This allows template authors to require extra configuration that not - # relevant to all themes and doesn't need to be explicitly supported by - # MkDocs itself. A good example here would be including the current - # project version. - ('extra', config_options.SubConfig()), - - # a list of plugins. Each item may contain a string name or a key value pair. - # A key value pair should be the string name (as the key) and a dict of config - # options (as the value). - ('plugins', config_options.Plugins(default=['search'])), -) +def get_schema(): + return ( + + # Reserved for internal use, stores the mkdocs.yml config file. + ('config_file_path', config_options.Type(str)), + + # The title to use for the documentation + ('site_name', config_options.Type(str, required=True)), + + # Defines the structure of the navigation. + ('nav', config_options.Nav()), + # TODO: remove this when the `pages` config setting is fully deprecated. + ('pages', config_options.Nav()), + + # The full URL to where the documentation will be hosted + ('site_url', config_options.URL(is_dir=True)), + + # A description for the documentation project that will be added to the + # HTML meta tags. + ('site_description', config_options.Type(str)), + # The name of the author to add to the HTML meta tags + ('site_author', config_options.Type(str)), + + # The MkDocs theme for the documentation. + ('theme', config_options.Theme(default='mkdocs')), + + # The directory containing the documentation markdown. + ('docs_dir', config_options.Dir(default='docs', exists=True)), + + # The directory where the site will be built to + ('site_dir', config_options.SiteDir(default='site')), + + # A copyright notice to add to the footer of documentation. + ('copyright', config_options.Type(str)), + + # set of values for Google analytics containing the account IO and domain, + # this should look like, ['UA-27795084-5', 'mkdocs.org'] + ('google_analytics', config_options.Deprecated( + message=( + 'The configuration option {} has been deprecated and ' + 'will be removed in a future release of MkDocs. See the ' + 'options available on your theme for an alternative.' + ), + option_type=config_options.Type(list, length=2) + )), + + # The address on which to serve the live reloading docs server. + ('dev_addr', config_options.IpAddress(default='127.0.0.1:8000')), + + # If `True`, use `/index.hmtl` style files with hyperlinks to + # the directory.If `False`, use `.html style file with + # hyperlinks to the file. + # True generates nicer URLs, but False is useful if browsing the output on + # a filesystem. + ('use_directory_urls', config_options.Type(bool, default=True)), + + # Specify a link to the project source repo to be included + # in the documentation pages. + ('repo_url', config_options.RepoURL()), + + # A name to use for the link to the project source repo. + # Default, If repo_url is unset then None, otherwise + # "GitHub", "Bitbucket" or "GitLab" for known url or Hostname + # for unknown urls. + ('repo_name', config_options.Type(str)), + + # Specify a URI to the docs dir in the project source repo, relative to the + # repo_url. When set, a link directly to the page in the source repo will + # be added to the generated HTML. If repo_url is not set also, this option + # is ignored. + ('edit_uri', config_options.Type(str)), + + # Specify which css or javascript files from the docs directory should be + # additionally included in the site. + ('extra_css', config_options.Type(list, default=[])), + ('extra_javascript', config_options.Type(list, default=[])), + + # Similar to the above, but each template (HTML or XML) will be build with + # Jinja2 and the global context. + ('extra_templates', config_options.Type(list, default=[])), + + # PyMarkdown extension names. + ('markdown_extensions', config_options.MarkdownExtensions( + builtins=['toc', 'tables', 'fenced_code'], + configkey='mdx_configs', default=[])), + + # PyMarkdown Extension Configs. For internal use only. + ('mdx_configs', config_options.Private()), + + # enabling strict mode causes MkDocs to stop the build when a problem is + # encountered rather than display an error. + ('strict', config_options.Type(bool, default=False)), + + # the remote branch to commit to when using gh-deploy + ('remote_branch', config_options.Type( + str, default='gh-pages')), + + # the remote name to push to when using gh-deploy + ('remote_name', config_options.Type(str, default='origin')), + + # extra is a mapping/dictionary of data that is passed to the template. + # This allows template authors to require extra configuration that not + # relevant to all themes and doesn't need to be explicitly supported by + # MkDocs itself. A good example here would be including the current + # project version. + ('extra', config_options.SubConfig()), + + # a list of plugins. Each item may contain a string name or a key value pair. + # A key value pair should be the string name (as the key) and a dict of config + # options (as the value). + ('plugins', config_options.Plugins(default=['search'])), + ) diff --git a/mkdocs/contrib/legacy_search/__init__.py b/mkdocs/contrib/legacy_search/__init__.py deleted file mode 100644 index e00f7322fe..0000000000 --- a/mkdocs/contrib/legacy_search/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import, unicode_literals - -import os -import logging -from mkdocs import utils -from mkdocs.plugins import BasePlugin -from mkdocs.contrib.legacy_search.search_index import SearchIndex - - -log = logging.getLogger(__name__) - - -class SearchPlugin(BasePlugin): - """ Add a search feature to MkDocs. """ - - def on_config(self, config, **kwargs): - "Add plugin templates and scripts to config." - if 'include_search_page' in config['theme'] and config['theme']['include_search_page']: - config['theme'].static_templates.add('search.html') - if not ('search_index_only' in config['theme'] and config['theme']['search_index_only']): - path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') - config['theme'].dirs.append(path) - config['extra_javascript'].append('search/require.js') - config['extra_javascript'].append('search/search.js') - return config - - def on_pre_build(self, config, **kwargs): - "Create search index instance for later use." - self.search_index = SearchIndex() - - def on_page_context(self, context, **kwargs): - "Add page to search index." - self.search_index.add_entry_from_context(context['page']) - - def on_post_build(self, config, **kwargs): - "Build search index." - search_index = self.search_index.generate_search_index() - json_output_path = os.path.join(config['site_dir'], 'search', 'search_index.json') - utils.write_file(search_index.encode('utf-8'), json_output_path) diff --git a/mkdocs/contrib/legacy_search/templates/search/lunr.min.js b/mkdocs/contrib/legacy_search/templates/search/lunr.min.js deleted file mode 100644 index b0198dff91..0000000000 --- a/mkdocs/contrib/legacy_search/templates/search/lunr.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.7.0 - * Copyright (C) 2016 Oliver Nightingale - * MIT Licensed - * @license - */ -!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.0",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();rp;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n":">",'"':""","'":"'","/":"/"};function escapeHtml(string){return String(string).replace(/[&<>"'\/]/g,function(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tags){if(typeof tags==="string")tags=tags.split(spaceRe,2);if(!isArray(tags)||tags.length!==2)throw new Error("Invalid tags: "+tags);openingTagRe=new RegExp(escapeRegExp(tags[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tags[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tags[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function(view){return new Context(view,this)};Context.prototype.lookup=function(name){var cache=this.cache;var value;if(name in cache){value=cache[name]}else{var context=this,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){value=context.view;names=name.split(".");index=0;while(value!=null&&index")value=this._renderPartial(token,context,partials,originalTemplate);else if(symbol==="&")value=this._unescapedValue(token,context);else if(symbol==="name")value=this._escapedValue(token,context);else if(symbol==="text")value=this._rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype._renderSection=function(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;jthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&& -(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= -this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f); -if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval", -"fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b, -a);this.check()}));this.errback?q(a,"error",u(this,this.errback)):this.events.error&&q(a,"error",u(this,function(a){this.emit("error",a)}))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b, -registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p,nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a); -b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b,a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n, -q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild=!0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d, -e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!==e&&(!("."===k||".."===k)||1e.attachEvent.toString().indexOf("[native code"))&& -!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)):(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"), -s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl=O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"=== -b.readyState)return N=b}),e=N;e&&(b||(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); diff --git a/mkdocs/contrib/legacy_search/templates/search/search-results-template.mustache b/mkdocs/contrib/legacy_search/templates/search/search-results-template.mustache deleted file mode 100644 index a8b3862f20..0000000000 --- a/mkdocs/contrib/legacy_search/templates/search/search-results-template.mustache +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/mkdocs/contrib/legacy_search/templates/search/search.js b/mkdocs/contrib/legacy_search/templates/search/search.js deleted file mode 100644 index 2283930c83..0000000000 --- a/mkdocs/contrib/legacy_search/templates/search/search.js +++ /dev/null @@ -1,92 +0,0 @@ -require.config({ - baseUrl: base_url + "/search/" -}); - -require([ - 'mustache.min', - 'lunr.min', - 'text!search-results-template.mustache', - 'text!search_index.json', -], function (Mustache, lunr, results_template, data) { - "use strict"; - - function getSearchTerm() - { - var sPageURL = window.location.search.substring(1); - var sURLVariables = sPageURL.split('&'); - for (var i = 0; i < sURLVariables.length; i++) - { - var sParameterName = sURLVariables[i].split('='); - if (sParameterName[0] == 'q') - { - return decodeURIComponent(sParameterName[1].replace(/\+/g, '%20')); - } - } - } - - var index = lunr(function () { - this.field('title', {boost: 10}); - this.field('text'); - this.ref('location'); - }); - - data = JSON.parse(data); - var documents = {}; - - for (var i=0; i < data.docs.length; i++){ - var doc = data.docs[i]; - doc.location = base_url + doc.location; - index.add(doc); - documents[doc.location] = doc; - } - - var search = function(){ - - var query = document.getElementById('mkdocs-search-query').value; - var search_results = document.getElementById("mkdocs-search-results"); - while (search_results.firstChild) { - search_results.removeChild(search_results.firstChild); - } - - if(query === ''){ - return; - } - - var results = index.search(query); - - if (results.length > 0){ - for (var i=0; i < results.length; i++){ - var result = results[i]; - doc = documents[result.ref]; - doc.base_url = base_url; - doc.summary = doc.text.substring(0, 200); - var html = Mustache.to_html(results_template, doc); - search_results.insertAdjacentHTML('beforeend', html); - } - } else { - search_results.insertAdjacentHTML('beforeend', "

No results found

"); - } - - if(jQuery){ - /* - * We currently only automatically hide bootstrap models. This - * requires jQuery to work. - */ - jQuery('#mkdocs_search_modal a').click(function(){ - jQuery('#mkdocs_search_modal').modal('hide'); - }); - } - - }; - - var search_input = document.getElementById('mkdocs-search-query'); - - var term = getSearchTerm(); - if (term){ - search_input.value = term; - search(); - } - - if (search_input){search_input.addEventListener("keyup", search);} - -}); diff --git a/mkdocs/contrib/legacy_search/templates/search/text.js b/mkdocs/contrib/legacy_search/templates/search/text.js deleted file mode 100644 index 17921b6e5e..0000000000 --- a/mkdocs/contrib/legacy_search/templates/search/text.js +++ /dev/null @@ -1,390 +0,0 @@ -/** - * @license RequireJS text 2.0.12 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/requirejs/text for details - */ -/*jslint regexp: true */ -/*global require, XMLHttpRequest, ActiveXObject, - define, window, process, Packages, - java, location, Components, FileUtils */ - -define(['module'], function (module) { - 'use strict'; - - var text, fs, Cc, Ci, xpcIsWindows, - progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], - xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, - bodyRegExp = /]*>\s*([\s\S]+)\s*<\/body>/im, - hasLocation = typeof location !== 'undefined' && location.href, - defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''), - defaultHostName = hasLocation && location.hostname, - defaultPort = hasLocation && (location.port || undefined), - buildMap = {}, - masterConfig = (module.config && module.config()) || {}; - - text = { - version: '2.0.12', - - strip: function (content) { - //Strips declarations so that external SVG and XML - //documents can be added to a document without worry. Also, if the string - //is an HTML document, only the part inside the body tag is returned. - if (content) { - content = content.replace(xmlRegExp, ""); - var matches = content.match(bodyRegExp); - if (matches) { - content = matches[1]; - } - } else { - content = ""; - } - return content; - }, - - jsEscape: function (content) { - return content.replace(/(['\\])/g, '\\$1') - .replace(/[\f]/g, "\\f") - .replace(/[\b]/g, "\\b") - .replace(/[\n]/g, "\\n") - .replace(/[\t]/g, "\\t") - .replace(/[\r]/g, "\\r") - .replace(/[\u2028]/g, "\\u2028") - .replace(/[\u2029]/g, "\\u2029"); - }, - - createXhr: masterConfig.createXhr || function () { - //Would love to dump the ActiveX crap in here. Need IE 6 to die first. - var xhr, i, progId; - if (typeof XMLHttpRequest !== "undefined") { - return new XMLHttpRequest(); - } else if (typeof ActiveXObject !== "undefined") { - for (i = 0; i < 3; i += 1) { - progId = progIds[i]; - try { - xhr = new ActiveXObject(progId); - } catch (e) {} - - if (xhr) { - progIds = [progId]; // so faster next time - break; - } - } - } - - return xhr; - }, - - /** - * Parses a resource name into its component parts. Resource names - * look like: module/name.ext!strip, where the !strip part is - * optional. - * @param {String} name the resource name - * @returns {Object} with properties "moduleName", "ext" and "strip" - * where strip is a boolean. - */ - parseName: function (name) { - var modName, ext, temp, - strip = false, - index = name.indexOf("."), - isRelative = name.indexOf('./') === 0 || - name.indexOf('../') === 0; - - if (index !== -1 && (!isRelative || index > 1)) { - modName = name.substring(0, index); - ext = name.substring(index + 1, name.length); - } else { - modName = name; - } - - temp = ext || modName; - index = temp.indexOf("!"); - if (index !== -1) { - //Pull off the strip arg. - strip = temp.substring(index + 1) === "strip"; - temp = temp.substring(0, index); - if (ext) { - ext = temp; - } else { - modName = temp; - } - } - - return { - moduleName: modName, - ext: ext, - strip: strip - }; - }, - - xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/, - - /** - * Is an URL on another domain. Only works for browser use, returns - * false in non-browser environments. Only used to know if an - * optimized .js version of a text resource should be loaded - * instead. - * @param {String} url - * @returns Boolean - */ - useXhr: function (url, protocol, hostname, port) { - var uProtocol, uHostName, uPort, - match = text.xdRegExp.exec(url); - if (!match) { - return true; - } - uProtocol = match[2]; - uHostName = match[3]; - - uHostName = uHostName.split(':'); - uPort = uHostName[1]; - uHostName = uHostName[0]; - - return (!uProtocol || uProtocol === protocol) && - (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) && - ((!uPort && !uHostName) || uPort === port); - }, - - finishLoad: function (name, strip, content, onLoad) { - content = strip ? text.strip(content) : content; - if (masterConfig.isBuild) { - buildMap[name] = content; - } - onLoad(content); - }, - - load: function (name, req, onLoad, config) { - //Name has format: some.module.filext!strip - //The strip part is optional. - //if strip is present, then that means only get the string contents - //inside a body tag in an HTML string. For XML/SVG content it means - //removing the declarations so the content can be inserted - //into the current doc without problems. - - // Do not bother with the work if a build and text will - // not be inlined. - if (config && config.isBuild && !config.inlineText) { - onLoad(); - return; - } - - masterConfig.isBuild = config && config.isBuild; - - var parsed = text.parseName(name), - nonStripName = parsed.moduleName + - (parsed.ext ? '.' + parsed.ext : ''), - url = req.toUrl(nonStripName), - useXhr = (masterConfig.useXhr) || - text.useXhr; - - // Do not load if it is an empty: url - if (url.indexOf('empty:') === 0) { - onLoad(); - return; - } - - //Load the text. Use XHR if possible and in a browser. - if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) { - text.get(url, function (content) { - text.finishLoad(name, parsed.strip, content, onLoad); - }, function (err) { - if (onLoad.error) { - onLoad.error(err); - } - }); - } else { - //Need to fetch the resource across domains. Assume - //the resource has been optimized into a JS module. Fetch - //by the module name + extension, but do not include the - //!strip part to avoid file system issues. - req([nonStripName], function (content) { - text.finishLoad(parsed.moduleName + '.' + parsed.ext, - parsed.strip, content, onLoad); - }); - } - }, - - write: function (pluginName, moduleName, write, config) { - if (buildMap.hasOwnProperty(moduleName)) { - var content = text.jsEscape(buildMap[moduleName]); - write.asModule(pluginName + "!" + moduleName, - "define(function () { return '" + - content + - "';});\n"); - } - }, - - writeFile: function (pluginName, moduleName, req, write, config) { - var parsed = text.parseName(moduleName), - extPart = parsed.ext ? '.' + parsed.ext : '', - nonStripName = parsed.moduleName + extPart, - //Use a '.js' file name so that it indicates it is a - //script that can be loaded across domains. - fileName = req.toUrl(parsed.moduleName + extPart) + '.js'; - - //Leverage own load() method to load plugin value, but only - //write out values that do not have the strip argument, - //to avoid any potential issues with ! in file names. - text.load(nonStripName, req, function (value) { - //Use own write() method to construct full module value. - //But need to create shell that translates writeFile's - //write() to the right interface. - var textWrite = function (contents) { - return write(fileName, contents); - }; - textWrite.asModule = function (moduleName, contents) { - return write.asModule(moduleName, fileName, contents); - }; - - text.write(pluginName, nonStripName, textWrite, config); - }, config); - } - }; - - if (masterConfig.env === 'node' || (!masterConfig.env && - typeof process !== "undefined" && - process.versions && - !!process.versions.node && - !process.versions['node-webkit'])) { - //Using special require.nodeRequire, something added by r.js. - fs = require.nodeRequire('fs'); - - text.get = function (url, callback, errback) { - try { - var file = fs.readFileSync(url, 'utf8'); - //Remove BOM (Byte Mark Order) from utf8 files if it is there. - if (file.indexOf('\uFEFF') === 0) { - file = file.substring(1); - } - callback(file); - } catch (e) { - if (errback) { - errback(e); - } - } - }; - } else if (masterConfig.env === 'xhr' || (!masterConfig.env && - text.createXhr())) { - text.get = function (url, callback, errback, headers) { - var xhr = text.createXhr(), header; - xhr.open('GET', url, true); - - //Allow plugins direct access to xhr headers - if (headers) { - for (header in headers) { - if (headers.hasOwnProperty(header)) { - xhr.setRequestHeader(header.toLowerCase(), headers[header]); - } - } - } - - //Allow overrides specified in config - if (masterConfig.onXhr) { - masterConfig.onXhr(xhr, url); - } - - xhr.onreadystatechange = function (evt) { - var status, err; - //Do not explicitly handle errors, those should be - //visible via console output in the browser. - if (xhr.readyState === 4) { - status = xhr.status || 0; - if (status > 399 && status < 600) { - //An http 4xx or 5xx error. Signal an error. - err = new Error(url + ' HTTP status: ' + status); - err.xhr = xhr; - if (errback) { - errback(err); - } - } else { - callback(xhr.responseText); - } - - if (masterConfig.onXhrComplete) { - masterConfig.onXhrComplete(xhr, url); - } - } - }; - xhr.send(null); - }; - } else if (masterConfig.env === 'rhino' || (!masterConfig.env && - typeof Packages !== 'undefined' && typeof java !== 'undefined')) { - //Why Java, why is this so awkward? - text.get = function (url, callback) { - var stringBuffer, line, - encoding = "utf-8", - file = new java.io.File(url), - lineSeparator = java.lang.System.getProperty("line.separator"), - input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)), - content = ''; - try { - stringBuffer = new java.lang.StringBuffer(); - line = input.readLine(); - - // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 - // http://www.unicode.org/faq/utf_bom.html - - // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK: - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 - if (line && line.length() && line.charAt(0) === 0xfeff) { - // Eat the BOM, since we've already found the encoding on this file, - // and we plan to concatenating this buffer with others; the BOM should - // only appear at the top of a file. - line = line.substring(1); - } - - if (line !== null) { - stringBuffer.append(line); - } - - while ((line = input.readLine()) !== null) { - stringBuffer.append(lineSeparator); - stringBuffer.append(line); - } - //Make sure we return a JavaScript string and not a Java string. - content = String(stringBuffer.toString()); //String - } finally { - input.close(); - } - callback(content); - }; - } else if (masterConfig.env === 'xpconnect' || (!masterConfig.env && - typeof Components !== 'undefined' && Components.classes && - Components.interfaces)) { - //Avert your gaze! - Cc = Components.classes; - Ci = Components.interfaces; - Components.utils['import']('resource://gre/modules/FileUtils.jsm'); - xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc); - - text.get = function (url, callback) { - var inStream, convertStream, fileObj, - readData = {}; - - if (xpcIsWindows) { - url = url.replace(/\//g, '\\'); - } - - fileObj = new FileUtils.File(url); - - //XPCOM, you so crazy - try { - inStream = Cc['@mozilla.org/network/file-input-stream;1'] - .createInstance(Ci.nsIFileInputStream); - inStream.init(fileObj, 1, 0, false); - - convertStream = Cc['@mozilla.org/intl/converter-input-stream;1'] - .createInstance(Ci.nsIConverterInputStream); - convertStream.init(inStream, "utf-8", inStream.available(), - Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); - - convertStream.readString(inStream.available(), readData); - convertStream.close(); - inStream.close(); - callback(readData.value); - } catch (e) { - throw new Error((fileObj && fileObj.path || '') + ': ' + e); - } - }; - } - return text; -}); diff --git a/mkdocs/contrib/search/__init__.py b/mkdocs/contrib/search/__init__.py new file mode 100644 index 0000000000..66eb92d88a --- /dev/null +++ b/mkdocs/contrib/search/__init__.py @@ -0,0 +1,107 @@ +import os +import logging +from mkdocs import utils +from mkdocs.plugins import BasePlugin +from mkdocs.config import config_options +from mkdocs.contrib.search.search_index import SearchIndex + + +log = logging.getLogger(__name__) +base_path = os.path.dirname(os.path.abspath(__file__)) + + +class LangOption(config_options.OptionallyRequired): + """ Validate Language(s) provided in config are known languages. """ + + def get_lunr_supported_lang(self, lang): + for lang_part in lang.split("_"): + lang_part = lang_part.lower() + if os.path.isfile(os.path.join(base_path, 'lunr-language', f'lunr.{lang_part}.js')): + return lang_part + + def run_validation(self, value): + if isinstance(value, str): + value = [value] + elif not isinstance(value, (list, tuple)): + raise config_options.ValidationError('Expected a list of language codes.') + for lang in list(value): + if lang != 'en': + lang_detected = self.get_lunr_supported_lang(lang) + if not lang_detected: + log.info(f"Option search.lang '{lang}' is not supported, falling back to 'en'") + value.remove(lang) + if 'en' not in value: + value.append('en') + elif lang_detected != lang: + value.remove(lang) + value.append(lang_detected) + log.info(f"Option search.lang '{lang}' switched to '{lang_detected}'") + return value + + +class SearchPlugin(BasePlugin): + """ Add a search feature to MkDocs. """ + + config_scheme = ( + ('lang', LangOption()), + ('separator', config_options.Type(str, default=r'[\s\-]+')), + ('min_search_length', config_options.Type(int, default=3)), + ('prebuild_index', config_options.Choice((False, True, 'node', 'python'), default=False)), + ('indexing', config_options.Choice(('full', 'sections', 'titles'), default='full')) + ) + + def on_config(self, config, **kwargs): + "Add plugin templates and scripts to config." + if 'include_search_page' in config['theme'] and config['theme']['include_search_page']: + config['theme'].static_templates.add('search.html') + if not ('search_index_only' in config['theme'] and config['theme']['search_index_only']): + path = os.path.join(base_path, 'templates') + config['theme'].dirs.append(path) + if 'search/main.js' not in config['extra_javascript']: + config['extra_javascript'].append('search/main.js') + if self.config['lang'] is None: + # lang setting undefined. Set default based on theme locale + validate = self.config_scheme[0][1].run_validation + self.config['lang'] = validate(config['theme']['locale'].language) + # The `python` method of `prebuild_index` is pending deprecation as of version 1.2. + # TODO: Raise a deprecation warning in a future release (1.3?). + if self.config['prebuild_index'] == 'python': + log.info( + "The 'python' method of the search plugin's 'prebuild_index' config option " + "is pending deprecation and will not be supported in a future release." + ) + return config + + def on_pre_build(self, config, **kwargs): + "Create search index instance for later use." + self.search_index = SearchIndex(**self.config) + + def on_page_context(self, context, **kwargs): + "Add page to search index." + self.search_index.add_entry_from_context(context['page']) + + def on_post_build(self, config, **kwargs): + "Build search index." + output_base_path = os.path.join(config['site_dir'], 'search') + search_index = self.search_index.generate_search_index() + json_output_path = os.path.join(output_base_path, 'search_index.json') + utils.write_file(search_index.encode('utf-8'), json_output_path) + + if not ('search_index_only' in config['theme'] and config['theme']['search_index_only']): + # Include language support files in output. Copy them directly + # so that only the needed files are included. + files = [] + if len(self.config['lang']) > 1 or 'en' not in self.config['lang']: + files.append('lunr.stemmer.support.js') + if len(self.config['lang']) > 1: + files.append('lunr.multi.js') + if ('ja' in self.config['lang'] or 'jp' in self.config['lang']): + files.append('tinyseg.js') + for lang in self.config['lang']: + if (lang != 'en'): + files.append(f'lunr.{lang}.js') + + for filename in files: + from_path = os.path.join(base_path, 'lunr-language', filename) + to_path = os.path.join(output_base_path, filename) + utils.copy_file(from_path, to_path) diff --git a/mkdocs/contrib/search/lunr-language/lunr.ar.js b/mkdocs/contrib/search/lunr-language/lunr.ar.js new file mode 100644 index 0000000000..c5450f16e2 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.ar.js @@ -0,0 +1,381 @@ +/*! + * Lunr languages, `Arabic` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2018, Dalia Al-Shahrabi + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Kazem Taghva, Rania Elkhoury, and Jeffrey Coombs (2005) + * Meryeme Hadni, Abdelmonaime Lachkar, and S. Alaoui Ouatik (2012) + * + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.ar = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.ar.trimmer, + lunr.ar.stopWordFilter, + lunr.ar.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.ar.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.ar.wordCharacters = "\u0621-\u065b\u0671\u0640"; + lunr.ar.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.ar.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.ar.trimmer, 'trimmer-ar'); + + /* lunr stemmer function */ + lunr.ar.stemmer = (function() { + var self = this; + var word = ''; + self.result = false; + self.preRemoved = false; + self.sufRemoved = false; + + //prefix data + self.pre = { + pre1: 'ف ك ب و س ل ن ا ي ت', + pre2: 'ال لل', + pre3: 'بال وال فال تال كال ولل', + pre4: 'فبال كبال وبال وكال' + }; + + //suffix data + self.suf = { + suf1: 'ه ك ت ن ا ي', + suf2: 'نك نه ها وك يا اه ون ين تن تم نا وا ان كم كن ني نن ما هم هن تك ته ات يه', + suf3: 'تين كهم نيه نهم ونه وها يهم ونا ونك وني وهم تكم تنا تها تني تهم كما كها ناه نكم هنا تان يها', + suf4: 'كموه ناها ونني ونهم تكما تموه تكاه كماه ناكم ناهم نيها وننا' + } + + //arabic language patterns and alternative mapping for patterns + self.patterns = JSON.parse('{"pt43":[{"pt":[{"c":"ا","l":1}]},{"pt":[{"c":"ا,ت,ن,ي","l":0}],"mPt":[{"c":"ف","l":0,"m":1},{"c":"ع","l":1,"m":2},{"c":"ل","l":2,"m":3}]},{"pt":[{"c":"و","l":2}],"mPt":[{"c":"ف","l":0,"m":0},{"c":"ع","l":1,"m":1},{"c":"ل","l":2,"m":3}]},{"pt":[{"c":"ا","l":2}]},{"pt":[{"c":"ي","l":2}],"mPt":[{"c":"ف","l":0,"m":0},{"c":"ع","l":1,"m":1},{"c":"ا","l":2},{"c":"ل","l":3,"m":3}]},{"pt":[{"c":"م","l":0}]}],"pt53":[{"pt":[{"c":"ت","l":0},{"c":"ا","l":2}]},{"pt":[{"c":"ا,ن,ت,ي","l":0},{"c":"ت","l":2}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ت","l":2},{"c":"ع","l":3,"m":3},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"ا","l":0},{"c":"ا","l":2}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ع","l":2,"m":3},{"c":"ل","l":3,"m":4},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"ا","l":0},{"c":"ا","l":3}],"mPt":[{"c":"ف","l":0,"m":1},{"c":"ع","l":1,"m":2},{"c":"ل","l":2,"m":4}]},{"pt":[{"c":"ا","l":3},{"c":"ن","l":4}]},{"pt":[{"c":"ت","l":0},{"c":"ي","l":3}]},{"pt":[{"c":"م","l":0},{"c":"و","l":3}]},{"pt":[{"c":"ا","l":1},{"c":"و","l":3}]},{"pt":[{"c":"و","l":1},{"c":"ا","l":2}]},{"pt":[{"c":"م","l":0},{"c":"ا","l":3}]},{"pt":[{"c":"م","l":0},{"c":"ي","l":3}]},{"pt":[{"c":"ا","l":2},{"c":"ن","l":3}]},{"pt":[{"c":"م","l":0},{"c":"ن","l":1}],"mPt":[{"c":"ا","l":0},{"c":"ن","l":1},{"c":"ف","l":2,"m":2},{"c":"ع","l":3,"m":3},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"م","l":0},{"c":"ت","l":2}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ت","l":2},{"c":"ع","l":3,"m":3},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"م","l":0},{"c":"ا","l":2}]},{"pt":[{"c":"م","l":1},{"c":"ا","l":3}]},{"pt":[{"c":"ي,ت,ا,ن","l":0},{"c":"ت","l":1}],"mPt":[{"c":"ف","l":0,"m":2},{"c":"ع","l":1,"m":3},{"c":"ا","l":2},{"c":"ل","l":3,"m":4}]},{"pt":[{"c":"ت,ي,ا,ن","l":0},{"c":"ت","l":2}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ت","l":2},{"c":"ع","l":3,"m":3},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"ا","l":2},{"c":"ي","l":3}]},{"pt":[{"c":"ا,ي,ت,ن","l":0},{"c":"ن","l":1}],"mPt":[{"c":"ا","l":0},{"c":"ن","l":1},{"c":"ف","l":2,"m":2},{"c":"ع","l":3,"m":3},{"c":"ا","l":4},{"c":"ل","l":5,"m":4}]},{"pt":[{"c":"ا","l":3},{"c":"ء","l":4}]}],"pt63":[{"pt":[{"c":"ا","l":0},{"c":"ت","l":2},{"c":"ا","l":4}]},{"pt":[{"c":"ا,ت,ن,ي","l":0},{"c":"س","l":1},{"c":"ت","l":2}],"mPt":[{"c":"ا","l":0},{"c":"س","l":1},{"c":"ت","l":2},{"c":"ف","l":3,"m":3},{"c":"ع","l":4,"m":4},{"c":"ا","l":5},{"c":"ل","l":6,"m":5}]},{"pt":[{"c":"ا,ن,ت,ي","l":0},{"c":"و","l":3}]},{"pt":[{"c":"م","l":0},{"c":"س","l":1},{"c":"ت","l":2}],"mPt":[{"c":"ا","l":0},{"c":"س","l":1},{"c":"ت","l":2},{"c":"ف","l":3,"m":3},{"c":"ع","l":4,"m":4},{"c":"ا","l":5},{"c":"ل","l":6,"m":5}]},{"pt":[{"c":"ي","l":1},{"c":"ي","l":3},{"c":"ا","l":4},{"c":"ء","l":5}]},{"pt":[{"c":"ا","l":0},{"c":"ن","l":1},{"c":"ا","l":4}]}],"pt54":[{"pt":[{"c":"ت","l":0}]},{"pt":[{"c":"ا,ي,ت,ن","l":0}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ع","l":2,"m":2},{"c":"ل","l":3,"m":3},{"c":"ر","l":4,"m":4},{"c":"ا","l":5},{"c":"ر","l":6,"m":4}]},{"pt":[{"c":"م","l":0}],"mPt":[{"c":"ا","l":0},{"c":"ف","l":1,"m":1},{"c":"ع","l":2,"m":2},{"c":"ل","l":3,"m":3},{"c":"ر","l":4,"m":4},{"c":"ا","l":5},{"c":"ر","l":6,"m":4}]},{"pt":[{"c":"ا","l":2}]},{"pt":[{"c":"ا","l":0},{"c":"ن","l":2}]}],"pt64":[{"pt":[{"c":"ا","l":0},{"c":"ا","l":4}]},{"pt":[{"c":"م","l":0},{"c":"ت","l":1}]}],"pt73":[{"pt":[{"c":"ا","l":0},{"c":"س","l":1},{"c":"ت","l":2},{"c":"ا","l":5}]}],"pt75":[{"pt":[{"c":"ا","l":0},{"c":"ا","l":5}]}]}'); + + self.execArray = [ + 'cleanWord', + 'removeDiacritics', + 'cleanAlef', + 'removeStopWords', + 'normalizeHamzaAndAlef', + 'removeStartWaw', + 'removePre432', + 'removeEndTaa', + 'wordCheck' + ]; + + self.stem = function() { + var counter = 0; + self.result = false; + self.preRemoved = false; + self.sufRemoved = false; + while (counter < self.execArray.length && self.result != true) { + self.result = self[self.execArray[counter]](); + counter++; + } + } + + self.setCurrent = function(word) { + self.word = word; + } + + self.getCurrent = function() { + return self.word + } + + /*remove elongating character and test that the word does not contain non-arabic characters. + If the word contains special characters, don't stem. */ + self.cleanWord = function() { + var wordCharacters = "\u0621-\u065b\u0671\u0640"; + var testRegex = new RegExp("[^" + wordCharacters + "]"); + self.word = self.word + .replace('\u0640', ''); + if (testRegex.test(word)) { + return true; + } + return false; + } + + self.removeDiacritics = function() { + var diacriticsRegex = new RegExp("[\u064b-\u065b]"); + self.word = self.word.replace(/[\u064b-\u065b]/gi, ''); + return false; + } + + /*Replace all variations of alef (آأإٱى) to a plain alef (ا)*/ + self.cleanAlef = function() { + var alefRegex = new RegExp("[\u0622\u0623\u0625\u0671\u0649]"); + self.word = self.word.replace(alefRegex, "\u0627"); + return false; + } + + /* if the word is a stop word, don't stem*/ + self.removeStopWords = function() { + var stopWords = '، اض امين اه اها اي ا اب اجل اجمع اخ اخذ اصبح اضحى اقبل اقل اكثر الا ام اما امامك امامك امسى اما ان انا انت انتم انتما انتن انت انشا انى او اوشك اولئك اولئكم اولاء اولالك اوه اي ايا اين اينما اي ان اي اف اذ اذا اذا اذما اذن الى اليكم اليكما اليكن اليك اليك الا اما ان انما اي اياك اياكم اياكما اياكن ايانا اياه اياها اياهم اياهما اياهن اياي ايه ان ا ابتدا اثر اجل احد اخرى اخلولق اذا اربعة ارتد استحال اطار اعادة اعلنت اف اكثر اكد الالاء الالى الا الاخيرة الان الاول الاولى التى التي الثاني الثانية الذاتي الذى الذي الذين السابق الف اللائي اللاتي اللتان اللتيا اللتين اللذان اللذين اللواتي الماضي المقبل الوقت الى اليوم اما امام امس ان انبرى انقلب انه انها او اول اي ايار ايام ايضا ب بات باسم بان بخ برس بسبب بس بشكل بضع بطان بعد بعض بك بكم بكما بكن بل بلى بما بماذا بمن بن بنا به بها بي بيد بين بس بله بئس تان تانك تبدل تجاه تحول تلقاء تلك تلكم تلكما تم تينك تين ته تي ثلاثة ثم ثم ثمة ثم جعل جلل جميع جير حار حاشا حاليا حاي حتى حرى حسب حم حوالى حول حيث حيثما حين حي حبذا حتى حذار خلا خلال دون دونك ذا ذات ذاك ذانك ذان ذلك ذلكم ذلكما ذلكن ذو ذوا ذواتا ذواتي ذيت ذينك ذين ذه ذي راح رجع رويدك ريث رب زيارة سبحان سرعان سنة سنوات سوف سوى ساء ساءما شبه شخصا شرع شتان صار صباح صفر صه صه ضد ضمن طاق طالما طفق طق ظل عاد عام عاما عامة عدا عدة عدد عدم عسى عشر عشرة علق على عليك عليه عليها عل عن عند عندما عوض عين عدس عما غدا غير ف فان فلان فو فى في فيم فيما فيه فيها قال قام قبل قد قط قلما قوة كانما كاين كاي كاين كاد كان كانت كذا كذلك كرب كل كلا كلاهما كلتا كلم كليكما كليهما كلما كلا كم كما كي كيت كيف كيفما كان كخ لئن لا لات لاسيما لدن لدى لعمر لقاء لك لكم لكما لكن لكنما لكي لكيلا للامم لم لما لما لن لنا له لها لو لوكالة لولا لوما لي لست لست لستم لستما لستن لست لسن لعل لكن ليت ليس ليسا ليستا ليست ليسوا لسنا ما ماانفك مابرح مادام ماذا مازال مافتئ مايو متى مثل مذ مساء مع معاذ مقابل مكانكم مكانكما مكانكن مكانك مليار مليون مما ممن من منذ منها مه مهما من من نحن نحو نعم نفس نفسه نهاية نخ نعما نعم ها هاؤم هاك هاهنا هب هذا هذه هكذا هل هلم هلا هم هما هن هنا هناك هنالك هو هي هيا هيت هيا هؤلاء هاتان هاتين هاته هاتي هج هذا هذان هذين هذه هذي هيهات و وا واحد واضاف واضافت واكد وان واها واوضح وراءك وفي وقال وقالت وقد وقف وكان وكانت ولا ولم ومن وهو وهي ويكان وي وشكان يكون يمكن يوم ايان'.split(' '); + if (stopWords.indexOf(self.word) >= 0) { + return true; + } + } + + /* changes ؤ ئ to ء and removes alef if at the end of the word*/ + self.normalizeHamzaAndAlef = function() { + self.word = self.word.replace('\u0624', '\u0621'); + self.word = self.word.replace('\u0626', '\u0621'); + self.word = self.word.replace(/([\u0627])\1+/gi, '\u0627'); + return false; + } + + /*remove end taa marboota ة*/ + self.removeEndTaa = function() { + if (self.word.length > 2) { + self.word = self.word.replace(/[\u0627]$/, ''); + self.word = self.word.replace('\u0629', ''); + return false; + } else return true; + } + + /* if the word starts with double waw وو keep only one of them */ + self.removeStartWaw = function() { + if (self.word.length > 3 && self.word[0] == '\u0648' && self.word[1] == '\u0648') { + self.word = self.word.slice(1); + } + return false; + } + + /* remove prefixes of size 4, 3 and 2 characters */ + self.removePre432 = function() { + var word = self.word; + if (self.word.length >= 7) { + var pre4Regex = new RegExp('^(' + self.pre.pre4.split(' ').join('|') + ')') + self.word = self.word.replace(pre4Regex, ''); + } + if (self.word == word && self.word.length >= 6) { + var pre3Regex = new RegExp('^(' + self.pre.pre3.split(' ').join('|') + ')') + self.word = self.word.replace(pre3Regex, ''); + } + if (self.word == word && self.word.length >= 5) { + var pre2Regex = new RegExp('^(' + self.pre.pre2.split(' ').join('|') + ')') + self.word = self.word.replace(pre2Regex, ''); + } + if (word != self.word) self.preRemoved = true; + return false; + } + + /* check the word against word patterns. If the word matches a pattern, map it to the + alternative pattern if available then stop stemming. */ + self.patternCheck = function(pattern) { + var patternMatch = false; + for (var i = 0; i < pattern.length; i++) { + var currentPatternCheck = true; + for (var j = 0; j < pattern[i].pt.length; j++) { + var chars = pattern[i].pt[j].c.split(','); + var charMatch = false; + chars.forEach(function(el) { + if (self.word[pattern[i].pt[j].l] == el) { + charMatch = true; + } + }) + if (!charMatch) { + currentPatternCheck = false; + break; + } + } + if (currentPatternCheck == true) { + if (pattern[i].mPt) { + var newWord = []; + for (var k = 0; k < pattern[i].mPt.length; k++) { + if (pattern[i].mPt[k].m != null) { + newWord[pattern[i].mPt[k].l] = self.word[pattern[i].mPt[k].m] + } else { + newWord[pattern[i].mPt[k].l] = pattern[i].mPt[k].c + } + } + self.word = newWord.join(''); + } + self.result = true; + break; + } + } + } + + /* remove prefixes of size 1 char*/ + self.removePre1 = function() { + var word = self.word; + if (self.preRemoved == false) + if (self.word.length > 3) { + var pre1Regex = new RegExp('^(' + self.pre.pre1.split(' ').join('|') + ')') + self.word = self.word.replace(pre1Regex, ''); + } + if (word != self.word) self.preRemoved = true; + return false; + } + + /*remove suffixes of size 1 char */ + self.removeSuf1 = function() { + var word = self.word; + if (self.sufRemoved == false) + if (self.word.length > 3) { + var suf1Regex = new RegExp('(' + self.suf.suf1.split(' ').join('|') + ')$') + self.word = self.word.replace(suf1Regex, ''); + } + if (word != self.word) self.sufRemoved = true; + return false; + } + + /*remove suffixes of size 4, 3 and 2 chars*/ + self.removeSuf432 = function() { + var word = self.word; + if (self.word.length >= 6) { + var suf4Regex = new RegExp('(' + self.suf.suf4.split(' ').join('|') + ')$') + self.word = self.word.replace(suf4Regex, ''); + } + if (self.word == word && self.word.length >= 5) { + var suf3Regex = new RegExp('(' + self.suf.suf3.split(' ').join('|') + ')$') + self.word = self.word.replace(suf3Regex, ''); + } + if (self.word == word && self.word.length >= 4) { + var suf2Regex = new RegExp('(' + self.suf.suf2.split(' ').join('|') + ')$') + self.word = self.word.replace(suf2Regex, ''); + } + if (word != self.word) self.sufRemoved = true; + return false; + } + + /*check the word length and decide what is the next step accordingly*/ + self.wordCheck = function() { + var word = self.word; + var word7Exec = [self.removeSuf432, self.removeSuf1, self.removePre1] + var counter = 0; + var patternChecked = false; + while (self.word.length >= 7 && !self.result && counter < word7Exec.length) { + if (self.word.length == 7 && !patternChecked) { + self.checkPattern73(); + patternChecked = true; + } else { + word7Exec[counter](); + counter++; + patternChecked = false; + } + } + + var word6Exec = [self.checkPattern63, self.removeSuf432, self.removeSuf1, self.removePre1, self.checkPattern64]; + counter = 0; + while (self.word.length == 6 && !self.result && counter < word6Exec.length) { + word6Exec[counter](); + counter++; + } + + var word5Exec = [self.checkPattern53, self.removeSuf432, self.removeSuf1, self.removePre1, self.checkPattern54]; + counter = 0; + while (self.word.length == 5 && !self.result && counter < word5Exec.length) { + word5Exec[counter](); + counter++; + } + + var word4Exec = [self.checkPattern43, self.removeSuf1, self.removePre1, self.removeSuf432]; + counter = 0; + while (self.word.length == 4 && !self.result && counter < word4Exec.length) { + word4Exec[counter](); + counter++; + } + return true; + } + + self.checkPattern43 = function() { + self.patternCheck(self.patterns.pt43) + } + self.checkPattern53 = function() { + self.patternCheck(self.patterns.pt53) + } + self.checkPattern54 = function() { + self.patternCheck(self.patterns.pt54) + } + self.checkPattern63 = function() { + self.patternCheck(self.patterns.pt63) + } + self.checkPattern64 = function() { + self.patternCheck(self.patterns.pt64) + } + self.checkPattern73 = function() { + self.patternCheck(self.patterns.pt73) + } + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + self.setCurrent(word); + self.stem(); + return self.getCurrent(); + }) + } else { // for lunr version <= 1 + self.setCurrent(token); + self.stem(); + return self.getCurrent(); + } + + } + })(); + + lunr.Pipeline.registerFunction(lunr.ar.stemmer, 'stemmer-ar'); + + lunr.ar.stopWordFilter = lunr.generateStopWordFilter('، اض امين اه اها اي ا اب اجل اجمع اخ اخذ اصبح اضحى اقبل اقل اكثر الا ام اما امامك امامك امسى اما ان انا انت انتم انتما انتن انت انشا انى او اوشك اولئك اولئكم اولاء اولالك اوه اي ايا اين اينما اي ان اي اف اذ اذا اذا اذما اذن الى اليكم اليكما اليكن اليك اليك الا اما ان انما اي اياك اياكم اياكما اياكن ايانا اياه اياها اياهم اياهما اياهن اياي ايه ان ا ابتدا اثر اجل احد اخرى اخلولق اذا اربعة ارتد استحال اطار اعادة اعلنت اف اكثر اكد الالاء الالى الا الاخيرة الان الاول الاولى التى التي الثاني الثانية الذاتي الذى الذي الذين السابق الف اللائي اللاتي اللتان اللتيا اللتين اللذان اللذين اللواتي الماضي المقبل الوقت الى اليوم اما امام امس ان انبرى انقلب انه انها او اول اي ايار ايام ايضا ب بات باسم بان بخ برس بسبب بس بشكل بضع بطان بعد بعض بك بكم بكما بكن بل بلى بما بماذا بمن بن بنا به بها بي بيد بين بس بله بئس تان تانك تبدل تجاه تحول تلقاء تلك تلكم تلكما تم تينك تين ته تي ثلاثة ثم ثم ثمة ثم جعل جلل جميع جير حار حاشا حاليا حاي حتى حرى حسب حم حوالى حول حيث حيثما حين حي حبذا حتى حذار خلا خلال دون دونك ذا ذات ذاك ذانك ذان ذلك ذلكم ذلكما ذلكن ذو ذوا ذواتا ذواتي ذيت ذينك ذين ذه ذي راح رجع رويدك ريث رب زيارة سبحان سرعان سنة سنوات سوف سوى ساء ساءما شبه شخصا شرع شتان صار صباح صفر صه صه ضد ضمن طاق طالما طفق طق ظل عاد عام عاما عامة عدا عدة عدد عدم عسى عشر عشرة علق على عليك عليه عليها عل عن عند عندما عوض عين عدس عما غدا غير ف فان فلان فو فى في فيم فيما فيه فيها قال قام قبل قد قط قلما قوة كانما كاين كاي كاين كاد كان كانت كذا كذلك كرب كل كلا كلاهما كلتا كلم كليكما كليهما كلما كلا كم كما كي كيت كيف كيفما كان كخ لئن لا لات لاسيما لدن لدى لعمر لقاء لك لكم لكما لكن لكنما لكي لكيلا للامم لم لما لما لن لنا له لها لو لوكالة لولا لوما لي لست لست لستم لستما لستن لست لسن لعل لكن ليت ليس ليسا ليستا ليست ليسوا لسنا ما ماانفك مابرح مادام ماذا مازال مافتئ مايو متى مثل مذ مساء مع معاذ مقابل مكانكم مكانكما مكانكن مكانك مليار مليون مما ممن من منذ منها مه مهما من من نحن نحو نعم نفس نفسه نهاية نخ نعما نعم ها هاؤم هاك هاهنا هب هذا هذه هكذا هل هلم هلا هم هما هن هنا هناك هنالك هو هي هيا هيت هيا هؤلاء هاتان هاتين هاته هاتي هج هذا هذان هذين هذه هذي هيهات وا واحد واضاف واضافت واكد وان واها واوضح وراءك وفي وقال وقالت وقد وقف وكان وكانت ولا ولم ومن وهو وهي ويكان وي وشكان يكون يمكن يوم ايان'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.ar.stopWordFilter, 'stopWordFilter-ar'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.da.js b/mkdocs/contrib/search/lunr-language/lunr.da.js new file mode 100644 index 0000000000..28b5c2d5d8 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.da.js @@ -0,0 +1,284 @@ +/*! + * Lunr languages, `Danish` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.da = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.da.trimmer, + lunr.da.stopWordFilter, + lunr.da.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.da.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.da.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.da.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.da.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.da.trimmer, 'trimmer-da'); + + /* lunr stemmer function */ + lunr.da.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function DanishStemmer() { + var a_0 = [new Among("hed", -1, 1), new Among("ethed", 0, 1), + new Among("ered", -1, 1), new Among("e", -1, 1), + new Among("erede", 3, 1), new Among("ende", 3, 1), + new Among("erende", 5, 1), new Among("ene", 3, 1), + new Among("erne", 3, 1), new Among("ere", 3, 1), + new Among("en", -1, 1), new Among("heden", 10, 1), + new Among("eren", 10, 1), new Among("er", -1, 1), + new Among("heder", 13, 1), new Among("erer", 13, 1), + new Among("s", -1, 2), new Among("heds", 16, 1), + new Among("es", 16, 1), new Among("endes", 18, 1), + new Among("erendes", 19, 1), new Among("enes", 18, 1), + new Among("ernes", 18, 1), new Among("eres", 18, 1), + new Among("ens", 16, 1), new Among("hedens", 24, 1), + new Among("erens", 24, 1), new Among("ers", 16, 1), + new Among("ets", 16, 1), new Among("erets", 28, 1), + new Among("et", -1, 1), new Among("eret", 30, 1) + ], + a_1 = [ + new Among("gd", -1, -1), new Among("dt", -1, -1), + new Among("gt", -1, -1), new Among("kt", -1, -1) + ], + a_2 = [ + new Among("ig", -1, 1), new Among("lig", 0, 1), + new Among("elig", 1, 1), new Among("els", -1, 1), + new Among("l\u00F8st", -1, 2) + ], + g_v = [17, 65, 16, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 + ], + g_s_ending = [239, 254, 42, 3, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 + ], + I_x, I_p1, S_ch, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_mark_regions() { + var v_1, c = sbp.cursor + 3; + I_p1 = sbp.limit; + if (0 <= c && c <= sbp.limit) { + I_x = c; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 248)) { + sbp.cursor = v_1; + break; + } + sbp.cursor = v_1; + if (v_1 >= sbp.limit) + return; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 248)) { + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_p1 = sbp.cursor; + if (I_p1 < I_x) + I_p1 = I_x; + } + } + + function r_main_suffix() { + var among_var, v_1; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_0, 32); + sbp.limit_backward = v_1; + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + if (sbp.in_grouping_b(g_s_ending, 97, 229)) + sbp.slice_del(); + break; + } + } + } + } + + function r_consonant_pair() { + var v_1 = sbp.limit - sbp.cursor, + v_2; + if (sbp.cursor >= I_p1) { + v_2 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_1, 4)) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_2; + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } else + sbp.limit_backward = v_2; + } + } + + function r_other_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor, + v_2, v_3; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "st")) { + sbp.bra = sbp.cursor; + if (sbp.eq_s_b(2, "ig")) + sbp.slice_del(); + } + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor >= I_p1) { + v_2 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 5); + sbp.limit_backward = v_2; + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + v_3 = sbp.limit - sbp.cursor; + r_consonant_pair(); + sbp.cursor = sbp.limit - v_3; + break; + case 2: + sbp.slice_from("l\u00F8s"); + break; + } + } + } + } + + function r_undouble() { + var v_1; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + if (sbp.out_grouping_b(g_v, 97, 248)) { + sbp.bra = sbp.cursor; + S_ch = sbp.slice_to(S_ch); + sbp.limit_backward = v_1; + if (sbp.eq_v_b(S_ch)) + sbp.slice_del(); + } else + sbp.limit_backward = v_1; + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_main_suffix(); + sbp.cursor = sbp.limit; + r_consonant_pair(); + sbp.cursor = sbp.limit; + r_other_suffix(); + sbp.cursor = sbp.limit; + r_undouble(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.da.stemmer, 'stemmer-da'); + + lunr.da.stopWordFilter = lunr.generateStopWordFilter('ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.da.stopWordFilter, 'stopWordFilter-da'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.de.js b/mkdocs/contrib/search/lunr-language/lunr.de.js new file mode 100644 index 0000000000..9e32b0c397 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.de.js @@ -0,0 +1,384 @@ +/*! + * Lunr languages, `German` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.de = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.de.trimmer, + lunr.de.stopWordFilter, + lunr.de.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.de.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.de.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.de.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.de.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.de.trimmer, 'trimmer-de'); + + /* lunr stemmer function */ + lunr.de.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function GermanStemmer() { + var a_0 = [new Among("", -1, 6), new Among("U", 0, 2), + new Among("Y", 0, 1), new Among("\u00E4", 0, 3), + new Among("\u00F6", 0, 4), new Among("\u00FC", 0, 5) + ], + a_1 = [ + new Among("e", -1, 2), new Among("em", -1, 1), + new Among("en", -1, 2), new Among("ern", -1, 1), + new Among("er", -1, 1), new Among("s", -1, 3), + new Among("es", 5, 2) + ], + a_2 = [new Among("en", -1, 1), + new Among("er", -1, 1), new Among("st", -1, 2), + new Among("est", 2, 1) + ], + a_3 = [new Among("ig", -1, 1), + new Among("lich", -1, 1) + ], + a_4 = [new Among("end", -1, 1), + new Among("ig", -1, 2), new Among("ung", -1, 1), + new Among("lich", -1, 3), new Among("isch", -1, 2), + new Among("ik", -1, 2), new Among("heit", -1, 3), + new Among("keit", -1, 4) + ], + g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 + ], + g_s_ending = [117, 30, 5], + g_st_ending = [ + 117, 30, 4 + ], + I_x, I_p2, I_p1, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1(c1, c2, v_1) { + if (sbp.eq_s(1, c1)) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 252)) { + sbp.slice_from(c2); + sbp.cursor = v_1; + return true; + } + } + return false; + } + + function r_prelude() { + var v_1 = sbp.cursor, + v_2, v_3, v_4, v_5; + while (true) { + v_2 = sbp.cursor; + sbp.bra = v_2; + if (sbp.eq_s(1, "\u00DF")) { + sbp.ket = sbp.cursor; + sbp.slice_from("ss"); + } else { + if (v_2 >= sbp.limit) + break; + sbp.cursor = v_2 + 1; + } + } + sbp.cursor = v_1; + while (true) { + v_3 = sbp.cursor; + while (true) { + v_4 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 252)) { + v_5 = sbp.cursor; + sbp.bra = v_5; + if (habr1("u", "U", v_4)) + break; + sbp.cursor = v_5; + if (habr1("y", "Y", v_4)) + break; + } + if (v_4 >= sbp.limit) { + sbp.cursor = v_3; + return; + } + sbp.cursor = v_4 + 1; + } + } + } + + function habr2() { + while (!sbp.in_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + + function r_mark_regions() { + I_p1 = sbp.limit; + I_p2 = I_p1; + var c = sbp.cursor + 3; + if (0 <= c && c <= sbp.limit) { + I_x = c; + if (!habr2()) { + I_p1 = sbp.cursor; + if (I_p1 < I_x) + I_p1 = I_x; + if (!habr2()) + I_p2 = sbp.cursor; + } + } + } + + function r_postlude() { + var among_var, v_1; + while (true) { + v_1 = sbp.cursor; + sbp.bra = v_1; + among_var = sbp.find_among(a_0, 6); + if (!among_var) + return; + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("y"); + break; + case 2: + case 5: + sbp.slice_from("u"); + break; + case 3: + sbp.slice_from("a"); + break; + case 4: + sbp.slice_from("o"); + break; + case 6: + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + break; + } + } + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_standard_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor, + v_2, v_3, v_4; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_1, 7); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "s")) { + sbp.bra = sbp.cursor; + if (sbp.eq_s_b(3, "nis")) + sbp.slice_del(); + } + break; + case 3: + if (sbp.in_grouping_b(g_s_ending, 98, 116)) + sbp.slice_del(); + break; + } + } + } + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 4); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + if (sbp.in_grouping_b(g_st_ending, 98, 116)) { + var c = sbp.cursor - 3; + if (sbp.limit_backward <= c && c <= sbp.limit) { + sbp.cursor = c; + sbp.slice_del(); + } + } + break; + } + } + } + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 8); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2()) { + switch (among_var) { + case 1: + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ig")) { + sbp.bra = sbp.cursor; + v_2 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_2; + if (r_R2()) + sbp.slice_del(); + } + } + break; + case 2: + v_3 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_3; + sbp.slice_del(); + } + break; + case 3: + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_4 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(2, "er")) { + sbp.cursor = sbp.limit - v_4; + if (!sbp.eq_s_b(2, "en")) + break; + } + sbp.bra = sbp.cursor; + if (r_R1()) + sbp.slice_del(); + break; + case 4: + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 2); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2() && among_var == 1) + sbp.slice_del(); + } + break; + } + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_standard_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.de.stemmer, 'stemmer-de'); + + lunr.de.stopWordFilter = lunr.generateStopWordFilter('aber alle allem allen aller alles als also am an ander andere anderem anderen anderer anderes anderm andern anderr anders auch auf aus bei bin bis bist da damit dann das dasselbe dazu daß dein deine deinem deinen deiner deines dem demselben den denn denselben der derer derselbe derselben des desselben dessen dich die dies diese dieselbe dieselben diesem diesen dieser dieses dir doch dort du durch ein eine einem einen einer eines einig einige einigem einigen einiger einiges einmal er es etwas euch euer eure eurem euren eurer eures für gegen gewesen hab habe haben hat hatte hatten hier hin hinter ich ihm ihn ihnen ihr ihre ihrem ihren ihrer ihres im in indem ins ist jede jedem jeden jeder jedes jene jenem jenen jener jenes jetzt kann kein keine keinem keinen keiner keines können könnte machen man manche manchem manchen mancher manches mein meine meinem meinen meiner meines mich mir mit muss musste nach nicht nichts noch nun nur ob oder ohne sehr sein seine seinem seinen seiner seines selbst sich sie sind so solche solchem solchen solcher solches soll sollte sondern sonst um und uns unse unsem unsen unser unses unter viel vom von vor war waren warst was weg weil weiter welche welchem welchen welcher welches wenn werde werden wie wieder will wir wird wirst wo wollen wollte während würde würden zu zum zur zwar zwischen über'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.de.stopWordFilter, 'stopWordFilter-de'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.du.js b/mkdocs/contrib/search/lunr-language/lunr.du.js new file mode 100644 index 0000000000..18edeb8e1b --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.du.js @@ -0,0 +1,450 @@ +/*! + * Lunr languages, `Dutch` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + console.warn("[Lunr Languages] Please use the \"nl\" instead of the \"du\". The \"nl\" code is the standard code for Dutch language, and \"du\" will be removed in the next major versions."); + + /* register specific locale function */ + lunr.du = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.du.trimmer, + lunr.du.stopWordFilter, + lunr.du.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.du.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.du.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.du.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.du.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.du.trimmer, 'trimmer-du'); + + /* lunr stemmer function */ + lunr.du.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function DutchStemmer() { + var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1), + new Among("\u00E4", 0, 1), new Among("\u00E9", 0, 2), + new Among("\u00EB", 0, 2), new Among("\u00ED", 0, 3), + new Among("\u00EF", 0, 3), new Among("\u00F3", 0, 4), + new Among("\u00F6", 0, 4), new Among("\u00FA", 0, 5), + new Among("\u00FC", 0, 5) + ], + a_1 = [new Among("", -1, 3), + new Among("I", 0, 2), new Among("Y", 0, 1) + ], + a_2 = [ + new Among("dd", -1, -1), new Among("kk", -1, -1), + new Among("tt", -1, -1) + ], + a_3 = [new Among("ene", -1, 2), + new Among("se", -1, 3), new Among("en", -1, 2), + new Among("heden", 2, 1), new Among("s", -1, 3) + ], + a_4 = [ + new Among("end", -1, 1), new Among("ig", -1, 2), + new Among("ing", -1, 1), new Among("lijk", -1, 3), + new Among("baar", -1, 4), new Among("bar", -1, 5) + ], + a_5 = [ + new Among("aa", -1, -1), new Among("ee", -1, -1), + new Among("oo", -1, -1), new Among("uu", -1, -1) + ], + g_v = [17, 65, + 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + g_v_I = [1, 0, 0, + 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + g_v_j = [ + 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + I_p2, I_p1, B_e_found, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_prelude() { + var among_var, v_1 = sbp.cursor, + v_2, v_3; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 11); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("a"); + continue; + case 2: + sbp.slice_from("e"); + continue; + case 3: + sbp.slice_from("i"); + continue; + case 4: + sbp.slice_from("o"); + continue; + case 5: + sbp.slice_from("u"); + continue; + case 6: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + sbp.cursor = v_1; + sbp.bra = v_1; + if (sbp.eq_s(1, "y")) { + sbp.ket = sbp.cursor; + sbp.slice_from("Y"); + } else + sbp.cursor = v_1; + while (true) { + v_2 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 232)) { + v_3 = sbp.cursor; + sbp.bra = v_3; + if (sbp.eq_s(1, "i")) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 232)) { + sbp.slice_from("I"); + sbp.cursor = v_2; + } + } else { + sbp.cursor = v_3; + if (sbp.eq_s(1, "y")) { + sbp.ket = sbp.cursor; + sbp.slice_from("Y"); + sbp.cursor = v_2; + } else if (habr1(v_2)) + break; + } + } else if (habr1(v_2)) + break; + } + } + + function habr1(v_1) { + sbp.cursor = v_1; + if (v_1 >= sbp.limit) + return true; + sbp.cursor++; + return false; + } + + function r_mark_regions() { + I_p1 = sbp.limit; + I_p2 = I_p1; + if (!habr2()) { + I_p1 = sbp.cursor; + if (I_p1 < 3) + I_p1 = 3; + if (!habr2()) + I_p2 = sbp.cursor; + } + } + + function habr2() { + while (!sbp.in_grouping(g_v, 97, 232)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 232)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_1, 3); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("y"); + break; + case 2: + sbp.slice_from("i"); + break; + case 3: + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + break; + } + } + } + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_undouble() { + var v_1 = sbp.limit - sbp.cursor; + if (sbp.find_among_b(a_2, 3)) { + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + } + + function r_e_ending() { + var v_1; + B_e_found = false; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "e")) { + sbp.bra = sbp.cursor; + if (r_R1()) { + v_1 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_del(); + B_e_found = true; + r_undouble(); + } + } + } + } + + function r_en_ending() { + var v_1; + if (r_R1()) { + v_1 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_1; + if (!sbp.eq_s_b(3, "gem")) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_del(); + r_undouble(); + } + } + } + } + + function r_standard_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor, + v_2, v_3, v_4, v_5, v_6; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 5); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R1()) + sbp.slice_from("heid"); + break; + case 2: + r_en_ending(); + break; + case 3: + if (r_R1() && sbp.out_grouping_b(g_v_j, 97, 232)) + sbp.slice_del(); + break; + } + } + sbp.cursor = sbp.limit - v_1; + r_e_ending(); + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(4, "heid")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + v_2 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "c")) { + sbp.cursor = sbp.limit - v_2; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "en")) { + sbp.bra = sbp.cursor; + r_en_ending(); + } + } + } + } + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 6); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R2()) { + sbp.slice_del(); + v_3 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ig")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + v_4 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_4; + sbp.slice_del(); + break; + } + } + } + sbp.cursor = sbp.limit - v_3; + r_undouble(); + } + break; + case 2: + if (r_R2()) { + v_5 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_5; + sbp.slice_del(); + } + } + break; + case 3: + if (r_R2()) { + sbp.slice_del(); + r_e_ending(); + } + break; + case 4: + if (r_R2()) + sbp.slice_del(); + break; + case 5: + if (r_R2() && B_e_found) + sbp.slice_del(); + break; + } + } + sbp.cursor = sbp.limit - v_1; + if (sbp.out_grouping_b(g_v_I, 73, 232)) { + v_6 = sbp.limit - sbp.cursor; + if (sbp.find_among_b(a_5, 4) && sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_6; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_standard_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.du.stemmer, 'stemmer-du'); + + lunr.du.stopWordFilter = lunr.generateStopWordFilter(' aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.du.stopWordFilter, 'stopWordFilter-du'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.es.js b/mkdocs/contrib/search/lunr-language/lunr.es.js new file mode 100644 index 0000000000..46cbc36070 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.es.js @@ -0,0 +1,599 @@ +/*! + * Lunr languages, `Spanish` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.es = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.es.trimmer, + lunr.es.stopWordFilter, + lunr.es.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.es.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.es.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.es.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.es.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.es.trimmer, 'trimmer-es'); + + /* lunr stemmer function */ + lunr.es.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function SpanishStemmer() { + var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1), + new Among("\u00E9", 0, 2), new Among("\u00ED", 0, 3), + new Among("\u00F3", 0, 4), new Among("\u00FA", 0, 5) + ], + a_1 = [ + new Among("la", -1, -1), new Among("sela", 0, -1), + new Among("le", -1, -1), new Among("me", -1, -1), + new Among("se", -1, -1), new Among("lo", -1, -1), + new Among("selo", 5, -1), new Among("las", -1, -1), + new Among("selas", 7, -1), new Among("les", -1, -1), + new Among("los", -1, -1), new Among("selos", 10, -1), + new Among("nos", -1, -1) + ], + a_2 = [new Among("ando", -1, 6), + new Among("iendo", -1, 6), new Among("yendo", -1, 7), + new Among("\u00E1ndo", -1, 2), new Among("i\u00E9ndo", -1, 1), + new Among("ar", -1, 6), new Among("er", -1, 6), + new Among("ir", -1, 6), new Among("\u00E1r", -1, 3), + new Among("\u00E9r", -1, 4), new Among("\u00EDr", -1, 5) + ], + a_3 = [ + new Among("ic", -1, -1), new Among("ad", -1, -1), + new Among("os", -1, -1), new Among("iv", -1, 1) + ], + a_4 = [ + new Among("able", -1, 1), new Among("ible", -1, 1), + new Among("ante", -1, 1) + ], + a_5 = [new Among("ic", -1, 1), + new Among("abil", -1, 1), new Among("iv", -1, 1) + ], + a_6 = [ + new Among("ica", -1, 1), new Among("ancia", -1, 2), + new Among("encia", -1, 5), new Among("adora", -1, 2), + new Among("osa", -1, 1), new Among("ista", -1, 1), + new Among("iva", -1, 9), new Among("anza", -1, 1), + new Among("log\u00EDa", -1, 3), new Among("idad", -1, 8), + new Among("able", -1, 1), new Among("ible", -1, 1), + new Among("ante", -1, 2), new Among("mente", -1, 7), + new Among("amente", 13, 6), new Among("aci\u00F3n", -1, 2), + new Among("uci\u00F3n", -1, 4), new Among("ico", -1, 1), + new Among("ismo", -1, 1), new Among("oso", -1, 1), + new Among("amiento", -1, 1), new Among("imiento", -1, 1), + new Among("ivo", -1, 9), new Among("ador", -1, 2), + new Among("icas", -1, 1), new Among("ancias", -1, 2), + new Among("encias", -1, 5), new Among("adoras", -1, 2), + new Among("osas", -1, 1), new Among("istas", -1, 1), + new Among("ivas", -1, 9), new Among("anzas", -1, 1), + new Among("log\u00EDas", -1, 3), new Among("idades", -1, 8), + new Among("ables", -1, 1), new Among("ibles", -1, 1), + new Among("aciones", -1, 2), new Among("uciones", -1, 4), + new Among("adores", -1, 2), new Among("antes", -1, 2), + new Among("icos", -1, 1), new Among("ismos", -1, 1), + new Among("osos", -1, 1), new Among("amientos", -1, 1), + new Among("imientos", -1, 1), new Among("ivos", -1, 9) + ], + a_7 = [ + new Among("ya", -1, 1), new Among("ye", -1, 1), + new Among("yan", -1, 1), new Among("yen", -1, 1), + new Among("yeron", -1, 1), new Among("yendo", -1, 1), + new Among("yo", -1, 1), new Among("yas", -1, 1), + new Among("yes", -1, 1), new Among("yais", -1, 1), + new Among("yamos", -1, 1), new Among("y\u00F3", -1, 1) + ], + a_8 = [ + new Among("aba", -1, 2), new Among("ada", -1, 2), + new Among("ida", -1, 2), new Among("ara", -1, 2), + new Among("iera", -1, 2), new Among("\u00EDa", -1, 2), + new Among("ar\u00EDa", 5, 2), new Among("er\u00EDa", 5, 2), + new Among("ir\u00EDa", 5, 2), new Among("ad", -1, 2), + new Among("ed", -1, 2), new Among("id", -1, 2), + new Among("ase", -1, 2), new Among("iese", -1, 2), + new Among("aste", -1, 2), new Among("iste", -1, 2), + new Among("an", -1, 2), new Among("aban", 16, 2), + new Among("aran", 16, 2), new Among("ieran", 16, 2), + new Among("\u00EDan", 16, 2), new Among("ar\u00EDan", 20, 2), + new Among("er\u00EDan", 20, 2), new Among("ir\u00EDan", 20, 2), + new Among("en", -1, 1), new Among("asen", 24, 2), + new Among("iesen", 24, 2), new Among("aron", -1, 2), + new Among("ieron", -1, 2), new Among("ar\u00E1n", -1, 2), + new Among("er\u00E1n", -1, 2), new Among("ir\u00E1n", -1, 2), + new Among("ado", -1, 2), new Among("ido", -1, 2), + new Among("ando", -1, 2), new Among("iendo", -1, 2), + new Among("ar", -1, 2), new Among("er", -1, 2), + new Among("ir", -1, 2), new Among("as", -1, 2), + new Among("abas", 39, 2), new Among("adas", 39, 2), + new Among("idas", 39, 2), new Among("aras", 39, 2), + new Among("ieras", 39, 2), new Among("\u00EDas", 39, 2), + new Among("ar\u00EDas", 45, 2), new Among("er\u00EDas", 45, 2), + new Among("ir\u00EDas", 45, 2), new Among("es", -1, 1), + new Among("ases", 49, 2), new Among("ieses", 49, 2), + new Among("abais", -1, 2), new Among("arais", -1, 2), + new Among("ierais", -1, 2), new Among("\u00EDais", -1, 2), + new Among("ar\u00EDais", 55, 2), new Among("er\u00EDais", 55, 2), + new Among("ir\u00EDais", 55, 2), new Among("aseis", -1, 2), + new Among("ieseis", -1, 2), new Among("asteis", -1, 2), + new Among("isteis", -1, 2), new Among("\u00E1is", -1, 2), + new Among("\u00E9is", -1, 1), new Among("ar\u00E9is", 64, 2), + new Among("er\u00E9is", 64, 2), new Among("ir\u00E9is", 64, 2), + new Among("ados", -1, 2), new Among("idos", -1, 2), + new Among("amos", -1, 2), new Among("\u00E1bamos", 70, 2), + new Among("\u00E1ramos", 70, 2), new Among("i\u00E9ramos", 70, 2), + new Among("\u00EDamos", 70, 2), new Among("ar\u00EDamos", 74, 2), + new Among("er\u00EDamos", 74, 2), new Among("ir\u00EDamos", 74, 2), + new Among("emos", -1, 1), new Among("aremos", 78, 2), + new Among("eremos", 78, 2), new Among("iremos", 78, 2), + new Among("\u00E1semos", 78, 2), new Among("i\u00E9semos", 78, 2), + new Among("imos", -1, 2), new Among("ar\u00E1s", -1, 2), + new Among("er\u00E1s", -1, 2), new Among("ir\u00E1s", -1, 2), + new Among("\u00EDs", -1, 2), new Among("ar\u00E1", -1, 2), + new Among("er\u00E1", -1, 2), new Among("ir\u00E1", -1, 2), + new Among("ar\u00E9", -1, 2), new Among("er\u00E9", -1, 2), + new Among("ir\u00E9", -1, 2), new Among("i\u00F3", -1, 2) + ], + a_9 = [ + new Among("a", -1, 1), new Among("e", -1, 2), + new Among("o", -1, 1), new Among("os", -1, 1), + new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2), + new Among("\u00ED", -1, 1), new Among("\u00F3", -1, 1) + ], + g_v = [17, + 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 10 + ], + I_p2, I_p1, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1() { + if (sbp.out_grouping(g_v, 97, 252)) { + while (!sbp.in_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + return true; + } + + function habr2() { + if (sbp.in_grouping(g_v, 97, 252)) { + var v_1 = sbp.cursor; + if (habr1()) { + sbp.cursor = v_1; + if (!sbp.in_grouping(g_v, 97, 252)) + return true; + while (!sbp.out_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + } + return false; + } + return true; + } + + function habr3() { + var v_1 = sbp.cursor, + v_2; + if (habr2()) { + sbp.cursor = v_1; + if (!sbp.out_grouping(g_v, 97, 252)) + return; + v_2 = sbp.cursor; + if (habr1()) { + sbp.cursor = v_2; + if (!sbp.in_grouping(g_v, 97, 252) || sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + } + I_pV = sbp.cursor; + } + + function habr4() { + while (!sbp.in_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function r_mark_regions() { + var v_1 = sbp.cursor; + I_pV = sbp.limit; + I_p1 = I_pV; + I_p2 = I_pV; + habr3(); + sbp.cursor = v_1; + if (habr4()) { + I_p1 = sbp.cursor; + if (habr4()) + I_p2 = sbp.cursor; + } + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 6); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("a"); + continue; + case 2: + sbp.slice_from("e"); + continue; + case 3: + sbp.slice_from("i"); + continue; + case 4: + sbp.slice_from("o"); + continue; + case 5: + sbp.slice_from("u"); + continue; + case 6: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + } + + function r_RV() { + return I_pV <= sbp.cursor; + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_attached_pronoun() { + var among_var; + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_1, 13)) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among_b(a_2, 11); + if (among_var && r_RV()) + switch (among_var) { + case 1: + sbp.bra = sbp.cursor; + sbp.slice_from("iendo"); + break; + case 2: + sbp.bra = sbp.cursor; + sbp.slice_from("ando"); + break; + case 3: + sbp.bra = sbp.cursor; + sbp.slice_from("ar"); + break; + case 4: + sbp.bra = sbp.cursor; + sbp.slice_from("er"); + break; + case 5: + sbp.bra = sbp.cursor; + sbp.slice_from("ir"); + break; + case 6: + sbp.slice_del(); + break; + case 7: + if (sbp.eq_s_b(1, "u")) + sbp.slice_del(); + break; + } + } + } + + function habr5(a, n) { + if (!r_R2()) + return true; + sbp.slice_del(); + sbp.ket = sbp.cursor; + var among_var = sbp.find_among_b(a, n); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1 && r_R2()) + sbp.slice_del(); + } + return false; + } + + function habr6(c1) { + if (!r_R2()) + return true; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, c1)) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + return false; + } + + function r_standard_suffix() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 46); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (!r_R2()) + return false; + sbp.slice_del(); + break; + case 2: + if (habr6("ic")) + return false; + break; + case 3: + if (!r_R2()) + return false; + sbp.slice_from("log"); + break; + case 4: + if (!r_R2()) + return false; + sbp.slice_from("u"); + break; + case 5: + if (!r_R2()) + return false; + sbp.slice_from("ente"); + break; + case 6: + if (!r_R1()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 4); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2()) { + sbp.slice_del(); + if (among_var == 1) { + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + } + } + } + break; + case 7: + if (habr5(a_4, 3)) + return false; + break; + case 8: + if (habr5(a_5, 3)) + return false; + break; + case 9: + if (habr6("at")) + return false; + break; + } + return true; + } + return false; + } + + function r_y_verb_suffix() { + var among_var, v_1; + if (sbp.cursor >= I_pV) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 12); + sbp.limit_backward = v_1; + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) { + if (!sbp.eq_s_b(1, "u")) + return false; + sbp.slice_del(); + } + return true; + } + } + return false; + } + + function r_verb_suffix() { + var among_var, v_1, v_2, v_3; + if (sbp.cursor >= I_pV) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_8, 96); + sbp.limit_backward = v_1; + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + v_2 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(1, "u")) { + v_3 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(1, "g")) + sbp.cursor = sbp.limit - v_3; + else + sbp.cursor = sbp.limit - v_2; + } else + sbp.cursor = sbp.limit - v_2; + sbp.bra = sbp.cursor; + case 2: + sbp.slice_del(); + break; + } + } + } + } + + function r_residual_suffix() { + var among_var, v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_9, 8); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_RV()) + sbp.slice_del(); + break; + case 2: + if (r_RV()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "u")) { + sbp.bra = sbp.cursor; + v_1 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(1, "g")) { + sbp.cursor = sbp.limit - v_1; + if (r_RV()) + sbp.slice_del(); + } + } + } + break; + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_attached_pronoun(); + sbp.cursor = sbp.limit; + if (!r_standard_suffix()) { + sbp.cursor = sbp.limit; + if (!r_y_verb_suffix()) { + sbp.cursor = sbp.limit; + r_verb_suffix(); + } + } + sbp.cursor = sbp.limit; + r_residual_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.es.stemmer, 'stemmer-es'); + + lunr.es.stopWordFilter = lunr.generateStopWordFilter('a al algo algunas algunos ante antes como con contra cual cuando de del desde donde durante e el ella ellas ellos en entre era erais eran eras eres es esa esas ese eso esos esta estaba estabais estaban estabas estad estada estadas estado estados estamos estando estar estaremos estará estarán estarás estaré estaréis estaría estaríais estaríamos estarían estarías estas este estemos esto estos estoy estuve estuviera estuvierais estuvieran estuvieras estuvieron estuviese estuvieseis estuviesen estuvieses estuvimos estuviste estuvisteis estuviéramos estuviésemos estuvo está estábamos estáis están estás esté estéis estén estés fue fuera fuerais fueran fueras fueron fuese fueseis fuesen fueses fui fuimos fuiste fuisteis fuéramos fuésemos ha habida habidas habido habidos habiendo habremos habrá habrán habrás habré habréis habría habríais habríamos habrían habrías habéis había habíais habíamos habían habías han has hasta hay haya hayamos hayan hayas hayáis he hemos hube hubiera hubierais hubieran hubieras hubieron hubiese hubieseis hubiesen hubieses hubimos hubiste hubisteis hubiéramos hubiésemos hubo la las le les lo los me mi mis mucho muchos muy más mí mía mías mío míos nada ni no nos nosotras nosotros nuestra nuestras nuestro nuestros o os otra otras otro otros para pero poco por porque que quien quienes qué se sea seamos sean seas seremos será serán serás seré seréis sería seríais seríamos serían serías seáis sido siendo sin sobre sois somos son soy su sus suya suyas suyo suyos sí también tanto te tendremos tendrá tendrán tendrás tendré tendréis tendría tendríais tendríamos tendrían tendrías tened tenemos tenga tengamos tengan tengas tengo tengáis tenida tenidas tenido tenidos teniendo tenéis tenía teníais teníamos tenían tenías ti tiene tienen tienes todo todos tu tus tuve tuviera tuvierais tuvieran tuvieras tuvieron tuviese tuvieseis tuviesen tuvieses tuvimos tuviste tuvisteis tuviéramos tuviésemos tuvo tuya tuyas tuyo tuyos tú un una uno unos vosotras vosotros vuestra vuestras vuestro vuestros y ya yo él éramos'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.es.stopWordFilter, 'stopWordFilter-es'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.fi.js b/mkdocs/contrib/search/lunr-language/lunr.fi.js new file mode 100644 index 0000000000..7ce9515404 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.fi.js @@ -0,0 +1,541 @@ +/*! + * Lunr languages, `Finnish` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.fi = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.fi.trimmer, + lunr.fi.stopWordFilter, + lunr.fi.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.fi.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.fi.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.fi.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.fi.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.fi.trimmer, 'trimmer-fi'); + + /* lunr stemmer function */ + lunr.fi.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function FinnishStemmer() { + var a_0 = [new Among("pa", -1, 1), new Among("sti", -1, 2), + new Among("kaan", -1, 1), new Among("han", -1, 1), + new Among("kin", -1, 1), new Among("h\u00E4n", -1, 1), + new Among("k\u00E4\u00E4n", -1, 1), new Among("ko", -1, 1), + new Among("p\u00E4", -1, 1), new Among("k\u00F6", -1, 1) + ], + a_1 = [ + new Among("lla", -1, -1), new Among("na", -1, -1), + new Among("ssa", -1, -1), new Among("ta", -1, -1), + new Among("lta", 3, -1), new Among("sta", 3, -1) + ], + a_2 = [ + new Among("ll\u00E4", -1, -1), new Among("n\u00E4", -1, -1), + new Among("ss\u00E4", -1, -1), new Among("t\u00E4", -1, -1), + new Among("lt\u00E4", 3, -1), new Among("st\u00E4", 3, -1) + ], + a_3 = [ + new Among("lle", -1, -1), new Among("ine", -1, -1) + ], + a_4 = [ + new Among("nsa", -1, 3), new Among("mme", -1, 3), + new Among("nne", -1, 3), new Among("ni", -1, 2), + new Among("si", -1, 1), new Among("an", -1, 4), + new Among("en", -1, 6), new Among("\u00E4n", -1, 5), + new Among("ns\u00E4", -1, 3) + ], + a_5 = [new Among("aa", -1, -1), + new Among("ee", -1, -1), new Among("ii", -1, -1), + new Among("oo", -1, -1), new Among("uu", -1, -1), + new Among("\u00E4\u00E4", -1, -1), + new Among("\u00F6\u00F6", -1, -1) + ], + a_6 = [new Among("a", -1, 8), + new Among("lla", 0, -1), new Among("na", 0, -1), + new Among("ssa", 0, -1), new Among("ta", 0, -1), + new Among("lta", 4, -1), new Among("sta", 4, -1), + new Among("tta", 4, 9), new Among("lle", -1, -1), + new Among("ine", -1, -1), new Among("ksi", -1, -1), + new Among("n", -1, 7), new Among("han", 11, 1), + new Among("den", 11, -1, r_VI), new Among("seen", 11, -1, r_LONG), + new Among("hen", 11, 2), new Among("tten", 11, -1, r_VI), + new Among("hin", 11, 3), new Among("siin", 11, -1, r_VI), + new Among("hon", 11, 4), new Among("h\u00E4n", 11, 5), + new Among("h\u00F6n", 11, 6), new Among("\u00E4", -1, 8), + new Among("ll\u00E4", 22, -1), new Among("n\u00E4", 22, -1), + new Among("ss\u00E4", 22, -1), new Among("t\u00E4", 22, -1), + new Among("lt\u00E4", 26, -1), new Among("st\u00E4", 26, -1), + new Among("tt\u00E4", 26, 9) + ], + a_7 = [new Among("eja", -1, -1), + new Among("mma", -1, 1), new Among("imma", 1, -1), + new Among("mpa", -1, 1), new Among("impa", 3, -1), + new Among("mmi", -1, 1), new Among("immi", 5, -1), + new Among("mpi", -1, 1), new Among("impi", 7, -1), + new Among("ej\u00E4", -1, -1), new Among("mm\u00E4", -1, 1), + new Among("imm\u00E4", 10, -1), new Among("mp\u00E4", -1, 1), + new Among("imp\u00E4", 12, -1) + ], + a_8 = [new Among("i", -1, -1), + new Among("j", -1, -1) + ], + a_9 = [new Among("mma", -1, 1), + new Among("imma", 0, -1) + ], + g_AEI = [17, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 8 + ], + g_V1 = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 8, 0, 32 + ], + g_V2 = [17, 65, 16, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 8, 0, 32 + ], + g_particle_end = [17, 97, 24, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 + ], + B_ending_removed, S_x, I_p2, I_p1, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_mark_regions() { + I_p1 = sbp.limit; + I_p2 = I_p1; + if (!habr1()) { + I_p1 = sbp.cursor; + if (!habr1()) + I_p2 = sbp.cursor; + } + } + + function habr1() { + var v_1; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_V1, 97, 246)) + break; + sbp.cursor = v_1; + if (v_1 >= sbp.limit) + return true; + sbp.cursor++; + } + sbp.cursor = v_1; + while (!sbp.out_grouping(g_V1, 97, 246)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_particle_etc() { + var among_var, v_1; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_0, 10); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + switch (among_var) { + case 1: + if (!sbp.in_grouping_b(g_particle_end, 97, 246)) + return; + break; + case 2: + if (!r_R2()) + return; + break; + } + sbp.slice_del(); + } else + sbp.limit_backward = v_1; + } + } + + function r_possessive() { + var among_var, v_1, v_2; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 9); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + switch (among_var) { + case 1: + v_2 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "k")) { + sbp.cursor = sbp.limit - v_2; + sbp.slice_del(); + } + break; + case 2: + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(3, "kse")) { + sbp.bra = sbp.cursor; + sbp.slice_from("ksi"); + } + break; + case 3: + sbp.slice_del(); + break; + case 4: + if (sbp.find_among_b(a_1, 6)) + sbp.slice_del(); + break; + case 5: + if (sbp.find_among_b(a_2, 6)) + sbp.slice_del(); + break; + case 6: + if (sbp.find_among_b(a_3, 2)) + sbp.slice_del(); + break; + } + } else + sbp.limit_backward = v_1; + } + } + + function r_LONG() { + return sbp.find_among_b(a_5, 7); + } + + function r_VI() { + return sbp.eq_s_b(1, "i") && sbp.in_grouping_b(g_V2, 97, 246); + } + + function r_case_ending() { + var among_var, v_1, v_2; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 30); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + switch (among_var) { + case 1: + if (!sbp.eq_s_b(1, "a")) + return; + break; + case 2: + case 9: + if (!sbp.eq_s_b(1, "e")) + return; + break; + case 3: + if (!sbp.eq_s_b(1, "i")) + return; + break; + case 4: + if (!sbp.eq_s_b(1, "o")) + return; + break; + case 5: + if (!sbp.eq_s_b(1, "\u00E4")) + return; + break; + case 6: + if (!sbp.eq_s_b(1, "\u00F6")) + return; + break; + case 7: + v_2 = sbp.limit - sbp.cursor; + if (!r_LONG()) { + sbp.cursor = sbp.limit - v_2; + if (!sbp.eq_s_b(2, "ie")) { + sbp.cursor = sbp.limit - v_2; + break; + } + } + sbp.cursor = sbp.limit - v_2; + if (sbp.cursor <= sbp.limit_backward) { + sbp.cursor = sbp.limit - v_2; + break; + } + sbp.cursor--; + sbp.bra = sbp.cursor; + break; + case 8: + if (!sbp.in_grouping_b(g_V1, 97, 246) || + !sbp.out_grouping_b(g_V1, 97, 246)) + return; + break; + } + sbp.slice_del(); + B_ending_removed = true; + } else + sbp.limit_backward = v_1; + } + } + + function r_other_endings() { + var among_var, v_1, v_2; + if (sbp.cursor >= I_p2) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p2; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 14); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + if (among_var == 1) { + v_2 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(2, "po")) + return; + sbp.cursor = sbp.limit - v_2; + } + sbp.slice_del(); + } else + sbp.limit_backward = v_1; + } + } + + function r_i_plural() { + var v_1; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_8, 2)) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + sbp.slice_del(); + } else + sbp.limit_backward = v_1; + } + } + + function r_t_plural() { + var among_var, v_1, v_2, v_3, v_4, v_5; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "t")) { + sbp.bra = sbp.cursor; + v_2 = sbp.limit - sbp.cursor; + if (sbp.in_grouping_b(g_V1, 97, 246)) { + sbp.cursor = sbp.limit - v_2; + sbp.slice_del(); + sbp.limit_backward = v_1; + v_3 = sbp.limit - sbp.cursor; + if (sbp.cursor >= I_p2) { + sbp.cursor = I_p2; + v_4 = sbp.limit_backward; + sbp.limit_backward = sbp.cursor; + sbp.cursor = sbp.limit - v_3; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_9, 2); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_4; + if (among_var == 1) { + v_5 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(2, "po")) + return; + sbp.cursor = sbp.limit - v_5; + } + sbp.slice_del(); + return; + } + } + } + } + sbp.limit_backward = v_1; + } + } + + function r_tidy() { + var v_1, v_2, v_3, v_4; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + v_2 = sbp.limit - sbp.cursor; + if (r_LONG()) { + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (sbp.in_grouping_b(g_AEI, 97, 228)) { + sbp.bra = sbp.cursor; + if (sbp.out_grouping_b(g_V1, 97, 246)) + sbp.slice_del(); + } + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "j")) { + sbp.bra = sbp.cursor; + v_3 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "o")) { + sbp.cursor = sbp.limit - v_3; + if (sbp.eq_s_b(1, "u")) + sbp.slice_del(); + } else + sbp.slice_del(); + } + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "o")) { + sbp.bra = sbp.cursor; + if (sbp.eq_s_b(1, "j")) + sbp.slice_del(); + } + sbp.cursor = sbp.limit - v_2; + sbp.limit_backward = v_1; + while (true) { + v_4 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_V1, 97, 246)) { + sbp.cursor = sbp.limit - v_4; + break; + } + sbp.cursor = sbp.limit - v_4; + if (sbp.cursor <= sbp.limit_backward) + return; + sbp.cursor--; + } + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + S_x = sbp.slice_to(); + if (sbp.eq_v_b(S_x)) + sbp.slice_del(); + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + B_ending_removed = false; + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_particle_etc(); + sbp.cursor = sbp.limit; + r_possessive(); + sbp.cursor = sbp.limit; + r_case_ending(); + sbp.cursor = sbp.limit; + r_other_endings(); + sbp.cursor = sbp.limit; + if (B_ending_removed) { + r_i_plural(); + sbp.cursor = sbp.limit; + } else { + sbp.cursor = sbp.limit; + r_t_plural(); + sbp.cursor = sbp.limit; + } + r_tidy(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.fi.stemmer, 'stemmer-fi'); + + lunr.fi.stopWordFilter = lunr.generateStopWordFilter('ei eivät emme en et ette että he heidän heidät heihin heille heillä heiltä heissä heistä heitä hän häneen hänelle hänellä häneltä hänen hänessä hänestä hänet häntä itse ja johon joiden joihin joiksi joilla joille joilta joina joissa joista joita joka joksi jolla jolle jolta jona jonka jos jossa josta jota jotka kanssa keiden keihin keiksi keille keillä keiltä keinä keissä keistä keitä keneen keneksi kenelle kenellä keneltä kenen kenenä kenessä kenestä kenet ketkä ketkä ketä koska kuin kuka kun me meidän meidät meihin meille meillä meiltä meissä meistä meitä mihin miksi mikä mille millä miltä minkä minkä minua minulla minulle minulta minun minussa minusta minut minuun minä minä missä mistä mitkä mitä mukaan mutta ne niiden niihin niiksi niille niillä niiltä niin niin niinä niissä niistä niitä noiden noihin noiksi noilla noille noilta noin noina noissa noista noita nuo nyt näiden näihin näiksi näille näillä näiltä näinä näissä näistä näitä nämä ole olemme olen olet olette oli olimme olin olisi olisimme olisin olisit olisitte olisivat olit olitte olivat olla olleet ollut on ovat poikki se sekä sen siihen siinä siitä siksi sille sillä sillä siltä sinua sinulla sinulle sinulta sinun sinussa sinusta sinut sinuun sinä sinä sitä tai te teidän teidät teihin teille teillä teiltä teissä teistä teitä tuo tuohon tuoksi tuolla tuolle tuolta tuon tuona tuossa tuosta tuota tähän täksi tälle tällä tältä tämä tämän tänä tässä tästä tätä vaan vai vaikka yli'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.fi.stopWordFilter, 'stopWordFilter-fi'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.fr.js b/mkdocs/contrib/search/lunr-language/lunr.fr.js new file mode 100644 index 0000000000..2de6d469b3 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.fr.js @@ -0,0 +1,703 @@ +/*! + * Lunr languages, `French` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.fr = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.fr.trimmer, + lunr.fr.stopWordFilter, + lunr.fr.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.fr.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.fr.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.fr.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.fr.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.fr.trimmer, 'trimmer-fr'); + + /* lunr stemmer function */ + lunr.fr.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function FrenchStemmer() { + var a_0 = [new Among("col", -1, -1), new Among("par", -1, -1), + new Among("tap", -1, -1) + ], + a_1 = [new Among("", -1, 4), + new Among("I", 0, 1), new Among("U", 0, 2), new Among("Y", 0, 3) + ], + a_2 = [ + new Among("iqU", -1, 3), new Among("abl", -1, 3), + new Among("I\u00E8r", -1, 4), new Among("i\u00E8r", -1, 4), + new Among("eus", -1, 2), new Among("iv", -1, 1) + ], + a_3 = [ + new Among("ic", -1, 2), new Among("abil", -1, 1), + new Among("iv", -1, 3) + ], + a_4 = [new Among("iqUe", -1, 1), + new Among("atrice", -1, 2), new Among("ance", -1, 1), + new Among("ence", -1, 5), new Among("logie", -1, 3), + new Among("able", -1, 1), new Among("isme", -1, 1), + new Among("euse", -1, 11), new Among("iste", -1, 1), + new Among("ive", -1, 8), new Among("if", -1, 8), + new Among("usion", -1, 4), new Among("ation", -1, 2), + new Among("ution", -1, 4), new Among("ateur", -1, 2), + new Among("iqUes", -1, 1), new Among("atrices", -1, 2), + new Among("ances", -1, 1), new Among("ences", -1, 5), + new Among("logies", -1, 3), new Among("ables", -1, 1), + new Among("ismes", -1, 1), new Among("euses", -1, 11), + new Among("istes", -1, 1), new Among("ives", -1, 8), + new Among("ifs", -1, 8), new Among("usions", -1, 4), + new Among("ations", -1, 2), new Among("utions", -1, 4), + new Among("ateurs", -1, 2), new Among("ments", -1, 15), + new Among("ements", 30, 6), new Among("issements", 31, 12), + new Among("it\u00E9s", -1, 7), new Among("ment", -1, 15), + new Among("ement", 34, 6), new Among("issement", 35, 12), + new Among("amment", 34, 13), new Among("emment", 34, 14), + new Among("aux", -1, 10), new Among("eaux", 39, 9), + new Among("eux", -1, 1), new Among("it\u00E9", -1, 7) + ], + a_5 = [ + new Among("ira", -1, 1), new Among("ie", -1, 1), + new Among("isse", -1, 1), new Among("issante", -1, 1), + new Among("i", -1, 1), new Among("irai", 4, 1), + new Among("ir", -1, 1), new Among("iras", -1, 1), + new Among("ies", -1, 1), new Among("\u00EEmes", -1, 1), + new Among("isses", -1, 1), new Among("issantes", -1, 1), + new Among("\u00EEtes", -1, 1), new Among("is", -1, 1), + new Among("irais", 13, 1), new Among("issais", 13, 1), + new Among("irions", -1, 1), new Among("issions", -1, 1), + new Among("irons", -1, 1), new Among("issons", -1, 1), + new Among("issants", -1, 1), new Among("it", -1, 1), + new Among("irait", 21, 1), new Among("issait", 21, 1), + new Among("issant", -1, 1), new Among("iraIent", -1, 1), + new Among("issaIent", -1, 1), new Among("irent", -1, 1), + new Among("issent", -1, 1), new Among("iront", -1, 1), + new Among("\u00EEt", -1, 1), new Among("iriez", -1, 1), + new Among("issiez", -1, 1), new Among("irez", -1, 1), + new Among("issez", -1, 1) + ], + a_6 = [new Among("a", -1, 3), + new Among("era", 0, 2), new Among("asse", -1, 3), + new Among("ante", -1, 3), new Among("\u00E9e", -1, 2), + new Among("ai", -1, 3), new Among("erai", 5, 2), + new Among("er", -1, 2), new Among("as", -1, 3), + new Among("eras", 8, 2), new Among("\u00E2mes", -1, 3), + new Among("asses", -1, 3), new Among("antes", -1, 3), + new Among("\u00E2tes", -1, 3), new Among("\u00E9es", -1, 2), + new Among("ais", -1, 3), new Among("erais", 15, 2), + new Among("ions", -1, 1), new Among("erions", 17, 2), + new Among("assions", 17, 3), new Among("erons", -1, 2), + new Among("ants", -1, 3), new Among("\u00E9s", -1, 2), + new Among("ait", -1, 3), new Among("erait", 23, 2), + new Among("ant", -1, 3), new Among("aIent", -1, 3), + new Among("eraIent", 26, 2), new Among("\u00E8rent", -1, 2), + new Among("assent", -1, 3), new Among("eront", -1, 2), + new Among("\u00E2t", -1, 3), new Among("ez", -1, 2), + new Among("iez", 32, 2), new Among("eriez", 33, 2), + new Among("assiez", 33, 3), new Among("erez", 32, 2), + new Among("\u00E9", -1, 2) + ], + a_7 = [new Among("e", -1, 3), + new Among("I\u00E8re", 0, 2), new Among("i\u00E8re", 0, 2), + new Among("ion", -1, 1), new Among("Ier", -1, 2), + new Among("ier", -1, 2), new Among("\u00EB", -1, 4) + ], + a_8 = [ + new Among("ell", -1, -1), new Among("eill", -1, -1), + new Among("enn", -1, -1), new Among("onn", -1, -1), + new Among("ett", -1, -1) + ], + g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 128, 130, 103, 8, 5 + ], + g_keep_with_s = [1, 65, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + I_p2, I_p1, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1(c1, c2, v_1) { + if (sbp.eq_s(1, c1)) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 251)) { + sbp.slice_from(c2); + sbp.cursor = v_1; + return true; + } + } + return false; + } + + function habr2(c1, c2, v_1) { + if (sbp.eq_s(1, c1)) { + sbp.ket = sbp.cursor; + sbp.slice_from(c2); + sbp.cursor = v_1; + return true; + } + return false; + } + + function r_prelude() { + var v_1, v_2; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 251)) { + sbp.bra = sbp.cursor; + v_2 = sbp.cursor; + if (habr1("u", "U", v_1)) + continue; + sbp.cursor = v_2; + if (habr1("i", "I", v_1)) + continue; + sbp.cursor = v_2; + if (habr2("y", "Y", v_1)) + continue; + } + sbp.cursor = v_1; + sbp.bra = v_1; + if (!habr1("y", "Y", v_1)) { + sbp.cursor = v_1; + if (sbp.eq_s(1, "q")) { + sbp.bra = sbp.cursor; + if (habr2("u", "U", v_1)) + continue; + } + sbp.cursor = v_1; + if (v_1 >= sbp.limit) + return; + sbp.cursor++; + } + } + } + + function habr3() { + while (!sbp.in_grouping(g_v, 97, 251)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 251)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + + function r_mark_regions() { + var v_1 = sbp.cursor; + I_pV = sbp.limit; + I_p1 = I_pV; + I_p2 = I_pV; + if (sbp.in_grouping(g_v, 97, 251) && sbp.in_grouping(g_v, 97, 251) && + sbp.cursor < sbp.limit) + sbp.cursor++; + else { + sbp.cursor = v_1; + if (!sbp.find_among(a_0, 3)) { + sbp.cursor = v_1; + do { + if (sbp.cursor >= sbp.limit) { + sbp.cursor = I_pV; + break; + } + sbp.cursor++; + } while (!sbp.in_grouping(g_v, 97, 251)); + } + } + I_pV = sbp.cursor; + sbp.cursor = v_1; + if (!habr3()) { + I_p1 = sbp.cursor; + if (!habr3()) + I_p2 = sbp.cursor; + } + } + + function r_postlude() { + var among_var, v_1; + while (true) { + v_1 = sbp.cursor; + sbp.bra = v_1; + among_var = sbp.find_among(a_1, 4); + if (!among_var) + break; + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("i"); + break; + case 2: + sbp.slice_from("u"); + break; + case 3: + sbp.slice_from("y"); + break; + case 4: + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + break; + } + } + } + + function r_RV() { + return I_pV <= sbp.cursor; + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_standard_suffix() { + var among_var, v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 43); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (!r_R2()) + return false; + sbp.slice_del(); + break; + case 2: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ic")) { + sbp.bra = sbp.cursor; + if (!r_R2()) + sbp.slice_from("iqU"); + else + sbp.slice_del(); + } + break; + case 3: + if (!r_R2()) + return false; + sbp.slice_from("log"); + break; + case 4: + if (!r_R2()) + return false; + sbp.slice_from("u"); + break; + case 5: + if (!r_R2()) + return false; + sbp.slice_from("ent"); + break; + case 6: + if (!r_RV()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 6); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R2()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + } + break; + case 2: + if (r_R2()) + sbp.slice_del(); + else if (r_R1()) + sbp.slice_from("eux"); + break; + case 3: + if (r_R2()) + sbp.slice_del(); + break; + case 4: + if (r_RV()) + sbp.slice_from("i"); + break; + } + } + break; + case 7: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 3); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R2()) + sbp.slice_del(); + else + sbp.slice_from("abl"); + break; + case 2: + if (r_R2()) + sbp.slice_del(); + else + sbp.slice_from("iqU"); + break; + case 3: + if (r_R2()) + sbp.slice_del(); + break; + } + } + break; + case 8: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ic")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + else + sbp.slice_from("iqU"); + break; + } + } + } + break; + case 9: + sbp.slice_from("eau"); + break; + case 10: + if (!r_R1()) + return false; + sbp.slice_from("al"); + break; + case 11: + if (r_R2()) + sbp.slice_del(); + else if (!r_R1()) + return false; + else + sbp.slice_from("eux"); + break; + case 12: + if (!r_R1() || !sbp.out_grouping_b(g_v, 97, 251)) + return false; + sbp.slice_del(); + break; + case 13: + if (r_RV()) + sbp.slice_from("ant"); + return false; + case 14: + if (r_RV()) + sbp.slice_from("ent"); + return false; + case 15: + v_1 = sbp.limit - sbp.cursor; + if (sbp.in_grouping_b(g_v, 97, 251) && r_RV()) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_del(); + } + return false; + } + return true; + } + return false; + } + + function r_i_verb_suffix() { + var among_var, v_1; + if (sbp.cursor < I_pV) + return false; + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_5, 35); + if (!among_var) { + sbp.limit_backward = v_1; + return false; + } + sbp.bra = sbp.cursor; + if (among_var == 1) { + if (!sbp.out_grouping_b(g_v, 97, 251)) { + sbp.limit_backward = v_1; + return false; + } + sbp.slice_del(); + } + sbp.limit_backward = v_1; + return true; + } + + function r_verb_suffix() { + var among_var, v_2, v_3; + if (sbp.cursor < I_pV) + return false; + v_2 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 38); + if (!among_var) { + sbp.limit_backward = v_2; + return false; + } + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (!r_R2()) { + sbp.limit_backward = v_2; + return false; + } + sbp.slice_del(); + break; + case 2: + sbp.slice_del(); + break; + case 3: + sbp.slice_del(); + v_3 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "e")) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else + sbp.cursor = sbp.limit - v_3; + break; + } + sbp.limit_backward = v_2; + return true; + } + + function r_residual_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor, + v_2, v_4, v_5; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "s")) { + sbp.bra = sbp.cursor; + v_2 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_keep_with_s, 97, 232)) { + sbp.cursor = sbp.limit - v_2; + sbp.slice_del(); + } else + sbp.cursor = sbp.limit - v_1; + } else + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor >= I_pV) { + v_4 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 7); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R2()) { + v_5 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "s")) { + sbp.cursor = sbp.limit - v_5; + if (!sbp.eq_s_b(1, "t")) + break; + } + sbp.slice_del(); + } + break; + case 2: + sbp.slice_from("i"); + break; + case 3: + sbp.slice_del(); + break; + case 4: + if (sbp.eq_s_b(2, "gu")) + sbp.slice_del(); + break; + } + } + sbp.limit_backward = v_4; + } + } + + function r_un_double() { + var v_1 = sbp.limit - sbp.cursor; + if (sbp.find_among_b(a_8, 5)) { + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + } + + function r_un_accent() { + var v_1, v_2 = 1; + while (sbp.out_grouping_b(g_v, 97, 251)) + v_2--; + if (v_2 <= 0) { + sbp.ket = sbp.cursor; + v_1 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "\u00E9")) { + sbp.cursor = sbp.limit - v_1; + if (!sbp.eq_s_b(1, "\u00E8")) + return; + } + sbp.bra = sbp.cursor; + sbp.slice_from("e"); + } + } + + function habr5() { + if (!r_standard_suffix()) { + sbp.cursor = sbp.limit; + if (!r_i_verb_suffix()) { + sbp.cursor = sbp.limit; + if (!r_verb_suffix()) { + sbp.cursor = sbp.limit; + r_residual_suffix(); + return; + } + } + } + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "Y")) { + sbp.bra = sbp.cursor; + sbp.slice_from("i"); + } else { + sbp.cursor = sbp.limit; + if (sbp.eq_s_b(1, "\u00E7")) { + sbp.bra = sbp.cursor; + sbp.slice_from("c"); + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + habr5(); + sbp.cursor = sbp.limit; + r_un_double(); + sbp.cursor = sbp.limit; + r_un_accent(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.fr.stemmer, 'stemmer-fr'); + + lunr.fr.stopWordFilter = lunr.generateStopWordFilter('ai aie aient aies ait as au aura aurai auraient aurais aurait auras aurez auriez aurions aurons auront aux avaient avais avait avec avez aviez avions avons ayant ayez ayons c ce ceci celà ces cet cette d dans de des du elle en es est et eu eue eues eurent eus eusse eussent eusses eussiez eussions eut eux eûmes eût eûtes furent fus fusse fussent fusses fussiez fussions fut fûmes fût fûtes ici il ils j je l la le les leur leurs lui m ma mais me mes moi mon même n ne nos notre nous on ont ou par pas pour qu que quel quelle quelles quels qui s sa sans se sera serai seraient serais serait seras serez seriez serions serons seront ses soi soient sois soit sommes son sont soyez soyons suis sur t ta te tes toi ton tu un une vos votre vous y à étaient étais était étant étiez étions été étée étées étés êtes'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.fr.stopWordFilter, 'stopWordFilter-fr'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.hu.js b/mkdocs/contrib/search/lunr-language/lunr.hu.js new file mode 100644 index 0000000000..c52219ffee --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.hu.js @@ -0,0 +1,565 @@ +/*! + * Lunr languages, `Hungarian` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.hu = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.hu.trimmer, + lunr.hu.stopWordFilter, + lunr.hu.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.hu.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.hu.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.hu.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.hu.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.hu.trimmer, 'trimmer-hu'); + + /* lunr stemmer function */ + lunr.hu.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function HungarianStemmer() { + var a_0 = [new Among("cs", -1, -1), new Among("dzs", -1, -1), + new Among("gy", -1, -1), new Among("ly", -1, -1), + new Among("ny", -1, -1), new Among("sz", -1, -1), + new Among("ty", -1, -1), new Among("zs", -1, -1) + ], + a_1 = [ + new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2) + ], + a_2 = [ + new Among("bb", -1, -1), new Among("cc", -1, -1), + new Among("dd", -1, -1), new Among("ff", -1, -1), + new Among("gg", -1, -1), new Among("jj", -1, -1), + new Among("kk", -1, -1), new Among("ll", -1, -1), + new Among("mm", -1, -1), new Among("nn", -1, -1), + new Among("pp", -1, -1), new Among("rr", -1, -1), + new Among("ccs", -1, -1), new Among("ss", -1, -1), + new Among("zzs", -1, -1), new Among("tt", -1, -1), + new Among("vv", -1, -1), new Among("ggy", -1, -1), + new Among("lly", -1, -1), new Among("nny", -1, -1), + new Among("tty", -1, -1), new Among("ssz", -1, -1), + new Among("zz", -1, -1) + ], + a_3 = [new Among("al", -1, 1), + new Among("el", -1, 2) + ], + a_4 = [new Among("ba", -1, -1), + new Among("ra", -1, -1), new Among("be", -1, -1), + new Among("re", -1, -1), new Among("ig", -1, -1), + new Among("nak", -1, -1), new Among("nek", -1, -1), + new Among("val", -1, -1), new Among("vel", -1, -1), + new Among("ul", -1, -1), new Among("n\u00E1l", -1, -1), + new Among("n\u00E9l", -1, -1), new Among("b\u00F3l", -1, -1), + new Among("r\u00F3l", -1, -1), new Among("t\u00F3l", -1, -1), + new Among("b\u00F5l", -1, -1), new Among("r\u00F5l", -1, -1), + new Among("t\u00F5l", -1, -1), new Among("\u00FCl", -1, -1), + new Among("n", -1, -1), new Among("an", 19, -1), + new Among("ban", 20, -1), new Among("en", 19, -1), + new Among("ben", 22, -1), new Among("k\u00E9ppen", 22, -1), + new Among("on", 19, -1), new Among("\u00F6n", 19, -1), + new Among("k\u00E9pp", -1, -1), new Among("kor", -1, -1), + new Among("t", -1, -1), new Among("at", 29, -1), + new Among("et", 29, -1), new Among("k\u00E9nt", 29, -1), + new Among("ank\u00E9nt", 32, -1), new Among("enk\u00E9nt", 32, -1), + new Among("onk\u00E9nt", 32, -1), new Among("ot", 29, -1), + new Among("\u00E9rt", 29, -1), new Among("\u00F6t", 29, -1), + new Among("hez", -1, -1), new Among("hoz", -1, -1), + new Among("h\u00F6z", -1, -1), new Among("v\u00E1", -1, -1), + new Among("v\u00E9", -1, -1) + ], + a_5 = [new Among("\u00E1n", -1, 2), + new Among("\u00E9n", -1, 1), new Among("\u00E1nk\u00E9nt", -1, 3) + ], + a_6 = [ + new Among("stul", -1, 2), new Among("astul", 0, 1), + new Among("\u00E1stul", 0, 3), new Among("st\u00FCl", -1, 2), + new Among("est\u00FCl", 3, 1), new Among("\u00E9st\u00FCl", 3, 4) + ], + a_7 = [ + new Among("\u00E1", -1, 1), new Among("\u00E9", -1, 2) + ], + a_8 = [ + new Among("k", -1, 7), new Among("ak", 0, 4), + new Among("ek", 0, 6), new Among("ok", 0, 5), + new Among("\u00E1k", 0, 1), new Among("\u00E9k", 0, 2), + new Among("\u00F6k", 0, 3) + ], + a_9 = [new Among("\u00E9i", -1, 7), + new Among("\u00E1\u00E9i", 0, 6), new Among("\u00E9\u00E9i", 0, 5), + new Among("\u00E9", -1, 9), new Among("k\u00E9", 3, 4), + new Among("ak\u00E9", 4, 1), new Among("ek\u00E9", 4, 1), + new Among("ok\u00E9", 4, 1), new Among("\u00E1k\u00E9", 4, 3), + new Among("\u00E9k\u00E9", 4, 2), new Among("\u00F6k\u00E9", 4, 1), + new Among("\u00E9\u00E9", 3, 8) + ], + a_10 = [new Among("a", -1, 18), + new Among("ja", 0, 17), new Among("d", -1, 16), + new Among("ad", 2, 13), new Among("ed", 2, 13), + new Among("od", 2, 13), new Among("\u00E1d", 2, 14), + new Among("\u00E9d", 2, 15), new Among("\u00F6d", 2, 13), + new Among("e", -1, 18), new Among("je", 9, 17), + new Among("nk", -1, 4), new Among("unk", 11, 1), + new Among("\u00E1nk", 11, 2), new Among("\u00E9nk", 11, 3), + new Among("\u00FCnk", 11, 1), new Among("uk", -1, 8), + new Among("juk", 16, 7), new Among("\u00E1juk", 17, 5), + new Among("\u00FCk", -1, 8), new Among("j\u00FCk", 19, 7), + new Among("\u00E9j\u00FCk", 20, 6), new Among("m", -1, 12), + new Among("am", 22, 9), new Among("em", 22, 9), + new Among("om", 22, 9), new Among("\u00E1m", 22, 10), + new Among("\u00E9m", 22, 11), new Among("o", -1, 18), + new Among("\u00E1", -1, 19), new Among("\u00E9", -1, 20) + ], + a_11 = [ + new Among("id", -1, 10), new Among("aid", 0, 9), + new Among("jaid", 1, 6), new Among("eid", 0, 9), + new Among("jeid", 3, 6), new Among("\u00E1id", 0, 7), + new Among("\u00E9id", 0, 8), new Among("i", -1, 15), + new Among("ai", 7, 14), new Among("jai", 8, 11), + new Among("ei", 7, 14), new Among("jei", 10, 11), + new Among("\u00E1i", 7, 12), new Among("\u00E9i", 7, 13), + new Among("itek", -1, 24), new Among("eitek", 14, 21), + new Among("jeitek", 15, 20), new Among("\u00E9itek", 14, 23), + new Among("ik", -1, 29), new Among("aik", 18, 26), + new Among("jaik", 19, 25), new Among("eik", 18, 26), + new Among("jeik", 21, 25), new Among("\u00E1ik", 18, 27), + new Among("\u00E9ik", 18, 28), new Among("ink", -1, 20), + new Among("aink", 25, 17), new Among("jaink", 26, 16), + new Among("eink", 25, 17), new Among("jeink", 28, 16), + new Among("\u00E1ink", 25, 18), new Among("\u00E9ink", 25, 19), + new Among("aitok", -1, 21), new Among("jaitok", 32, 20), + new Among("\u00E1itok", -1, 22), new Among("im", -1, 5), + new Among("aim", 35, 4), new Among("jaim", 36, 1), + new Among("eim", 35, 4), new Among("jeim", 38, 1), + new Among("\u00E1im", 35, 2), new Among("\u00E9im", 35, 3) + ], + g_v = [ + 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 52, 14 + ], + I_p1, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_mark_regions() { + var v_1 = sbp.cursor, + v_2; + I_p1 = sbp.limit; + if (sbp.in_grouping(g_v, 97, 252)) { + while (true) { + v_2 = sbp.cursor; + if (sbp.out_grouping(g_v, 97, 252)) { + sbp.cursor = v_2; + if (!sbp.find_among(a_0, 8)) { + sbp.cursor = v_2; + if (v_2 < sbp.limit) + sbp.cursor++; + } + I_p1 = sbp.cursor; + return; + } + sbp.cursor = v_2; + if (v_2 >= sbp.limit) { + I_p1 = v_2; + return; + } + sbp.cursor++; + } + } + sbp.cursor = v_1; + if (sbp.out_grouping(g_v, 97, 252)) { + while (!sbp.in_grouping(g_v, 97, 252)) { + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_p1 = sbp.cursor; + } + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_v_ending() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_1, 2); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_from("a"); + break; + case 2: + sbp.slice_from("e"); + break; + } + } + } + } + + function r_double() { + var v_1 = sbp.limit - sbp.cursor; + if (!sbp.find_among_b(a_2, 23)) + return false; + sbp.cursor = sbp.limit - v_1; + return true; + } + + function r_undouble() { + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.ket = sbp.cursor; + var c = sbp.cursor - 1; + if (sbp.limit_backward <= c && c <= sbp.limit) { + sbp.cursor = c; + sbp.bra = c; + sbp.slice_del(); + } + } + } + + function r_instrum() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 2); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + if (among_var == 1 || among_var == 2) + if (!r_double()) + return; + sbp.slice_del(); + r_undouble(); + } + } + } + + function r_case() { + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_4, 44)) { + sbp.bra = sbp.cursor; + if (r_R1()) { + sbp.slice_del(); + r_v_ending(); + } + } + } + + function r_case_special() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_5, 3); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_from("e"); + break; + case 2: + case 3: + sbp.slice_from("a"); + break; + } + } + } + } + + function r_case_other() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 6); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + case 2: + sbp.slice_del(); + break; + case 3: + sbp.slice_from("a"); + break; + case 4: + sbp.slice_from("e"); + break; + } + } + } + } + + function r_factive() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 2); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + if (among_var == 1 || among_var == 2) + if (!r_double()) + return; + sbp.slice_del(); + r_undouble() + } + } + } + + function r_plural() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_8, 7); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_from("a"); + break; + case 2: + sbp.slice_from("e"); + break; + case 3: + case 4: + case 5: + case 6: + case 7: + sbp.slice_del(); + break; + } + } + } + } + + function r_owned() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_9, 12); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + case 4: + case 7: + case 9: + sbp.slice_del(); + break; + case 2: + case 5: + case 8: + sbp.slice_from("e"); + break; + case 3: + case 6: + sbp.slice_from("a"); + break; + } + } + } + } + + function r_sing_owner() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_10, 31); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + case 4: + case 7: + case 8: + case 9: + case 12: + case 13: + case 16: + case 17: + case 18: + sbp.slice_del(); + break; + case 2: + case 5: + case 10: + case 14: + case 19: + sbp.slice_from("a"); + break; + case 3: + case 6: + case 11: + case 15: + case 20: + sbp.slice_from("e"); + break; + } + } + } + } + + function r_plur_owner() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_11, 42); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + case 4: + case 5: + case 6: + case 9: + case 10: + case 11: + case 14: + case 15: + case 16: + case 17: + case 20: + case 21: + case 24: + case 25: + case 26: + case 29: + sbp.slice_del(); + break; + case 2: + case 7: + case 12: + case 18: + case 22: + case 27: + sbp.slice_from("a"); + break; + case 3: + case 8: + case 13: + case 19: + case 23: + case 28: + sbp.slice_from("e"); + break; + } + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_instrum(); + sbp.cursor = sbp.limit; + r_case(); + sbp.cursor = sbp.limit; + r_case_special(); + sbp.cursor = sbp.limit; + r_case_other(); + sbp.cursor = sbp.limit; + r_factive(); + sbp.cursor = sbp.limit; + r_owned(); + sbp.cursor = sbp.limit; + r_sing_owner(); + sbp.cursor = sbp.limit; + r_plur_owner(); + sbp.cursor = sbp.limit; + r_plural(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.hu.stemmer, 'stemmer-hu'); + + lunr.hu.stopWordFilter = lunr.generateStopWordFilter('a abban ahhoz ahogy ahol aki akik akkor alatt amely amelyek amelyekben amelyeket amelyet amelynek ami amikor amit amolyan amíg annak arra arról az azok azon azonban azt aztán azután azzal azért be belül benne bár cikk cikkek cikkeket csak de e ebben eddig egy egyes egyetlen egyik egyre egyéb egész ehhez ekkor el ellen elsõ elég elõ elõször elõtt emilyen ennek erre ez ezek ezen ezt ezzel ezért fel felé hanem hiszen hogy hogyan igen ill ill. illetve ilyen ilyenkor ismét ison itt jobban jó jól kell kellett keressünk keresztül ki kívül között közül legalább legyen lehet lehetett lenne lenni lesz lett maga magát majd majd meg mellett mely melyek mert mi mikor milyen minden mindenki mindent mindig mint mintha mit mivel miért most már más másik még míg nagy nagyobb nagyon ne nekem neki nem nincs néha néhány nélkül olyan ott pedig persze rá s saját sem semmi sok sokat sokkal szemben szerint szinte számára talán tehát teljes tovább továbbá több ugyanis utolsó után utána vagy vagyis vagyok valaki valami valamint való van vannak vele vissza viszont volna volt voltak voltam voltunk által általában át én éppen és így õ õk õket össze úgy új újabb újra'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.hu.stopWordFilter, 'stopWordFilter-hu'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.it.js b/mkdocs/contrib/search/lunr-language/lunr.it.js new file mode 100644 index 0000000000..676863b563 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.it.js @@ -0,0 +1,617 @@ +/*! + * Lunr languages, `Italian` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.it = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.it.trimmer, + lunr.it.stopWordFilter, + lunr.it.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.it.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.it.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.it.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.it.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.it.trimmer, 'trimmer-it'); + + /* lunr stemmer function */ + lunr.it.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function ItalianStemmer() { + var a_0 = [new Among("", -1, 7), new Among("qu", 0, 6), + new Among("\u00E1", 0, 1), new Among("\u00E9", 0, 2), + new Among("\u00ED", 0, 3), new Among("\u00F3", 0, 4), + new Among("\u00FA", 0, 5) + ], + a_1 = [new Among("", -1, 3), + new Among("I", 0, 1), new Among("U", 0, 2) + ], + a_2 = [ + new Among("la", -1, -1), new Among("cela", 0, -1), + new Among("gliela", 0, -1), new Among("mela", 0, -1), + new Among("tela", 0, -1), new Among("vela", 0, -1), + new Among("le", -1, -1), new Among("cele", 6, -1), + new Among("gliele", 6, -1), new Among("mele", 6, -1), + new Among("tele", 6, -1), new Among("vele", 6, -1), + new Among("ne", -1, -1), new Among("cene", 12, -1), + new Among("gliene", 12, -1), new Among("mene", 12, -1), + new Among("sene", 12, -1), new Among("tene", 12, -1), + new Among("vene", 12, -1), new Among("ci", -1, -1), + new Among("li", -1, -1), new Among("celi", 20, -1), + new Among("glieli", 20, -1), new Among("meli", 20, -1), + new Among("teli", 20, -1), new Among("veli", 20, -1), + new Among("gli", 20, -1), new Among("mi", -1, -1), + new Among("si", -1, -1), new Among("ti", -1, -1), + new Among("vi", -1, -1), new Among("lo", -1, -1), + new Among("celo", 31, -1), new Among("glielo", 31, -1), + new Among("melo", 31, -1), new Among("telo", 31, -1), + new Among("velo", 31, -1) + ], + a_3 = [new Among("ando", -1, 1), + new Among("endo", -1, 1), new Among("ar", -1, 2), + new Among("er", -1, 2), new Among("ir", -1, 2) + ], + a_4 = [ + new Among("ic", -1, -1), new Among("abil", -1, -1), + new Among("os", -1, -1), new Among("iv", -1, 1) + ], + a_5 = [ + new Among("ic", -1, 1), new Among("abil", -1, 1), + new Among("iv", -1, 1) + ], + a_6 = [new Among("ica", -1, 1), + new Among("logia", -1, 3), new Among("osa", -1, 1), + new Among("ista", -1, 1), new Among("iva", -1, 9), + new Among("anza", -1, 1), new Among("enza", -1, 5), + new Among("ice", -1, 1), new Among("atrice", 7, 1), + new Among("iche", -1, 1), new Among("logie", -1, 3), + new Among("abile", -1, 1), new Among("ibile", -1, 1), + new Among("usione", -1, 4), new Among("azione", -1, 2), + new Among("uzione", -1, 4), new Among("atore", -1, 2), + new Among("ose", -1, 1), new Among("ante", -1, 1), + new Among("mente", -1, 1), new Among("amente", 19, 7), + new Among("iste", -1, 1), new Among("ive", -1, 9), + new Among("anze", -1, 1), new Among("enze", -1, 5), + new Among("ici", -1, 1), new Among("atrici", 25, 1), + new Among("ichi", -1, 1), new Among("abili", -1, 1), + new Among("ibili", -1, 1), new Among("ismi", -1, 1), + new Among("usioni", -1, 4), new Among("azioni", -1, 2), + new Among("uzioni", -1, 4), new Among("atori", -1, 2), + new Among("osi", -1, 1), new Among("anti", -1, 1), + new Among("amenti", -1, 6), new Among("imenti", -1, 6), + new Among("isti", -1, 1), new Among("ivi", -1, 9), + new Among("ico", -1, 1), new Among("ismo", -1, 1), + new Among("oso", -1, 1), new Among("amento", -1, 6), + new Among("imento", -1, 6), new Among("ivo", -1, 9), + new Among("it\u00E0", -1, 8), new Among("ist\u00E0", -1, 1), + new Among("ist\u00E8", -1, 1), new Among("ist\u00EC", -1, 1) + ], + a_7 = [ + new Among("isca", -1, 1), new Among("enda", -1, 1), + new Among("ata", -1, 1), new Among("ita", -1, 1), + new Among("uta", -1, 1), new Among("ava", -1, 1), + new Among("eva", -1, 1), new Among("iva", -1, 1), + new Among("erebbe", -1, 1), new Among("irebbe", -1, 1), + new Among("isce", -1, 1), new Among("ende", -1, 1), + new Among("are", -1, 1), new Among("ere", -1, 1), + new Among("ire", -1, 1), new Among("asse", -1, 1), + new Among("ate", -1, 1), new Among("avate", 16, 1), + new Among("evate", 16, 1), new Among("ivate", 16, 1), + new Among("ete", -1, 1), new Among("erete", 20, 1), + new Among("irete", 20, 1), new Among("ite", -1, 1), + new Among("ereste", -1, 1), new Among("ireste", -1, 1), + new Among("ute", -1, 1), new Among("erai", -1, 1), + new Among("irai", -1, 1), new Among("isci", -1, 1), + new Among("endi", -1, 1), new Among("erei", -1, 1), + new Among("irei", -1, 1), new Among("assi", -1, 1), + new Among("ati", -1, 1), new Among("iti", -1, 1), + new Among("eresti", -1, 1), new Among("iresti", -1, 1), + new Among("uti", -1, 1), new Among("avi", -1, 1), + new Among("evi", -1, 1), new Among("ivi", -1, 1), + new Among("isco", -1, 1), new Among("ando", -1, 1), + new Among("endo", -1, 1), new Among("Yamo", -1, 1), + new Among("iamo", -1, 1), new Among("avamo", -1, 1), + new Among("evamo", -1, 1), new Among("ivamo", -1, 1), + new Among("eremo", -1, 1), new Among("iremo", -1, 1), + new Among("assimo", -1, 1), new Among("ammo", -1, 1), + new Among("emmo", -1, 1), new Among("eremmo", 54, 1), + new Among("iremmo", 54, 1), new Among("immo", -1, 1), + new Among("ano", -1, 1), new Among("iscano", 58, 1), + new Among("avano", 58, 1), new Among("evano", 58, 1), + new Among("ivano", 58, 1), new Among("eranno", -1, 1), + new Among("iranno", -1, 1), new Among("ono", -1, 1), + new Among("iscono", 65, 1), new Among("arono", 65, 1), + new Among("erono", 65, 1), new Among("irono", 65, 1), + new Among("erebbero", -1, 1), new Among("irebbero", -1, 1), + new Among("assero", -1, 1), new Among("essero", -1, 1), + new Among("issero", -1, 1), new Among("ato", -1, 1), + new Among("ito", -1, 1), new Among("uto", -1, 1), + new Among("avo", -1, 1), new Among("evo", -1, 1), + new Among("ivo", -1, 1), new Among("ar", -1, 1), + new Among("ir", -1, 1), new Among("er\u00E0", -1, 1), + new Among("ir\u00E0", -1, 1), new Among("er\u00F2", -1, 1), + new Among("ir\u00F2", -1, 1) + ], + g_v = [17, 65, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 128, 128, 8, 2, 1 + ], + g_AEIO = [17, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2 + ], + g_CG = [17], + I_p2, I_p1, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1(c1, c2, v_1) { + if (sbp.eq_s(1, c1)) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 249)) { + sbp.slice_from(c2); + sbp.cursor = v_1; + return true; + } + } + return false; + } + + function r_prelude() { + var among_var, v_1 = sbp.cursor, + v_2, v_3, v_4; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 7); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("\u00E0"); + continue; + case 2: + sbp.slice_from("\u00E8"); + continue; + case 3: + sbp.slice_from("\u00EC"); + continue; + case 4: + sbp.slice_from("\u00F2"); + continue; + case 5: + sbp.slice_from("\u00F9"); + continue; + case 6: + sbp.slice_from("qU"); + continue; + case 7: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + sbp.cursor = v_1; + while (true) { + v_2 = sbp.cursor; + while (true) { + v_3 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 249)) { + sbp.bra = sbp.cursor; + v_4 = sbp.cursor; + if (habr1("u", "U", v_3)) + break; + sbp.cursor = v_4; + if (habr1("i", "I", v_3)) + break; + } + sbp.cursor = v_3; + if (sbp.cursor >= sbp.limit) { + sbp.cursor = v_2; + return; + } + sbp.cursor++; + } + } + } + + function habr2(v_1) { + sbp.cursor = v_1; + if (!sbp.in_grouping(g_v, 97, 249)) + return false; + while (!sbp.out_grouping(g_v, 97, 249)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function habr3() { + if (sbp.in_grouping(g_v, 97, 249)) { + var v_1 = sbp.cursor; + if (sbp.out_grouping(g_v, 97, 249)) { + while (!sbp.in_grouping(g_v, 97, 249)) { + if (sbp.cursor >= sbp.limit) + return habr2(v_1); + sbp.cursor++; + } + return true; + } + return habr2(v_1); + } + return false; + } + + function habr4() { + var v_1 = sbp.cursor, + v_2; + if (!habr3()) { + sbp.cursor = v_1; + if (!sbp.out_grouping(g_v, 97, 249)) + return; + v_2 = sbp.cursor; + if (sbp.out_grouping(g_v, 97, 249)) { + while (!sbp.in_grouping(g_v, 97, 249)) { + if (sbp.cursor >= sbp.limit) { + sbp.cursor = v_2; + if (sbp.in_grouping(g_v, 97, 249) && + sbp.cursor < sbp.limit) + sbp.cursor++; + return; + } + sbp.cursor++; + } + I_pV = sbp.cursor; + return; + } + sbp.cursor = v_2; + if (!sbp.in_grouping(g_v, 97, 249) || sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_pV = sbp.cursor; + } + + function habr5() { + while (!sbp.in_grouping(g_v, 97, 249)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 249)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function r_mark_regions() { + var v_1 = sbp.cursor; + I_pV = sbp.limit; + I_p1 = I_pV; + I_p2 = I_pV; + habr4(); + sbp.cursor = v_1; + if (habr5()) { + I_p1 = sbp.cursor; + if (habr5()) + I_p2 = sbp.cursor; + } + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_1, 3); + if (!among_var) + break; + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("i"); + break; + case 2: + sbp.slice_from("u"); + break; + case 3: + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + break; + } + } + } + + function r_RV() { + return I_pV <= sbp.cursor; + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_attached_pronoun() { + var among_var; + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_2, 37)) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among_b(a_3, 5); + if (among_var && r_RV()) { + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + sbp.slice_from("e"); + break; + } + } + } + } + + function r_standard_suffix() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 51); + if (!among_var) + return false; + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (!r_R2()) + return false; + sbp.slice_del(); + break; + case 2: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ic")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + break; + case 3: + if (!r_R2()) + return false; + sbp.slice_from("log"); + break; + case 4: + if (!r_R2()) + return false; + sbp.slice_from("u"); + break; + case 5: + if (!r_R2()) + return false; + sbp.slice_from("ente"); + break; + case 6: + if (!r_RV()) + return false; + sbp.slice_del(); + break; + case 7: + if (!r_R1()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 4); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2()) { + sbp.slice_del(); + if (among_var == 1) { + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + } + } + } + break; + case 8: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_5, 3); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + if (r_R2()) + sbp.slice_del(); + } + break; + case 9: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ic")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + } + } + break; + } + return true; + } + + function r_verb_suffix() { + var among_var, v_1; + if (sbp.cursor >= I_pV) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 87); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + sbp.slice_del(); + } + sbp.limit_backward = v_1; + } + } + + function habr6() { + var v_1 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (sbp.in_grouping_b(g_AEIO, 97, 242)) { + sbp.bra = sbp.cursor; + if (r_RV()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "i")) { + sbp.bra = sbp.cursor; + if (r_RV()) { + sbp.slice_del(); + return; + } + } + } + } + sbp.cursor = sbp.limit - v_1; + } + + function r_vowel_suffix() { + habr6(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "h")) { + sbp.bra = sbp.cursor; + if (sbp.in_grouping_b(g_CG, 99, 103)) + if (r_RV()) + sbp.slice_del(); + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_attached_pronoun(); + sbp.cursor = sbp.limit; + if (!r_standard_suffix()) { + sbp.cursor = sbp.limit; + r_verb_suffix(); + } + sbp.cursor = sbp.limit; + r_vowel_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.it.stemmer, 'stemmer-it'); + + lunr.it.stopWordFilter = lunr.generateStopWordFilter('a abbia abbiamo abbiano abbiate ad agl agli ai al all alla alle allo anche avemmo avendo avesse avessero avessi avessimo aveste avesti avete aveva avevamo avevano avevate avevi avevo avrai avranno avrebbe avrebbero avrei avremmo avremo avreste avresti avrete avrà avrò avuta avute avuti avuto c che chi ci coi col come con contro cui da dagl dagli dai dal dall dalla dalle dallo degl degli dei del dell della delle dello di dov dove e ebbe ebbero ebbi ed era erano eravamo eravate eri ero essendo faccia facciamo facciano facciate faccio facemmo facendo facesse facessero facessi facessimo faceste facesti faceva facevamo facevano facevate facevi facevo fai fanno farai faranno farebbe farebbero farei faremmo faremo fareste faresti farete farà farò fece fecero feci fosse fossero fossi fossimo foste fosti fu fui fummo furono gli ha hai hanno ho i il in io l la le lei li lo loro lui ma mi mia mie miei mio ne negl negli nei nel nell nella nelle nello noi non nostra nostre nostri nostro o per perché più quale quanta quante quanti quanto quella quelle quelli quello questa queste questi questo sarai saranno sarebbe sarebbero sarei saremmo saremo sareste saresti sarete sarà sarò se sei si sia siamo siano siate siete sono sta stai stando stanno starai staranno starebbe starebbero starei staremmo staremo stareste staresti starete starà starò stava stavamo stavano stavate stavi stavo stemmo stesse stessero stessi stessimo steste stesti stette stettero stetti stia stiamo stiano stiate sto su sua sue sugl sugli sui sul sull sulla sulle sullo suo suoi ti tra tu tua tue tuo tuoi tutti tutto un una uno vi voi vostra vostre vostri vostro è'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.it.stopWordFilter, 'stopWordFilter-it'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.ja.js b/mkdocs/contrib/search/lunr-language/lunr.ja.js new file mode 100644 index 0000000000..44eb411ef5 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.ja.js @@ -0,0 +1,188 @@ +/*! + * Lunr languages, `Japanese` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Chad Liu + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* + Japanese tokenization is trickier, since it does not + take into account spaces. + Since the tokenization function is represented different + internally for each of the Lunr versions, this had to be done + in order to try to try to pick the best way of doing this based + on the Lunr version + */ + var isLunr2 = lunr.version[0] == "2"; + + /* register specific locale function */ + lunr.ja = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.ja.trimmer, + lunr.ja.stopWordFilter, + lunr.ja.stemmer + ); + + // change the tokenizer for japanese one + if (isLunr2) { // for lunr version 2.0.0 + this.tokenizer = lunr.ja.tokenizer; + } else { + if (lunr.tokenizer) { // for lunr version 0.6.0 + lunr.tokenizer = lunr.ja.tokenizer; + } + if (this.tokenizerFn) { // for lunr version 0.7.0 -> 1.0.0 + this.tokenizerFn = lunr.ja.tokenizer; + } + } + }; + var segmenter = new lunr.TinySegmenter(); // インスタンス生成 + + lunr.ja.tokenizer = function(obj) { + var i; + var str; + var len; + var segs; + var tokens; + var char; + var sliceLength; + var sliceStart; + var sliceEnd; + var segStart; + + if (!arguments.length || obj == null || obj == undefined) + return []; + + if (Array.isArray(obj)) { + return obj.map( + function(t) { + return isLunr2 ? new lunr.Token(t.toLowerCase()) : t.toLowerCase(); + } + ); + } + + str = obj.toString().toLowerCase().replace(/^\s+/, ''); + for (i = str.length - 1; i >= 0; i--) { + if (/\S/.test(str.charAt(i))) { + str = str.substring(0, i + 1); + break; + } + } + + tokens = []; + len = str.length; + for (sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) { + char = str.charAt(sliceEnd); + sliceLength = sliceEnd - sliceStart; + + if ((char.match(/\s/) || sliceEnd == len)) { + if (sliceLength > 0) { + segs = segmenter.segment(str.slice(sliceStart, sliceEnd)).filter( + function(token) { + return !!token; + } + ); + + segStart = sliceStart; + for (i = 0; i < segs.length; i++) { + if (isLunr2) { + tokens.push( + new lunr.Token( + segs[i], { + position: [segStart, segs[i].length], + index: tokens.length + } + ) + ); + } else { + tokens.push(segs[i]); + } + segStart += segs[i].length; + } + } + + sliceStart = sliceEnd + 1; + } + } + + return tokens; + } + + /* lunr stemmer function */ + lunr.ja.stemmer = (function() { + + /* TODO japanese stemmer */ + return function(word) { + return word; + } + })(); + lunr.Pipeline.registerFunction(lunr.ja.stemmer, 'stemmer-ja'); + + /* lunr trimmer function */ + lunr.ja.wordCharacters = "一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Za-zA-Z0-90-9"; + lunr.ja.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.ja.wordCharacters); + lunr.Pipeline.registerFunction(lunr.ja.trimmer, 'trimmer-ja'); + + /* lunr stop word filter. see http://www.ranks.nl/stopwords/japanese */ + lunr.ja.stopWordFilter = lunr.generateStopWordFilter( + 'これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし'.split(' ')); + lunr.Pipeline.registerFunction(lunr.ja.stopWordFilter, 'stopWordFilter-ja'); + + // alias ja => jp for backward-compatibility. + // jp is the country code, while ja is the language code + // a new lunr.ja.js has been created, but in order to + // keep the backward compatibility, we'll leave the lunr.jp.js + // here for a while, and just make it use the new lunr.ja.js + lunr.jp = lunr.ja; + lunr.Pipeline.registerFunction(lunr.jp.stemmer, 'stemmer-jp'); + lunr.Pipeline.registerFunction(lunr.jp.trimmer, 'trimmer-jp'); + lunr.Pipeline.registerFunction(lunr.jp.stopWordFilter, 'stopWordFilter-jp'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.jp.js b/mkdocs/contrib/search/lunr-language/lunr.jp.js new file mode 100644 index 0000000000..73ebff1d6e --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.jp.js @@ -0,0 +1,5 @@ +// jp is the country code, while ja is the language code +// a new lunr.ja.js has been created, but in order to +// keep the backward compatibility, we'll leave the lunr.jp.js +// here for a while, and just make it use the new lunr.ja.js +module.exports = require('./lunr.ja'); \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.multi.js b/mkdocs/contrib/search/lunr-language/lunr.multi.js new file mode 100644 index 0000000000..4e921e022f --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.multi.js @@ -0,0 +1,79 @@ +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +;(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function () { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* Set up the pipeline for indexing content in multiple languages. The + corresponding lunr.{lang} files must be loaded before calling this + function; English ('en') is built in. + + Returns: a lunr plugin for use in your indexer. + + Known drawback: every word will be stemmed with stemmers for every + language. This could mean that sometimes words that have the same + stemming root will not be stemmed as such. + */ + lunr.multiLanguage = function(/* lang1, lang2, ... */) { + var languages = Array.prototype.slice.call(arguments); + var nameSuffix = languages.join('-'); + var wordCharacters = ""; + var pipeline = []; + var searchPipeline = []; + for (var i = 0; i < languages.length; ++i) { + if (languages[i] == 'en') { + wordCharacters += '\\w'; + pipeline.unshift(lunr.stopWordFilter); + pipeline.push(lunr.stemmer); + searchPipeline.push(lunr.stemmer); + } else { + wordCharacters += lunr[languages[i]].wordCharacters; + if (lunr[languages[i]].stopWordFilter) { + pipeline.unshift(lunr[languages[i]].stopWordFilter); + } + if (lunr[languages[i]].stemmer) { + pipeline.push(lunr[languages[i]].stemmer); + searchPipeline.push(lunr[languages[i]].stemmer); + } + } + }; + var multiTrimmer = lunr.trimmerSupport.generateTrimmer(wordCharacters); + lunr.Pipeline.registerFunction(multiTrimmer, 'lunr-multi-trimmer-' + nameSuffix); + pipeline.unshift(multiTrimmer); + + return function() { + this.pipeline.reset(); + + this.pipeline.add.apply(this.pipeline, pipeline); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add.apply(this.searchPipeline, searchPipeline); + } + }; + } + } +})); diff --git a/mkdocs/contrib/search/lunr-language/lunr.nl.js b/mkdocs/contrib/search/lunr-language/lunr.nl.js new file mode 100644 index 0000000000..55b43ff0fb --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.nl.js @@ -0,0 +1,448 @@ +/*! + * Lunr languages, `Dutch` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.nl = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.nl.trimmer, + lunr.nl.stopWordFilter, + lunr.nl.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.nl.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.nl.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.nl.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.nl.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.nl.trimmer, 'trimmer-nl'); + + /* lunr stemmer function */ + lunr.nl.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function DutchStemmer() { + var a_0 = [new Among("", -1, 6), new Among("\u00E1", 0, 1), + new Among("\u00E4", 0, 1), new Among("\u00E9", 0, 2), + new Among("\u00EB", 0, 2), new Among("\u00ED", 0, 3), + new Among("\u00EF", 0, 3), new Among("\u00F3", 0, 4), + new Among("\u00F6", 0, 4), new Among("\u00FA", 0, 5), + new Among("\u00FC", 0, 5) + ], + a_1 = [new Among("", -1, 3), + new Among("I", 0, 2), new Among("Y", 0, 1) + ], + a_2 = [ + new Among("dd", -1, -1), new Among("kk", -1, -1), + new Among("tt", -1, -1) + ], + a_3 = [new Among("ene", -1, 2), + new Among("se", -1, 3), new Among("en", -1, 2), + new Among("heden", 2, 1), new Among("s", -1, 3) + ], + a_4 = [ + new Among("end", -1, 1), new Among("ig", -1, 2), + new Among("ing", -1, 1), new Among("lijk", -1, 3), + new Among("baar", -1, 4), new Among("bar", -1, 5) + ], + a_5 = [ + new Among("aa", -1, -1), new Among("ee", -1, -1), + new Among("oo", -1, -1), new Among("uu", -1, -1) + ], + g_v = [17, 65, + 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + g_v_I = [1, 0, 0, + 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + g_v_j = [ + 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 + ], + I_p2, I_p1, B_e_found, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_prelude() { + var among_var, v_1 = sbp.cursor, + v_2, v_3; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 11); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("a"); + continue; + case 2: + sbp.slice_from("e"); + continue; + case 3: + sbp.slice_from("i"); + continue; + case 4: + sbp.slice_from("o"); + continue; + case 5: + sbp.slice_from("u"); + continue; + case 6: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + sbp.cursor = v_1; + sbp.bra = v_1; + if (sbp.eq_s(1, "y")) { + sbp.ket = sbp.cursor; + sbp.slice_from("Y"); + } else + sbp.cursor = v_1; + while (true) { + v_2 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 232)) { + v_3 = sbp.cursor; + sbp.bra = v_3; + if (sbp.eq_s(1, "i")) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 232)) { + sbp.slice_from("I"); + sbp.cursor = v_2; + } + } else { + sbp.cursor = v_3; + if (sbp.eq_s(1, "y")) { + sbp.ket = sbp.cursor; + sbp.slice_from("Y"); + sbp.cursor = v_2; + } else if (habr1(v_2)) + break; + } + } else if (habr1(v_2)) + break; + } + } + + function habr1(v_1) { + sbp.cursor = v_1; + if (v_1 >= sbp.limit) + return true; + sbp.cursor++; + return false; + } + + function r_mark_regions() { + I_p1 = sbp.limit; + I_p2 = I_p1; + if (!habr2()) { + I_p1 = sbp.cursor; + if (I_p1 < 3) + I_p1 = 3; + if (!habr2()) + I_p2 = sbp.cursor; + } + } + + function habr2() { + while (!sbp.in_grouping(g_v, 97, 232)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 232)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_1, 3); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("y"); + break; + case 2: + sbp.slice_from("i"); + break; + case 3: + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + break; + } + } + } + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_undouble() { + var v_1 = sbp.limit - sbp.cursor; + if (sbp.find_among_b(a_2, 3)) { + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + } + + function r_e_ending() { + var v_1; + B_e_found = false; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "e")) { + sbp.bra = sbp.cursor; + if (r_R1()) { + v_1 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_del(); + B_e_found = true; + r_undouble(); + } + } + } + } + + function r_en_ending() { + var v_1; + if (r_R1()) { + v_1 = sbp.limit - sbp.cursor; + if (sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_1; + if (!sbp.eq_s_b(3, "gem")) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_del(); + r_undouble(); + } + } + } + } + + function r_standard_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor, + v_2, v_3, v_4, v_5, v_6; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 5); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R1()) + sbp.slice_from("heid"); + break; + case 2: + r_en_ending(); + break; + case 3: + if (r_R1() && sbp.out_grouping_b(g_v_j, 97, 232)) + sbp.slice_del(); + break; + } + } + sbp.cursor = sbp.limit - v_1; + r_e_ending(); + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(4, "heid")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + v_2 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "c")) { + sbp.cursor = sbp.limit - v_2; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "en")) { + sbp.bra = sbp.cursor; + r_en_ending(); + } + } + } + } + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 6); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_R2()) { + sbp.slice_del(); + v_3 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "ig")) { + sbp.bra = sbp.cursor; + if (r_R2()) { + v_4 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_4; + sbp.slice_del(); + break; + } + } + } + sbp.cursor = sbp.limit - v_3; + r_undouble(); + } + break; + case 2: + if (r_R2()) { + v_5 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "e")) { + sbp.cursor = sbp.limit - v_5; + sbp.slice_del(); + } + } + break; + case 3: + if (r_R2()) { + sbp.slice_del(); + r_e_ending(); + } + break; + case 4: + if (r_R2()) + sbp.slice_del(); + break; + case 5: + if (r_R2() && B_e_found) + sbp.slice_del(); + break; + } + } + sbp.cursor = sbp.limit - v_1; + if (sbp.out_grouping_b(g_v_I, 73, 232)) { + v_6 = sbp.limit - sbp.cursor; + if (sbp.find_among_b(a_5, 4) && sbp.out_grouping_b(g_v, 97, 232)) { + sbp.cursor = sbp.limit - v_6; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_standard_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.nl.stemmer, 'stemmer-nl'); + + lunr.nl.stopWordFilter = lunr.generateStopWordFilter(' aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.nl.stopWordFilter, 'stopWordFilter-nl'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.no.js b/mkdocs/contrib/search/lunr-language/lunr.no.js new file mode 100644 index 0000000000..34f8ab1aae --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.no.js @@ -0,0 +1,258 @@ +/*! + * Lunr languages, `Norwegian` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.no = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.no.trimmer, + lunr.no.stopWordFilter, + lunr.no.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.no.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.no.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.no.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.no.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.no.trimmer, 'trimmer-no'); + + /* lunr stemmer function */ + lunr.no.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function NorwegianStemmer() { + var a_0 = [new Among("a", -1, 1), new Among("e", -1, 1), + new Among("ede", 1, 1), new Among("ande", 1, 1), + new Among("ende", 1, 1), new Among("ane", 1, 1), + new Among("ene", 1, 1), new Among("hetene", 6, 1), + new Among("erte", 1, 3), new Among("en", -1, 1), + new Among("heten", 9, 1), new Among("ar", -1, 1), + new Among("er", -1, 1), new Among("heter", 12, 1), + new Among("s", -1, 2), new Among("as", 14, 1), + new Among("es", 14, 1), new Among("edes", 16, 1), + new Among("endes", 16, 1), new Among("enes", 16, 1), + new Among("hetenes", 19, 1), new Among("ens", 14, 1), + new Among("hetens", 21, 1), new Among("ers", 14, 1), + new Among("ets", 14, 1), new Among("et", -1, 1), + new Among("het", 25, 1), new Among("ert", -1, 3), + new Among("ast", -1, 1) + ], + a_1 = [new Among("dt", -1, -1), + new Among("vt", -1, -1) + ], + a_2 = [new Among("leg", -1, 1), + new Among("eleg", 0, 1), new Among("ig", -1, 1), + new Among("eig", 2, 1), new Among("lig", 2, 1), + new Among("elig", 4, 1), new Among("els", -1, 1), + new Among("lov", -1, 1), new Among("elov", 7, 1), + new Among("slov", 7, 1), new Among("hetslov", 9, 1) + ], + g_v = [17, + 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 + ], + g_s_ending = [ + 119, 125, 149, 1 + ], + I_x, I_p1, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_mark_regions() { + var v_1, c = sbp.cursor + 3; + I_p1 = sbp.limit; + if (0 <= c || c <= sbp.limit) { + I_x = c; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 248)) { + sbp.cursor = v_1; + break; + } + if (v_1 >= sbp.limit) + return; + sbp.cursor = v_1 + 1; + } + while (!sbp.out_grouping(g_v, 97, 248)) { + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_p1 = sbp.cursor; + if (I_p1 < I_x) + I_p1 = I_x; + } + } + + function r_main_suffix() { + var among_var, v_1, v_2; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_0, 29); + sbp.limit_backward = v_1; + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + v_2 = sbp.limit - sbp.cursor; + if (sbp.in_grouping_b(g_s_ending, 98, 122)) + sbp.slice_del(); + else { + sbp.cursor = sbp.limit - v_2; + if (sbp.eq_s_b(1, "k") && + sbp.out_grouping_b(g_v, 97, 248)) + sbp.slice_del(); + } + break; + case 3: + sbp.slice_from("er"); + break; + } + } + } + } + + function r_consonant_pair() { + var v_1 = sbp.limit - sbp.cursor, + v_2; + if (sbp.cursor >= I_p1) { + v_2 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + if (sbp.find_among_b(a_1, 2)) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_2; + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + } else + sbp.limit_backward = v_2; + } + } + + function r_other_suffix() { + var among_var, v_1; + if (sbp.cursor >= I_p1) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 11); + if (among_var) { + sbp.bra = sbp.cursor; + sbp.limit_backward = v_1; + if (among_var == 1) + sbp.slice_del(); + } else + sbp.limit_backward = v_1; + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_main_suffix(); + sbp.cursor = sbp.limit; + r_consonant_pair(); + sbp.cursor = sbp.limit; + r_other_suffix(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.no.stemmer, 'stemmer-no'); + + lunr.no.stopWordFilter = lunr.generateStopWordFilter('alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.no.stopWordFilter, 'stopWordFilter-no'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.pt.js b/mkdocs/contrib/search/lunr-language/lunr.pt.js new file mode 100644 index 0000000000..8834b907f1 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.pt.js @@ -0,0 +1,570 @@ +/*! + * Lunr languages, `Portuguese` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.pt = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.pt.trimmer, + lunr.pt.stopWordFilter, + lunr.pt.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.pt.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.pt.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.pt.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.pt.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.pt.trimmer, 'trimmer-pt'); + + /* lunr stemmer function */ + lunr.pt.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function PortugueseStemmer() { + var a_0 = [new Among("", -1, 3), new Among("\u00E3", 0, 1), + new Among("\u00F5", 0, 2) + ], + a_1 = [new Among("", -1, 3), + new Among("a~", 0, 1), new Among("o~", 0, 2) + ], + a_2 = [ + new Among("ic", -1, -1), new Among("ad", -1, -1), + new Among("os", -1, -1), new Among("iv", -1, 1) + ], + a_3 = [ + new Among("ante", -1, 1), new Among("avel", -1, 1), + new Among("\u00EDvel", -1, 1) + ], + a_4 = [new Among("ic", -1, 1), + new Among("abil", -1, 1), new Among("iv", -1, 1) + ], + a_5 = [ + new Among("ica", -1, 1), new Among("\u00E2ncia", -1, 1), + new Among("\u00EAncia", -1, 4), new Among("ira", -1, 9), + new Among("adora", -1, 1), new Among("osa", -1, 1), + new Among("ista", -1, 1), new Among("iva", -1, 8), + new Among("eza", -1, 1), new Among("log\u00EDa", -1, 2), + new Among("idade", -1, 7), new Among("ante", -1, 1), + new Among("mente", -1, 6), new Among("amente", 12, 5), + new Among("\u00E1vel", -1, 1), new Among("\u00EDvel", -1, 1), + new Among("uci\u00F3n", -1, 3), new Among("ico", -1, 1), + new Among("ismo", -1, 1), new Among("oso", -1, 1), + new Among("amento", -1, 1), new Among("imento", -1, 1), + new Among("ivo", -1, 8), new Among("a\u00E7a~o", -1, 1), + new Among("ador", -1, 1), new Among("icas", -1, 1), + new Among("\u00EAncias", -1, 4), new Among("iras", -1, 9), + new Among("adoras", -1, 1), new Among("osas", -1, 1), + new Among("istas", -1, 1), new Among("ivas", -1, 8), + new Among("ezas", -1, 1), new Among("log\u00EDas", -1, 2), + new Among("idades", -1, 7), new Among("uciones", -1, 3), + new Among("adores", -1, 1), new Among("antes", -1, 1), + new Among("a\u00E7o~es", -1, 1), new Among("icos", -1, 1), + new Among("ismos", -1, 1), new Among("osos", -1, 1), + new Among("amentos", -1, 1), new Among("imentos", -1, 1), + new Among("ivos", -1, 8) + ], + a_6 = [new Among("ada", -1, 1), + new Among("ida", -1, 1), new Among("ia", -1, 1), + new Among("aria", 2, 1), new Among("eria", 2, 1), + new Among("iria", 2, 1), new Among("ara", -1, 1), + new Among("era", -1, 1), new Among("ira", -1, 1), + new Among("ava", -1, 1), new Among("asse", -1, 1), + new Among("esse", -1, 1), new Among("isse", -1, 1), + new Among("aste", -1, 1), new Among("este", -1, 1), + new Among("iste", -1, 1), new Among("ei", -1, 1), + new Among("arei", 16, 1), new Among("erei", 16, 1), + new Among("irei", 16, 1), new Among("am", -1, 1), + new Among("iam", 20, 1), new Among("ariam", 21, 1), + new Among("eriam", 21, 1), new Among("iriam", 21, 1), + new Among("aram", 20, 1), new Among("eram", 20, 1), + new Among("iram", 20, 1), new Among("avam", 20, 1), + new Among("em", -1, 1), new Among("arem", 29, 1), + new Among("erem", 29, 1), new Among("irem", 29, 1), + new Among("assem", 29, 1), new Among("essem", 29, 1), + new Among("issem", 29, 1), new Among("ado", -1, 1), + new Among("ido", -1, 1), new Among("ando", -1, 1), + new Among("endo", -1, 1), new Among("indo", -1, 1), + new Among("ara~o", -1, 1), new Among("era~o", -1, 1), + new Among("ira~o", -1, 1), new Among("ar", -1, 1), + new Among("er", -1, 1), new Among("ir", -1, 1), + new Among("as", -1, 1), new Among("adas", 47, 1), + new Among("idas", 47, 1), new Among("ias", 47, 1), + new Among("arias", 50, 1), new Among("erias", 50, 1), + new Among("irias", 50, 1), new Among("aras", 47, 1), + new Among("eras", 47, 1), new Among("iras", 47, 1), + new Among("avas", 47, 1), new Among("es", -1, 1), + new Among("ardes", 58, 1), new Among("erdes", 58, 1), + new Among("irdes", 58, 1), new Among("ares", 58, 1), + new Among("eres", 58, 1), new Among("ires", 58, 1), + new Among("asses", 58, 1), new Among("esses", 58, 1), + new Among("isses", 58, 1), new Among("astes", 58, 1), + new Among("estes", 58, 1), new Among("istes", 58, 1), + new Among("is", -1, 1), new Among("ais", 71, 1), + new Among("eis", 71, 1), new Among("areis", 73, 1), + new Among("ereis", 73, 1), new Among("ireis", 73, 1), + new Among("\u00E1reis", 73, 1), new Among("\u00E9reis", 73, 1), + new Among("\u00EDreis", 73, 1), new Among("\u00E1sseis", 73, 1), + new Among("\u00E9sseis", 73, 1), new Among("\u00EDsseis", 73, 1), + new Among("\u00E1veis", 73, 1), new Among("\u00EDeis", 73, 1), + new Among("ar\u00EDeis", 84, 1), new Among("er\u00EDeis", 84, 1), + new Among("ir\u00EDeis", 84, 1), new Among("ados", -1, 1), + new Among("idos", -1, 1), new Among("amos", -1, 1), + new Among("\u00E1ramos", 90, 1), new Among("\u00E9ramos", 90, 1), + new Among("\u00EDramos", 90, 1), new Among("\u00E1vamos", 90, 1), + new Among("\u00EDamos", 90, 1), new Among("ar\u00EDamos", 95, 1), + new Among("er\u00EDamos", 95, 1), new Among("ir\u00EDamos", 95, 1), + new Among("emos", -1, 1), new Among("aremos", 99, 1), + new Among("eremos", 99, 1), new Among("iremos", 99, 1), + new Among("\u00E1ssemos", 99, 1), new Among("\u00EAssemos", 99, 1), + new Among("\u00EDssemos", 99, 1), new Among("imos", -1, 1), + new Among("armos", -1, 1), new Among("ermos", -1, 1), + new Among("irmos", -1, 1), new Among("\u00E1mos", -1, 1), + new Among("ar\u00E1s", -1, 1), new Among("er\u00E1s", -1, 1), + new Among("ir\u00E1s", -1, 1), new Among("eu", -1, 1), + new Among("iu", -1, 1), new Among("ou", -1, 1), + new Among("ar\u00E1", -1, 1), new Among("er\u00E1", -1, 1), + new Among("ir\u00E1", -1, 1) + ], + a_7 = [new Among("a", -1, 1), + new Among("i", -1, 1), new Among("o", -1, 1), + new Among("os", -1, 1), new Among("\u00E1", -1, 1), + new Among("\u00ED", -1, 1), new Among("\u00F3", -1, 1) + ], + a_8 = [ + new Among("e", -1, 1), new Among("\u00E7", -1, 2), + new Among("\u00E9", -1, 1), new Among("\u00EA", -1, 1) + ], + g_v = [17, + 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2 + ], + I_p2, I_p1, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_prelude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 3); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("a~"); + continue; + case 2: + sbp.slice_from("o~"); + continue; + case 3: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + } + + function habr2() { + if (sbp.out_grouping(g_v, 97, 250)) { + while (!sbp.in_grouping(g_v, 97, 250)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + return true; + } + + function habr3() { + if (sbp.in_grouping(g_v, 97, 250)) { + while (!sbp.out_grouping(g_v, 97, 250)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + } + I_pV = sbp.cursor; + return true; + } + + function habr4() { + var v_1 = sbp.cursor, + v_2, v_3; + if (sbp.in_grouping(g_v, 97, 250)) { + v_2 = sbp.cursor; + if (habr2()) { + sbp.cursor = v_2; + if (habr3()) + return; + } else + I_pV = sbp.cursor; + } + sbp.cursor = v_1; + if (sbp.out_grouping(g_v, 97, 250)) { + v_3 = sbp.cursor; + if (habr2()) { + sbp.cursor = v_3; + if (!sbp.in_grouping(g_v, 97, 250) || sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_pV = sbp.cursor; + } + } + + function habr5() { + while (!sbp.in_grouping(g_v, 97, 250)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 250)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function r_mark_regions() { + var v_1 = sbp.cursor; + I_pV = sbp.limit; + I_p1 = I_pV; + I_p2 = I_pV; + habr4(); + sbp.cursor = v_1; + if (habr5()) { + I_p1 = sbp.cursor; + if (habr5()) + I_p2 = sbp.cursor; + } + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_1, 3); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("\u00E3"); + continue; + case 2: + sbp.slice_from("\u00F5"); + continue; + case 3: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + } + + function r_RV() { + return I_pV <= sbp.cursor; + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_standard_suffix() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_5, 45); + if (!among_var) + return false; + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (!r_R2()) + return false; + sbp.slice_del(); + break; + case 2: + if (!r_R2()) + return false; + sbp.slice_from("log"); + break; + case 3: + if (!r_R2()) + return false; + sbp.slice_from("u"); + break; + case 4: + if (!r_R2()) + return false; + sbp.slice_from("ente"); + break; + case 5: + if (!r_R1()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 4); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2()) { + sbp.slice_del(); + if (among_var == 1) { + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + } + } + } + break; + case 6: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 3); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + if (r_R2()) + sbp.slice_del(); + } + break; + case 7: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 3); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + if (r_R2()) + sbp.slice_del(); + } + break; + case 8: + if (!r_R2()) + return false; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(2, "at")) { + sbp.bra = sbp.cursor; + if (r_R2()) + sbp.slice_del(); + } + break; + case 9: + if (!r_RV() || !sbp.eq_s_b(1, "e")) + return false; + sbp.slice_from("ir"); + break; + } + return true; + } + + function r_verb_suffix() { + var among_var, v_1; + if (sbp.cursor >= I_pV) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 120); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + sbp.slice_del(); + sbp.limit_backward = v_1; + return true; + } + sbp.limit_backward = v_1; + } + return false; + } + + function r_residual_suffix() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 7); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + if (r_RV()) + sbp.slice_del(); + } + } + + function habr6(c1, c2) { + if (sbp.eq_s_b(1, c1)) { + sbp.bra = sbp.cursor; + var v_1 = sbp.limit - sbp.cursor; + if (sbp.eq_s_b(1, c2)) { + sbp.cursor = sbp.limit - v_1; + if (r_RV()) + sbp.slice_del(); + return false; + } + } + return true; + } + + function r_residual_form() { + var among_var, v_1, v_2, v_3; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_8, 4); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + if (r_RV()) { + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_1 = sbp.limit - sbp.cursor; + if (habr6("u", "g")) + habr6("i", "c") + } + break; + case 2: + sbp.slice_from("c"); + break; + } + } + } + + function habr1() { + if (!r_standard_suffix()) { + sbp.cursor = sbp.limit; + if (!r_verb_suffix()) { + sbp.cursor = sbp.limit; + r_residual_suffix(); + return; + } + } + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "i")) { + sbp.bra = sbp.cursor; + if (sbp.eq_s_b(1, "c")) { + sbp.cursor = sbp.limit; + if (r_RV()) + sbp.slice_del(); + } + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + habr1(); + sbp.cursor = sbp.limit; + r_residual_form(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.pt.stemmer, 'stemmer-pt'); + + lunr.pt.stopWordFilter = lunr.generateStopWordFilter('a ao aos aquela aquelas aquele aqueles aquilo as até com como da das de dela delas dele deles depois do dos e ela elas ele eles em entre era eram essa essas esse esses esta estamos estas estava estavam este esteja estejam estejamos estes esteve estive estivemos estiver estivera estiveram estiverem estivermos estivesse estivessem estivéramos estivéssemos estou está estávamos estão eu foi fomos for fora foram forem formos fosse fossem fui fôramos fôssemos haja hajam hajamos havemos hei houve houvemos houver houvera houveram houverei houverem houveremos houveria houveriam houvermos houverá houverão houveríamos houvesse houvessem houvéramos houvéssemos há hão isso isto já lhe lhes mais mas me mesmo meu meus minha minhas muito na nas nem no nos nossa nossas nosso nossos num numa não nós o os ou para pela pelas pelo pelos por qual quando que quem se seja sejam sejamos sem serei seremos seria seriam será serão seríamos seu seus somos sou sua suas são só também te tem temos tenha tenham tenhamos tenho terei teremos teria teriam terá terão teríamos teu teus teve tinha tinham tive tivemos tiver tivera tiveram tiverem tivermos tivesse tivessem tivéramos tivéssemos tu tua tuas tém tínhamos um uma você vocês vos à às éramos'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.pt.stopWordFilter, 'stopWordFilter-pt'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.ro.js b/mkdocs/contrib/search/lunr-language/lunr.ro.js new file mode 100644 index 0000000000..9659b76858 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.ro.js @@ -0,0 +1,558 @@ +/*! + * Lunr languages, `Romanian` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.ro = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.ro.trimmer, + lunr.ro.stopWordFilter, + lunr.ro.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.ro.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.ro.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.ro.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.ro.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.ro.trimmer, 'trimmer-ro'); + + /* lunr stemmer function */ + lunr.ro.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function RomanianStemmer() { + var a_0 = [new Among("", -1, 3), new Among("I", 0, 1), new Among("U", 0, 2)], + a_1 = [ + new Among("ea", -1, 3), new Among("a\u0163ia", -1, 7), + new Among("aua", -1, 2), new Among("iua", -1, 4), + new Among("a\u0163ie", -1, 7), new Among("ele", -1, 3), + new Among("ile", -1, 5), new Among("iile", 6, 4), + new Among("iei", -1, 4), new Among("atei", -1, 6), + new Among("ii", -1, 4), new Among("ului", -1, 1), + new Among("ul", -1, 1), new Among("elor", -1, 3), + new Among("ilor", -1, 4), new Among("iilor", 14, 4) + ], + a_2 = [ + new Among("icala", -1, 4), new Among("iciva", -1, 4), + new Among("ativa", -1, 5), new Among("itiva", -1, 6), + new Among("icale", -1, 4), new Among("a\u0163iune", -1, 5), + new Among("i\u0163iune", -1, 6), new Among("atoare", -1, 5), + new Among("itoare", -1, 6), new Among("\u0103toare", -1, 5), + new Among("icitate", -1, 4), new Among("abilitate", -1, 1), + new Among("ibilitate", -1, 2), new Among("ivitate", -1, 3), + new Among("icive", -1, 4), new Among("ative", -1, 5), + new Among("itive", -1, 6), new Among("icali", -1, 4), + new Among("atori", -1, 5), new Among("icatori", 18, 4), + new Among("itori", -1, 6), new Among("\u0103tori", -1, 5), + new Among("icitati", -1, 4), new Among("abilitati", -1, 1), + new Among("ivitati", -1, 3), new Among("icivi", -1, 4), + new Among("ativi", -1, 5), new Among("itivi", -1, 6), + new Among("icit\u0103i", -1, 4), new Among("abilit\u0103i", -1, 1), + new Among("ivit\u0103i", -1, 3), + new Among("icit\u0103\u0163i", -1, 4), + new Among("abilit\u0103\u0163i", -1, 1), + new Among("ivit\u0103\u0163i", -1, 3), new Among("ical", -1, 4), + new Among("ator", -1, 5), new Among("icator", 35, 4), + new Among("itor", -1, 6), new Among("\u0103tor", -1, 5), + new Among("iciv", -1, 4), new Among("ativ", -1, 5), + new Among("itiv", -1, 6), new Among("ical\u0103", -1, 4), + new Among("iciv\u0103", -1, 4), new Among("ativ\u0103", -1, 5), + new Among("itiv\u0103", -1, 6) + ], + a_3 = [new Among("ica", -1, 1), + new Among("abila", -1, 1), new Among("ibila", -1, 1), + new Among("oasa", -1, 1), new Among("ata", -1, 1), + new Among("ita", -1, 1), new Among("anta", -1, 1), + new Among("ista", -1, 3), new Among("uta", -1, 1), + new Among("iva", -1, 1), new Among("ic", -1, 1), + new Among("ice", -1, 1), new Among("abile", -1, 1), + new Among("ibile", -1, 1), new Among("isme", -1, 3), + new Among("iune", -1, 2), new Among("oase", -1, 1), + new Among("ate", -1, 1), new Among("itate", 17, 1), + new Among("ite", -1, 1), new Among("ante", -1, 1), + new Among("iste", -1, 3), new Among("ute", -1, 1), + new Among("ive", -1, 1), new Among("ici", -1, 1), + new Among("abili", -1, 1), new Among("ibili", -1, 1), + new Among("iuni", -1, 2), new Among("atori", -1, 1), + new Among("osi", -1, 1), new Among("ati", -1, 1), + new Among("itati", 30, 1), new Among("iti", -1, 1), + new Among("anti", -1, 1), new Among("isti", -1, 3), + new Among("uti", -1, 1), new Among("i\u015Fti", -1, 3), + new Among("ivi", -1, 1), new Among("it\u0103i", -1, 1), + new Among("o\u015Fi", -1, 1), new Among("it\u0103\u0163i", -1, 1), + new Among("abil", -1, 1), new Among("ibil", -1, 1), + new Among("ism", -1, 3), new Among("ator", -1, 1), + new Among("os", -1, 1), new Among("at", -1, 1), + new Among("it", -1, 1), new Among("ant", -1, 1), + new Among("ist", -1, 3), new Among("ut", -1, 1), + new Among("iv", -1, 1), new Among("ic\u0103", -1, 1), + new Among("abil\u0103", -1, 1), new Among("ibil\u0103", -1, 1), + new Among("oas\u0103", -1, 1), new Among("at\u0103", -1, 1), + new Among("it\u0103", -1, 1), new Among("ant\u0103", -1, 1), + new Among("ist\u0103", -1, 3), new Among("ut\u0103", -1, 1), + new Among("iv\u0103", -1, 1) + ], + a_4 = [new Among("ea", -1, 1), + new Among("ia", -1, 1), new Among("esc", -1, 1), + new Among("\u0103sc", -1, 1), new Among("ind", -1, 1), + new Among("\u00E2nd", -1, 1), new Among("are", -1, 1), + new Among("ere", -1, 1), new Among("ire", -1, 1), + new Among("\u00E2re", -1, 1), new Among("se", -1, 2), + new Among("ase", 10, 1), new Among("sese", 10, 2), + new Among("ise", 10, 1), new Among("use", 10, 1), + new Among("\u00E2se", 10, 1), new Among("e\u015Fte", -1, 1), + new Among("\u0103\u015Fte", -1, 1), new Among("eze", -1, 1), + new Among("ai", -1, 1), new Among("eai", 19, 1), + new Among("iai", 19, 1), new Among("sei", -1, 2), + new Among("e\u015Fti", -1, 1), new Among("\u0103\u015Fti", -1, 1), + new Among("ui", -1, 1), new Among("ezi", -1, 1), + new Among("\u00E2i", -1, 1), new Among("a\u015Fi", -1, 1), + new Among("se\u015Fi", -1, 2), new Among("ase\u015Fi", 29, 1), + new Among("sese\u015Fi", 29, 2), new Among("ise\u015Fi", 29, 1), + new Among("use\u015Fi", 29, 1), + new Among("\u00E2se\u015Fi", 29, 1), new Among("i\u015Fi", -1, 1), + new Among("u\u015Fi", -1, 1), new Among("\u00E2\u015Fi", -1, 1), + new Among("a\u0163i", -1, 2), new Among("ea\u0163i", 38, 1), + new Among("ia\u0163i", 38, 1), new Among("e\u0163i", -1, 2), + new Among("i\u0163i", -1, 2), new Among("\u00E2\u0163i", -1, 2), + new Among("ar\u0103\u0163i", -1, 1), + new Among("ser\u0103\u0163i", -1, 2), + new Among("aser\u0103\u0163i", 45, 1), + new Among("seser\u0103\u0163i", 45, 2), + new Among("iser\u0103\u0163i", 45, 1), + new Among("user\u0103\u0163i", 45, 1), + new Among("\u00E2ser\u0103\u0163i", 45, 1), + new Among("ir\u0103\u0163i", -1, 1), + new Among("ur\u0103\u0163i", -1, 1), + new Among("\u00E2r\u0103\u0163i", -1, 1), new Among("am", -1, 1), + new Among("eam", 54, 1), new Among("iam", 54, 1), + new Among("em", -1, 2), new Among("asem", 57, 1), + new Among("sesem", 57, 2), new Among("isem", 57, 1), + new Among("usem", 57, 1), new Among("\u00E2sem", 57, 1), + new Among("im", -1, 2), new Among("\u00E2m", -1, 2), + new Among("\u0103m", -1, 2), new Among("ar\u0103m", 65, 1), + new Among("ser\u0103m", 65, 2), new Among("aser\u0103m", 67, 1), + new Among("seser\u0103m", 67, 2), new Among("iser\u0103m", 67, 1), + new Among("user\u0103m", 67, 1), + new Among("\u00E2ser\u0103m", 67, 1), + new Among("ir\u0103m", 65, 1), new Among("ur\u0103m", 65, 1), + new Among("\u00E2r\u0103m", 65, 1), new Among("au", -1, 1), + new Among("eau", 76, 1), new Among("iau", 76, 1), + new Among("indu", -1, 1), new Among("\u00E2ndu", -1, 1), + new Among("ez", -1, 1), new Among("easc\u0103", -1, 1), + new Among("ar\u0103", -1, 1), new Among("ser\u0103", -1, 2), + new Among("aser\u0103", 84, 1), new Among("seser\u0103", 84, 2), + new Among("iser\u0103", 84, 1), new Among("user\u0103", 84, 1), + new Among("\u00E2ser\u0103", 84, 1), new Among("ir\u0103", -1, 1), + new Among("ur\u0103", -1, 1), new Among("\u00E2r\u0103", -1, 1), + new Among("eaz\u0103", -1, 1) + ], + a_5 = [new Among("a", -1, 1), + new Among("e", -1, 1), new Among("ie", 1, 1), + new Among("i", -1, 1), new Among("\u0103", -1, 1) + ], + g_v = [17, 65, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 4 + ], + B_standard_suffix_removed, I_p2, I_p1, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1(c1, c2) { + if (sbp.eq_s(1, c1)) { + sbp.ket = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 259)) + sbp.slice_from(c2); + } + } + + function r_prelude() { + var v_1, v_2; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 259)) { + v_2 = sbp.cursor; + sbp.bra = v_2; + habr1("u", "U"); + sbp.cursor = v_2; + habr1("i", "I"); + } + sbp.cursor = v_1; + if (sbp.cursor >= sbp.limit) { + break; + } + sbp.cursor++; + } + } + + function habr2() { + if (sbp.out_grouping(g_v, 97, 259)) { + while (!sbp.in_grouping(g_v, 97, 259)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + return false; + } + return true; + } + + function habr3() { + if (sbp.in_grouping(g_v, 97, 259)) { + while (!sbp.out_grouping(g_v, 97, 259)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + } + return false; + } + + function habr4() { + var v_1 = sbp.cursor, + v_2, v_3; + if (sbp.in_grouping(g_v, 97, 259)) { + v_2 = sbp.cursor; + if (habr2()) { + sbp.cursor = v_2; + if (!habr3()) { + I_pV = sbp.cursor; + return; + } + } else { + I_pV = sbp.cursor; + return; + } + } + sbp.cursor = v_1; + if (sbp.out_grouping(g_v, 97, 259)) { + v_3 = sbp.cursor; + if (habr2()) { + sbp.cursor = v_3; + if (sbp.in_grouping(g_v, 97, 259) && sbp.cursor < sbp.limit) + sbp.cursor++; + } + I_pV = sbp.cursor; + } + } + + function habr5() { + while (!sbp.in_grouping(g_v, 97, 259)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 259)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function r_mark_regions() { + var v_1 = sbp.cursor; + I_pV = sbp.limit; + I_p1 = I_pV; + I_p2 = I_pV; + habr4(); + sbp.cursor = v_1; + if (habr5()) { + I_p1 = sbp.cursor; + if (habr5()) + I_p2 = sbp.cursor; + } + } + + function r_postlude() { + var among_var; + while (true) { + sbp.bra = sbp.cursor; + among_var = sbp.find_among(a_0, 3); + if (among_var) { + sbp.ket = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("i"); + continue; + case 2: + sbp.slice_from("u"); + continue; + case 3: + if (sbp.cursor >= sbp.limit) + break; + sbp.cursor++; + continue; + } + } + break; + } + } + + function r_RV() { + return I_pV <= sbp.cursor; + } + + function r_R1() { + return I_p1 <= sbp.cursor; + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function r_step_0() { + var among_var, v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_1, 16); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + sbp.slice_from("a"); + break; + case 3: + sbp.slice_from("e"); + break; + case 4: + sbp.slice_from("i"); + break; + case 5: + v_1 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(2, "ab")) { + sbp.cursor = sbp.limit - v_1; + sbp.slice_from("i"); + } + break; + case 6: + sbp.slice_from("at"); + break; + case 7: + sbp.slice_from("a\u0163i"); + break; + } + } + } + } + + function r_combo_suffix() { + var among_var, v_1 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 46); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R1()) { + switch (among_var) { + case 1: + sbp.slice_from("abil"); + break; + case 2: + sbp.slice_from("ibil"); + break; + case 3: + sbp.slice_from("iv"); + break; + case 4: + sbp.slice_from("ic"); + break; + case 5: + sbp.slice_from("at"); + break; + case 6: + sbp.slice_from("it"); + break; + } + B_standard_suffix_removed = true; + sbp.cursor = sbp.limit - v_1; + return true; + } + } + return false; + } + + function r_standard_suffix() { + var among_var, v_1; + B_standard_suffix_removed = false; + while (true) { + v_1 = sbp.limit - sbp.cursor; + if (!r_combo_suffix()) { + sbp.cursor = sbp.limit - v_1; + break; + } + } + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_3, 62); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2()) { + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + if (sbp.eq_s_b(1, "\u0163")) { + sbp.bra = sbp.cursor; + sbp.slice_from("t"); + } + break; + case 3: + sbp.slice_from("ist"); + break; + } + B_standard_suffix_removed = true; + } + } + } + + function r_verb_suffix() { + var among_var, v_1, v_2; + if (sbp.cursor >= I_pV) { + v_1 = sbp.limit_backward; + sbp.limit_backward = I_pV; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_4, 94); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + v_2 = sbp.limit - sbp.cursor; + if (!sbp.out_grouping_b(g_v, 97, 259)) { + sbp.cursor = sbp.limit - v_2; + if (!sbp.eq_s_b(1, "u")) + break; + } + case 2: + sbp.slice_del(); + break; + } + } + sbp.limit_backward = v_1; + } + } + + function r_vowel_suffix() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_5, 5); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_RV() && among_var == 1) + sbp.slice_del(); + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_prelude(); + sbp.cursor = v_1; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_step_0(); + sbp.cursor = sbp.limit; + r_standard_suffix(); + sbp.cursor = sbp.limit; + if (!B_standard_suffix_removed) { + sbp.cursor = sbp.limit; + r_verb_suffix(); + sbp.cursor = sbp.limit; + } + r_vowel_suffix(); + sbp.cursor = sbp.limit_backward; + r_postlude(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.ro.stemmer, 'stemmer-ro'); + + lunr.ro.stopWordFilter = lunr.generateStopWordFilter('acea aceasta această aceea acei aceia acel acela acele acelea acest acesta aceste acestea aceşti aceştia acolo acord acum ai aia aibă aici al ale alea altceva altcineva am ar are asemenea asta astea astăzi asupra au avea avem aveţi azi aş aşadar aţi bine bucur bună ca care caut ce cel ceva chiar cinci cine cineva contra cu cum cumva curând curînd când cât câte câtva câţi cînd cît cîte cîtva cîţi că căci cărei căror cărui către da dacă dar datorită dată dau de deci deja deoarece departe deşi din dinaintea dintr- dintre doi doilea două drept după dă ea ei el ele eram este eu eşti face fata fi fie fiecare fii fim fiu fiţi frumos fără graţie halbă iar ieri la le li lor lui lângă lîngă mai mea mei mele mereu meu mi mie mine mult multă mulţi mulţumesc mâine mîine mă ne nevoie nici nicăieri nimeni nimeri nimic nişte noastre noastră noi noroc nostru nouă noştri nu opt ori oricare orice oricine oricum oricând oricât oricînd oricît oriunde patra patru patrulea pe pentru peste pic poate pot prea prima primul prin puţin puţina puţină până pînă rog sa sale sau se spate spre sub sunt suntem sunteţi sută sînt sîntem sînteţi să săi său ta tale te timp tine toate toată tot totuşi toţi trei treia treilea tu tăi tău un una unde undeva unei uneia unele uneori unii unor unora unu unui unuia unul vi voastre voastră voi vostru vouă voştri vreme vreo vreun vă zece zero zi zice îi îl îmi împotriva în înainte înaintea încotro încât încît între întrucât întrucît îţi ăla ălea ăsta ăstea ăştia şapte şase şi ştiu ţi ţie'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.ro.stopWordFilter, 'stopWordFilter-ro'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.ru.js b/mkdocs/contrib/search/lunr-language/lunr.ru.js new file mode 100644 index 0000000000..3e79452523 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.ru.js @@ -0,0 +1,391 @@ +/*! + * Lunr languages, `Russian` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.ru = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.ru.trimmer, + lunr.ru.stopWordFilter, + lunr.ru.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.ru.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.ru.wordCharacters = "\u0400-\u0484\u0487-\u052F\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F"; + lunr.ru.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.ru.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.ru.trimmer, 'trimmer-ru'); + + /* lunr stemmer function */ + lunr.ru.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function RussianStemmer() { + var a_0 = [new Among("\u0432", -1, 1), new Among("\u0438\u0432", 0, 2), + new Among("\u044B\u0432", 0, 2), + new Among("\u0432\u0448\u0438", -1, 1), + new Among("\u0438\u0432\u0448\u0438", 3, 2), + new Among("\u044B\u0432\u0448\u0438", 3, 2), + new Among("\u0432\u0448\u0438\u0441\u044C", -1, 1), + new Among("\u0438\u0432\u0448\u0438\u0441\u044C", 6, 2), + new Among("\u044B\u0432\u0448\u0438\u0441\u044C", 6, 2) + ], + a_1 = [ + new Among("\u0435\u0435", -1, 1), new Among("\u0438\u0435", -1, 1), + new Among("\u043E\u0435", -1, 1), new Among("\u044B\u0435", -1, 1), + new Among("\u0438\u043C\u0438", -1, 1), + new Among("\u044B\u043C\u0438", -1, 1), + new Among("\u0435\u0439", -1, 1), new Among("\u0438\u0439", -1, 1), + new Among("\u043E\u0439", -1, 1), new Among("\u044B\u0439", -1, 1), + new Among("\u0435\u043C", -1, 1), new Among("\u0438\u043C", -1, 1), + new Among("\u043E\u043C", -1, 1), new Among("\u044B\u043C", -1, 1), + new Among("\u0435\u0433\u043E", -1, 1), + new Among("\u043E\u0433\u043E", -1, 1), + new Among("\u0435\u043C\u0443", -1, 1), + new Among("\u043E\u043C\u0443", -1, 1), + new Among("\u0438\u0445", -1, 1), new Among("\u044B\u0445", -1, 1), + new Among("\u0435\u044E", -1, 1), new Among("\u043E\u044E", -1, 1), + new Among("\u0443\u044E", -1, 1), new Among("\u044E\u044E", -1, 1), + new Among("\u0430\u044F", -1, 1), new Among("\u044F\u044F", -1, 1) + ], + a_2 = [ + new Among("\u0435\u043C", -1, 1), new Among("\u043D\u043D", -1, 1), + new Among("\u0432\u0448", -1, 1), + new Among("\u0438\u0432\u0448", 2, 2), + new Among("\u044B\u0432\u0448", 2, 2), new Among("\u0449", -1, 1), + new Among("\u044E\u0449", 5, 1), + new Among("\u0443\u044E\u0449", 6, 2) + ], + a_3 = [ + new Among("\u0441\u044C", -1, 1), new Among("\u0441\u044F", -1, 1) + ], + a_4 = [ + new Among("\u043B\u0430", -1, 1), + new Among("\u0438\u043B\u0430", 0, 2), + new Among("\u044B\u043B\u0430", 0, 2), + new Among("\u043D\u0430", -1, 1), + new Among("\u0435\u043D\u0430", 3, 2), + new Among("\u0435\u0442\u0435", -1, 1), + new Among("\u0438\u0442\u0435", -1, 2), + new Among("\u0439\u0442\u0435", -1, 1), + new Among("\u0435\u0439\u0442\u0435", 7, 2), + new Among("\u0443\u0439\u0442\u0435", 7, 2), + new Among("\u043B\u0438", -1, 1), + new Among("\u0438\u043B\u0438", 10, 2), + new Among("\u044B\u043B\u0438", 10, 2), new Among("\u0439", -1, 1), + new Among("\u0435\u0439", 13, 2), new Among("\u0443\u0439", 13, 2), + new Among("\u043B", -1, 1), new Among("\u0438\u043B", 16, 2), + new Among("\u044B\u043B", 16, 2), new Among("\u0435\u043C", -1, 1), + new Among("\u0438\u043C", -1, 2), new Among("\u044B\u043C", -1, 2), + new Among("\u043D", -1, 1), new Among("\u0435\u043D", 22, 2), + new Among("\u043B\u043E", -1, 1), + new Among("\u0438\u043B\u043E", 24, 2), + new Among("\u044B\u043B\u043E", 24, 2), + new Among("\u043D\u043E", -1, 1), + new Among("\u0435\u043D\u043E", 27, 2), + new Among("\u043D\u043D\u043E", 27, 1), + new Among("\u0435\u0442", -1, 1), + new Among("\u0443\u0435\u0442", 30, 2), + new Among("\u0438\u0442", -1, 2), new Among("\u044B\u0442", -1, 2), + new Among("\u044E\u0442", -1, 1), + new Among("\u0443\u044E\u0442", 34, 2), + new Among("\u044F\u0442", -1, 2), new Among("\u043D\u044B", -1, 1), + new Among("\u0435\u043D\u044B", 37, 2), + new Among("\u0442\u044C", -1, 1), + new Among("\u0438\u0442\u044C", 39, 2), + new Among("\u044B\u0442\u044C", 39, 2), + new Among("\u0435\u0448\u044C", -1, 1), + new Among("\u0438\u0448\u044C", -1, 2), new Among("\u044E", -1, 2), + new Among("\u0443\u044E", 44, 2) + ], + a_5 = [ + new Among("\u0430", -1, 1), new Among("\u0435\u0432", -1, 1), + new Among("\u043E\u0432", -1, 1), new Among("\u0435", -1, 1), + new Among("\u0438\u0435", 3, 1), new Among("\u044C\u0435", 3, 1), + new Among("\u0438", -1, 1), new Among("\u0435\u0438", 6, 1), + new Among("\u0438\u0438", 6, 1), + new Among("\u0430\u043C\u0438", 6, 1), + new Among("\u044F\u043C\u0438", 6, 1), + new Among("\u0438\u044F\u043C\u0438", 10, 1), + new Among("\u0439", -1, 1), new Among("\u0435\u0439", 12, 1), + new Among("\u0438\u0435\u0439", 13, 1), + new Among("\u0438\u0439", 12, 1), new Among("\u043E\u0439", 12, 1), + new Among("\u0430\u043C", -1, 1), new Among("\u0435\u043C", -1, 1), + new Among("\u0438\u0435\u043C", 18, 1), + new Among("\u043E\u043C", -1, 1), new Among("\u044F\u043C", -1, 1), + new Among("\u0438\u044F\u043C", 21, 1), new Among("\u043E", -1, 1), + new Among("\u0443", -1, 1), new Among("\u0430\u0445", -1, 1), + new Among("\u044F\u0445", -1, 1), + new Among("\u0438\u044F\u0445", 26, 1), new Among("\u044B", -1, 1), + new Among("\u044C", -1, 1), new Among("\u044E", -1, 1), + new Among("\u0438\u044E", 30, 1), new Among("\u044C\u044E", 30, 1), + new Among("\u044F", -1, 1), new Among("\u0438\u044F", 33, 1), + new Among("\u044C\u044F", 33, 1) + ], + a_6 = [ + new Among("\u043E\u0441\u0442", -1, 1), + new Among("\u043E\u0441\u0442\u044C", -1, 1) + ], + a_7 = [ + new Among("\u0435\u0439\u0448\u0435", -1, 1), + new Among("\u043D", -1, 2), new Among("\u0435\u0439\u0448", -1, 1), + new Among("\u044C", -1, 3) + ], + g_v = [33, 65, 8, 232], + I_p2, I_pV, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr3() { + while (!sbp.in_grouping(g_v, 1072, 1103)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function habr4() { + while (!sbp.out_grouping(g_v, 1072, 1103)) { + if (sbp.cursor >= sbp.limit) + return false; + sbp.cursor++; + } + return true; + } + + function r_mark_regions() { + I_pV = sbp.limit; + I_p2 = I_pV; + if (habr3()) { + I_pV = sbp.cursor; + if (habr4()) + if (habr3()) + if (habr4()) + I_p2 = sbp.cursor; + } + } + + function r_R2() { + return I_p2 <= sbp.cursor; + } + + function habr2(a, n) { + var among_var, v_1; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a, n); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + v_1 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "\u0430")) { + sbp.cursor = sbp.limit - v_1; + if (!sbp.eq_s_b(1, "\u044F")) + return false; + } + case 2: + sbp.slice_del(); + break; + } + return true; + } + return false; + } + + function r_perfective_gerund() { + return habr2(a_0, 9); + } + + function habr1(a, n) { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a, n); + if (among_var) { + sbp.bra = sbp.cursor; + if (among_var == 1) + sbp.slice_del(); + return true; + } + return false; + } + + function r_adjective() { + return habr1(a_1, 26); + } + + function r_adjectival() { + var among_var; + if (r_adjective()) { + habr2(a_2, 8); + return true; + } + return false; + } + + function r_reflexive() { + return habr1(a_3, 2); + } + + function r_verb() { + return habr2(a_4, 46); + } + + function r_noun() { + habr1(a_5, 36); + } + + function r_derivational() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_6, 2); + if (among_var) { + sbp.bra = sbp.cursor; + if (r_R2() && among_var == 1) + sbp.slice_del(); + } + } + + function r_tidy_up() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_7, 4); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (!sbp.eq_s_b(1, "\u043D")) + break; + sbp.bra = sbp.cursor; + case 2: + if (!sbp.eq_s_b(1, "\u043D")) + break; + case 3: + sbp.slice_del(); + break; + } + } + } + this.stem = function() { + r_mark_regions(); + sbp.cursor = sbp.limit; + if (sbp.cursor < I_pV) + return false; + sbp.limit_backward = I_pV; + if (!r_perfective_gerund()) { + sbp.cursor = sbp.limit; + if (!r_reflexive()) + sbp.cursor = sbp.limit; + if (!r_adjectival()) { + sbp.cursor = sbp.limit; + if (!r_verb()) { + sbp.cursor = sbp.limit; + r_noun(); + } + } + } + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + if (sbp.eq_s_b(1, "\u0438")) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else + sbp.cursor = sbp.limit; + r_derivational(); + sbp.cursor = sbp.limit; + r_tidy_up(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.ru.stemmer, 'stemmer-ru'); + + lunr.ru.stopWordFilter = lunr.generateStopWordFilter('алло без близко более больше будем будет будете будешь будто буду будут будь бы бывает бывь был была были было быть в важная важное важные важный вам вами вас ваш ваша ваше ваши вверх вдали вдруг ведь везде весь вниз внизу во вокруг вон восемнадцатый восемнадцать восемь восьмой вот впрочем времени время все всегда всего всем всеми всему всех всею всю всюду вся всё второй вы г где говорил говорит год года году да давно даже далеко дальше даром два двадцатый двадцать две двенадцатый двенадцать двух девятнадцатый девятнадцать девятый девять действительно дел день десятый десять для до довольно долго должно другая другие других друго другое другой е его ее ей ему если есть еще ещё ею её ж же жизнь за занят занята занято заняты затем зато зачем здесь значит и из или им именно иметь ими имя иногда их к каждая каждое каждые каждый кажется как какая какой кем когда кого ком кому конечно которая которого которой которые который которых кроме кругом кто куда лет ли лишь лучше люди м мало между меля менее меньше меня миллионов мимо мира мне много многочисленная многочисленное многочисленные многочисленный мной мною мог могут мож может можно можхо мои мой мор мочь моя моё мы на наверху над надо назад наиболее наконец нам нами нас начала наш наша наше наши не него недавно недалеко нее ней нельзя нем немного нему непрерывно нередко несколько нет нею неё ни нибудь ниже низко никогда никуда ними них ничего но ну нужно нх о об оба обычно один одиннадцатый одиннадцать однажды однако одного одной около он она они оно опять особенно от отовсюду отсюда очень первый перед по под пожалуйста позже пока пор пора после посреди потом потому почему почти прекрасно при про просто против процентов пятнадцатый пятнадцать пятый пять раз разве рано раньше рядом с сам сама сами самим самими самих само самого самой самом самому саму свое своего своей свои своих свою сеаой себе себя сегодня седьмой сейчас семнадцатый семнадцать семь сих сказал сказала сказать сколько слишком сначала снова со собой собою совсем спасибо стал суть т та так такая также такие такое такой там твой твоя твоё те тебе тебя тем теми теперь тех то тобой тобою тогда того тоже только том тому тот тою третий три тринадцатый тринадцать ту туда тут ты тысяч у уж уже уметь хорошо хотеть хоть хотя хочешь часто чаще чего человек чем чему через четвертый четыре четырнадцатый четырнадцать что чтоб чтобы чуть шестнадцатый шестнадцать шестой шесть эта эти этим этими этих это этого этой этом этому этот эту я а'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.ru.stopWordFilter, 'stopWordFilter-ru'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.stemmer.support.js b/mkdocs/contrib/search/lunr-language/lunr.stemmer.support.js new file mode 100644 index 0000000000..896476a181 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.stemmer.support.js @@ -0,0 +1,304 @@ +/*! + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +;(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function () { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* provides utilities for the included stemmers */ + lunr.stemmerSupport = { + Among: function(s, substring_i, result, method) { + this.toCharArray = function(s) { + var sLength = s.length, charArr = new Array(sLength); + for (var i = 0; i < sLength; i++) + charArr[i] = s.charCodeAt(i); + return charArr; + }; + + if ((!s && s != "") || (!substring_i && (substring_i != 0)) || !result) + throw ("Bad Among initialisation: s:" + s + ", substring_i: " + + substring_i + ", result: " + result); + this.s_size = s.length; + this.s = this.toCharArray(s); + this.substring_i = substring_i; + this.result = result; + this.method = method; + }, + SnowballProgram: function() { + var current; + return { + bra : 0, + ket : 0, + limit : 0, + cursor : 0, + limit_backward : 0, + setCurrent : function(word) { + current = word; + this.cursor = 0; + this.limit = word.length; + this.limit_backward = 0; + this.bra = this.cursor; + this.ket = this.limit; + }, + getCurrent : function() { + var result = current; + current = null; + return result; + }, + in_grouping : function(s, min, max) { + if (this.cursor < this.limit) { + var ch = current.charCodeAt(this.cursor); + if (ch <= max && ch >= min) { + ch -= min; + if (s[ch >> 3] & (0X1 << (ch & 0X7))) { + this.cursor++; + return true; + } + } + } + return false; + }, + in_grouping_b : function(s, min, max) { + if (this.cursor > this.limit_backward) { + var ch = current.charCodeAt(this.cursor - 1); + if (ch <= max && ch >= min) { + ch -= min; + if (s[ch >> 3] & (0X1 << (ch & 0X7))) { + this.cursor--; + return true; + } + } + } + return false; + }, + out_grouping : function(s, min, max) { + if (this.cursor < this.limit) { + var ch = current.charCodeAt(this.cursor); + if (ch > max || ch < min) { + this.cursor++; + return true; + } + ch -= min; + if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) { + this.cursor++; + return true; + } + } + return false; + }, + out_grouping_b : function(s, min, max) { + if (this.cursor > this.limit_backward) { + var ch = current.charCodeAt(this.cursor - 1); + if (ch > max || ch < min) { + this.cursor--; + return true; + } + ch -= min; + if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) { + this.cursor--; + return true; + } + } + return false; + }, + eq_s : function(s_size, s) { + if (this.limit - this.cursor < s_size) + return false; + for (var i = 0; i < s_size; i++) + if (current.charCodeAt(this.cursor + i) != s.charCodeAt(i)) + return false; + this.cursor += s_size; + return true; + }, + eq_s_b : function(s_size, s) { + if (this.cursor - this.limit_backward < s_size) + return false; + for (var i = 0; i < s_size; i++) + if (current.charCodeAt(this.cursor - s_size + i) != s + .charCodeAt(i)) + return false; + this.cursor -= s_size; + return true; + }, + find_among : function(v, v_size) { + var i = 0, j = v_size, c = this.cursor, l = this.limit, common_i = 0, common_j = 0, first_key_inspected = false; + while (true) { + var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j + ? common_i + : common_j, w = v[k]; + for (var i2 = common; i2 < w.s_size; i2++) { + if (c + common == l) { + diff = -1; + break; + } + diff = current.charCodeAt(c + common) - w.s[i2]; + if (diff) + break; + common++; + } + if (diff < 0) { + j = k; + common_j = common; + } else { + i = k; + common_i = common; + } + if (j - i <= 1) { + if (i > 0 || j == i || first_key_inspected) + break; + first_key_inspected = true; + } + } + while (true) { + var w = v[i]; + if (common_i >= w.s_size) { + this.cursor = c + w.s_size; + if (!w.method) + return w.result; + var res = w.method(); + this.cursor = c + w.s_size; + if (res) + return w.result; + } + i = w.substring_i; + if (i < 0) + return 0; + } + }, + find_among_b : function(v, v_size) { + var i = 0, j = v_size, c = this.cursor, lb = this.limit_backward, common_i = 0, common_j = 0, first_key_inspected = false; + while (true) { + var k = i + ((j - i) >> 1), diff = 0, common = common_i < common_j + ? common_i + : common_j, w = v[k]; + for (var i2 = w.s_size - 1 - common; i2 >= 0; i2--) { + if (c - common == lb) { + diff = -1; + break; + } + diff = current.charCodeAt(c - 1 - common) - w.s[i2]; + if (diff) + break; + common++; + } + if (diff < 0) { + j = k; + common_j = common; + } else { + i = k; + common_i = common; + } + if (j - i <= 1) { + if (i > 0 || j == i || first_key_inspected) + break; + first_key_inspected = true; + } + } + while (true) { + var w = v[i]; + if (common_i >= w.s_size) { + this.cursor = c - w.s_size; + if (!w.method) + return w.result; + var res = w.method(); + this.cursor = c - w.s_size; + if (res) + return w.result; + } + i = w.substring_i; + if (i < 0) + return 0; + } + }, + replace_s : function(c_bra, c_ket, s) { + var adjustment = s.length - (c_ket - c_bra), left = current + .substring(0, c_bra), right = current.substring(c_ket); + current = left + s + right; + this.limit += adjustment; + if (this.cursor >= c_ket) + this.cursor += adjustment; + else if (this.cursor > c_bra) + this.cursor = c_bra; + return adjustment; + }, + slice_check : function() { + if (this.bra < 0 || this.bra > this.ket || this.ket > this.limit + || this.limit > current.length) + throw ("faulty slice operation"); + }, + slice_from : function(s) { + this.slice_check(); + this.replace_s(this.bra, this.ket, s); + }, + slice_del : function() { + this.slice_from(""); + }, + insert : function(c_bra, c_ket, s) { + var adjustment = this.replace_s(c_bra, c_ket, s); + if (c_bra <= this.bra) + this.bra += adjustment; + if (c_bra <= this.ket) + this.ket += adjustment; + }, + slice_to : function() { + this.slice_check(); + return current.substring(this.bra, this.ket); + }, + eq_v_b : function(s) { + return this.eq_s_b(s.length, s); + } + }; + } + }; + + lunr.trimmerSupport = { + generateTrimmer: function(wordCharacters) { + var startRegex = new RegExp("^[^" + wordCharacters + "]+") + var endRegex = new RegExp("[^" + wordCharacters + "]+$") + + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function (s) { + return s + .replace(startRegex, '') + .replace(endRegex, ''); + }) + } else { // for lunr version 1 + return token + .replace(startRegex, '') + .replace(endRegex, ''); + } + }; + } + } + } +})); diff --git a/mkdocs/contrib/search/lunr-language/lunr.sv.js b/mkdocs/contrib/search/lunr-language/lunr.sv.js new file mode 100644 index 0000000000..6a7d93202b --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.sv.js @@ -0,0 +1,256 @@ +/*! + * Lunr languages, `Swedish` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.sv = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.sv.trimmer, + lunr.sv.stopWordFilter, + lunr.sv.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.sv.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.sv.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.sv.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.sv.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.sv.trimmer, 'trimmer-sv'); + + /* lunr stemmer function */ + lunr.sv.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function SwedishStemmer() { + var a_0 = [new Among("a", -1, 1), new Among("arna", 0, 1), + new Among("erna", 0, 1), new Among("heterna", 2, 1), + new Among("orna", 0, 1), new Among("ad", -1, 1), + new Among("e", -1, 1), new Among("ade", 6, 1), + new Among("ande", 6, 1), new Among("arne", 6, 1), + new Among("are", 6, 1), new Among("aste", 6, 1), + new Among("en", -1, 1), new Among("anden", 12, 1), + new Among("aren", 12, 1), new Among("heten", 12, 1), + new Among("ern", -1, 1), new Among("ar", -1, 1), + new Among("er", -1, 1), new Among("heter", 18, 1), + new Among("or", -1, 1), new Among("s", -1, 2), + new Among("as", 21, 1), new Among("arnas", 22, 1), + new Among("ernas", 22, 1), new Among("ornas", 22, 1), + new Among("es", 21, 1), new Among("ades", 26, 1), + new Among("andes", 26, 1), new Among("ens", 21, 1), + new Among("arens", 29, 1), new Among("hetens", 29, 1), + new Among("erns", 21, 1), new Among("at", -1, 1), + new Among("andet", -1, 1), new Among("het", -1, 1), + new Among("ast", -1, 1) + ], + a_1 = [new Among("dd", -1, -1), + new Among("gd", -1, -1), new Among("nn", -1, -1), + new Among("dt", -1, -1), new Among("gt", -1, -1), + new Among("kt", -1, -1), new Among("tt", -1, -1) + ], + a_2 = [ + new Among("ig", -1, 1), new Among("lig", 0, 1), + new Among("els", -1, 1), new Among("fullt", -1, 3), + new Among("l\u00F6st", -1, 2) + ], + g_v = [17, 65, 16, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 + ], + g_s_ending = [119, 127, 149], + I_x, I_p1, sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function r_mark_regions() { + var v_1, c = sbp.cursor + 3; + I_p1 = sbp.limit; + if (0 <= c || c <= sbp.limit) { + I_x = c; + while (true) { + v_1 = sbp.cursor; + if (sbp.in_grouping(g_v, 97, 246)) { + sbp.cursor = v_1; + break; + } + sbp.cursor = v_1; + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + while (!sbp.out_grouping(g_v, 97, 246)) { + if (sbp.cursor >= sbp.limit) + return; + sbp.cursor++; + } + I_p1 = sbp.cursor; + if (I_p1 < I_x) + I_p1 = I_x; + } + } + + function r_main_suffix() { + var among_var, v_2 = sbp.limit_backward; + if (sbp.cursor >= I_p1) { + sbp.limit_backward = I_p1; + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_0, 37); + sbp.limit_backward = v_2; + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + if (sbp.in_grouping_b(g_s_ending, 98, 121)) + sbp.slice_del(); + break; + } + } + } + } + + function r_consonant_pair() { + var v_1 = sbp.limit_backward; + if (sbp.cursor >= I_p1) { + sbp.limit_backward = I_p1; + sbp.cursor = sbp.limit; + if (sbp.find_among_b(a_1, 7)) { + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + if (sbp.cursor > sbp.limit_backward) { + sbp.bra = --sbp.cursor; + sbp.slice_del(); + } + } + sbp.limit_backward = v_1; + } + } + + function r_other_suffix() { + var among_var, v_2; + if (sbp.cursor >= I_p1) { + v_2 = sbp.limit_backward; + sbp.limit_backward = I_p1; + sbp.cursor = sbp.limit; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_2, 5); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_del(); + break; + case 2: + sbp.slice_from("l\u00F6s"); + break; + case 3: + sbp.slice_from("full"); + break; + } + } + sbp.limit_backward = v_2; + } + } + this.stem = function() { + var v_1 = sbp.cursor; + r_mark_regions(); + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_main_suffix(); + sbp.cursor = sbp.limit; + r_consonant_pair(); + sbp.cursor = sbp.limit; + r_other_suffix(); + return true; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.sv.stemmer, 'stemmer-sv'); + + lunr.sv.stopWordFilter = lunr.generateStopWordFilter('alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.sv.stopWordFilter, 'stopWordFilter-sv'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.th.js b/mkdocs/contrib/search/lunr-language/lunr.th.js new file mode 100644 index 0000000000..2bf7db519a --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.th.js @@ -0,0 +1,97 @@ +/*! + * Lunr languages, `Thai` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2017, Keerati Thiwanruk + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* + Thai tokenization is the same to Japanense, which does not take into account spaces. + So, it uses the same logic to assign tokenization function due to different Lunr versions. + */ + var isLunr2 = lunr.version[0] == "2"; + + /* register specific locale function */ + lunr.th = function() { + this.pipeline.reset(); + this.pipeline.add( + /*lunr.th.stopWordFilter,*/ + lunr.th.trimmer + ); + + if (isLunr2) { // for lunr version 2.0.0 + this.tokenizer = lunr.th.tokenizer; + } else { + if (lunr.tokenizer) { // for lunr version 0.6.0 + lunr.tokenizer = lunr.th.tokenizer; + } + if (this.tokenizerFn) { // for lunr version 0.7.0 -> 1.0.0 + this.tokenizerFn = lunr.th.tokenizer; + } + } + }; + + /* lunr trimmer function */ + lunr.th.wordCharacters = "[\u0e00-\u0e7f]"; + lunr.th.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.th.wordCharacters); + lunr.Pipeline.registerFunction(lunr.th.trimmer, 'trimmer-th'); + + var segmenter = lunr.wordcut; + segmenter.init(); + lunr.th.tokenizer = function (obj) { + //console.log(obj); + if (!arguments.length || obj == null || obj == undefined) return [] + if (Array.isArray(obj)) return obj.map(function (t) { return isLunr2 ? new lunr.Token(t) : t }) + + var str = obj.toString().replace(/^\s+/, ''); + return segmenter.cut(str).split('|'); + } + }; +})) diff --git a/mkdocs/contrib/search/lunr-language/lunr.tr.js b/mkdocs/contrib/search/lunr-language/lunr.tr.js new file mode 100644 index 0000000000..5b4bad814c --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.tr.js @@ -0,0 +1,1087 @@ +/*! + * Lunr languages, `Turkish` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2014, Mihai Valentin + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.tr = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.tr.trimmer, + lunr.tr.stopWordFilter, + lunr.tr.stemmer + ); + + // for lunr version 2 + // this is necessary so that every searched word is also stemmed before + // in lunr <= 1 this is not needed, as it is done using the normal pipeline + if (this.searchPipeline) { + this.searchPipeline.reset(); + this.searchPipeline.add(lunr.tr.stemmer) + } + }; + + /* lunr trimmer function */ + lunr.tr.wordCharacters = "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A"; + lunr.tr.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.tr.wordCharacters); + + lunr.Pipeline.registerFunction(lunr.tr.trimmer, 'trimmer-tr'); + + /* lunr stemmer function */ + lunr.tr.stemmer = (function() { + /* create the wrapped stemmer object */ + var Among = lunr.stemmerSupport.Among, + SnowballProgram = lunr.stemmerSupport.SnowballProgram, + st = new function TurkishStemmer() { + var a_0 = [new Among("m", -1, -1), new Among("n", -1, -1), + new Among("miz", -1, -1), new Among("niz", -1, -1), + new Among("muz", -1, -1), new Among("nuz", -1, -1), + new Among("m\u00FCz", -1, -1), new Among("n\u00FCz", -1, -1), + new Among("m\u0131z", -1, -1), new Among("n\u0131z", -1, -1) + ], + a_1 = [ + new Among("leri", -1, -1), new Among("lar\u0131", -1, -1) + ], + a_2 = [ + new Among("ni", -1, -1), new Among("nu", -1, -1), + new Among("n\u00FC", -1, -1), new Among("n\u0131", -1, -1) + ], + a_3 = [ + new Among("in", -1, -1), new Among("un", -1, -1), + new Among("\u00FCn", -1, -1), new Among("\u0131n", -1, -1) + ], + a_4 = [ + new Among("a", -1, -1), new Among("e", -1, -1) + ], + a_5 = [ + new Among("na", -1, -1), new Among("ne", -1, -1) + ], + a_6 = [ + new Among("da", -1, -1), new Among("ta", -1, -1), + new Among("de", -1, -1), new Among("te", -1, -1) + ], + a_7 = [ + new Among("nda", -1, -1), new Among("nde", -1, -1) + ], + a_8 = [ + new Among("dan", -1, -1), new Among("tan", -1, -1), + new Among("den", -1, -1), new Among("ten", -1, -1) + ], + a_9 = [ + new Among("ndan", -1, -1), new Among("nden", -1, -1) + ], + a_10 = [ + new Among("la", -1, -1), new Among("le", -1, -1) + ], + a_11 = [ + new Among("ca", -1, -1), new Among("ce", -1, -1) + ], + a_12 = [ + new Among("im", -1, -1), new Among("um", -1, -1), + new Among("\u00FCm", -1, -1), new Among("\u0131m", -1, -1) + ], + a_13 = [ + new Among("sin", -1, -1), new Among("sun", -1, -1), + new Among("s\u00FCn", -1, -1), new Among("s\u0131n", -1, -1) + ], + a_14 = [ + new Among("iz", -1, -1), new Among("uz", -1, -1), + new Among("\u00FCz", -1, -1), new Among("\u0131z", -1, -1) + ], + a_15 = [ + new Among("siniz", -1, -1), new Among("sunuz", -1, -1), + new Among("s\u00FCn\u00FCz", -1, -1), + new Among("s\u0131n\u0131z", -1, -1) + ], + a_16 = [ + new Among("lar", -1, -1), new Among("ler", -1, -1) + ], + a_17 = [ + new Among("niz", -1, -1), new Among("nuz", -1, -1), + new Among("n\u00FCz", -1, -1), new Among("n\u0131z", -1, -1) + ], + a_18 = [ + new Among("dir", -1, -1), new Among("tir", -1, -1), + new Among("dur", -1, -1), new Among("tur", -1, -1), + new Among("d\u00FCr", -1, -1), new Among("t\u00FCr", -1, -1), + new Among("d\u0131r", -1, -1), new Among("t\u0131r", -1, -1) + ], + a_19 = [ + new Among("cas\u0131na", -1, -1), new Among("cesine", -1, -1) + ], + a_20 = [ + new Among("di", -1, -1), new Among("ti", -1, -1), + new Among("dik", -1, -1), new Among("tik", -1, -1), + new Among("duk", -1, -1), new Among("tuk", -1, -1), + new Among("d\u00FCk", -1, -1), new Among("t\u00FCk", -1, -1), + new Among("d\u0131k", -1, -1), new Among("t\u0131k", -1, -1), + new Among("dim", -1, -1), new Among("tim", -1, -1), + new Among("dum", -1, -1), new Among("tum", -1, -1), + new Among("d\u00FCm", -1, -1), new Among("t\u00FCm", -1, -1), + new Among("d\u0131m", -1, -1), new Among("t\u0131m", -1, -1), + new Among("din", -1, -1), new Among("tin", -1, -1), + new Among("dun", -1, -1), new Among("tun", -1, -1), + new Among("d\u00FCn", -1, -1), new Among("t\u00FCn", -1, -1), + new Among("d\u0131n", -1, -1), new Among("t\u0131n", -1, -1), + new Among("du", -1, -1), new Among("tu", -1, -1), + new Among("d\u00FC", -1, -1), new Among("t\u00FC", -1, -1), + new Among("d\u0131", -1, -1), new Among("t\u0131", -1, -1) + ], + a_21 = [ + new Among("sa", -1, -1), new Among("se", -1, -1), + new Among("sak", -1, -1), new Among("sek", -1, -1), + new Among("sam", -1, -1), new Among("sem", -1, -1), + new Among("san", -1, -1), new Among("sen", -1, -1) + ], + a_22 = [ + new Among("mi\u015F", -1, -1), new Among("mu\u015F", -1, -1), + new Among("m\u00FC\u015F", -1, -1), + new Among("m\u0131\u015F", -1, -1) + ], + a_23 = [new Among("b", -1, 1), + new Among("c", -1, 2), new Among("d", -1, 3), + new Among("\u011F", -1, 4) + ], + g_vowel = [17, 65, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8, 0, 0, 0, 0, 0, 0, 1 + ], + g_U = [ + 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, + 0, 0, 0, 1 + ], + g_vowel1 = [1, 64, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 + ], + g_vowel2 = [17, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130 + ], + g_vowel3 = [1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1 + ], + g_vowel4 = [17], + g_vowel5 = [65], + g_vowel6 = [65], + B_c_s_n_s, I_strlen, g_habr = [ + ["a", g_vowel1, 97, 305], + ["e", g_vowel2, 101, 252], + ["\u0131", g_vowel3, 97, 305], + ["i", g_vowel4, 101, 105], + ["o", g_vowel5, 111, 117], + ["\u00F6", g_vowel6, 246, 252], + ["u", g_vowel5, 111, 117] + ], + sbp = new SnowballProgram(); + this.setCurrent = function(word) { + sbp.setCurrent(word); + }; + this.getCurrent = function() { + return sbp.getCurrent(); + }; + + function habr1(g_v, n1, n2) { + while (true) { + var v_1 = sbp.limit - sbp.cursor; + if (sbp.in_grouping_b(g_v, n1, n2)) { + sbp.cursor = sbp.limit - v_1; + break; + } + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor <= sbp.limit_backward) + return false; + sbp.cursor--; + } + return true; + } + + function r_check_vowel_harmony() { + var v_1, v_2; + v_1 = sbp.limit - sbp.cursor; + habr1(g_vowel, 97, 305); + for (var i = 0; i < g_habr.length; i++) { + v_2 = sbp.limit - sbp.cursor; + var habr = g_habr[i]; + if (sbp.eq_s_b(1, habr[0]) && habr1(habr[1], habr[2], habr[3])) { + sbp.cursor = sbp.limit - v_1; + return true; + } + sbp.cursor = sbp.limit - v_2; + } + sbp.cursor = sbp.limit - v_2; + if (!sbp.eq_s_b(1, "\u00FC") || !habr1(g_vowel6, 246, 252)) + return false; + sbp.cursor = sbp.limit - v_1; + return true; + } + + function habr2(f1, f2) { + var v_1 = sbp.limit - sbp.cursor, + v_2; + if (f1()) { + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor > sbp.limit_backward) { + sbp.cursor--; + v_2 = sbp.limit - sbp.cursor; + if (f2()) { + sbp.cursor = sbp.limit - v_2; + return true; + } + } + } + sbp.cursor = sbp.limit - v_1; + if (f1()) { + sbp.cursor = sbp.limit - v_1; + return false; + } + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor <= sbp.limit_backward) + return false; + sbp.cursor--; + if (!f2()) + return false; + sbp.cursor = sbp.limit - v_1; + return true; + } + + function habr3(f1) { + return habr2(f1, function() { + return sbp.in_grouping_b(g_vowel, 97, 305); + }); + } + + function r_mark_suffix_with_optional_n_consonant() { + return habr3(function() { + return sbp.eq_s_b(1, "n"); + }); + } + + function r_mark_suffix_with_optional_s_consonant() { + return habr3(function() { + return sbp.eq_s_b(1, "s"); + }); + } + + function r_mark_suffix_with_optional_y_consonant() { + return habr3(function() { + return sbp.eq_s_b(1, "y"); + }); + } + + function r_mark_suffix_with_optional_U_vowel() { + return habr2(function() { + return sbp.in_grouping_b(g_U, 105, 305); + }, function() { + return sbp.out_grouping_b(g_vowel, 97, 305); + }); + } + + function r_mark_possessives() { + return sbp.find_among_b(a_0, 10) && + r_mark_suffix_with_optional_U_vowel(); + } + + function r_mark_sU() { + return r_check_vowel_harmony() && sbp.in_grouping_b(g_U, 105, 305) && + r_mark_suffix_with_optional_s_consonant(); + } + + function r_mark_lArI() { + return sbp.find_among_b(a_1, 2); + } + + function r_mark_yU() { + return r_check_vowel_harmony() && sbp.in_grouping_b(g_U, 105, 305) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_nU() { + return r_check_vowel_harmony() && sbp.find_among_b(a_2, 4); + } + + function r_mark_nUn() { + return r_check_vowel_harmony() && sbp.find_among_b(a_3, 4) && + r_mark_suffix_with_optional_n_consonant(); + } + + function r_mark_yA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_4, 2) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_nA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_5, 2); + } + + function r_mark_DA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_6, 4); + } + + function r_mark_ndA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_7, 2); + } + + function r_mark_DAn() { + return r_check_vowel_harmony() && sbp.find_among_b(a_8, 4); + } + + function r_mark_ndAn() { + return r_check_vowel_harmony() && sbp.find_among_b(a_9, 2); + } + + function r_mark_ylA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_10, 2) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_ki() { + return sbp.eq_s_b(2, "ki"); + } + + function r_mark_ncA() { + return r_check_vowel_harmony() && sbp.find_among_b(a_11, 2) && + r_mark_suffix_with_optional_n_consonant(); + } + + function r_mark_yUm() { + return r_check_vowel_harmony() && sbp.find_among_b(a_12, 4) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_sUn() { + return r_check_vowel_harmony() && sbp.find_among_b(a_13, 4); + } + + function r_mark_yUz() { + return r_check_vowel_harmony() && sbp.find_among_b(a_14, 4) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_sUnUz() { + return sbp.find_among_b(a_15, 4); + } + + function r_mark_lAr() { + return r_check_vowel_harmony() && sbp.find_among_b(a_16, 2); + } + + function r_mark_nUz() { + return r_check_vowel_harmony() && sbp.find_among_b(a_17, 4); + } + + function r_mark_DUr() { + return r_check_vowel_harmony() && sbp.find_among_b(a_18, 8); + } + + function r_mark_cAsInA() { + return sbp.find_among_b(a_19, 2); + } + + function r_mark_yDU() { + return r_check_vowel_harmony() && sbp.find_among_b(a_20, 32) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_ysA() { + return sbp.find_among_b(a_21, 8) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_ymUs_() { + return r_check_vowel_harmony() && sbp.find_among_b(a_22, 4) && + r_mark_suffix_with_optional_y_consonant(); + } + + function r_mark_yken() { + return sbp.eq_s_b(3, "ken") && + r_mark_suffix_with_optional_y_consonant(); + } + + function habr4() { + var v_1 = sbp.limit - sbp.cursor; + if (!r_mark_ymUs_()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yDU()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_ysA()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yken()) + return true; + } + } + } + return false; + } + + function habr5() { + if (r_mark_cAsInA()) { + var v_1 = sbp.limit - sbp.cursor; + if (!r_mark_sUnUz()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_lAr()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yUm()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_sUn()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yUz()) + sbp.cursor = sbp.limit - v_1; + } + } + } + } + if (r_mark_ymUs_()) + return false; + } + return true; + } + + function habr6() { + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + var v_1 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (!r_mark_DUr()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yDU()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_ysA()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_ymUs_()) + sbp.cursor = sbp.limit - v_1; + } + } + } + B_c_s_n_s = false; + return false; + } + return true; + } + + function habr7() { + if (!r_mark_nUz()) + return true; + var v_1 = sbp.limit - sbp.cursor; + if (!r_mark_yDU()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_ysA()) + return true; + } + return false; + } + + function habr8() { + var v_1 = sbp.limit - sbp.cursor, + v_2; + if (!r_mark_sUnUz()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yUz()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_sUn()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yUm()) + return true; + } + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + v_2 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (!r_mark_ymUs_()) + sbp.cursor = sbp.limit - v_2; + return false; + } + + function r_stem_nominal_verb_suffixes() { + var v_1 = sbp.limit - sbp.cursor, + v_2; + sbp.ket = sbp.cursor; + B_c_s_n_s = true; + if (habr4()) { + sbp.cursor = sbp.limit - v_1; + if (habr5()) { + sbp.cursor = sbp.limit - v_1; + if (habr6()) { + sbp.cursor = sbp.limit - v_1; + if (habr7()) { + sbp.cursor = sbp.limit - v_1; + if (habr8()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_DUr()) + return; + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_2 = sbp.limit - sbp.cursor; + if (!r_mark_sUnUz()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_lAr()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_yUm()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_sUn()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_yUz()) + sbp.cursor = sbp.limit - v_2; + } + } + } + } + if (!r_mark_ymUs_()) + sbp.cursor = sbp.limit - v_2; + } + } + } + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + } + + function r_stem_suffix_chain_before_ki() { + var v_1, v_2, v_3, v_4; + sbp.ket = sbp.cursor; + if (r_mark_ki()) { + v_1 = sbp.limit - sbp.cursor; + if (r_mark_DA()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + v_2 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } else { + sbp.cursor = sbp.limit - v_2; + if (r_mark_possessives()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } + } + return true; + } + sbp.cursor = sbp.limit - v_1; + if (r_mark_nUn()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_3 = sbp.limit - sbp.cursor; + if (r_mark_lArI()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else { + sbp.cursor = sbp.limit - v_3; + sbp.ket = sbp.cursor; + if (!r_mark_possessives()) { + sbp.cursor = sbp.limit - v_3; + if (!r_mark_sU()) { + sbp.cursor = sbp.limit - v_3; + if (!r_stem_suffix_chain_before_ki()) + return true; + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki() + } + } + return true; + } + sbp.cursor = sbp.limit - v_1; + if (r_mark_ndA()) { + v_4 = sbp.limit - sbp.cursor; + if (r_mark_lArI()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else { + sbp.cursor = sbp.limit - v_4; + if (r_mark_sU()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } else { + sbp.cursor = sbp.limit - v_4; + if (!r_stem_suffix_chain_before_ki()) + return false; + } + } + return true; + } + } + return false; + } + + function habr9(v_1) { + sbp.ket = sbp.cursor; + if (!r_mark_ndA()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_nA()) + return false; + } + var v_2 = sbp.limit - sbp.cursor; + if (r_mark_lArI()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else { + sbp.cursor = sbp.limit - v_2; + if (r_mark_sU()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } else { + sbp.cursor = sbp.limit - v_2; + if (!r_stem_suffix_chain_before_ki()) + return false; + } + } + return true; + } + + function habr10(v_1) { + sbp.ket = sbp.cursor; + if (!r_mark_ndAn()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_nU()) + return false; + } + var v_2 = sbp.limit - sbp.cursor; + if (!r_mark_sU()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_lArI()) + return false; + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + return true; + } + + function habr11() { + var v_1 = sbp.limit - sbp.cursor, + v_2; + sbp.ket = sbp.cursor; + if (!r_mark_nUn()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_ylA()) + return false; + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + v_2 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + if (r_stem_suffix_chain_before_ki()) + return true; + } + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (!r_mark_possessives()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_sU()) { + sbp.cursor = sbp.limit - v_2; + if (!r_stem_suffix_chain_before_ki()) + return true; + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + return true; + } + + function habr12() { + var v_1 = sbp.limit - sbp.cursor, + v_2, v_3; + sbp.ket = sbp.cursor; + if (!r_mark_DA()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yU()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_yA()) + return false; + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_2 = sbp.limit - sbp.cursor; + if (r_mark_possessives()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + v_3 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (!r_mark_lAr()) + sbp.cursor = sbp.limit - v_3; + } else { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_lAr()) + return true; + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + r_stem_suffix_chain_before_ki(); + return true; + } + + function r_stem_noun_suffixes() { + var v_1 = sbp.limit - sbp.cursor, + v_2, v_3; + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + return; + } + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (r_mark_ncA()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + v_2 = sbp.limit - sbp.cursor; + sbp.ket = sbp.cursor; + if (r_mark_lArI()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + } else { + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (!r_mark_possessives()) { + sbp.cursor = sbp.limit - v_2; + if (!r_mark_sU()) { + sbp.cursor = sbp.limit - v_2; + sbp.ket = sbp.cursor; + if (!r_mark_lAr()) + return; + sbp.bra = sbp.cursor; + sbp.slice_del(); + if (!r_stem_suffix_chain_before_ki()) + return; + } + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } + return; + } + sbp.cursor = sbp.limit - v_1; + if (habr9(v_1)) + return; + sbp.cursor = sbp.limit - v_1; + if (habr10(v_1)) + return; + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (r_mark_DAn()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + v_3 = sbp.limit - sbp.cursor; + if (r_mark_possessives()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } else { + sbp.cursor = sbp.limit - v_3; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } else { + sbp.cursor = sbp.limit - v_3; + r_stem_suffix_chain_before_ki(); + } + } + return; + } + sbp.cursor = sbp.limit - v_1; + if (habr11()) + return; + sbp.cursor = sbp.limit - v_1; + if (r_mark_lArI()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + return; + } + sbp.cursor = sbp.limit - v_1; + if (r_stem_suffix_chain_before_ki()) + return; + sbp.cursor = sbp.limit - v_1; + if (habr12()) + return; + sbp.cursor = sbp.limit - v_1; + sbp.ket = sbp.cursor; + if (!r_mark_possessives()) { + sbp.cursor = sbp.limit - v_1; + if (!r_mark_sU()) + return; + } + sbp.bra = sbp.cursor; + sbp.slice_del(); + sbp.ket = sbp.cursor; + if (r_mark_lAr()) { + sbp.bra = sbp.cursor; + sbp.slice_del(); + r_stem_suffix_chain_before_ki(); + } + } + + function r_post_process_last_consonants() { + var among_var; + sbp.ket = sbp.cursor; + among_var = sbp.find_among_b(a_23, 4); + if (among_var) { + sbp.bra = sbp.cursor; + switch (among_var) { + case 1: + sbp.slice_from("p"); + break; + case 2: + sbp.slice_from("\u00E7"); + break; + case 3: + sbp.slice_from("t"); + break; + case 4: + sbp.slice_from("k"); + break; + } + } + } + + function habr13() { + while (true) { + var v_1 = sbp.limit - sbp.cursor; + if (sbp.in_grouping_b(g_vowel, 97, 305)) { + sbp.cursor = sbp.limit - v_1; + break; + } + sbp.cursor = sbp.limit - v_1; + if (sbp.cursor <= sbp.limit_backward) + return false; + sbp.cursor--; + } + return true; + } + + function habr14(v_1, c1, c2) { + sbp.cursor = sbp.limit - v_1; + if (habr13()) { + var v_2 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, c1)) { + sbp.cursor = sbp.limit - v_2; + if (!sbp.eq_s_b(1, c2)) + return true; + } + sbp.cursor = sbp.limit - v_1; + var c = sbp.cursor; + sbp.insert(sbp.cursor, sbp.cursor, c2); + sbp.cursor = c; + return false; + } + return true; + } + + function r_append_U_to_stems_ending_with_d_or_g() { + var v_1 = sbp.limit - sbp.cursor; + if (!sbp.eq_s_b(1, "d")) { + sbp.cursor = sbp.limit - v_1; + if (!sbp.eq_s_b(1, "g")) + return; + } + if (habr14(v_1, "a", "\u0131")) + if (habr14(v_1, "e", "i")) + if (habr14(v_1, "o", "u")) + habr14(v_1, "\u00F6", "\u00FC") + } + + function r_more_than_one_syllable_word() { + var v_1 = sbp.cursor, + v_2 = 2, + v_3; + while (true) { + v_3 = sbp.cursor; + while (!sbp.in_grouping(g_vowel, 97, 305)) { + if (sbp.cursor >= sbp.limit) { + sbp.cursor = v_3; + if (v_2 > 0) + return false; + sbp.cursor = v_1; + return true; + } + sbp.cursor++; + } + v_2--; + } + } + + function habr15(v_1, n1, c1) { + while (!sbp.eq_s(n1, c1)) { + if (sbp.cursor >= sbp.limit) + return true; + sbp.cursor++; + } + I_strlen = n1; + if (I_strlen != sbp.limit) + return true; + sbp.cursor = v_1; + return false; + } + + function r_is_reserved_word() { + var v_1 = sbp.cursor; + if (habr15(v_1, 2, "ad")) { + sbp.cursor = v_1; + if (habr15(v_1, 5, "soyad")) + return false; + } + return true; + } + + function r_postlude() { + var v_1 = sbp.cursor; + if (r_is_reserved_word()) + return false; + sbp.limit_backward = v_1; + sbp.cursor = sbp.limit; + r_append_U_to_stems_ending_with_d_or_g(); + sbp.cursor = sbp.limit; + r_post_process_last_consonants(); + return true; + } + this.stem = function() { + if (r_more_than_one_syllable_word()) { + sbp.limit_backward = sbp.cursor; + sbp.cursor = sbp.limit; + r_stem_nominal_verb_suffixes(); + sbp.cursor = sbp.limit; + if (B_c_s_n_s) { + r_stem_noun_suffixes(); + sbp.cursor = sbp.limit_backward; + if (r_postlude()) + return true; + } + } + return false; + } + }; + + /* and return a function that stems a word for the current locale */ + return function(token) { + // for lunr version 2 + if (typeof token.update === "function") { + return token.update(function(word) { + st.setCurrent(word); + st.stem(); + return st.getCurrent(); + }) + } else { // for lunr version <= 1 + st.setCurrent(token); + st.stem(); + return st.getCurrent(); + } + } + })(); + + lunr.Pipeline.registerFunction(lunr.tr.stemmer, 'stemmer-tr'); + + lunr.tr.stopWordFilter = lunr.generateStopWordFilter('acaba altmış altı ama ancak arada aslında ayrıca bana bazı belki ben benden beni benim beri beş bile bin bir biri birkaç birkez birçok birşey birşeyi biz bizden bize bizi bizim bu buna bunda bundan bunlar bunları bunların bunu bunun burada böyle böylece da daha dahi de defa değil diye diğer doksan dokuz dolayı dolayısıyla dört edecek eden ederek edilecek ediliyor edilmesi ediyor elli en etmesi etti ettiği ettiğini eğer gibi göre halen hangi hatta hem henüz hep hepsi her herhangi herkesin hiç hiçbir iki ile ilgili ise itibaren itibariyle için işte kadar karşın katrilyon kendi kendilerine kendini kendisi kendisine kendisini kez ki kim kimden kime kimi kimse kırk milyar milyon mu mü mı nasıl ne neden nedenle nerde nerede nereye niye niçin o olan olarak oldu olduklarını olduğu olduğunu olmadı olmadığı olmak olması olmayan olmaz olsa olsun olup olur olursa oluyor on ona ondan onlar onlardan onları onların onu onun otuz oysa pek rağmen sadece sanki sekiz seksen sen senden seni senin siz sizden sizi sizin tarafından trilyon tüm var vardı ve veya ya yani yapacak yapmak yaptı yaptıkları yaptığı yaptığını yapılan yapılması yapıyor yedi yerine yetmiş yine yirmi yoksa yüz zaten çok çünkü öyle üzere üç şey şeyden şeyi şeyler şu şuna şunda şundan şunları şunu şöyle'.split(' ')); + + lunr.Pipeline.registerFunction(lunr.tr.stopWordFilter, 'stopWordFilter-tr'); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/lunr.vi.js b/mkdocs/contrib/search/lunr-language/lunr.vi.js new file mode 100644 index 0000000000..e7a65b2345 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/lunr.vi.js @@ -0,0 +1,84 @@ +/*! + * Lunr languages, `Vietnamese` language + * https://github.com/MihaiValentin/lunr-languages + * + * Copyright 2017, Keerati Thiwanruk + * http://www.mozilla.org/MPL/ + */ +/*! + * based on + * Snowball JavaScript Library v0.3 + * http://code.google.com/p/urim/ + * http://snowball.tartarus.org/ + * + * Copyright 2010, Oleg Mazko + * http://www.mozilla.org/MPL/ + */ + +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +; +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function() { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return function(lunr) { + /* throw error if lunr is not yet included */ + if ('undefined' === typeof lunr) { + throw new Error('Lunr is not present. Please include / require Lunr before this script.'); + } + + /* throw error if lunr stemmer support is not yet included */ + if ('undefined' === typeof lunr.stemmerSupport) { + throw new Error('Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.'); + } + + /* register specific locale function */ + lunr.vi = function() { + this.pipeline.reset(); + this.pipeline.add( + lunr.vi.stopWordFilter, + lunr.vi.trimmer + ); + }; + + /* lunr trimmer function */ + lunr.vi.wordCharacters = "[" + + "A-Za-z" + + "\u0300\u0350" + // dấu huyền + "\u0301\u0351" + // dấu sắc + "\u0309" + // dấu hỏi + "\u0323" + // dấu nặng + "\u0303\u0343" + // dấu ngã + "\u00C2\u00E2" + // Â + "\u00CA\u00EA" + // Ê + "\u00D4\u00F4" + // Ô + "\u0102-\u0103" + // Ă + "\u0110-\u0111" + // Đ + "\u01A0-\u01A1" + // Ơ + "\u01AF-\u01B0" + // Ư + "]"; + lunr.vi.trimmer = lunr.trimmerSupport.generateTrimmer(lunr.vi.wordCharacters); + lunr.Pipeline.registerFunction(lunr.vi.trimmer, 'trimmer-vi'); + lunr.vi.stopWordFilter = lunr.generateStopWordFilter('là cái nhưng mà'.split(' ')); + }; +})) \ No newline at end of file diff --git a/mkdocs/contrib/search/lunr-language/tinyseg.js b/mkdocs/contrib/search/lunr-language/tinyseg.js new file mode 100644 index 0000000000..167fa6dd69 --- /dev/null +++ b/mkdocs/contrib/search/lunr-language/tinyseg.js @@ -0,0 +1,206 @@ +/** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ +;(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like environments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + factory()(root.lunr); + } +}(this, function () { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + + return function(lunr) { + // TinySegmenter 0.1 -- Super compact Japanese tokenizer in Javascript + // (c) 2008 Taku Kudo + // TinySegmenter is freely distributable under the terms of a new BSD licence. + // For details, see http://chasen.org/~taku/software/TinySegmenter/LICENCE.txt + + function TinySegmenter() { + var patterns = { + "[一二三四五六七八九十百千万億兆]":"M", + "[一-龠々〆ヵヶ]":"H", + "[ぁ-ん]":"I", + "[ァ-ヴーア-ン゙ー]":"K", + "[a-zA-Za-zA-Z]":"A", + "[0-90-9]":"N" + } + this.chartype_ = []; + for (var i in patterns) { + var regexp = new RegExp(i); + this.chartype_.push([regexp, patterns[i]]); + } + + this.BIAS__ = -332 + this.BC1__ = {"HH":6,"II":2461,"KH":406,"OH":-1378}; + this.BC2__ = {"AA":-3267,"AI":2744,"AN":-878,"HH":-4070,"HM":-1711,"HN":4012,"HO":3761,"IA":1327,"IH":-1184,"II":-1332,"IK":1721,"IO":5492,"KI":3831,"KK":-8741,"MH":-3132,"MK":3334,"OO":-2920}; + this.BC3__ = {"HH":996,"HI":626,"HK":-721,"HN":-1307,"HO":-836,"IH":-301,"KK":2762,"MK":1079,"MM":4034,"OA":-1652,"OH":266}; + this.BP1__ = {"BB":295,"OB":304,"OO":-125,"UB":352}; + this.BP2__ = {"BO":60,"OO":-1762}; + this.BQ1__ = {"BHH":1150,"BHM":1521,"BII":-1158,"BIM":886,"BMH":1208,"BNH":449,"BOH":-91,"BOO":-2597,"OHI":451,"OIH":-296,"OKA":1851,"OKH":-1020,"OKK":904,"OOO":2965}; + this.BQ2__ = {"BHH":118,"BHI":-1159,"BHM":466,"BIH":-919,"BKK":-1720,"BKO":864,"OHH":-1139,"OHM":-181,"OIH":153,"UHI":-1146}; + this.BQ3__ = {"BHH":-792,"BHI":2664,"BII":-299,"BKI":419,"BMH":937,"BMM":8335,"BNN":998,"BOH":775,"OHH":2174,"OHM":439,"OII":280,"OKH":1798,"OKI":-793,"OKO":-2242,"OMH":-2402,"OOO":11699}; + this.BQ4__ = {"BHH":-3895,"BIH":3761,"BII":-4654,"BIK":1348,"BKK":-1806,"BMI":-3385,"BOO":-12396,"OAH":926,"OHH":266,"OHK":-2036,"ONN":-973}; + this.BW1__ = {",と":660,",同":727,"B1あ":1404,"B1同":542,"、と":660,"、同":727,"」と":1682,"あっ":1505,"いう":1743,"いっ":-2055,"いる":672,"うし":-4817,"うん":665,"から":3472,"がら":600,"こう":-790,"こと":2083,"こん":-1262,"さら":-4143,"さん":4573,"した":2641,"して":1104,"すで":-3399,"そこ":1977,"それ":-871,"たち":1122,"ため":601,"った":3463,"つい":-802,"てい":805,"てき":1249,"でき":1127,"です":3445,"では":844,"とい":-4915,"とみ":1922,"どこ":3887,"ない":5713,"なっ":3015,"など":7379,"なん":-1113,"にし":2468,"には":1498,"にも":1671,"に対":-912,"の一":-501,"の中":741,"ませ":2448,"まで":1711,"まま":2600,"まる":-2155,"やむ":-1947,"よっ":-2565,"れた":2369,"れで":-913,"をし":1860,"を見":731,"亡く":-1886,"京都":2558,"取り":-2784,"大き":-2604,"大阪":1497,"平方":-2314,"引き":-1336,"日本":-195,"本当":-2423,"毎日":-2113,"目指":-724,"B1あ":1404,"B1同":542,"」と":1682}; + this.BW2__ = {"..":-11822,"11":-669,"――":-5730,"−−":-13175,"いう":-1609,"うか":2490,"かし":-1350,"かも":-602,"から":-7194,"かれ":4612,"がい":853,"がら":-3198,"きた":1941,"くな":-1597,"こと":-8392,"この":-4193,"させ":4533,"され":13168,"さん":-3977,"しい":-1819,"しか":-545,"した":5078,"して":972,"しな":939,"その":-3744,"たい":-1253,"たた":-662,"ただ":-3857,"たち":-786,"たと":1224,"たは":-939,"った":4589,"って":1647,"っと":-2094,"てい":6144,"てき":3640,"てく":2551,"ては":-3110,"ても":-3065,"でい":2666,"でき":-1528,"でし":-3828,"です":-4761,"でも":-4203,"とい":1890,"とこ":-1746,"とと":-2279,"との":720,"とみ":5168,"とも":-3941,"ない":-2488,"なが":-1313,"など":-6509,"なの":2614,"なん":3099,"にお":-1615,"にし":2748,"にな":2454,"によ":-7236,"に対":-14943,"に従":-4688,"に関":-11388,"のか":2093,"ので":-7059,"のに":-6041,"のの":-6125,"はい":1073,"はが":-1033,"はず":-2532,"ばれ":1813,"まし":-1316,"まで":-6621,"まれ":5409,"めて":-3153,"もい":2230,"もの":-10713,"らか":-944,"らし":-1611,"らに":-1897,"りし":651,"りま":1620,"れた":4270,"れて":849,"れば":4114,"ろう":6067,"われ":7901,"を通":-11877,"んだ":728,"んな":-4115,"一人":602,"一方":-1375,"一日":970,"一部":-1051,"上が":-4479,"会社":-1116,"出て":2163,"分の":-7758,"同党":970,"同日":-913,"大阪":-2471,"委員":-1250,"少な":-1050,"年度":-8669,"年間":-1626,"府県":-2363,"手権":-1982,"新聞":-4066,"日新":-722,"日本":-7068,"日米":3372,"曜日":-601,"朝鮮":-2355,"本人":-2697,"東京":-1543,"然と":-1384,"社会":-1276,"立て":-990,"第に":-1612,"米国":-4268,"11":-669}; + this.BW3__ = {"あた":-2194,"あり":719,"ある":3846,"い.":-1185,"い。":-1185,"いい":5308,"いえ":2079,"いく":3029,"いた":2056,"いっ":1883,"いる":5600,"いわ":1527,"うち":1117,"うと":4798,"えと":1454,"か.":2857,"か。":2857,"かけ":-743,"かっ":-4098,"かに":-669,"から":6520,"かり":-2670,"が,":1816,"が、":1816,"がき":-4855,"がけ":-1127,"がっ":-913,"がら":-4977,"がり":-2064,"きた":1645,"けど":1374,"こと":7397,"この":1542,"ころ":-2757,"さい":-714,"さを":976,"し,":1557,"し、":1557,"しい":-3714,"した":3562,"して":1449,"しな":2608,"しま":1200,"す.":-1310,"す。":-1310,"する":6521,"ず,":3426,"ず、":3426,"ずに":841,"そう":428,"た.":8875,"た。":8875,"たい":-594,"たの":812,"たり":-1183,"たる":-853,"だ.":4098,"だ。":4098,"だっ":1004,"った":-4748,"って":300,"てい":6240,"てお":855,"ても":302,"です":1437,"でに":-1482,"では":2295,"とう":-1387,"とし":2266,"との":541,"とも":-3543,"どう":4664,"ない":1796,"なく":-903,"など":2135,"に,":-1021,"に、":-1021,"にし":1771,"にな":1906,"には":2644,"の,":-724,"の、":-724,"の子":-1000,"は,":1337,"は、":1337,"べき":2181,"まし":1113,"ます":6943,"まっ":-1549,"まで":6154,"まれ":-793,"らし":1479,"られ":6820,"るる":3818,"れ,":854,"れ、":854,"れた":1850,"れて":1375,"れば":-3246,"れる":1091,"われ":-605,"んだ":606,"んで":798,"カ月":990,"会議":860,"入り":1232,"大会":2217,"始め":1681,"市":965,"新聞":-5055,"日,":974,"日、":974,"社会":2024,"カ月":990}; + this.TC1__ = {"AAA":1093,"HHH":1029,"HHM":580,"HII":998,"HOH":-390,"HOM":-331,"IHI":1169,"IOH":-142,"IOI":-1015,"IOM":467,"MMH":187,"OOI":-1832}; + this.TC2__ = {"HHO":2088,"HII":-1023,"HMM":-1154,"IHI":-1965,"KKH":703,"OII":-2649}; + this.TC3__ = {"AAA":-294,"HHH":346,"HHI":-341,"HII":-1088,"HIK":731,"HOH":-1486,"IHH":128,"IHI":-3041,"IHO":-1935,"IIH":-825,"IIM":-1035,"IOI":-542,"KHH":-1216,"KKA":491,"KKH":-1217,"KOK":-1009,"MHH":-2694,"MHM":-457,"MHO":123,"MMH":-471,"NNH":-1689,"NNO":662,"OHO":-3393}; + this.TC4__ = {"HHH":-203,"HHI":1344,"HHK":365,"HHM":-122,"HHN":182,"HHO":669,"HIH":804,"HII":679,"HOH":446,"IHH":695,"IHO":-2324,"IIH":321,"III":1497,"IIO":656,"IOO":54,"KAK":4845,"KKA":3386,"KKK":3065,"MHH":-405,"MHI":201,"MMH":-241,"MMM":661,"MOM":841}; + this.TQ1__ = {"BHHH":-227,"BHHI":316,"BHIH":-132,"BIHH":60,"BIII":1595,"BNHH":-744,"BOHH":225,"BOOO":-908,"OAKK":482,"OHHH":281,"OHIH":249,"OIHI":200,"OIIH":-68}; + this.TQ2__ = {"BIHH":-1401,"BIII":-1033,"BKAK":-543,"BOOO":-5591}; + this.TQ3__ = {"BHHH":478,"BHHM":-1073,"BHIH":222,"BHII":-504,"BIIH":-116,"BIII":-105,"BMHI":-863,"BMHM":-464,"BOMH":620,"OHHH":346,"OHHI":1729,"OHII":997,"OHMH":481,"OIHH":623,"OIIH":1344,"OKAK":2792,"OKHH":587,"OKKA":679,"OOHH":110,"OOII":-685}; + this.TQ4__ = {"BHHH":-721,"BHHM":-3604,"BHII":-966,"BIIH":-607,"BIII":-2181,"OAAA":-2763,"OAKK":180,"OHHH":-294,"OHHI":2446,"OHHO":480,"OHIH":-1573,"OIHH":1935,"OIHI":-493,"OIIH":626,"OIII":-4007,"OKAK":-8156}; + this.TW1__ = {"につい":-4681,"東京都":2026}; + this.TW2__ = {"ある程":-2049,"いった":-1256,"ころが":-2434,"しょう":3873,"その後":-4430,"だって":-1049,"ていた":1833,"として":-4657,"ともに":-4517,"もので":1882,"一気に":-792,"初めて":-1512,"同時に":-8097,"大きな":-1255,"対して":-2721,"社会党":-3216}; + this.TW3__ = {"いただ":-1734,"してい":1314,"として":-4314,"につい":-5483,"にとっ":-5989,"に当た":-6247,"ので,":-727,"ので、":-727,"のもの":-600,"れから":-3752,"十二月":-2287}; + this.TW4__ = {"いう.":8576,"いう。":8576,"からな":-2348,"してい":2958,"たが,":1516,"たが、":1516,"ている":1538,"という":1349,"ました":5543,"ません":1097,"ようと":-4258,"よると":5865}; + this.UC1__ = {"A":484,"K":93,"M":645,"O":-505}; + this.UC2__ = {"A":819,"H":1059,"I":409,"M":3987,"N":5775,"O":646}; + this.UC3__ = {"A":-1370,"I":2311}; + this.UC4__ = {"A":-2643,"H":1809,"I":-1032,"K":-3450,"M":3565,"N":3876,"O":6646}; + this.UC5__ = {"H":313,"I":-1238,"K":-799,"M":539,"O":-831}; + this.UC6__ = {"H":-506,"I":-253,"K":87,"M":247,"O":-387}; + this.UP1__ = {"O":-214}; + this.UP2__ = {"B":69,"O":935}; + this.UP3__ = {"B":189}; + this.UQ1__ = {"BH":21,"BI":-12,"BK":-99,"BN":142,"BO":-56,"OH":-95,"OI":477,"OK":410,"OO":-2422}; + this.UQ2__ = {"BH":216,"BI":113,"OK":1759}; + this.UQ3__ = {"BA":-479,"BH":42,"BI":1913,"BK":-7198,"BM":3160,"BN":6427,"BO":14761,"OI":-827,"ON":-3212}; + this.UW1__ = {",":156,"、":156,"「":-463,"あ":-941,"う":-127,"が":-553,"き":121,"こ":505,"で":-201,"と":-547,"ど":-123,"に":-789,"の":-185,"は":-847,"も":-466,"や":-470,"よ":182,"ら":-292,"り":208,"れ":169,"を":-446,"ん":-137,"・":-135,"主":-402,"京":-268,"区":-912,"午":871,"国":-460,"大":561,"委":729,"市":-411,"日":-141,"理":361,"生":-408,"県":-386,"都":-718,"「":-463,"・":-135}; + this.UW2__ = {",":-829,"、":-829,"〇":892,"「":-645,"」":3145,"あ":-538,"い":505,"う":134,"お":-502,"か":1454,"が":-856,"く":-412,"こ":1141,"さ":878,"ざ":540,"し":1529,"す":-675,"せ":300,"そ":-1011,"た":188,"だ":1837,"つ":-949,"て":-291,"で":-268,"と":-981,"ど":1273,"な":1063,"に":-1764,"の":130,"は":-409,"ひ":-1273,"べ":1261,"ま":600,"も":-1263,"や":-402,"よ":1639,"り":-579,"る":-694,"れ":571,"を":-2516,"ん":2095,"ア":-587,"カ":306,"キ":568,"ッ":831,"三":-758,"不":-2150,"世":-302,"中":-968,"主":-861,"事":492,"人":-123,"会":978,"保":362,"入":548,"初":-3025,"副":-1566,"北":-3414,"区":-422,"大":-1769,"天":-865,"太":-483,"子":-1519,"学":760,"実":1023,"小":-2009,"市":-813,"年":-1060,"強":1067,"手":-1519,"揺":-1033,"政":1522,"文":-1355,"新":-1682,"日":-1815,"明":-1462,"最":-630,"朝":-1843,"本":-1650,"東":-931,"果":-665,"次":-2378,"民":-180,"気":-1740,"理":752,"発":529,"目":-1584,"相":-242,"県":-1165,"立":-763,"第":810,"米":509,"自":-1353,"行":838,"西":-744,"見":-3874,"調":1010,"議":1198,"込":3041,"開":1758,"間":-1257,"「":-645,"」":3145,"ッ":831,"ア":-587,"カ":306,"キ":568}; + this.UW3__ = {",":4889,"1":-800,"−":-1723,"、":4889,"々":-2311,"〇":5827,"」":2670,"〓":-3573,"あ":-2696,"い":1006,"う":2342,"え":1983,"お":-4864,"か":-1163,"が":3271,"く":1004,"け":388,"げ":401,"こ":-3552,"ご":-3116,"さ":-1058,"し":-395,"す":584,"せ":3685,"そ":-5228,"た":842,"ち":-521,"っ":-1444,"つ":-1081,"て":6167,"で":2318,"と":1691,"ど":-899,"な":-2788,"に":2745,"の":4056,"は":4555,"ひ":-2171,"ふ":-1798,"へ":1199,"ほ":-5516,"ま":-4384,"み":-120,"め":1205,"も":2323,"や":-788,"よ":-202,"ら":727,"り":649,"る":5905,"れ":2773,"わ":-1207,"を":6620,"ん":-518,"ア":551,"グ":1319,"ス":874,"ッ":-1350,"ト":521,"ム":1109,"ル":1591,"ロ":2201,"ン":278,"・":-3794,"一":-1619,"下":-1759,"世":-2087,"両":3815,"中":653,"主":-758,"予":-1193,"二":974,"人":2742,"今":792,"他":1889,"以":-1368,"低":811,"何":4265,"作":-361,"保":-2439,"元":4858,"党":3593,"全":1574,"公":-3030,"六":755,"共":-1880,"円":5807,"再":3095,"分":457,"初":2475,"別":1129,"前":2286,"副":4437,"力":365,"動":-949,"務":-1872,"化":1327,"北":-1038,"区":4646,"千":-2309,"午":-783,"協":-1006,"口":483,"右":1233,"各":3588,"合":-241,"同":3906,"和":-837,"員":4513,"国":642,"型":1389,"場":1219,"外":-241,"妻":2016,"学":-1356,"安":-423,"実":-1008,"家":1078,"小":-513,"少":-3102,"州":1155,"市":3197,"平":-1804,"年":2416,"広":-1030,"府":1605,"度":1452,"建":-2352,"当":-3885,"得":1905,"思":-1291,"性":1822,"戸":-488,"指":-3973,"政":-2013,"教":-1479,"数":3222,"文":-1489,"新":1764,"日":2099,"旧":5792,"昨":-661,"時":-1248,"曜":-951,"最":-937,"月":4125,"期":360,"李":3094,"村":364,"東":-805,"核":5156,"森":2438,"業":484,"氏":2613,"民":-1694,"決":-1073,"法":1868,"海":-495,"無":979,"物":461,"特":-3850,"生":-273,"用":914,"町":1215,"的":7313,"直":-1835,"省":792,"県":6293,"知":-1528,"私":4231,"税":401,"立":-960,"第":1201,"米":7767,"系":3066,"約":3663,"級":1384,"統":-4229,"総":1163,"線":1255,"者":6457,"能":725,"自":-2869,"英":785,"見":1044,"調":-562,"財":-733,"費":1777,"車":1835,"軍":1375,"込":-1504,"通":-1136,"選":-681,"郎":1026,"郡":4404,"部":1200,"金":2163,"長":421,"開":-1432,"間":1302,"関":-1282,"雨":2009,"電":-1045,"非":2066,"駅":1620,"1":-800,"」":2670,"・":-3794,"ッ":-1350,"ア":551,"グ":1319,"ス":874,"ト":521,"ム":1109,"ル":1591,"ロ":2201,"ン":278}; + this.UW4__ = {",":3930,".":3508,"―":-4841,"、":3930,"。":3508,"〇":4999,"「":1895,"」":3798,"〓":-5156,"あ":4752,"い":-3435,"う":-640,"え":-2514,"お":2405,"か":530,"が":6006,"き":-4482,"ぎ":-3821,"く":-3788,"け":-4376,"げ":-4734,"こ":2255,"ご":1979,"さ":2864,"し":-843,"じ":-2506,"す":-731,"ず":1251,"せ":181,"そ":4091,"た":5034,"だ":5408,"ち":-3654,"っ":-5882,"つ":-1659,"て":3994,"で":7410,"と":4547,"な":5433,"に":6499,"ぬ":1853,"ね":1413,"の":7396,"は":8578,"ば":1940,"ひ":4249,"び":-4134,"ふ":1345,"へ":6665,"べ":-744,"ほ":1464,"ま":1051,"み":-2082,"む":-882,"め":-5046,"も":4169,"ゃ":-2666,"や":2795,"ょ":-1544,"よ":3351,"ら":-2922,"り":-9726,"る":-14896,"れ":-2613,"ろ":-4570,"わ":-1783,"を":13150,"ん":-2352,"カ":2145,"コ":1789,"セ":1287,"ッ":-724,"ト":-403,"メ":-1635,"ラ":-881,"リ":-541,"ル":-856,"ン":-3637,"・":-4371,"ー":-11870,"一":-2069,"中":2210,"予":782,"事":-190,"井":-1768,"人":1036,"以":544,"会":950,"体":-1286,"作":530,"側":4292,"先":601,"党":-2006,"共":-1212,"内":584,"円":788,"初":1347,"前":1623,"副":3879,"力":-302,"動":-740,"務":-2715,"化":776,"区":4517,"協":1013,"参":1555,"合":-1834,"和":-681,"員":-910,"器":-851,"回":1500,"国":-619,"園":-1200,"地":866,"場":-1410,"塁":-2094,"士":-1413,"多":1067,"大":571,"子":-4802,"学":-1397,"定":-1057,"寺":-809,"小":1910,"屋":-1328,"山":-1500,"島":-2056,"川":-2667,"市":2771,"年":374,"庁":-4556,"後":456,"性":553,"感":916,"所":-1566,"支":856,"改":787,"政":2182,"教":704,"文":522,"方":-856,"日":1798,"時":1829,"最":845,"月":-9066,"木":-485,"来":-442,"校":-360,"業":-1043,"氏":5388,"民":-2716,"気":-910,"沢":-939,"済":-543,"物":-735,"率":672,"球":-1267,"生":-1286,"産":-1101,"田":-2900,"町":1826,"的":2586,"目":922,"省":-3485,"県":2997,"空":-867,"立":-2112,"第":788,"米":2937,"系":786,"約":2171,"経":1146,"統":-1169,"総":940,"線":-994,"署":749,"者":2145,"能":-730,"般":-852,"行":-792,"規":792,"警":-1184,"議":-244,"谷":-1000,"賞":730,"車":-1481,"軍":1158,"輪":-1433,"込":-3370,"近":929,"道":-1291,"選":2596,"郎":-4866,"都":1192,"野":-1100,"銀":-2213,"長":357,"間":-2344,"院":-2297,"際":-2604,"電":-878,"領":-1659,"題":-792,"館":-1984,"首":1749,"高":2120,"「":1895,"」":3798,"・":-4371,"ッ":-724,"ー":-11870,"カ":2145,"コ":1789,"セ":1287,"ト":-403,"メ":-1635,"ラ":-881,"リ":-541,"ル":-856,"ン":-3637}; + this.UW5__ = {",":465,".":-299,"1":-514,"E2":-32768,"]":-2762,"、":465,"。":-299,"「":363,"あ":1655,"い":331,"う":-503,"え":1199,"お":527,"か":647,"が":-421,"き":1624,"ぎ":1971,"く":312,"げ":-983,"さ":-1537,"し":-1371,"す":-852,"だ":-1186,"ち":1093,"っ":52,"つ":921,"て":-18,"で":-850,"と":-127,"ど":1682,"な":-787,"に":-1224,"の":-635,"は":-578,"べ":1001,"み":502,"め":865,"ゃ":3350,"ょ":854,"り":-208,"る":429,"れ":504,"わ":419,"を":-1264,"ん":327,"イ":241,"ル":451,"ン":-343,"中":-871,"京":722,"会":-1153,"党":-654,"務":3519,"区":-901,"告":848,"員":2104,"大":-1296,"学":-548,"定":1785,"嵐":-1304,"市":-2991,"席":921,"年":1763,"思":872,"所":-814,"挙":1618,"新":-1682,"日":218,"月":-4353,"査":932,"格":1356,"機":-1508,"氏":-1347,"田":240,"町":-3912,"的":-3149,"相":1319,"省":-1052,"県":-4003,"研":-997,"社":-278,"空":-813,"統":1955,"者":-2233,"表":663,"語":-1073,"議":1219,"選":-1018,"郎":-368,"長":786,"間":1191,"題":2368,"館":-689,"1":-514,"E2":-32768,"「":363,"イ":241,"ル":451,"ン":-343}; + this.UW6__ = {",":227,".":808,"1":-270,"E1":306,"、":227,"。":808,"あ":-307,"う":189,"か":241,"が":-73,"く":-121,"こ":-200,"じ":1782,"す":383,"た":-428,"っ":573,"て":-1014,"で":101,"と":-105,"な":-253,"に":-149,"の":-417,"は":-236,"も":-206,"り":187,"る":-135,"を":195,"ル":-673,"ン":-496,"一":-277,"中":201,"件":-800,"会":624,"前":302,"区":1792,"員":-1212,"委":798,"学":-960,"市":887,"広":-695,"後":535,"業":-697,"相":753,"社":-507,"福":974,"空":-822,"者":1811,"連":463,"郎":1082,"1":-270,"E1":306,"ル":-673,"ン":-496}; + + return this; + } + TinySegmenter.prototype.ctype_ = function(str) { + for (var i in this.chartype_) { + if (str.match(this.chartype_[i][0])) { + return this.chartype_[i][1]; + } + } + return "O"; + } + + TinySegmenter.prototype.ts_ = function(v) { + if (v) { return v; } + return 0; + } + + TinySegmenter.prototype.segment = function(input) { + if (input == null || input == undefined || input == "") { + return []; + } + var result = []; + var seg = ["B3","B2","B1"]; + var ctype = ["O","O","O"]; + var o = input.split(""); + for (i = 0; i < o.length; ++i) { + seg.push(o[i]); + ctype.push(this.ctype_(o[i])) + } + seg.push("E1"); + seg.push("E2"); + seg.push("E3"); + ctype.push("O"); + ctype.push("O"); + ctype.push("O"); + var word = seg[3]; + var p1 = "U"; + var p2 = "U"; + var p3 = "U"; + for (var i = 4; i < seg.length - 3; ++i) { + var score = this.BIAS__; + var w1 = seg[i-3]; + var w2 = seg[i-2]; + var w3 = seg[i-1]; + var w4 = seg[i]; + var w5 = seg[i+1]; + var w6 = seg[i+2]; + var c1 = ctype[i-3]; + var c2 = ctype[i-2]; + var c3 = ctype[i-1]; + var c4 = ctype[i]; + var c5 = ctype[i+1]; + var c6 = ctype[i+2]; + score += this.ts_(this.UP1__[p1]); + score += this.ts_(this.UP2__[p2]); + score += this.ts_(this.UP3__[p3]); + score += this.ts_(this.BP1__[p1 + p2]); + score += this.ts_(this.BP2__[p2 + p3]); + score += this.ts_(this.UW1__[w1]); + score += this.ts_(this.UW2__[w2]); + score += this.ts_(this.UW3__[w3]); + score += this.ts_(this.UW4__[w4]); + score += this.ts_(this.UW5__[w5]); + score += this.ts_(this.UW6__[w6]); + score += this.ts_(this.BW1__[w2 + w3]); + score += this.ts_(this.BW2__[w3 + w4]); + score += this.ts_(this.BW3__[w4 + w5]); + score += this.ts_(this.TW1__[w1 + w2 + w3]); + score += this.ts_(this.TW2__[w2 + w3 + w4]); + score += this.ts_(this.TW3__[w3 + w4 + w5]); + score += this.ts_(this.TW4__[w4 + w5 + w6]); + score += this.ts_(this.UC1__[c1]); + score += this.ts_(this.UC2__[c2]); + score += this.ts_(this.UC3__[c3]); + score += this.ts_(this.UC4__[c4]); + score += this.ts_(this.UC5__[c5]); + score += this.ts_(this.UC6__[c6]); + score += this.ts_(this.BC1__[c2 + c3]); + score += this.ts_(this.BC2__[c3 + c4]); + score += this.ts_(this.BC3__[c4 + c5]); + score += this.ts_(this.TC1__[c1 + c2 + c3]); + score += this.ts_(this.TC2__[c2 + c3 + c4]); + score += this.ts_(this.TC3__[c3 + c4 + c5]); + score += this.ts_(this.TC4__[c4 + c5 + c6]); + // score += this.ts_(this.TC5__[c4 + c5 + c6]); + score += this.ts_(this.UQ1__[p1 + c1]); + score += this.ts_(this.UQ2__[p2 + c2]); + score += this.ts_(this.UQ3__[p3 + c3]); + score += this.ts_(this.BQ1__[p2 + c2 + c3]); + score += this.ts_(this.BQ2__[p2 + c3 + c4]); + score += this.ts_(this.BQ3__[p3 + c2 + c3]); + score += this.ts_(this.BQ4__[p3 + c3 + c4]); + score += this.ts_(this.TQ1__[p2 + c1 + c2 + c3]); + score += this.ts_(this.TQ2__[p2 + c2 + c3 + c4]); + score += this.ts_(this.TQ3__[p3 + c1 + c2 + c3]); + score += this.ts_(this.TQ4__[p3 + c2 + c3 + c4]); + var p = "O"; + if (score > 0) { + result.push(word); + word = ""; + p = "B"; + } + p1 = p2; + p2 = p3; + p3 = p; + word += seg[i]; + } + result.push(word); + + return result; + } + + lunr.TinySegmenter = TinySegmenter; + }; + +})); \ No newline at end of file diff --git a/mkdocs/contrib/search/prebuild-index.js b/mkdocs/contrib/search/prebuild-index.js new file mode 100644 index 0000000000..835d17ba37 --- /dev/null +++ b/mkdocs/contrib/search/prebuild-index.js @@ -0,0 +1,56 @@ +var lunr = require('./templates/search/lunr'), + stdin = process.stdin, + stdout = process.stdout, + buffer = []; + +stdin.resume(); +stdin.setEncoding('utf8'); + +stdin.on('data', function (data) { + buffer.push(data); +}); + +stdin.on('end', function () { + var data = JSON.parse(buffer.join('')), + lang = ['en']; + + if (data.config) { + if (data.config.lang && data.config.lang.length) { + lang = data.config.lang; + if (lang.length > 1 || lang[0] !== "en") { + require('./lunr-language/lunr.stemmer.support')(lunr); + if (lang.length > 1) { + require('./lunr-language/lunr.multi')(lunr); + } + if (lang.includes("ja") || lang.includes("jp")) { + require('./lunr-language/tinyseg')(lunr); + } + for (var i=0; i < lang.length; i++) { + if (lang[i] != 'en') { + require('./lunr-language/lunr.' + lang[i])(lunr); + } + } + } + } + if (data.config.separator && data.config.separator.length) { + lunr.tokenizer.separator = new RegExp(data.config.separator); + } + } + + var idx = lunr(function () { + if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) { + this.use(lunr[lang[0]]); + } else if (lang.length > 1) { + this.use(lunr.multiLanguage.apply(null, lang)); + } + this.field('title'); + this.field('text'); + this.ref('location'); + + data.docs.forEach(function (doc) { + this.add(doc); + }, this); + }); + + stdout.write(JSON.stringify(idx)); +}); diff --git a/mkdocs/contrib/legacy_search/search_index.py b/mkdocs/contrib/search/search_index.py similarity index 54% rename from mkdocs/contrib/legacy_search/search_index.py rename to mkdocs/contrib/search/search_index.py index ba26f02483..bef81393e8 100644 --- a/mkdocs/contrib/legacy_search/search_index.py +++ b/mkdocs/contrib/search/search_index.py @@ -1,24 +1,29 @@ -# coding: utf-8 +import os +import re +import json +import logging +import subprocess -from __future__ import unicode_literals +from html.parser import HTMLParser -import json -from mkdocs import utils +try: + from lunr import lunr + haslunrpy = True +except ImportError: + haslunrpy = False -try: # pragma: no cover - from html.parser import HTMLParser # noqa -except ImportError: # pragma: no cover - from HTMLParser import HTMLParser # noqa +log = logging.getLogger(__name__) -class SearchIndex(object): +class SearchIndex: """ Search index is a collection of pages and sections (heading tags and their following content are sections). """ - def __init__(self): + def __init__(self, **config): self._entries = [] + self.config = config def _find_toc_by_id(self, toc, id_): """ @@ -26,7 +31,7 @@ def _find_toc_by_id(self, toc, id_): and return the matched item in the TOC. """ for toc_item in toc: - if toc_item.url[1:] == id_: + if toc_item.id == id_: return toc_item toc_item_r = self._find_toc_by_id(toc_item.children, id_) if toc_item_r is not None: @@ -34,12 +39,14 @@ def _find_toc_by_id(self, toc, id_): def _add_entry(self, title, text, loc): """ - A simple wrapper to add an entry and ensure the contents - is UTF8 encoded. + A simple wrapper to add an entry, dropping bad characters. """ + text = text.replace('\u00a0', ' ') + text = re.sub(r'[ \t\n\r\f\v]+', ' ', text.strip()) + self._entries.append({ 'title': title, - 'text': utils.text_type(text.strip().encode('utf-8'), encoding='utf-8'), + 'text': text, 'location': loc }) @@ -59,17 +66,19 @@ def add_entry_from_context(self, page): # Get the absolute URL for the page, this is then # prepended to the urls of the sections - abs_url = page.abs_url + url = page.url # Create an entry for the full page. + text = parser.stripped_html.rstrip('\n') if self.config['indexing'] == 'full' else '' self._add_entry( title=page.title, - text=self.strip_tags(page.content).rstrip('\n'), - loc=abs_url + text=text, + loc=url ) - for section in parser.data: - self.create_entry_for_section(section, page.toc, abs_url) + if self.config['indexing'] in ['full', 'sections']: + for section in parser.data: + self.create_entry_for_section(section, page.toc, url) def create_entry_for_section(self, section, toc, abs_url): """ @@ -80,10 +89,11 @@ def create_entry_for_section(self, section, toc, abs_url): toc_item = self._find_toc_by_id(toc, section.id) + text = ' '.join(section.text) if self.config['indexing'] == 'full' else '' if toc_item is not None: self._add_entry( title=toc_item.title, - text=u" ".join(section.text), + text=text, loc=abs_url + toc_item.url ) @@ -91,41 +101,48 @@ def generate_search_index(self): """python to json conversion""" page_dicts = { 'docs': self._entries, + 'config': self.config } - return json.dumps(page_dicts, sort_keys=True, indent=4) - - def strip_tags(self, html): - """strip html tags from data""" - s = HTMLStripper() - s.feed(html) - return s.get_data() - - -class HTMLStripper(HTMLParser): - """ - A simple HTML parser that stores all of the data within tags - but ignores the tags themselves and thus strips them from the - content. - """ - - def __init__(self, *args, **kwargs): - # HTMLParser is a old-style class in Python 2, so - # super() wont work here. - HTMLParser.__init__(self, *args, **kwargs) - - self.data = [] - - def handle_data(self, d): - """ - Called for the text contents of each tag. - """ - self.data.append(d) - - def get_data(self): - return '\n'.join(self.data) - - -class ContentSection(object): + data = json.dumps(page_dicts, sort_keys=True, separators=(',', ':'), default=str) + + if self.config['prebuild_index'] in (True, 'node'): + try: + script_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'prebuild-index.js') + p = subprocess.Popen( + ['node', script_path], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + idx, err = p.communicate(data.encode('utf-8')) + if not err: + idx = idx.decode('utf-8') if hasattr(idx, 'decode') else idx + page_dicts['index'] = json.loads(idx) + data = json.dumps(page_dicts, sort_keys=True, separators=(',', ':')) + log.debug('Pre-built search index created successfully.') + else: + log.warning(f'Failed to pre-build search index. Error: {err}') + except (OSError, ValueError) as e: + log.warning(f'Failed to pre-build search index. Error: {e}') + elif self.config['prebuild_index'] == 'python': + if haslunrpy: + idx = lunr( + ref='location', fields=('title', 'text'), documents=self._entries, + languages=self.config['lang']) + page_dicts['index'] = idx.serialize() + data = json.dumps(page_dicts, sort_keys=True, separators=(',', ':')) + else: + log.warning( + "Failed to pre-build search index. The 'python' method was specified; " + "however, the 'lunr.py' library does not appear to be installed. Try " + "installing it with 'pip install lunr'. If you are using any language " + "other than English you will also need to install 'lunr[languages]'." + ) + + return data + + +class ContentSection: """ Used by the ContentParser class to capture the information we need when it is parsing the HMTL. @@ -137,11 +154,11 @@ def __init__(self, text=None, id_=None, title=None): self.title = title def __eq__(self, other): - return all([ - self.text == other.text, - self.id == other.id, + return ( + self.text == other.text and + self.id == other.id and self.title == other.title - ]) + ) class ContentParser(HTMLParser): @@ -153,19 +170,18 @@ class ContentParser(HTMLParser): def __init__(self, *args, **kwargs): - # HTMLParser is a old-style class in Python 2, so - # super() wont work here. - HTMLParser.__init__(self, *args, **kwargs) + super().__init__(*args, **kwargs) self.data = [] self.section = None self.is_header_tag = False + self._stripped_html = [] def handle_starttag(self, tag, attrs): """Called at the start of every HTML tag.""" # We only care about the opening tag for headings. - if tag not in (["h%d" % x for x in range(1, 7)]): + if tag not in ([f"h{x}" for x in range(1, 7)]): return # We are dealing with a new header, create a new section @@ -182,7 +198,7 @@ def handle_endtag(self, tag): """Called at the end of every HTML tag.""" # We only care about the opening tag for headings. - if tag not in (["h%d" % x for x in range(1, 7)]): + if tag not in ([f"h{x}" for x in range(1, 7)]): return self.is_header_tag = False @@ -192,6 +208,8 @@ def handle_data(self, data): Called for the text contents of each tag. """ + self._stripped_html.append(data) + if self.section is None: # This means we have some content at the start of the # HTML before we reach a heading tag. We don't actually @@ -206,3 +224,7 @@ def handle_data(self, data): self.section.title = data else: self.section.text.append(data.rstrip('\n')) + + @property + def stripped_html(self): + return '\n'.join(self._stripped_html) diff --git a/mkdocs/contrib/search/templates/search/lunr.js b/mkdocs/contrib/search/templates/search/lunr.js new file mode 100644 index 0000000000..6aa370fbcb --- /dev/null +++ b/mkdocs/contrib/search/templates/search/lunr.js @@ -0,0 +1,3475 @@ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + */ + +;(function(){ + +/** + * A convenience function for configuring and constructing + * a new lunr Index. + * + * A lunr.Builder instance is created and the pipeline setup + * with a trimmer, stop word filter and stemmer. + * + * This builder object is yielded to the configuration function + * that is passed as a parameter, allowing the list of fields + * and other builder parameters to be customised. + * + * All documents _must_ be added within the passed config function. + * + * @example + * var idx = lunr(function () { + * this.field('title') + * this.field('body') + * this.ref('id') + * + * documents.forEach(function (doc) { + * this.add(doc) + * }, this) + * }) + * + * @see {@link lunr.Builder} + * @see {@link lunr.Pipeline} + * @see {@link lunr.trimmer} + * @see {@link lunr.stopWordFilter} + * @see {@link lunr.stemmer} + * @namespace {function} lunr + */ +var lunr = function (config) { + var builder = new lunr.Builder + + builder.pipeline.add( + lunr.trimmer, + lunr.stopWordFilter, + lunr.stemmer + ) + + builder.searchPipeline.add( + lunr.stemmer + ) + + config.call(builder, builder) + return builder.build() +} + +lunr.version = "2.3.9" +/*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * A namespace containing utils for the rest of the lunr library + * @namespace lunr.utils + */ +lunr.utils = {} + +/** + * Print a warning message to the console. + * + * @param {String} message The message to be printed. + * @memberOf lunr.utils + * @function + */ +lunr.utils.warn = (function (global) { + /* eslint-disable no-console */ + return function (message) { + if (global.console && console.warn) { + console.warn(message) + } + } + /* eslint-enable no-console */ +})(this) + +/** + * Convert an object to a string. + * + * In the case of `null` and `undefined` the function returns + * the empty string, in all other cases the result of calling + * `toString` on the passed object is returned. + * + * @param {Any} obj The object to convert to a string. + * @return {String} string representation of the passed object. + * @memberOf lunr.utils + */ +lunr.utils.asString = function (obj) { + if (obj === void 0 || obj === null) { + return "" + } else { + return obj.toString() + } +} + +/** + * Clones an object. + * + * Will create a copy of an existing object such that any mutations + * on the copy cannot affect the original. + * + * Only shallow objects are supported, passing a nested object to this + * function will cause a TypeError. + * + * Objects with primitives, and arrays of primitives are supported. + * + * @param {Object} obj The object to clone. + * @return {Object} a clone of the passed object. + * @throws {TypeError} when a nested object is passed. + * @memberOf Utils + */ +lunr.utils.clone = function (obj) { + if (obj === null || obj === undefined) { + return obj + } + + var clone = Object.create(null), + keys = Object.keys(obj) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i], + val = obj[key] + + if (Array.isArray(val)) { + clone[key] = val.slice() + continue + } + + if (typeof val === 'string' || + typeof val === 'number' || + typeof val === 'boolean') { + clone[key] = val + continue + } + + throw new TypeError("clone is not deep and does not support nested objects") + } + + return clone +} +lunr.FieldRef = function (docRef, fieldName, stringValue) { + this.docRef = docRef + this.fieldName = fieldName + this._stringValue = stringValue +} + +lunr.FieldRef.joiner = "/" + +lunr.FieldRef.fromString = function (s) { + var n = s.indexOf(lunr.FieldRef.joiner) + + if (n === -1) { + throw "malformed field ref string" + } + + var fieldRef = s.slice(0, n), + docRef = s.slice(n + 1) + + return new lunr.FieldRef (docRef, fieldRef, s) +} + +lunr.FieldRef.prototype.toString = function () { + if (this._stringValue == undefined) { + this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef + } + + return this._stringValue +} +/*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * A lunr set. + * + * @constructor + */ +lunr.Set = function (elements) { + this.elements = Object.create(null) + + if (elements) { + this.length = elements.length + + for (var i = 0; i < this.length; i++) { + this.elements[elements[i]] = true + } + } else { + this.length = 0 + } +} + +/** + * A complete set that contains all elements. + * + * @static + * @readonly + * @type {lunr.Set} + */ +lunr.Set.complete = { + intersect: function (other) { + return other + }, + + union: function () { + return this + }, + + contains: function () { + return true + } +} + +/** + * An empty set that contains no elements. + * + * @static + * @readonly + * @type {lunr.Set} + */ +lunr.Set.empty = { + intersect: function () { + return this + }, + + union: function (other) { + return other + }, + + contains: function () { + return false + } +} + +/** + * Returns true if this set contains the specified object. + * + * @param {object} object - Object whose presence in this set is to be tested. + * @returns {boolean} - True if this set contains the specified object. + */ +lunr.Set.prototype.contains = function (object) { + return !!this.elements[object] +} + +/** + * Returns a new set containing only the elements that are present in both + * this set and the specified set. + * + * @param {lunr.Set} other - set to intersect with this set. + * @returns {lunr.Set} a new set that is the intersection of this and the specified set. + */ + +lunr.Set.prototype.intersect = function (other) { + var a, b, elements, intersection = [] + + if (other === lunr.Set.complete) { + return this + } + + if (other === lunr.Set.empty) { + return other + } + + if (this.length < other.length) { + a = this + b = other + } else { + a = other + b = this + } + + elements = Object.keys(a.elements) + + for (var i = 0; i < elements.length; i++) { + var element = elements[i] + if (element in b.elements) { + intersection.push(element) + } + } + + return new lunr.Set (intersection) +} + +/** + * Returns a new set combining the elements of this and the specified set. + * + * @param {lunr.Set} other - set to union with this set. + * @return {lunr.Set} a new set that is the union of this and the specified set. + */ + +lunr.Set.prototype.union = function (other) { + if (other === lunr.Set.complete) { + return lunr.Set.complete + } + + if (other === lunr.Set.empty) { + return this + } + + return new lunr.Set(Object.keys(this.elements).concat(Object.keys(other.elements))) +} +/** + * A function to calculate the inverse document frequency for + * a posting. This is shared between the builder and the index + * + * @private + * @param {object} posting - The posting for a given term + * @param {number} documentCount - The total number of documents. + */ +lunr.idf = function (posting, documentCount) { + var documentsWithTerm = 0 + + for (var fieldName in posting) { + if (fieldName == '_index') continue // Ignore the term index, its not a field + documentsWithTerm += Object.keys(posting[fieldName]).length + } + + var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5) + + return Math.log(1 + Math.abs(x)) +} + +/** + * A token wraps a string representation of a token + * as it is passed through the text processing pipeline. + * + * @constructor + * @param {string} [str=''] - The string token being wrapped. + * @param {object} [metadata={}] - Metadata associated with this token. + */ +lunr.Token = function (str, metadata) { + this.str = str || "" + this.metadata = metadata || {} +} + +/** + * Returns the token string that is being wrapped by this object. + * + * @returns {string} + */ +lunr.Token.prototype.toString = function () { + return this.str +} + +/** + * A token update function is used when updating or optionally + * when cloning a token. + * + * @callback lunr.Token~updateFunction + * @param {string} str - The string representation of the token. + * @param {Object} metadata - All metadata associated with this token. + */ + +/** + * Applies the given function to the wrapped string token. + * + * @example + * token.update(function (str, metadata) { + * return str.toUpperCase() + * }) + * + * @param {lunr.Token~updateFunction} fn - A function to apply to the token string. + * @returns {lunr.Token} + */ +lunr.Token.prototype.update = function (fn) { + this.str = fn(this.str, this.metadata) + return this +} + +/** + * Creates a clone of this token. Optionally a function can be + * applied to the cloned token. + * + * @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token. + * @returns {lunr.Token} + */ +lunr.Token.prototype.clone = function (fn) { + fn = fn || function (s) { return s } + return new lunr.Token (fn(this.str, this.metadata), this.metadata) +} +/*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * A function for splitting a string into tokens ready to be inserted into + * the search index. Uses `lunr.tokenizer.separator` to split strings, change + * the value of this property to change how strings are split into tokens. + * + * This tokenizer will convert its parameter to a string by calling `toString` and + * then will split this string on the character in `lunr.tokenizer.separator`. + * Arrays will have their elements converted to strings and wrapped in a lunr.Token. + * + * Optional metadata can be passed to the tokenizer, this metadata will be cloned and + * added as metadata to every token that is created from the object to be tokenized. + * + * @static + * @param {?(string|object|object[])} obj - The object to convert into tokens + * @param {?object} metadata - Optional metadata to associate with every token + * @returns {lunr.Token[]} + * @see {@link lunr.Pipeline} + */ +lunr.tokenizer = function (obj, metadata) { + if (obj == null || obj == undefined) { + return [] + } + + if (Array.isArray(obj)) { + return obj.map(function (t) { + return new lunr.Token( + lunr.utils.asString(t).toLowerCase(), + lunr.utils.clone(metadata) + ) + }) + } + + var str = obj.toString().toLowerCase(), + len = str.length, + tokens = [] + + for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) { + var char = str.charAt(sliceEnd), + sliceLength = sliceEnd - sliceStart + + if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) { + + if (sliceLength > 0) { + var tokenMetadata = lunr.utils.clone(metadata) || {} + tokenMetadata["position"] = [sliceStart, sliceLength] + tokenMetadata["index"] = tokens.length + + tokens.push( + new lunr.Token ( + str.slice(sliceStart, sliceEnd), + tokenMetadata + ) + ) + } + + sliceStart = sliceEnd + 1 + } + + } + + return tokens +} + +/** + * The separator used to split a string into tokens. Override this property to change the behaviour of + * `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens. + * + * @static + * @see lunr.tokenizer + */ +lunr.tokenizer.separator = /[\s\-]+/ +/*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * lunr.Pipelines maintain an ordered list of functions to be applied to all + * tokens in documents entering the search index and queries being ran against + * the index. + * + * An instance of lunr.Index created with the lunr shortcut will contain a + * pipeline with a stop word filter and an English language stemmer. Extra + * functions can be added before or after either of these functions or these + * default functions can be removed. + * + * When run the pipeline will call each function in turn, passing a token, the + * index of that token in the original list of all tokens and finally a list of + * all the original tokens. + * + * The output of functions in the pipeline will be passed to the next function + * in the pipeline. To exclude a token from entering the index the function + * should return undefined, the rest of the pipeline will not be called with + * this token. + * + * For serialisation of pipelines to work, all functions used in an instance of + * a pipeline should be registered with lunr.Pipeline. Registered functions can + * then be loaded. If trying to load a serialised pipeline that uses functions + * that are not registered an error will be thrown. + * + * If not planning on serialising the pipeline then registering pipeline functions + * is not necessary. + * + * @constructor + */ +lunr.Pipeline = function () { + this._stack = [] +} + +lunr.Pipeline.registeredFunctions = Object.create(null) + +/** + * A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token + * string as well as all known metadata. A pipeline function can mutate the token string + * or mutate (or add) metadata for a given token. + * + * A pipeline function can indicate that the passed token should be discarded by returning + * null, undefined or an empty string. This token will not be passed to any downstream pipeline + * functions and will not be added to the index. + * + * Multiple tokens can be returned by returning an array of tokens. Each token will be passed + * to any downstream pipeline functions and all will returned tokens will be added to the index. + * + * Any number of pipeline functions may be chained together using a lunr.Pipeline. + * + * @interface lunr.PipelineFunction + * @param {lunr.Token} token - A token from the document being processed. + * @param {number} i - The index of this token in the complete list of tokens for this document/field. + * @param {lunr.Token[]} tokens - All tokens for this document/field. + * @returns {(?lunr.Token|lunr.Token[])} + */ + +/** + * Register a function with the pipeline. + * + * Functions that are used in the pipeline should be registered if the pipeline + * needs to be serialised, or a serialised pipeline needs to be loaded. + * + * Registering a function does not add it to a pipeline, functions must still be + * added to instances of the pipeline for them to be used when running a pipeline. + * + * @param {lunr.PipelineFunction} fn - The function to check for. + * @param {String} label - The label to register this function with + */ +lunr.Pipeline.registerFunction = function (fn, label) { + if (label in this.registeredFunctions) { + lunr.utils.warn('Overwriting existing registered function: ' + label) + } + + fn.label = label + lunr.Pipeline.registeredFunctions[fn.label] = fn +} + +/** + * Warns if the function is not registered as a Pipeline function. + * + * @param {lunr.PipelineFunction} fn - The function to check for. + * @private + */ +lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) { + var isRegistered = fn.label && (fn.label in this.registeredFunctions) + + if (!isRegistered) { + lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn) + } +} + +/** + * Loads a previously serialised pipeline. + * + * All functions to be loaded must already be registered with lunr.Pipeline. + * If any function from the serialised data has not been registered then an + * error will be thrown. + * + * @param {Object} serialised - The serialised pipeline to load. + * @returns {lunr.Pipeline} + */ +lunr.Pipeline.load = function (serialised) { + var pipeline = new lunr.Pipeline + + serialised.forEach(function (fnName) { + var fn = lunr.Pipeline.registeredFunctions[fnName] + + if (fn) { + pipeline.add(fn) + } else { + throw new Error('Cannot load unregistered function: ' + fnName) + } + }) + + return pipeline +} + +/** + * Adds new functions to the end of the pipeline. + * + * Logs a warning if the function has not been registered. + * + * @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline. + */ +lunr.Pipeline.prototype.add = function () { + var fns = Array.prototype.slice.call(arguments) + + fns.forEach(function (fn) { + lunr.Pipeline.warnIfFunctionNotRegistered(fn) + this._stack.push(fn) + }, this) +} + +/** + * Adds a single function after a function that already exists in the + * pipeline. + * + * Logs a warning if the function has not been registered. + * + * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline. + * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline. + */ +lunr.Pipeline.prototype.after = function (existingFn, newFn) { + lunr.Pipeline.warnIfFunctionNotRegistered(newFn) + + var pos = this._stack.indexOf(existingFn) + if (pos == -1) { + throw new Error('Cannot find existingFn') + } + + pos = pos + 1 + this._stack.splice(pos, 0, newFn) +} + +/** + * Adds a single function before a function that already exists in the + * pipeline. + * + * Logs a warning if the function has not been registered. + * + * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline. + * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline. + */ +lunr.Pipeline.prototype.before = function (existingFn, newFn) { + lunr.Pipeline.warnIfFunctionNotRegistered(newFn) + + var pos = this._stack.indexOf(existingFn) + if (pos == -1) { + throw new Error('Cannot find existingFn') + } + + this._stack.splice(pos, 0, newFn) +} + +/** + * Removes a function from the pipeline. + * + * @param {lunr.PipelineFunction} fn The function to remove from the pipeline. + */ +lunr.Pipeline.prototype.remove = function (fn) { + var pos = this._stack.indexOf(fn) + if (pos == -1) { + return + } + + this._stack.splice(pos, 1) +} + +/** + * Runs the current list of functions that make up the pipeline against the + * passed tokens. + * + * @param {Array} tokens The tokens to run through the pipeline. + * @returns {Array} + */ +lunr.Pipeline.prototype.run = function (tokens) { + var stackLength = this._stack.length + + for (var i = 0; i < stackLength; i++) { + var fn = this._stack[i] + var memo = [] + + for (var j = 0; j < tokens.length; j++) { + var result = fn(tokens[j], j, tokens) + + if (result === null || result === void 0 || result === '') continue + + if (Array.isArray(result)) { + for (var k = 0; k < result.length; k++) { + memo.push(result[k]) + } + } else { + memo.push(result) + } + } + + tokens = memo + } + + return tokens +} + +/** + * Convenience method for passing a string through a pipeline and getting + * strings out. This method takes care of wrapping the passed string in a + * token and mapping the resulting tokens back to strings. + * + * @param {string} str - The string to pass through the pipeline. + * @param {?object} metadata - Optional metadata to associate with the token + * passed to the pipeline. + * @returns {string[]} + */ +lunr.Pipeline.prototype.runString = function (str, metadata) { + var token = new lunr.Token (str, metadata) + + return this.run([token]).map(function (t) { + return t.toString() + }) +} + +/** + * Resets the pipeline by removing any existing processors. + * + */ +lunr.Pipeline.prototype.reset = function () { + this._stack = [] +} + +/** + * Returns a representation of the pipeline ready for serialisation. + * + * Logs a warning if the function has not been registered. + * + * @returns {Array} + */ +lunr.Pipeline.prototype.toJSON = function () { + return this._stack.map(function (fn) { + lunr.Pipeline.warnIfFunctionNotRegistered(fn) + + return fn.label + }) +} +/*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * A vector is used to construct the vector space of documents and queries. These + * vectors support operations to determine the similarity between two documents or + * a document and a query. + * + * Normally no parameters are required for initializing a vector, but in the case of + * loading a previously dumped vector the raw elements can be provided to the constructor. + * + * For performance reasons vectors are implemented with a flat array, where an elements + * index is immediately followed by its value. E.g. [index, value, index, value]. This + * allows the underlying array to be as sparse as possible and still offer decent + * performance when being used for vector calculations. + * + * @constructor + * @param {Number[]} [elements] - The flat list of element index and element value pairs. + */ +lunr.Vector = function (elements) { + this._magnitude = 0 + this.elements = elements || [] +} + + +/** + * Calculates the position within the vector to insert a given index. + * + * This is used internally by insert and upsert. If there are duplicate indexes then + * the position is returned as if the value for that index were to be updated, but it + * is the callers responsibility to check whether there is a duplicate at that index + * + * @param {Number} insertIdx - The index at which the element should be inserted. + * @returns {Number} + */ +lunr.Vector.prototype.positionForIndex = function (index) { + // For an empty vector the tuple can be inserted at the beginning + if (this.elements.length == 0) { + return 0 + } + + var start = 0, + end = this.elements.length / 2, + sliceLength = end - start, + pivotPoint = Math.floor(sliceLength / 2), + pivotIndex = this.elements[pivotPoint * 2] + + while (sliceLength > 1) { + if (pivotIndex < index) { + start = pivotPoint + } + + if (pivotIndex > index) { + end = pivotPoint + } + + if (pivotIndex == index) { + break + } + + sliceLength = end - start + pivotPoint = start + Math.floor(sliceLength / 2) + pivotIndex = this.elements[pivotPoint * 2] + } + + if (pivotIndex == index) { + return pivotPoint * 2 + } + + if (pivotIndex > index) { + return pivotPoint * 2 + } + + if (pivotIndex < index) { + return (pivotPoint + 1) * 2 + } +} + +/** + * Inserts an element at an index within the vector. + * + * Does not allow duplicates, will throw an error if there is already an entry + * for this index. + * + * @param {Number} insertIdx - The index at which the element should be inserted. + * @param {Number} val - The value to be inserted into the vector. + */ +lunr.Vector.prototype.insert = function (insertIdx, val) { + this.upsert(insertIdx, val, function () { + throw "duplicate index" + }) +} + +/** + * Inserts or updates an existing index within the vector. + * + * @param {Number} insertIdx - The index at which the element should be inserted. + * @param {Number} val - The value to be inserted into the vector. + * @param {function} fn - A function that is called for updates, the existing value and the + * requested value are passed as arguments + */ +lunr.Vector.prototype.upsert = function (insertIdx, val, fn) { + this._magnitude = 0 + var position = this.positionForIndex(insertIdx) + + if (this.elements[position] == insertIdx) { + this.elements[position + 1] = fn(this.elements[position + 1], val) + } else { + this.elements.splice(position, 0, insertIdx, val) + } +} + +/** + * Calculates the magnitude of this vector. + * + * @returns {Number} + */ +lunr.Vector.prototype.magnitude = function () { + if (this._magnitude) return this._magnitude + + var sumOfSquares = 0, + elementsLength = this.elements.length + + for (var i = 1; i < elementsLength; i += 2) { + var val = this.elements[i] + sumOfSquares += val * val + } + + return this._magnitude = Math.sqrt(sumOfSquares) +} + +/** + * Calculates the dot product of this vector and another vector. + * + * @param {lunr.Vector} otherVector - The vector to compute the dot product with. + * @returns {Number} + */ +lunr.Vector.prototype.dot = function (otherVector) { + var dotProduct = 0, + a = this.elements, b = otherVector.elements, + aLen = a.length, bLen = b.length, + aVal = 0, bVal = 0, + i = 0, j = 0 + + while (i < aLen && j < bLen) { + aVal = a[i], bVal = b[j] + if (aVal < bVal) { + i += 2 + } else if (aVal > bVal) { + j += 2 + } else if (aVal == bVal) { + dotProduct += a[i + 1] * b[j + 1] + i += 2 + j += 2 + } + } + + return dotProduct +} + +/** + * Calculates the similarity between this vector and another vector. + * + * @param {lunr.Vector} otherVector - The other vector to calculate the + * similarity with. + * @returns {Number} + */ +lunr.Vector.prototype.similarity = function (otherVector) { + return this.dot(otherVector) / this.magnitude() || 0 +} + +/** + * Converts the vector to an array of the elements within the vector. + * + * @returns {Number[]} + */ +lunr.Vector.prototype.toArray = function () { + var output = new Array (this.elements.length / 2) + + for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) { + output[j] = this.elements[i] + } + + return output +} + +/** + * A JSON serializable representation of the vector. + * + * @returns {Number[]} + */ +lunr.Vector.prototype.toJSON = function () { + return this.elements +} +/* eslint-disable */ +/*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + */ + +/** + * lunr.stemmer is an english language stemmer, this is a JavaScript + * implementation of the PorterStemmer taken from http://tartarus.org/~martin + * + * @static + * @implements {lunr.PipelineFunction} + * @param {lunr.Token} token - The string to stem + * @returns {lunr.Token} + * @see {@link lunr.Pipeline} + * @function + */ +lunr.stemmer = (function(){ + var step2list = { + "ational" : "ate", + "tional" : "tion", + "enci" : "ence", + "anci" : "ance", + "izer" : "ize", + "bli" : "ble", + "alli" : "al", + "entli" : "ent", + "eli" : "e", + "ousli" : "ous", + "ization" : "ize", + "ation" : "ate", + "ator" : "ate", + "alism" : "al", + "iveness" : "ive", + "fulness" : "ful", + "ousness" : "ous", + "aliti" : "al", + "iviti" : "ive", + "biliti" : "ble", + "logi" : "log" + }, + + step3list = { + "icate" : "ic", + "ative" : "", + "alize" : "al", + "iciti" : "ic", + "ical" : "ic", + "ful" : "", + "ness" : "" + }, + + c = "[^aeiou]", // consonant + v = "[aeiouy]", // vowel + C = c + "[^aeiouy]*", // consonant sequence + V = v + "[aeiou]*", // vowel sequence + + mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0 + meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1 + mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1 + s_v = "^(" + C + ")?" + v; // vowel in stem + + var re_mgr0 = new RegExp(mgr0); + var re_mgr1 = new RegExp(mgr1); + var re_meq1 = new RegExp(meq1); + var re_s_v = new RegExp(s_v); + + var re_1a = /^(.+?)(ss|i)es$/; + var re2_1a = /^(.+?)([^s])s$/; + var re_1b = /^(.+?)eed$/; + var re2_1b = /^(.+?)(ed|ing)$/; + var re_1b_2 = /.$/; + var re2_1b_2 = /(at|bl|iz)$/; + var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$"); + var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + + var re_1c = /^(.+?[^aeiou])y$/; + var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + + var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + + var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + var re2_4 = /^(.+?)(s|t)(ion)$/; + + var re_5 = /^(.+?)e$/; + var re_5_1 = /ll$/; + var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + + var porterStemmer = function porterStemmer(w) { + var stem, + suffix, + firstch, + re, + re2, + re3, + re4; + + if (w.length < 3) { return w; } + + firstch = w.substr(0,1); + if (firstch == "y") { + w = firstch.toUpperCase() + w.substr(1); + } + + // Step 1a + re = re_1a + re2 = re2_1a; + + if (re.test(w)) { w = w.replace(re,"$1$2"); } + else if (re2.test(w)) { w = w.replace(re2,"$1$2"); } + + // Step 1b + re = re_1b; + re2 = re2_1b; + if (re.test(w)) { + var fp = re.exec(w); + re = re_mgr0; + if (re.test(fp[1])) { + re = re_1b_2; + w = w.replace(re,""); + } + } else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = re_s_v; + if (re2.test(stem)) { + w = stem; + re2 = re2_1b_2; + re3 = re3_1b_2; + re4 = re4_1b_2; + if (re2.test(w)) { w = w + "e"; } + else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); } + else if (re4.test(w)) { w = w + "e"; } + } + } + + // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say) + re = re_1c; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + w = stem + "i"; + } + + // Step 2 + re = re_2; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = re_mgr0; + if (re.test(stem)) { + w = stem + step2list[suffix]; + } + } + + // Step 3 + re = re_3; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = re_mgr0; + if (re.test(stem)) { + w = stem + step3list[suffix]; + } + } + + // Step 4 + re = re_4; + re2 = re2_4; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = re_mgr1; + if (re.test(stem)) { + w = stem; + } + } else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = re_mgr1; + if (re2.test(stem)) { + w = stem; + } + } + + // Step 5 + re = re_5; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = re_mgr1; + re2 = re_meq1; + re3 = re3_5; + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) { + w = stem; + } + } + + re = re_5_1; + re2 = re_mgr1; + if (re.test(w) && re2.test(w)) { + re = re_1b_2; + w = w.replace(re,""); + } + + // and turn initial Y back to y + + if (firstch == "y") { + w = firstch.toLowerCase() + w.substr(1); + } + + return w; + }; + + return function (token) { + return token.update(porterStemmer); + } +})(); + +lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer') +/*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * lunr.generateStopWordFilter builds a stopWordFilter function from the provided + * list of stop words. + * + * The built in lunr.stopWordFilter is built using this generator and can be used + * to generate custom stopWordFilters for applications or non English languages. + * + * @function + * @param {Array} token The token to pass through the filter + * @returns {lunr.PipelineFunction} + * @see lunr.Pipeline + * @see lunr.stopWordFilter + */ +lunr.generateStopWordFilter = function (stopWords) { + var words = stopWords.reduce(function (memo, stopWord) { + memo[stopWord] = stopWord + return memo + }, {}) + + return function (token) { + if (token && words[token.toString()] !== token.toString()) return token + } +} + +/** + * lunr.stopWordFilter is an English language stop word list filter, any words + * contained in the list will not be passed through the filter. + * + * This is intended to be used in the Pipeline. If the token does not pass the + * filter then undefined will be returned. + * + * @function + * @implements {lunr.PipelineFunction} + * @params {lunr.Token} token - A token to check for being a stop word. + * @returns {lunr.Token} + * @see {@link lunr.Pipeline} + */ +lunr.stopWordFilter = lunr.generateStopWordFilter([ + 'a', + 'able', + 'about', + 'across', + 'after', + 'all', + 'almost', + 'also', + 'am', + 'among', + 'an', + 'and', + 'any', + 'are', + 'as', + 'at', + 'be', + 'because', + 'been', + 'but', + 'by', + 'can', + 'cannot', + 'could', + 'dear', + 'did', + 'do', + 'does', + 'either', + 'else', + 'ever', + 'every', + 'for', + 'from', + 'get', + 'got', + 'had', + 'has', + 'have', + 'he', + 'her', + 'hers', + 'him', + 'his', + 'how', + 'however', + 'i', + 'if', + 'in', + 'into', + 'is', + 'it', + 'its', + 'just', + 'least', + 'let', + 'like', + 'likely', + 'may', + 'me', + 'might', + 'most', + 'must', + 'my', + 'neither', + 'no', + 'nor', + 'not', + 'of', + 'off', + 'often', + 'on', + 'only', + 'or', + 'other', + 'our', + 'own', + 'rather', + 'said', + 'say', + 'says', + 'she', + 'should', + 'since', + 'so', + 'some', + 'than', + 'that', + 'the', + 'their', + 'them', + 'then', + 'there', + 'these', + 'they', + 'this', + 'tis', + 'to', + 'too', + 'twas', + 'us', + 'wants', + 'was', + 'we', + 'were', + 'what', + 'when', + 'where', + 'which', + 'while', + 'who', + 'whom', + 'why', + 'will', + 'with', + 'would', + 'yet', + 'you', + 'your' +]) + +lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter') +/*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * lunr.trimmer is a pipeline function for trimming non word + * characters from the beginning and end of tokens before they + * enter the index. + * + * This implementation may not work correctly for non latin + * characters and should either be removed or adapted for use + * with languages with non-latin characters. + * + * @static + * @implements {lunr.PipelineFunction} + * @param {lunr.Token} token The token to pass through the filter + * @returns {lunr.Token} + * @see lunr.Pipeline + */ +lunr.trimmer = function (token) { + return token.update(function (s) { + return s.replace(/^\W+/, '').replace(/\W+$/, '') + }) +} + +lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer') +/*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * A token set is used to store the unique list of all tokens + * within an index. Token sets are also used to represent an + * incoming query to the index, this query token set and index + * token set are then intersected to find which tokens to look + * up in the inverted index. + * + * A token set can hold multiple tokens, as in the case of the + * index token set, or it can hold a single token as in the + * case of a simple query token set. + * + * Additionally token sets are used to perform wildcard matching. + * Leading, contained and trailing wildcards are supported, and + * from this edit distance matching can also be provided. + * + * Token sets are implemented as a minimal finite state automata, + * where both common prefixes and suffixes are shared between tokens. + * This helps to reduce the space used for storing the token set. + * + * @constructor + */ +lunr.TokenSet = function () { + this.final = false + this.edges = {} + this.id = lunr.TokenSet._nextId + lunr.TokenSet._nextId += 1 +} + +/** + * Keeps track of the next, auto increment, identifier to assign + * to a new tokenSet. + * + * TokenSets require a unique identifier to be correctly minimised. + * + * @private + */ +lunr.TokenSet._nextId = 1 + +/** + * Creates a TokenSet instance from the given sorted array of words. + * + * @param {String[]} arr - A sorted array of strings to create the set from. + * @returns {lunr.TokenSet} + * @throws Will throw an error if the input array is not sorted. + */ +lunr.TokenSet.fromArray = function (arr) { + var builder = new lunr.TokenSet.Builder + + for (var i = 0, len = arr.length; i < len; i++) { + builder.insert(arr[i]) + } + + builder.finish() + return builder.root +} + +/** + * Creates a token set from a query clause. + * + * @private + * @param {Object} clause - A single clause from lunr.Query. + * @param {string} clause.term - The query clause term. + * @param {number} [clause.editDistance] - The optional edit distance for the term. + * @returns {lunr.TokenSet} + */ +lunr.TokenSet.fromClause = function (clause) { + if ('editDistance' in clause) { + return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance) + } else { + return lunr.TokenSet.fromString(clause.term) + } +} + +/** + * Creates a token set representing a single string with a specified + * edit distance. + * + * Insertions, deletions, substitutions and transpositions are each + * treated as an edit distance of 1. + * + * Increasing the allowed edit distance will have a dramatic impact + * on the performance of both creating and intersecting these TokenSets. + * It is advised to keep the edit distance less than 3. + * + * @param {string} str - The string to create the token set from. + * @param {number} editDistance - The allowed edit distance to match. + * @returns {lunr.Vector} + */ +lunr.TokenSet.fromFuzzyString = function (str, editDistance) { + var root = new lunr.TokenSet + + var stack = [{ + node: root, + editsRemaining: editDistance, + str: str + }] + + while (stack.length) { + var frame = stack.pop() + + // no edit + if (frame.str.length > 0) { + var char = frame.str.charAt(0), + noEditNode + + if (char in frame.node.edges) { + noEditNode = frame.node.edges[char] + } else { + noEditNode = new lunr.TokenSet + frame.node.edges[char] = noEditNode + } + + if (frame.str.length == 1) { + noEditNode.final = true + } + + stack.push({ + node: noEditNode, + editsRemaining: frame.editsRemaining, + str: frame.str.slice(1) + }) + } + + if (frame.editsRemaining == 0) { + continue + } + + // insertion + if ("*" in frame.node.edges) { + var insertionNode = frame.node.edges["*"] + } else { + var insertionNode = new lunr.TokenSet + frame.node.edges["*"] = insertionNode + } + + if (frame.str.length == 0) { + insertionNode.final = true + } + + stack.push({ + node: insertionNode, + editsRemaining: frame.editsRemaining - 1, + str: frame.str + }) + + // deletion + // can only do a deletion if we have enough edits remaining + // and if there are characters left to delete in the string + if (frame.str.length > 1) { + stack.push({ + node: frame.node, + editsRemaining: frame.editsRemaining - 1, + str: frame.str.slice(1) + }) + } + + // deletion + // just removing the last character from the str + if (frame.str.length == 1) { + frame.node.final = true + } + + // substitution + // can only do a substitution if we have enough edits remaining + // and if there are characters left to substitute + if (frame.str.length >= 1) { + if ("*" in frame.node.edges) { + var substitutionNode = frame.node.edges["*"] + } else { + var substitutionNode = new lunr.TokenSet + frame.node.edges["*"] = substitutionNode + } + + if (frame.str.length == 1) { + substitutionNode.final = true + } + + stack.push({ + node: substitutionNode, + editsRemaining: frame.editsRemaining - 1, + str: frame.str.slice(1) + }) + } + + // transposition + // can only do a transposition if there are edits remaining + // and there are enough characters to transpose + if (frame.str.length > 1) { + var charA = frame.str.charAt(0), + charB = frame.str.charAt(1), + transposeNode + + if (charB in frame.node.edges) { + transposeNode = frame.node.edges[charB] + } else { + transposeNode = new lunr.TokenSet + frame.node.edges[charB] = transposeNode + } + + if (frame.str.length == 1) { + transposeNode.final = true + } + + stack.push({ + node: transposeNode, + editsRemaining: frame.editsRemaining - 1, + str: charA + frame.str.slice(2) + }) + } + } + + return root +} + +/** + * Creates a TokenSet from a string. + * + * The string may contain one or more wildcard characters (*) + * that will allow wildcard matching when intersecting with + * another TokenSet. + * + * @param {string} str - The string to create a TokenSet from. + * @returns {lunr.TokenSet} + */ +lunr.TokenSet.fromString = function (str) { + var node = new lunr.TokenSet, + root = node + + /* + * Iterates through all characters within the passed string + * appending a node for each character. + * + * When a wildcard character is found then a self + * referencing edge is introduced to continually match + * any number of any characters. + */ + for (var i = 0, len = str.length; i < len; i++) { + var char = str[i], + final = (i == len - 1) + + if (char == "*") { + node.edges[char] = node + node.final = final + + } else { + var next = new lunr.TokenSet + next.final = final + + node.edges[char] = next + node = next + } + } + + return root +} + +/** + * Converts this TokenSet into an array of strings + * contained within the TokenSet. + * + * This is not intended to be used on a TokenSet that + * contains wildcards, in these cases the results are + * undefined and are likely to cause an infinite loop. + * + * @returns {string[]} + */ +lunr.TokenSet.prototype.toArray = function () { + var words = [] + + var stack = [{ + prefix: "", + node: this + }] + + while (stack.length) { + var frame = stack.pop(), + edges = Object.keys(frame.node.edges), + len = edges.length + + if (frame.node.final) { + /* In Safari, at this point the prefix is sometimes corrupted, see: + * https://github.com/olivernn/lunr.js/issues/279 Calling any + * String.prototype method forces Safari to "cast" this string to what + * it's supposed to be, fixing the bug. */ + frame.prefix.charAt(0) + words.push(frame.prefix) + } + + for (var i = 0; i < len; i++) { + var edge = edges[i] + + stack.push({ + prefix: frame.prefix.concat(edge), + node: frame.node.edges[edge] + }) + } + } + + return words +} + +/** + * Generates a string representation of a TokenSet. + * + * This is intended to allow TokenSets to be used as keys + * in objects, largely to aid the construction and minimisation + * of a TokenSet. As such it is not designed to be a human + * friendly representation of the TokenSet. + * + * @returns {string} + */ +lunr.TokenSet.prototype.toString = function () { + // NOTE: Using Object.keys here as this.edges is very likely + // to enter 'hash-mode' with many keys being added + // + // avoiding a for-in loop here as it leads to the function + // being de-optimised (at least in V8). From some simple + // benchmarks the performance is comparable, but allowing + // V8 to optimize may mean easy performance wins in the future. + + if (this._str) { + return this._str + } + + var str = this.final ? '1' : '0', + labels = Object.keys(this.edges).sort(), + len = labels.length + + for (var i = 0; i < len; i++) { + var label = labels[i], + node = this.edges[label] + + str = str + label + node.id + } + + return str +} + +/** + * Returns a new TokenSet that is the intersection of + * this TokenSet and the passed TokenSet. + * + * This intersection will take into account any wildcards + * contained within the TokenSet. + * + * @param {lunr.TokenSet} b - An other TokenSet to intersect with. + * @returns {lunr.TokenSet} + */ +lunr.TokenSet.prototype.intersect = function (b) { + var output = new lunr.TokenSet, + frame = undefined + + var stack = [{ + qNode: b, + output: output, + node: this + }] + + while (stack.length) { + frame = stack.pop() + + // NOTE: As with the #toString method, we are using + // Object.keys and a for loop instead of a for-in loop + // as both of these objects enter 'hash' mode, causing + // the function to be de-optimised in V8 + var qEdges = Object.keys(frame.qNode.edges), + qLen = qEdges.length, + nEdges = Object.keys(frame.node.edges), + nLen = nEdges.length + + for (var q = 0; q < qLen; q++) { + var qEdge = qEdges[q] + + for (var n = 0; n < nLen; n++) { + var nEdge = nEdges[n] + + if (nEdge == qEdge || qEdge == '*') { + var node = frame.node.edges[nEdge], + qNode = frame.qNode.edges[qEdge], + final = node.final && qNode.final, + next = undefined + + if (nEdge in frame.output.edges) { + // an edge already exists for this character + // no need to create a new node, just set the finality + // bit unless this node is already final + next = frame.output.edges[nEdge] + next.final = next.final || final + + } else { + // no edge exists yet, must create one + // set the finality bit and insert it + // into the output + next = new lunr.TokenSet + next.final = final + frame.output.edges[nEdge] = next + } + + stack.push({ + qNode: qNode, + output: next, + node: node + }) + } + } + } + } + + return output +} +lunr.TokenSet.Builder = function () { + this.previousWord = "" + this.root = new lunr.TokenSet + this.uncheckedNodes = [] + this.minimizedNodes = {} +} + +lunr.TokenSet.Builder.prototype.insert = function (word) { + var node, + commonPrefix = 0 + + if (word < this.previousWord) { + throw new Error ("Out of order word insertion") + } + + for (var i = 0; i < word.length && i < this.previousWord.length; i++) { + if (word[i] != this.previousWord[i]) break + commonPrefix++ + } + + this.minimize(commonPrefix) + + if (this.uncheckedNodes.length == 0) { + node = this.root + } else { + node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child + } + + for (var i = commonPrefix; i < word.length; i++) { + var nextNode = new lunr.TokenSet, + char = word[i] + + node.edges[char] = nextNode + + this.uncheckedNodes.push({ + parent: node, + char: char, + child: nextNode + }) + + node = nextNode + } + + node.final = true + this.previousWord = word +} + +lunr.TokenSet.Builder.prototype.finish = function () { + this.minimize(0) +} + +lunr.TokenSet.Builder.prototype.minimize = function (downTo) { + for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) { + var node = this.uncheckedNodes[i], + childKey = node.child.toString() + + if (childKey in this.minimizedNodes) { + node.parent.edges[node.char] = this.minimizedNodes[childKey] + } else { + // Cache the key for this node since + // we know it can't change anymore + node.child._str = childKey + + this.minimizedNodes[childKey] = node.child + } + + this.uncheckedNodes.pop() + } +} +/*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * An index contains the built index of all documents and provides a query interface + * to the index. + * + * Usually instances of lunr.Index will not be created using this constructor, instead + * lunr.Builder should be used to construct new indexes, or lunr.Index.load should be + * used to load previously built and serialized indexes. + * + * @constructor + * @param {Object} attrs - The attributes of the built search index. + * @param {Object} attrs.invertedIndex - An index of term/field to document reference. + * @param {Object} attrs.fieldVectors - Field vectors + * @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens. + * @param {string[]} attrs.fields - The names of indexed document fields. + * @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms. + */ +lunr.Index = function (attrs) { + this.invertedIndex = attrs.invertedIndex + this.fieldVectors = attrs.fieldVectors + this.tokenSet = attrs.tokenSet + this.fields = attrs.fields + this.pipeline = attrs.pipeline +} + +/** + * A result contains details of a document matching a search query. + * @typedef {Object} lunr.Index~Result + * @property {string} ref - The reference of the document this result represents. + * @property {number} score - A number between 0 and 1 representing how similar this document is to the query. + * @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match. + */ + +/** + * Although lunr provides the ability to create queries using lunr.Query, it also provides a simple + * query language which itself is parsed into an instance of lunr.Query. + * + * For programmatically building queries it is advised to directly use lunr.Query, the query language + * is best used for human entered text rather than program generated text. + * + * At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported + * and will be combined with OR, e.g `hello world` will match documents that contain either 'hello' + * or 'world', though those that contain both will rank higher in the results. + * + * Wildcards can be included in terms to match one or more unspecified characters, these wildcards can + * be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding + * wildcards will increase the number of documents that will be found but can also have a negative + * impact on query performance, especially with wildcards at the beginning of a term. + * + * Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term + * hello in the title field will match this query. Using a field not present in the index will lead + * to an error being thrown. + * + * Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term + * boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported + * to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2. + * Avoid large values for edit distance to improve query performance. + * + * Each term also supports a presence modifier. By default a term's presence in document is optional, however + * this can be changed to either required or prohibited. For a term's presence to be required in a document the + * term should be prefixed with a '+', e.g. `+foo bar` is a search for documents that must contain 'foo' and + * optionally contain 'bar'. Conversely a leading '-' sets the terms presence to prohibited, i.e. it must not + * appear in a document, e.g. `-foo bar` is a search for documents that do not contain 'foo' but may contain 'bar'. + * + * To escape special characters the backslash character '\' can be used, this allows searches to include + * characters that would normally be considered modifiers, e.g. `foo\~2` will search for a term "foo~2" instead + * of attempting to apply a boost of 2 to the search term "foo". + * + * @typedef {string} lunr.Index~QueryString + * @example Simple single term query + * hello + * @example Multiple term query + * hello world + * @example term scoped to a field + * title:hello + * @example term with a boost of 10 + * hello^10 + * @example term with an edit distance of 2 + * hello~2 + * @example terms with presence modifiers + * -foo +bar baz + */ + +/** + * Performs a search against the index using lunr query syntax. + * + * Results will be returned sorted by their score, the most relevant results + * will be returned first. For details on how the score is calculated, please see + * the {@link https://lunrjs.com/guides/searching.html#scoring|guide}. + * + * For more programmatic querying use lunr.Index#query. + * + * @param {lunr.Index~QueryString} queryString - A string containing a lunr query. + * @throws {lunr.QueryParseError} If the passed query string cannot be parsed. + * @returns {lunr.Index~Result[]} + */ +lunr.Index.prototype.search = function (queryString) { + return this.query(function (query) { + var parser = new lunr.QueryParser(queryString, query) + parser.parse() + }) +} + +/** + * A query builder callback provides a query object to be used to express + * the query to perform on the index. + * + * @callback lunr.Index~queryBuilder + * @param {lunr.Query} query - The query object to build up. + * @this lunr.Query + */ + +/** + * Performs a query against the index using the yielded lunr.Query object. + * + * If performing programmatic queries against the index, this method is preferred + * over lunr.Index#search so as to avoid the additional query parsing overhead. + * + * A query object is yielded to the supplied function which should be used to + * express the query to be run against the index. + * + * Note that although this function takes a callback parameter it is _not_ an + * asynchronous operation, the callback is just yielded a query object to be + * customized. + * + * @param {lunr.Index~queryBuilder} fn - A function that is used to build the query. + * @returns {lunr.Index~Result[]} + */ +lunr.Index.prototype.query = function (fn) { + // for each query clause + // * process terms + // * expand terms from token set + // * find matching documents and metadata + // * get document vectors + // * score documents + + var query = new lunr.Query(this.fields), + matchingFields = Object.create(null), + queryVectors = Object.create(null), + termFieldCache = Object.create(null), + requiredMatches = Object.create(null), + prohibitedMatches = Object.create(null) + + /* + * To support field level boosts a query vector is created per + * field. An empty vector is eagerly created to support negated + * queries. + */ + for (var i = 0; i < this.fields.length; i++) { + queryVectors[this.fields[i]] = new lunr.Vector + } + + fn.call(query, query) + + for (var i = 0; i < query.clauses.length; i++) { + /* + * Unless the pipeline has been disabled for this term, which is + * the case for terms with wildcards, we need to pass the clause + * term through the search pipeline. A pipeline returns an array + * of processed terms. Pipeline functions may expand the passed + * term, which means we may end up performing multiple index lookups + * for a single query term. + */ + var clause = query.clauses[i], + terms = null, + clauseMatches = lunr.Set.empty + + if (clause.usePipeline) { + terms = this.pipeline.runString(clause.term, { + fields: clause.fields + }) + } else { + terms = [clause.term] + } + + for (var m = 0; m < terms.length; m++) { + var term = terms[m] + + /* + * Each term returned from the pipeline needs to use the same query + * clause object, e.g. the same boost and or edit distance. The + * simplest way to do this is to re-use the clause object but mutate + * its term property. + */ + clause.term = term + + /* + * From the term in the clause we create a token set which will then + * be used to intersect the indexes token set to get a list of terms + * to lookup in the inverted index + */ + var termTokenSet = lunr.TokenSet.fromClause(clause), + expandedTerms = this.tokenSet.intersect(termTokenSet).toArray() + + /* + * If a term marked as required does not exist in the tokenSet it is + * impossible for the search to return any matches. We set all the field + * scoped required matches set to empty and stop examining any further + * clauses. + */ + if (expandedTerms.length === 0 && clause.presence === lunr.Query.presence.REQUIRED) { + for (var k = 0; k < clause.fields.length; k++) { + var field = clause.fields[k] + requiredMatches[field] = lunr.Set.empty + } + + break + } + + for (var j = 0; j < expandedTerms.length; j++) { + /* + * For each term get the posting and termIndex, this is required for + * building the query vector. + */ + var expandedTerm = expandedTerms[j], + posting = this.invertedIndex[expandedTerm], + termIndex = posting._index + + for (var k = 0; k < clause.fields.length; k++) { + /* + * For each field that this query term is scoped by (by default + * all fields are in scope) we need to get all the document refs + * that have this term in that field. + * + * The posting is the entry in the invertedIndex for the matching + * term from above. + */ + var field = clause.fields[k], + fieldPosting = posting[field], + matchingDocumentRefs = Object.keys(fieldPosting), + termField = expandedTerm + "/" + field, + matchingDocumentsSet = new lunr.Set(matchingDocumentRefs) + + /* + * if the presence of this term is required ensure that the matching + * documents are added to the set of required matches for this clause. + * + */ + if (clause.presence == lunr.Query.presence.REQUIRED) { + clauseMatches = clauseMatches.union(matchingDocumentsSet) + + if (requiredMatches[field] === undefined) { + requiredMatches[field] = lunr.Set.complete + } + } + + /* + * if the presence of this term is prohibited ensure that the matching + * documents are added to the set of prohibited matches for this field, + * creating that set if it does not yet exist. + */ + if (clause.presence == lunr.Query.presence.PROHIBITED) { + if (prohibitedMatches[field] === undefined) { + prohibitedMatches[field] = lunr.Set.empty + } + + prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet) + + /* + * Prohibited matches should not be part of the query vector used for + * similarity scoring and no metadata should be extracted so we continue + * to the next field + */ + continue + } + + /* + * The query field vector is populated using the termIndex found for + * the term and a unit value with the appropriate boost applied. + * Using upsert because there could already be an entry in the vector + * for the term we are working with. In that case we just add the scores + * together. + */ + queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b }) + + /** + * If we've already seen this term, field combo then we've already collected + * the matching documents and metadata, no need to go through all that again + */ + if (termFieldCache[termField]) { + continue + } + + for (var l = 0; l < matchingDocumentRefs.length; l++) { + /* + * All metadata for this term/field/document triple + * are then extracted and collected into an instance + * of lunr.MatchData ready to be returned in the query + * results + */ + var matchingDocumentRef = matchingDocumentRefs[l], + matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field), + metadata = fieldPosting[matchingDocumentRef], + fieldMatch + + if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) { + matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata) + } else { + fieldMatch.add(expandedTerm, field, metadata) + } + + } + + termFieldCache[termField] = true + } + } + } + + /** + * If the presence was required we need to update the requiredMatches field sets. + * We do this after all fields for the term have collected their matches because + * the clause terms presence is required in _any_ of the fields not _all_ of the + * fields. + */ + if (clause.presence === lunr.Query.presence.REQUIRED) { + for (var k = 0; k < clause.fields.length; k++) { + var field = clause.fields[k] + requiredMatches[field] = requiredMatches[field].intersect(clauseMatches) + } + } + } + + /** + * Need to combine the field scoped required and prohibited + * matching documents into a global set of required and prohibited + * matches + */ + var allRequiredMatches = lunr.Set.complete, + allProhibitedMatches = lunr.Set.empty + + for (var i = 0; i < this.fields.length; i++) { + var field = this.fields[i] + + if (requiredMatches[field]) { + allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field]) + } + + if (prohibitedMatches[field]) { + allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field]) + } + } + + var matchingFieldRefs = Object.keys(matchingFields), + results = [], + matches = Object.create(null) + + /* + * If the query is negated (contains only prohibited terms) + * we need to get _all_ fieldRefs currently existing in the + * index. This is only done when we know that the query is + * entirely prohibited terms to avoid any cost of getting all + * fieldRefs unnecessarily. + * + * Additionally, blank MatchData must be created to correctly + * populate the results. + */ + if (query.isNegated()) { + matchingFieldRefs = Object.keys(this.fieldVectors) + + for (var i = 0; i < matchingFieldRefs.length; i++) { + var matchingFieldRef = matchingFieldRefs[i] + var fieldRef = lunr.FieldRef.fromString(matchingFieldRef) + matchingFields[matchingFieldRef] = new lunr.MatchData + } + } + + for (var i = 0; i < matchingFieldRefs.length; i++) { + /* + * Currently we have document fields that match the query, but we + * need to return documents. The matchData and scores are combined + * from multiple fields belonging to the same document. + * + * Scores are calculated by field, using the query vectors created + * above, and combined into a final document score using addition. + */ + var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]), + docRef = fieldRef.docRef + + if (!allRequiredMatches.contains(docRef)) { + continue + } + + if (allProhibitedMatches.contains(docRef)) { + continue + } + + var fieldVector = this.fieldVectors[fieldRef], + score = queryVectors[fieldRef.fieldName].similarity(fieldVector), + docMatch + + if ((docMatch = matches[docRef]) !== undefined) { + docMatch.score += score + docMatch.matchData.combine(matchingFields[fieldRef]) + } else { + var match = { + ref: docRef, + score: score, + matchData: matchingFields[fieldRef] + } + matches[docRef] = match + results.push(match) + } + } + + /* + * Sort the results objects by score, highest first. + */ + return results.sort(function (a, b) { + return b.score - a.score + }) +} + +/** + * Prepares the index for JSON serialization. + * + * The schema for this JSON blob will be described in a + * separate JSON schema file. + * + * @returns {Object} + */ +lunr.Index.prototype.toJSON = function () { + var invertedIndex = Object.keys(this.invertedIndex) + .sort() + .map(function (term) { + return [term, this.invertedIndex[term]] + }, this) + + var fieldVectors = Object.keys(this.fieldVectors) + .map(function (ref) { + return [ref, this.fieldVectors[ref].toJSON()] + }, this) + + return { + version: lunr.version, + fields: this.fields, + fieldVectors: fieldVectors, + invertedIndex: invertedIndex, + pipeline: this.pipeline.toJSON() + } +} + +/** + * Loads a previously serialized lunr.Index + * + * @param {Object} serializedIndex - A previously serialized lunr.Index + * @returns {lunr.Index} + */ +lunr.Index.load = function (serializedIndex) { + var attrs = {}, + fieldVectors = {}, + serializedVectors = serializedIndex.fieldVectors, + invertedIndex = Object.create(null), + serializedInvertedIndex = serializedIndex.invertedIndex, + tokenSetBuilder = new lunr.TokenSet.Builder, + pipeline = lunr.Pipeline.load(serializedIndex.pipeline) + + if (serializedIndex.version != lunr.version) { + lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'") + } + + for (var i = 0; i < serializedVectors.length; i++) { + var tuple = serializedVectors[i], + ref = tuple[0], + elements = tuple[1] + + fieldVectors[ref] = new lunr.Vector(elements) + } + + for (var i = 0; i < serializedInvertedIndex.length; i++) { + var tuple = serializedInvertedIndex[i], + term = tuple[0], + posting = tuple[1] + + tokenSetBuilder.insert(term) + invertedIndex[term] = posting + } + + tokenSetBuilder.finish() + + attrs.fields = serializedIndex.fields + + attrs.fieldVectors = fieldVectors + attrs.invertedIndex = invertedIndex + attrs.tokenSet = tokenSetBuilder.root + attrs.pipeline = pipeline + + return new lunr.Index(attrs) +} +/*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + */ + +/** + * lunr.Builder performs indexing on a set of documents and + * returns instances of lunr.Index ready for querying. + * + * All configuration of the index is done via the builder, the + * fields to index, the document reference, the text processing + * pipeline and document scoring parameters are all set on the + * builder before indexing. + * + * @constructor + * @property {string} _ref - Internal reference to the document reference field. + * @property {string[]} _fields - Internal reference to the document fields to index. + * @property {object} invertedIndex - The inverted index maps terms to document fields. + * @property {object} documentTermFrequencies - Keeps track of document term frequencies. + * @property {object} documentLengths - Keeps track of the length of documents added to the index. + * @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing. + * @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing. + * @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index. + * @property {number} documentCount - Keeps track of the total number of documents indexed. + * @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75. + * @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2. + * @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space. + * @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index. + */ +lunr.Builder = function () { + this._ref = "id" + this._fields = Object.create(null) + this._documents = Object.create(null) + this.invertedIndex = Object.create(null) + this.fieldTermFrequencies = {} + this.fieldLengths = {} + this.tokenizer = lunr.tokenizer + this.pipeline = new lunr.Pipeline + this.searchPipeline = new lunr.Pipeline + this.documentCount = 0 + this._b = 0.75 + this._k1 = 1.2 + this.termIndex = 0 + this.metadataWhitelist = [] +} + +/** + * Sets the document field used as the document reference. Every document must have this field. + * The type of this field in the document should be a string, if it is not a string it will be + * coerced into a string by calling toString. + * + * The default ref is 'id'. + * + * The ref should _not_ be changed during indexing, it should be set before any documents are + * added to the index. Changing it during indexing can lead to inconsistent results. + * + * @param {string} ref - The name of the reference field in the document. + */ +lunr.Builder.prototype.ref = function (ref) { + this._ref = ref +} + +/** + * A function that is used to extract a field from a document. + * + * Lunr expects a field to be at the top level of a document, if however the field + * is deeply nested within a document an extractor function can be used to extract + * the right field for indexing. + * + * @callback fieldExtractor + * @param {object} doc - The document being added to the index. + * @returns {?(string|object|object[])} obj - The object that will be indexed for this field. + * @example Extracting a nested field + * function (doc) { return doc.nested.field } + */ + +/** + * Adds a field to the list of document fields that will be indexed. Every document being + * indexed should have this field. Null values for this field in indexed documents will + * not cause errors but will limit the chance of that document being retrieved by searches. + * + * All fields should be added before adding documents to the index. Adding fields after + * a document has been indexed will have no effect on already indexed documents. + * + * Fields can be boosted at build time. This allows terms within that field to have more + * importance when ranking search results. Use a field boost to specify that matches within + * one field are more important than other fields. + * + * @param {string} fieldName - The name of a field to index in all documents. + * @param {object} attributes - Optional attributes associated with this field. + * @param {number} [attributes.boost=1] - Boost applied to all terms within this field. + * @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document. + * @throws {RangeError} fieldName cannot contain unsupported characters '/' + */ +lunr.Builder.prototype.field = function (fieldName, attributes) { + if (/\//.test(fieldName)) { + throw new RangeError ("Field '" + fieldName + "' contains illegal character '/'") + } + + this._fields[fieldName] = attributes || {} +} + +/** + * A parameter to tune the amount of field length normalisation that is applied when + * calculating relevance scores. A value of 0 will completely disable any normalisation + * and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b + * will be clamped to the range 0 - 1. + * + * @param {number} number - The value to set for this tuning parameter. + */ +lunr.Builder.prototype.b = function (number) { + if (number < 0) { + this._b = 0 + } else if (number > 1) { + this._b = 1 + } else { + this._b = number + } +} + +/** + * A parameter that controls the speed at which a rise in term frequency results in term + * frequency saturation. The default value is 1.2. Setting this to a higher value will give + * slower saturation levels, a lower value will result in quicker saturation. + * + * @param {number} number - The value to set for this tuning parameter. + */ +lunr.Builder.prototype.k1 = function (number) { + this._k1 = number +} + +/** + * Adds a document to the index. + * + * Before adding fields to the index the index should have been fully setup, with the document + * ref and all fields to index already having been specified. + * + * The document must have a field name as specified by the ref (by default this is 'id') and + * it should have all fields defined for indexing, though null or undefined values will not + * cause errors. + * + * Entire documents can be boosted at build time. Applying a boost to a document indicates that + * this document should rank higher in search results than other documents. + * + * @param {object} doc - The document to add to the index. + * @param {object} attributes - Optional attributes associated with this document. + * @param {number} [attributes.boost=1] - Boost applied to all terms within this document. + */ +lunr.Builder.prototype.add = function (doc, attributes) { + var docRef = doc[this._ref], + fields = Object.keys(this._fields) + + this._documents[docRef] = attributes || {} + this.documentCount += 1 + + for (var i = 0; i < fields.length; i++) { + var fieldName = fields[i], + extractor = this._fields[fieldName].extractor, + field = extractor ? extractor(doc) : doc[fieldName], + tokens = this.tokenizer(field, { + fields: [fieldName] + }), + terms = this.pipeline.run(tokens), + fieldRef = new lunr.FieldRef (docRef, fieldName), + fieldTerms = Object.create(null) + + this.fieldTermFrequencies[fieldRef] = fieldTerms + this.fieldLengths[fieldRef] = 0 + + // store the length of this field for this document + this.fieldLengths[fieldRef] += terms.length + + // calculate term frequencies for this field + for (var j = 0; j < terms.length; j++) { + var term = terms[j] + + if (fieldTerms[term] == undefined) { + fieldTerms[term] = 0 + } + + fieldTerms[term] += 1 + + // add to inverted index + // create an initial posting if one doesn't exist + if (this.invertedIndex[term] == undefined) { + var posting = Object.create(null) + posting["_index"] = this.termIndex + this.termIndex += 1 + + for (var k = 0; k < fields.length; k++) { + posting[fields[k]] = Object.create(null) + } + + this.invertedIndex[term] = posting + } + + // add an entry for this term/fieldName/docRef to the invertedIndex + if (this.invertedIndex[term][fieldName][docRef] == undefined) { + this.invertedIndex[term][fieldName][docRef] = Object.create(null) + } + + // store all whitelisted metadata about this token in the + // inverted index + for (var l = 0; l < this.metadataWhitelist.length; l++) { + var metadataKey = this.metadataWhitelist[l], + metadata = term.metadata[metadataKey] + + if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) { + this.invertedIndex[term][fieldName][docRef][metadataKey] = [] + } + + this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata) + } + } + + } +} + +/** + * Calculates the average document length for this index + * + * @private + */ +lunr.Builder.prototype.calculateAverageFieldLengths = function () { + + var fieldRefs = Object.keys(this.fieldLengths), + numberOfFields = fieldRefs.length, + accumulator = {}, + documentsWithField = {} + + for (var i = 0; i < numberOfFields; i++) { + var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]), + field = fieldRef.fieldName + + documentsWithField[field] || (documentsWithField[field] = 0) + documentsWithField[field] += 1 + + accumulator[field] || (accumulator[field] = 0) + accumulator[field] += this.fieldLengths[fieldRef] + } + + var fields = Object.keys(this._fields) + + for (var i = 0; i < fields.length; i++) { + var fieldName = fields[i] + accumulator[fieldName] = accumulator[fieldName] / documentsWithField[fieldName] + } + + this.averageFieldLength = accumulator +} + +/** + * Builds a vector space model of every document using lunr.Vector + * + * @private + */ +lunr.Builder.prototype.createFieldVectors = function () { + var fieldVectors = {}, + fieldRefs = Object.keys(this.fieldTermFrequencies), + fieldRefsLength = fieldRefs.length, + termIdfCache = Object.create(null) + + for (var i = 0; i < fieldRefsLength; i++) { + var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]), + fieldName = fieldRef.fieldName, + fieldLength = this.fieldLengths[fieldRef], + fieldVector = new lunr.Vector, + termFrequencies = this.fieldTermFrequencies[fieldRef], + terms = Object.keys(termFrequencies), + termsLength = terms.length + + + var fieldBoost = this._fields[fieldName].boost || 1, + docBoost = this._documents[fieldRef.docRef].boost || 1 + + for (var j = 0; j < termsLength; j++) { + var term = terms[j], + tf = termFrequencies[term], + termIndex = this.invertedIndex[term]._index, + idf, score, scoreWithPrecision + + if (termIdfCache[term] === undefined) { + idf = lunr.idf(this.invertedIndex[term], this.documentCount) + termIdfCache[term] = idf + } else { + idf = termIdfCache[term] + } + + score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[fieldName])) + tf) + score *= fieldBoost + score *= docBoost + scoreWithPrecision = Math.round(score * 1000) / 1000 + // Converts 1.23456789 to 1.234. + // Reducing the precision so that the vectors take up less + // space when serialised. Doing it now so that they behave + // the same before and after serialisation. Also, this is + // the fastest approach to reducing a number's precision in + // JavaScript. + + fieldVector.insert(termIndex, scoreWithPrecision) + } + + fieldVectors[fieldRef] = fieldVector + } + + this.fieldVectors = fieldVectors +} + +/** + * Creates a token set of all tokens in the index using lunr.TokenSet + * + * @private + */ +lunr.Builder.prototype.createTokenSet = function () { + this.tokenSet = lunr.TokenSet.fromArray( + Object.keys(this.invertedIndex).sort() + ) +} + +/** + * Builds the index, creating an instance of lunr.Index. + * + * This completes the indexing process and should only be called + * once all documents have been added to the index. + * + * @returns {lunr.Index} + */ +lunr.Builder.prototype.build = function () { + this.calculateAverageFieldLengths() + this.createFieldVectors() + this.createTokenSet() + + return new lunr.Index({ + invertedIndex: this.invertedIndex, + fieldVectors: this.fieldVectors, + tokenSet: this.tokenSet, + fields: Object.keys(this._fields), + pipeline: this.searchPipeline + }) +} + +/** + * Applies a plugin to the index builder. + * + * A plugin is a function that is called with the index builder as its context. + * Plugins can be used to customise or extend the behaviour of the index + * in some way. A plugin is just a function, that encapsulated the custom + * behaviour that should be applied when building the index. + * + * The plugin function will be called with the index builder as its argument, additional + * arguments can also be passed when calling use. The function will be called + * with the index builder as its context. + * + * @param {Function} plugin The plugin to apply. + */ +lunr.Builder.prototype.use = function (fn) { + var args = Array.prototype.slice.call(arguments, 1) + args.unshift(this) + fn.apply(this, args) +} +/** + * Contains and collects metadata about a matching document. + * A single instance of lunr.MatchData is returned as part of every + * lunr.Index~Result. + * + * @constructor + * @param {string} term - The term this match data is associated with + * @param {string} field - The field in which the term was found + * @param {object} metadata - The metadata recorded about this term in this field + * @property {object} metadata - A cloned collection of metadata associated with this document. + * @see {@link lunr.Index~Result} + */ +lunr.MatchData = function (term, field, metadata) { + var clonedMetadata = Object.create(null), + metadataKeys = Object.keys(metadata || {}) + + // Cloning the metadata to prevent the original + // being mutated during match data combination. + // Metadata is kept in an array within the inverted + // index so cloning the data can be done with + // Array#slice + for (var i = 0; i < metadataKeys.length; i++) { + var key = metadataKeys[i] + clonedMetadata[key] = metadata[key].slice() + } + + this.metadata = Object.create(null) + + if (term !== undefined) { + this.metadata[term] = Object.create(null) + this.metadata[term][field] = clonedMetadata + } +} + +/** + * An instance of lunr.MatchData will be created for every term that matches a + * document. However only one instance is required in a lunr.Index~Result. This + * method combines metadata from another instance of lunr.MatchData with this + * objects metadata. + * + * @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one. + * @see {@link lunr.Index~Result} + */ +lunr.MatchData.prototype.combine = function (otherMatchData) { + var terms = Object.keys(otherMatchData.metadata) + + for (var i = 0; i < terms.length; i++) { + var term = terms[i], + fields = Object.keys(otherMatchData.metadata[term]) + + if (this.metadata[term] == undefined) { + this.metadata[term] = Object.create(null) + } + + for (var j = 0; j < fields.length; j++) { + var field = fields[j], + keys = Object.keys(otherMatchData.metadata[term][field]) + + if (this.metadata[term][field] == undefined) { + this.metadata[term][field] = Object.create(null) + } + + for (var k = 0; k < keys.length; k++) { + var key = keys[k] + + if (this.metadata[term][field][key] == undefined) { + this.metadata[term][field][key] = otherMatchData.metadata[term][field][key] + } else { + this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key]) + } + + } + } + } +} + +/** + * Add metadata for a term/field pair to this instance of match data. + * + * @param {string} term - The term this match data is associated with + * @param {string} field - The field in which the term was found + * @param {object} metadata - The metadata recorded about this term in this field + */ +lunr.MatchData.prototype.add = function (term, field, metadata) { + if (!(term in this.metadata)) { + this.metadata[term] = Object.create(null) + this.metadata[term][field] = metadata + return + } + + if (!(field in this.metadata[term])) { + this.metadata[term][field] = metadata + return + } + + var metadataKeys = Object.keys(metadata) + + for (var i = 0; i < metadataKeys.length; i++) { + var key = metadataKeys[i] + + if (key in this.metadata[term][field]) { + this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key]) + } else { + this.metadata[term][field][key] = metadata[key] + } + } +} +/** + * A lunr.Query provides a programmatic way of defining queries to be performed + * against a {@link lunr.Index}. + * + * Prefer constructing a lunr.Query using the {@link lunr.Index#query} method + * so the query object is pre-initialized with the right index fields. + * + * @constructor + * @property {lunr.Query~Clause[]} clauses - An array of query clauses. + * @property {string[]} allFields - An array of all available fields in a lunr.Index. + */ +lunr.Query = function (allFields) { + this.clauses = [] + this.allFields = allFields +} + +/** + * Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause. + * + * This allows wildcards to be added to the beginning and end of a term without having to manually do any string + * concatenation. + * + * The wildcard constants can be bitwise combined to select both leading and trailing wildcards. + * + * @constant + * @default + * @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour + * @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists + * @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists + * @see lunr.Query~Clause + * @see lunr.Query#clause + * @see lunr.Query#term + * @example query term with trailing wildcard + * query.term('foo', { wildcard: lunr.Query.wildcard.TRAILING }) + * @example query term with leading and trailing wildcard + * query.term('foo', { + * wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING + * }) + */ + +lunr.Query.wildcard = new String ("*") +lunr.Query.wildcard.NONE = 0 +lunr.Query.wildcard.LEADING = 1 +lunr.Query.wildcard.TRAILING = 2 + +/** + * Constants for indicating what kind of presence a term must have in matching documents. + * + * @constant + * @enum {number} + * @see lunr.Query~Clause + * @see lunr.Query#clause + * @see lunr.Query#term + * @example query term with required presence + * query.term('foo', { presence: lunr.Query.presence.REQUIRED }) + */ +lunr.Query.presence = { + /** + * Term's presence in a document is optional, this is the default value. + */ + OPTIONAL: 1, + + /** + * Term's presence in a document is required, documents that do not contain + * this term will not be returned. + */ + REQUIRED: 2, + + /** + * Term's presence in a document is prohibited, documents that do contain + * this term will not be returned. + */ + PROHIBITED: 3 +} + +/** + * A single clause in a {@link lunr.Query} contains a term and details on how to + * match that term against a {@link lunr.Index}. + * + * @typedef {Object} lunr.Query~Clause + * @property {string[]} fields - The fields in an index this clause should be matched against. + * @property {number} [boost=1] - Any boost that should be applied when matching this clause. + * @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be. + * @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline. + * @property {number} [wildcard=lunr.Query.wildcard.NONE] - Whether the term should have wildcards appended or prepended. + * @property {number} [presence=lunr.Query.presence.OPTIONAL] - The terms presence in any matching documents. + */ + +/** + * Adds a {@link lunr.Query~Clause} to this query. + * + * Unless the clause contains the fields to be matched all fields will be matched. In addition + * a default boost of 1 is applied to the clause. + * + * @param {lunr.Query~Clause} clause - The clause to add to this query. + * @see lunr.Query~Clause + * @returns {lunr.Query} + */ +lunr.Query.prototype.clause = function (clause) { + if (!('fields' in clause)) { + clause.fields = this.allFields + } + + if (!('boost' in clause)) { + clause.boost = 1 + } + + if (!('usePipeline' in clause)) { + clause.usePipeline = true + } + + if (!('wildcard' in clause)) { + clause.wildcard = lunr.Query.wildcard.NONE + } + + if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) { + clause.term = "*" + clause.term + } + + if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) { + clause.term = "" + clause.term + "*" + } + + if (!('presence' in clause)) { + clause.presence = lunr.Query.presence.OPTIONAL + } + + this.clauses.push(clause) + + return this +} + +/** + * A negated query is one in which every clause has a presence of + * prohibited. These queries require some special processing to return + * the expected results. + * + * @returns boolean + */ +lunr.Query.prototype.isNegated = function () { + for (var i = 0; i < this.clauses.length; i++) { + if (this.clauses[i].presence != lunr.Query.presence.PROHIBITED) { + return false + } + } + + return true +} + +/** + * Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause} + * to the list of clauses that make up this query. + * + * The term is used as is, i.e. no tokenization will be performed by this method. Instead conversion + * to a token or token-like string should be done before calling this method. + * + * The term will be converted to a string by calling `toString`. Multiple terms can be passed as an + * array, each term in the array will share the same options. + * + * @param {object|object[]} term - The term(s) to add to the query. + * @param {object} [options] - Any additional properties to add to the query clause. + * @returns {lunr.Query} + * @see lunr.Query#clause + * @see lunr.Query~Clause + * @example adding a single term to a query + * query.term("foo") + * @example adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard + * query.term("foo", { + * fields: ["title"], + * boost: 10, + * wildcard: lunr.Query.wildcard.TRAILING + * }) + * @example using lunr.tokenizer to convert a string to tokens before using them as terms + * query.term(lunr.tokenizer("foo bar")) + */ +lunr.Query.prototype.term = function (term, options) { + if (Array.isArray(term)) { + term.forEach(function (t) { this.term(t, lunr.utils.clone(options)) }, this) + return this + } + + var clause = options || {} + clause.term = term.toString() + + this.clause(clause) + + return this +} +lunr.QueryParseError = function (message, start, end) { + this.name = "QueryParseError" + this.message = message + this.start = start + this.end = end +} + +lunr.QueryParseError.prototype = new Error +lunr.QueryLexer = function (str) { + this.lexemes = [] + this.str = str + this.length = str.length + this.pos = 0 + this.start = 0 + this.escapeCharPositions = [] +} + +lunr.QueryLexer.prototype.run = function () { + var state = lunr.QueryLexer.lexText + + while (state) { + state = state(this) + } +} + +lunr.QueryLexer.prototype.sliceString = function () { + var subSlices = [], + sliceStart = this.start, + sliceEnd = this.pos + + for (var i = 0; i < this.escapeCharPositions.length; i++) { + sliceEnd = this.escapeCharPositions[i] + subSlices.push(this.str.slice(sliceStart, sliceEnd)) + sliceStart = sliceEnd + 1 + } + + subSlices.push(this.str.slice(sliceStart, this.pos)) + this.escapeCharPositions.length = 0 + + return subSlices.join('') +} + +lunr.QueryLexer.prototype.emit = function (type) { + this.lexemes.push({ + type: type, + str: this.sliceString(), + start: this.start, + end: this.pos + }) + + this.start = this.pos +} + +lunr.QueryLexer.prototype.escapeCharacter = function () { + this.escapeCharPositions.push(this.pos - 1) + this.pos += 1 +} + +lunr.QueryLexer.prototype.next = function () { + if (this.pos >= this.length) { + return lunr.QueryLexer.EOS + } + + var char = this.str.charAt(this.pos) + this.pos += 1 + return char +} + +lunr.QueryLexer.prototype.width = function () { + return this.pos - this.start +} + +lunr.QueryLexer.prototype.ignore = function () { + if (this.start == this.pos) { + this.pos += 1 + } + + this.start = this.pos +} + +lunr.QueryLexer.prototype.backup = function () { + this.pos -= 1 +} + +lunr.QueryLexer.prototype.acceptDigitRun = function () { + var char, charCode + + do { + char = this.next() + charCode = char.charCodeAt(0) + } while (charCode > 47 && charCode < 58) + + if (char != lunr.QueryLexer.EOS) { + this.backup() + } +} + +lunr.QueryLexer.prototype.more = function () { + return this.pos < this.length +} + +lunr.QueryLexer.EOS = 'EOS' +lunr.QueryLexer.FIELD = 'FIELD' +lunr.QueryLexer.TERM = 'TERM' +lunr.QueryLexer.EDIT_DISTANCE = 'EDIT_DISTANCE' +lunr.QueryLexer.BOOST = 'BOOST' +lunr.QueryLexer.PRESENCE = 'PRESENCE' + +lunr.QueryLexer.lexField = function (lexer) { + lexer.backup() + lexer.emit(lunr.QueryLexer.FIELD) + lexer.ignore() + return lunr.QueryLexer.lexText +} + +lunr.QueryLexer.lexTerm = function (lexer) { + if (lexer.width() > 1) { + lexer.backup() + lexer.emit(lunr.QueryLexer.TERM) + } + + lexer.ignore() + + if (lexer.more()) { + return lunr.QueryLexer.lexText + } +} + +lunr.QueryLexer.lexEditDistance = function (lexer) { + lexer.ignore() + lexer.acceptDigitRun() + lexer.emit(lunr.QueryLexer.EDIT_DISTANCE) + return lunr.QueryLexer.lexText +} + +lunr.QueryLexer.lexBoost = function (lexer) { + lexer.ignore() + lexer.acceptDigitRun() + lexer.emit(lunr.QueryLexer.BOOST) + return lunr.QueryLexer.lexText +} + +lunr.QueryLexer.lexEOS = function (lexer) { + if (lexer.width() > 0) { + lexer.emit(lunr.QueryLexer.TERM) + } +} + +// This matches the separator used when tokenising fields +// within a document. These should match otherwise it is +// not possible to search for some tokens within a document. +// +// It is possible for the user to change the separator on the +// tokenizer so it _might_ clash with any other of the special +// characters already used within the search string, e.g. :. +// +// This means that it is possible to change the separator in +// such a way that makes some words unsearchable using a search +// string. +lunr.QueryLexer.termSeparator = lunr.tokenizer.separator + +lunr.QueryLexer.lexText = function (lexer) { + while (true) { + var char = lexer.next() + + if (char == lunr.QueryLexer.EOS) { + return lunr.QueryLexer.lexEOS + } + + // Escape character is '\' + if (char.charCodeAt(0) == 92) { + lexer.escapeCharacter() + continue + } + + if (char == ":") { + return lunr.QueryLexer.lexField + } + + if (char == "~") { + lexer.backup() + if (lexer.width() > 0) { + lexer.emit(lunr.QueryLexer.TERM) + } + return lunr.QueryLexer.lexEditDistance + } + + if (char == "^") { + lexer.backup() + if (lexer.width() > 0) { + lexer.emit(lunr.QueryLexer.TERM) + } + return lunr.QueryLexer.lexBoost + } + + // "+" indicates term presence is required + // checking for length to ensure that only + // leading "+" are considered + if (char == "+" && lexer.width() === 1) { + lexer.emit(lunr.QueryLexer.PRESENCE) + return lunr.QueryLexer.lexText + } + + // "-" indicates term presence is prohibited + // checking for length to ensure that only + // leading "-" are considered + if (char == "-" && lexer.width() === 1) { + lexer.emit(lunr.QueryLexer.PRESENCE) + return lunr.QueryLexer.lexText + } + + if (char.match(lunr.QueryLexer.termSeparator)) { + return lunr.QueryLexer.lexTerm + } + } +} + +lunr.QueryParser = function (str, query) { + this.lexer = new lunr.QueryLexer (str) + this.query = query + this.currentClause = {} + this.lexemeIdx = 0 +} + +lunr.QueryParser.prototype.parse = function () { + this.lexer.run() + this.lexemes = this.lexer.lexemes + + var state = lunr.QueryParser.parseClause + + while (state) { + state = state(this) + } + + return this.query +} + +lunr.QueryParser.prototype.peekLexeme = function () { + return this.lexemes[this.lexemeIdx] +} + +lunr.QueryParser.prototype.consumeLexeme = function () { + var lexeme = this.peekLexeme() + this.lexemeIdx += 1 + return lexeme +} + +lunr.QueryParser.prototype.nextClause = function () { + var completedClause = this.currentClause + this.query.clause(completedClause) + this.currentClause = {} +} + +lunr.QueryParser.parseClause = function (parser) { + var lexeme = parser.peekLexeme() + + if (lexeme == undefined) { + return + } + + switch (lexeme.type) { + case lunr.QueryLexer.PRESENCE: + return lunr.QueryParser.parsePresence + case lunr.QueryLexer.FIELD: + return lunr.QueryParser.parseField + case lunr.QueryLexer.TERM: + return lunr.QueryParser.parseTerm + default: + var errorMessage = "expected either a field or a term, found " + lexeme.type + + if (lexeme.str.length >= 1) { + errorMessage += " with value '" + lexeme.str + "'" + } + + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } +} + +lunr.QueryParser.parsePresence = function (parser) { + var lexeme = parser.consumeLexeme() + + if (lexeme == undefined) { + return + } + + switch (lexeme.str) { + case "-": + parser.currentClause.presence = lunr.Query.presence.PROHIBITED + break + case "+": + parser.currentClause.presence = lunr.Query.presence.REQUIRED + break + default: + var errorMessage = "unrecognised presence operator'" + lexeme.str + "'" + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + var nextLexeme = parser.peekLexeme() + + if (nextLexeme == undefined) { + var errorMessage = "expecting term or field, found nothing" + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + switch (nextLexeme.type) { + case lunr.QueryLexer.FIELD: + return lunr.QueryParser.parseField + case lunr.QueryLexer.TERM: + return lunr.QueryParser.parseTerm + default: + var errorMessage = "expecting term or field, found '" + nextLexeme.type + "'" + throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end) + } +} + +lunr.QueryParser.parseField = function (parser) { + var lexeme = parser.consumeLexeme() + + if (lexeme == undefined) { + return + } + + if (parser.query.allFields.indexOf(lexeme.str) == -1) { + var possibleFields = parser.query.allFields.map(function (f) { return "'" + f + "'" }).join(', '), + errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields + + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + parser.currentClause.fields = [lexeme.str] + + var nextLexeme = parser.peekLexeme() + + if (nextLexeme == undefined) { + var errorMessage = "expecting term, found nothing" + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + switch (nextLexeme.type) { + case lunr.QueryLexer.TERM: + return lunr.QueryParser.parseTerm + default: + var errorMessage = "expecting term, found '" + nextLexeme.type + "'" + throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end) + } +} + +lunr.QueryParser.parseTerm = function (parser) { + var lexeme = parser.consumeLexeme() + + if (lexeme == undefined) { + return + } + + parser.currentClause.term = lexeme.str.toLowerCase() + + if (lexeme.str.indexOf("*") != -1) { + parser.currentClause.usePipeline = false + } + + var nextLexeme = parser.peekLexeme() + + if (nextLexeme == undefined) { + parser.nextClause() + return + } + + switch (nextLexeme.type) { + case lunr.QueryLexer.TERM: + parser.nextClause() + return lunr.QueryParser.parseTerm + case lunr.QueryLexer.FIELD: + parser.nextClause() + return lunr.QueryParser.parseField + case lunr.QueryLexer.EDIT_DISTANCE: + return lunr.QueryParser.parseEditDistance + case lunr.QueryLexer.BOOST: + return lunr.QueryParser.parseBoost + case lunr.QueryLexer.PRESENCE: + parser.nextClause() + return lunr.QueryParser.parsePresence + default: + var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'" + throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end) + } +} + +lunr.QueryParser.parseEditDistance = function (parser) { + var lexeme = parser.consumeLexeme() + + if (lexeme == undefined) { + return + } + + var editDistance = parseInt(lexeme.str, 10) + + if (isNaN(editDistance)) { + var errorMessage = "edit distance must be numeric" + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + parser.currentClause.editDistance = editDistance + + var nextLexeme = parser.peekLexeme() + + if (nextLexeme == undefined) { + parser.nextClause() + return + } + + switch (nextLexeme.type) { + case lunr.QueryLexer.TERM: + parser.nextClause() + return lunr.QueryParser.parseTerm + case lunr.QueryLexer.FIELD: + parser.nextClause() + return lunr.QueryParser.parseField + case lunr.QueryLexer.EDIT_DISTANCE: + return lunr.QueryParser.parseEditDistance + case lunr.QueryLexer.BOOST: + return lunr.QueryParser.parseBoost + case lunr.QueryLexer.PRESENCE: + parser.nextClause() + return lunr.QueryParser.parsePresence + default: + var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'" + throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end) + } +} + +lunr.QueryParser.parseBoost = function (parser) { + var lexeme = parser.consumeLexeme() + + if (lexeme == undefined) { + return + } + + var boost = parseInt(lexeme.str, 10) + + if (isNaN(boost)) { + var errorMessage = "boost must be numeric" + throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end) + } + + parser.currentClause.boost = boost + + var nextLexeme = parser.peekLexeme() + + if (nextLexeme == undefined) { + parser.nextClause() + return + } + + switch (nextLexeme.type) { + case lunr.QueryLexer.TERM: + parser.nextClause() + return lunr.QueryParser.parseTerm + case lunr.QueryLexer.FIELD: + parser.nextClause() + return lunr.QueryParser.parseField + case lunr.QueryLexer.EDIT_DISTANCE: + return lunr.QueryParser.parseEditDistance + case lunr.QueryLexer.BOOST: + return lunr.QueryParser.parseBoost + case lunr.QueryLexer.PRESENCE: + parser.nextClause() + return lunr.QueryParser.parsePresence + default: + var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'" + throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end) + } +} + + /** + * export the module via AMD, CommonJS or as a browser global + * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js + */ + ;(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(factory) + } else if (typeof exports === 'object') { + /** + * Node. Does not work with strict CommonJS, but + * only CommonJS-like enviroments that support module.exports, + * like Node. + */ + module.exports = factory() + } else { + // Browser globals (root is window) + root.lunr = factory() + } + }(this, function () { + /** + * Just return a value to define the module export. + * This example returns an object, but the module + * can return a function as the exported value. + */ + return lunr + })) +})(); diff --git a/mkdocs/contrib/search/templates/search/main.js b/mkdocs/contrib/search/templates/search/main.js new file mode 100644 index 0000000000..c5ccfa61a8 --- /dev/null +++ b/mkdocs/contrib/search/templates/search/main.js @@ -0,0 +1,102 @@ +function getSearchTermFromLocation() { + var sPageURL = window.location.search.substring(1); + var sURLVariables = sPageURL.split('&'); + for (var i = 0; i < sURLVariables.length; i++) { + var sParameterName = sURLVariables[i].split('='); + if (sParameterName[0] == 'q') { + return decodeURIComponent(sParameterName[1].replace(/\+/g, '%20')); + } + } +} + +function joinUrl (base, path) { + if (path.substring(0, 1) === "/") { + // path starts with `/`. Thus it is absolute. + return path; + } + if (base.substring(base.length-1) === "/") { + // base ends with `/` + return base + path; + } + return base + "/" + path; +} + +function formatResult (location, title, summary) { + return ''; +} + +function displayResults (results) { + var search_results = document.getElementById("mkdocs-search-results"); + while (search_results.firstChild) { + search_results.removeChild(search_results.firstChild); + } + if (results.length > 0){ + for (var i=0; i < results.length; i++){ + var result = results[i]; + var html = formatResult(result.location, result.title, result.summary); + search_results.insertAdjacentHTML('beforeend', html); + } + } else { + var noResultsText = search_results.getAttribute('data-no-results-text'); + if (!noResultsText) { + noResultsText = "No results found"; + } + search_results.insertAdjacentHTML('beforeend', '

' + noResultsText + '

'); + } +} + +function doSearch () { + var query = document.getElementById('mkdocs-search-query').value; + if (query.length > min_search_length) { + if (!window.Worker) { + displayResults(search(query)); + } else { + searchWorker.postMessage({query: query}); + } + } else { + // Clear results for short queries + displayResults([]); + } +} + +function initSearch () { + var search_input = document.getElementById('mkdocs-search-query'); + if (search_input) { + search_input.addEventListener("keyup", doSearch); + } + var term = getSearchTermFromLocation(); + if (term) { + search_input.value = term; + doSearch(); + } +} + +function onWorkerMessage (e) { + if (e.data.allowSearch) { + initSearch(); + } else if (e.data.results) { + var results = e.data.results; + displayResults(results); + } else if (e.data.config) { + min_search_length = e.data.config.min_search_length-1; + } +} + +if (!window.Worker) { + console.log('Web Worker API not supported'); + // load index in main thread + $.getScript(joinUrl(base_url, "search/worker.js")).done(function () { + console.log('Loaded worker'); + init(); + window.postMessage = function (msg) { + onWorkerMessage({data: msg}); + }; + }).fail(function (jqxhr, settings, exception) { + console.error('Could not load worker.js'); + }); +} else { + // Wrap search in a web worker + var searchWorker = new Worker(joinUrl(base_url, "search/worker.js")); + searchWorker.postMessage({init: true}); + searchWorker.onmessage = onWorkerMessage; +} diff --git a/mkdocs/contrib/search/templates/search/worker.js b/mkdocs/contrib/search/templates/search/worker.js new file mode 100644 index 0000000000..8628dbce94 --- /dev/null +++ b/mkdocs/contrib/search/templates/search/worker.js @@ -0,0 +1,133 @@ +var base_path = 'function' === typeof importScripts ? '.' : '/search/'; +var allowSearch = false; +var index; +var documents = {}; +var lang = ['en']; +var data; + +function getScript(script, callback) { + console.log('Loading script: ' + script); + $.getScript(base_path + script).done(function () { + callback(); + }).fail(function (jqxhr, settings, exception) { + console.log('Error: ' + exception); + }); +} + +function getScriptsInOrder(scripts, callback) { + if (scripts.length === 0) { + callback(); + return; + } + getScript(scripts[0], function() { + getScriptsInOrder(scripts.slice(1), callback); + }); +} + +function loadScripts(urls, callback) { + if( 'function' === typeof importScripts ) { + importScripts.apply(null, urls); + callback(); + } else { + getScriptsInOrder(urls, callback); + } +} + +function onJSONLoaded () { + data = JSON.parse(this.responseText); + var scriptsToLoad = ['lunr.js']; + if (data.config && data.config.lang && data.config.lang.length) { + lang = data.config.lang; + } + if (lang.length > 1 || lang[0] !== "en") { + scriptsToLoad.push('lunr.stemmer.support.js'); + if (lang.length > 1) { + scriptsToLoad.push('lunr.multi.js'); + } + if (lang.includes("ja") || lang.includes("jp")) { + scriptsToLoad.push('tinyseg.js'); + } + for (var i=0; i < lang.length; i++) { + if (lang[i] != 'en') { + scriptsToLoad.push(['lunr', lang[i], 'js'].join('.')); + } + } + } + loadScripts(scriptsToLoad, onScriptsLoaded); +} + +function onScriptsLoaded () { + console.log('All search scripts loaded, building Lunr index...'); + if (data.config && data.config.separator && data.config.separator.length) { + lunr.tokenizer.separator = new RegExp(data.config.separator); + } + + if (data.index) { + index = lunr.Index.load(data.index); + data.docs.forEach(function (doc) { + documents[doc.location] = doc; + }); + console.log('Lunr pre-built index loaded, search ready'); + } else { + index = lunr(function () { + if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) { + this.use(lunr[lang[0]]); + } else if (lang.length > 1) { + this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility + } + this.field('title'); + this.field('text'); + this.ref('location'); + + for (var i=0; i < data.docs.length; i++) { + var doc = data.docs[i]; + this.add(doc); + documents[doc.location] = doc; + } + }); + console.log('Lunr index built, search ready'); + } + allowSearch = true; + postMessage({config: data.config}); + postMessage({allowSearch: allowSearch}); +} + +function init () { + var oReq = new XMLHttpRequest(); + oReq.addEventListener("load", onJSONLoaded); + var index_path = base_path + '/search_index.json'; + if( 'function' === typeof importScripts ){ + index_path = 'search_index.json'; + } + oReq.open("GET", index_path); + oReq.send(); +} + +function search (query) { + if (!allowSearch) { + console.error('Assets for search still loading'); + return; + } + + var resultDocuments = []; + var results = index.search(query); + for (var i=0; i < results.length; i++){ + var result = results[i]; + doc = documents[result.ref]; + doc.summary = doc.text.substring(0, 200); + resultDocuments.push(doc); + } + return resultDocuments; +} + +if( 'function' === typeof importScripts ) { + onmessage = function (e) { + if (e.data.init) { + init(); + } else if (e.data.query) { + postMessage({ results: search(e.data.query) }); + } else { + console.error("Worker - Unrecognized message: " + e); + } + }; +} diff --git a/mkdocs/exceptions.py b/mkdocs/exceptions.py index 7297997bbc..c72175df27 100644 --- a/mkdocs/exceptions.py +++ b/mkdocs/exceptions.py @@ -1,14 +1,23 @@ -from __future__ import unicode_literals -from click import ClickException +from click import ClickException, echo class MkDocsException(ClickException): """Base exceptions for all MkDocs Exceptions""" +class Abort(MkDocsException): + """Abort the build""" + def show(self, **kwargs): + echo(self.format_message()) + + class ConfigurationError(MkDocsException): """Error in configuration""" -class MarkdownNotFound(MkDocsException): - """A linked local Markdown file isn't found in the table of contents.""" +class BuildError(MkDocsException): + """Error during the build process""" + + +class PluginError(BuildError): + """Error in a plugin""" diff --git a/mkdocs/livereload/__init__.py b/mkdocs/livereload/__init__.py new file mode 100644 index 0000000000..998022de7e --- /dev/null +++ b/mkdocs/livereload/__init__.py @@ -0,0 +1,269 @@ +import functools +import io +import logging +import mimetypes +import os +import os.path +import posixpath +import re +import socketserver +import threading +import time +import warnings +import wsgiref.simple_server + +import watchdog.events +import watchdog.observers.polling + + +class _LoggerAdapter(logging.LoggerAdapter): + def process(self, msg, kwargs): + return time.strftime("[%H:%M:%S] ") + msg, kwargs + + +log = _LoggerAdapter(logging.getLogger(__name__), {}) + + +class LiveReloadServer(socketserver.ThreadingMixIn, wsgiref.simple_server.WSGIServer): + daemon_threads = True + poll_response_timeout = 60 + + def __init__( + self, + builder, + host, + port, + root, + mount_path="/", + polling_interval=0.5, + shutdown_delay=0.25, + **kwargs, + ): + self.builder = builder + self.server_name = host + self.server_port = port + self.root = os.path.abspath(root) + self.mount_path = ("/" + mount_path.lstrip("/")).rstrip("/") + "/" + self.url = f"http://{self.server_name}:{self.server_port}{self.mount_path}" + self.build_delay = 0.1 + self.shutdown_delay = shutdown_delay + # To allow custom error pages. + self.error_handler = lambda code: None + + super().__init__((host, port), _Handler, **kwargs) + self.set_app(self.serve_request) + + self._wanted_epoch = _timestamp() # The version of the site that started building. + self._visible_epoch = self._wanted_epoch # Latest fully built version of the site. + self._epoch_cond = threading.Condition() # Must be held when accessing _visible_epoch. + + self._to_rebuild = {} # Used as an ordered set of functions to call. + self._rebuild_cond = threading.Condition() # Must be held when accessing _to_rebuild. + + self._shutdown = False + self.serve_thread = threading.Thread(target=lambda: self.serve_forever(shutdown_delay)) + self.observer = watchdog.observers.polling.PollingObserver(timeout=polling_interval) + + def watch(self, path, func=None, recursive=True): + """Add the 'path' to watched paths, call the function and reload when any file changes under it.""" + path = os.path.abspath(path) + if func in (None, self.builder): + func = self.builder + else: + warnings.warn( + "Plugins should not pass the 'func' parameter of watch(). " + "The ability to execute custom callbacks will be removed soon.", + DeprecationWarning, + stacklevel=2, + ) + + def callback(event): + if event.is_directory: + return + log.debug(str(event)) + with self._rebuild_cond: + self._to_rebuild[func] = True + self._rebuild_cond.notify_all() + + handler = watchdog.events.FileSystemEventHandler() + handler.on_any_event = callback + log.debug(f"Watching '{path}'") + self.observer.schedule(handler, path, recursive=recursive) + + def serve(self): + self.observer.start() + + log.info(f"Serving on {self.url}") + self.serve_thread.start() + + self._build_loop() + + def _build_loop(self): + while True: + with self._rebuild_cond: + while not self._rebuild_cond.wait_for( + lambda: self._to_rebuild or self._shutdown, timeout=self.shutdown_delay + ): + # We could have used just one wait instead of a loop + timeout, but we need + # occasional breaks, otherwise on Windows we can't receive KeyboardInterrupt. + pass + if self._shutdown: + break + log.info("Detected file changes") + while self._rebuild_cond.wait(timeout=self.build_delay): + log.debug("Waiting for file changes to stop happening") + + self._wanted_epoch = _timestamp() + funcs = list(self._to_rebuild) + self._to_rebuild.clear() + + for func in funcs: + func() + + with self._epoch_cond: + log.info("Reloading browsers") + self._visible_epoch = self._wanted_epoch + self._epoch_cond.notify_all() + + def shutdown(self): + self.observer.stop() + with self._rebuild_cond: + self._shutdown = True + self._rebuild_cond.notify_all() + + if self.serve_thread.is_alive(): + super().shutdown() + self.serve_thread.join() + self.observer.join() + + def serve_request(self, environ, start_response): + try: + result = self._serve_request(environ, start_response) + except Exception: + code = 500 + msg = "500 Internal Server Error" + log.exception(msg) + else: + if result is not None: + return result + code = 404 + msg = "404 Not Found" + + error_content = None + try: + error_content = self.error_handler(code) + except Exception: + log.exception("Failed to render an error message!") + if error_content is None: + error_content = msg.encode() + + start_response(msg, [("Content-Type", "text/html")]) + return [error_content] + + def _serve_request(self, environ, start_response): + # https://bugs.python.org/issue16679 + # https://github.com/bottlepy/bottle/blob/f9b1849db4/bottle.py#L984 + path = environ["PATH_INFO"].encode("latin-1").decode("utf-8", "ignore") + + m = re.fullmatch(r"/livereload/([0-9]+)/[0-9]+", path) + if m: + epoch = int(m[1]) + start_response("200 OK", [("Content-Type", "text/plain")]) + + def condition(): + return self._visible_epoch > epoch + + with self._epoch_cond: + if not condition(): + # Stall the browser, respond as soon as there's something new. + # If there's not, respond anyway after a minute. + self._log_poll_request(environ.get("HTTP_REFERER"), request_id=path) + self._epoch_cond.wait_for(condition, timeout=self.poll_response_timeout) + return [b"%d" % self._visible_epoch] + + if path == "/js/livereload.js": + file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "livereload.js") + elif path.startswith(self.mount_path): + rel_file_path = path[len(self.mount_path):] + if path.endswith("/"): + rel_file_path += "index.html" + # Prevent directory traversal - normalize the path. + rel_file_path = posixpath.normpath("/" + rel_file_path).lstrip("/") + file_path = os.path.join(self.root, rel_file_path) + elif path == "/": + start_response("302 Found", [("Location", self.mount_path)]) + return [] + else: + return None # Not found + + # Wait until the ongoing rebuild (if any) finishes, so we're not serving a half-built site. + with self._epoch_cond: + self._epoch_cond.wait_for(lambda: self._visible_epoch == self._wanted_epoch) + epoch = self._visible_epoch + + try: + file = open(file_path, "rb") + except OSError: + if not path.endswith("/") and os.path.isfile(os.path.join(file_path, "index.html")): + start_response("302 Found", [("Location", path + "/")]) + return [] + return None # Not found + + if file_path.endswith(".html"): + with file: + content = file.read() + content = self._inject_js_into_html(content, epoch) + file = io.BytesIO(content) + content_length = len(content) + else: + content_length = os.path.getsize(file_path) + + content_type = self._guess_type(file_path) + start_response( + "200 OK", [("Content-Type", content_type), ("Content-Length", str(content_length))] + ) + return wsgiref.util.FileWrapper(file) + + @classmethod + def _inject_js_into_html(cls, content, epoch): + try: + body_end = content.rindex(b"") + except ValueError: + body_end = len(content) + # The page will reload if the livereload poller returns a newer epoch than what it knows. + # The other timestamp becomes just a unique identifier for the initiating page. + return ( + b'%b%b' + % (content[:body_end], epoch, _timestamp(), content[body_end:]) + ) + + @classmethod + @functools.lru_cache() # "Cache" to not repeat the same message for the same browser tab. + def _log_poll_request(cls, url, request_id): + log.info(f"Browser connected: {url}") + + def _guess_type(cls, path): + # MkDocs only ensures a few common types (as seen in livereload_tests.py::test_mime_types). + # Other uncommon types will not be accepted. + if path.endswith((".js", ".JS")): + return "application/javascript" + if path.endswith(".gz"): + return "application/gzip" + + guess, _ = mimetypes.guess_type(path) + if guess: + return guess + return "application/octet-stream" + + +class _Handler(wsgiref.simple_server.WSGIRequestHandler): + def log_request(self, code="-", size="-"): + level = logging.DEBUG if str(code) == "200" else logging.WARNING + log.log(level, f'"{self.requestline}" code {code}') + + def log_message(self, format, *args): + log.debug(format, *args) + + +def _timestamp(): + return round(time.monotonic() * 1000) diff --git a/mkdocs/livereload/livereload.js b/mkdocs/livereload/livereload.js new file mode 100644 index 0000000000..a0f743652e --- /dev/null +++ b/mkdocs/livereload/livereload.js @@ -0,0 +1,19 @@ +function livereload(epoch, requestId) { + var req = new XMLHttpRequest(); + req.onloadend = function() { + if (parseFloat(this.responseText) > epoch) { + location.reload(); + return; + } + var launchNext = livereload.bind(this, epoch, requestId); + if (this.status === 200) { + launchNext(); + } else { + setTimeout(launchNext, 3000); + } + }; + req.open("GET", "/livereload/" + epoch + "/" + requestId); + req.send(); + + console.log('Enabled live reload'); +} diff --git a/mkdocs/localization.py b/mkdocs/localization.py new file mode 100644 index 0000000000..6f772ec3d4 --- /dev/null +++ b/mkdocs/localization.py @@ -0,0 +1,77 @@ +import os +import logging + +from jinja2.ext import Extension, InternationalizationExtension +from mkdocs.config.base import ValidationError + +try: + from babel.core import Locale, UnknownLocaleError + from babel.support import Translations, NullTranslations + has_babel = True +except ImportError: # pragma: no cover + from mkdocs.utils.babel_stub import Locale, UnknownLocaleError + has_babel = False + + +log = logging.getLogger(__name__) +base_path = os.path.dirname(os.path.abspath(__file__)) + + +class NoBabelExtension(InternationalizationExtension): # pragma: no cover + def __init__(self, environment): + Extension.__init__(self, environment) + environment.extend( + install_null_translations=self._install_null, + newstyle_gettext=False, + ) + + +def parse_locale(locale): + try: + return Locale.parse(locale, sep='_') + except (ValueError, UnknownLocaleError, TypeError) as e: + raise ValidationError(f'Invalid value for locale: {str(e)}') + + +def install_translations(env, locale, theme_dirs): + if has_babel: + env.add_extension('jinja2.ext.i18n') + translations = _get_merged_translations(theme_dirs, 'locales', locale) + if translations is not None: + env.install_gettext_translations(translations) + else: + env.install_null_translations() + if locale.language != 'en': + log.warning( + f"No translations could be found for the locale '{locale}'. " + 'Defaulting to English.' + ) + else: # pragma: no cover + # no babel installed, add dummy support for trans/endtrans blocks + env.add_extension(NoBabelExtension) + env.install_null_translations() + + +def _get_merged_translations(theme_dirs, locales_dir, locale): + merged_translations = None + + log.debug(f"Looking for translations for locale '{locale}'") + if locale.territory: + locale_str = f"{locale.language}_{locale.territory}" + else: + locale_str = locale.language + for theme_dir in reversed(theme_dirs): + dirname = os.path.join(theme_dir, locales_dir) + translations = Translations.load(dirname, [locale_str]) + + if type(translations) is NullTranslations: + log.debug(f"No translations found here: '{dirname}'") + continue + + log.debug(f"Translations found here: '{dirname}'") + if merged_translations is None: + merged_translations = translations + else: + merged_translations.merge(translations) + + return merged_translations diff --git a/mkdocs/nav.py b/mkdocs/nav.py deleted file mode 100644 index a78ab588df..0000000000 --- a/mkdocs/nav.py +++ /dev/null @@ -1,416 +0,0 @@ -# coding: utf-8 - -""" -Deals with generating the site-wide navigation. - -This consists of building a set of interlinked page and header objects. -""" - -from __future__ import unicode_literals -import datetime -import logging -import markdown -import os -import io - -from mkdocs import utils, exceptions, toc -from mkdocs.utils import meta -from mkdocs.relative_path_ext import RelativePathExtension - -log = logging.getLogger(__name__) - - -def _filename_to_title(filename): - """ - Automatically generate a default title, given a filename. - """ - if utils.is_homepage(filename): - return 'Home' - - return utils.filename_to_title(filename) - - -@meta.transformer() -def default(value): - """ By default, return all meta values as strings. """ - return ' '.join(value) - - -class SiteNavigation(object): - def __init__(self, config): - self.url_context = URLContext() - self.file_context = FileContext() - self.nav_items, self.pages = _generate_site_navigation( - config, self.url_context) - self.homepage = self.pages[0] if self.pages else None - self.use_directory_urls = config['use_directory_urls'] - - def __str__(self): - return ''.join([str(item) for item in self]) - - def __iter__(self): - return iter(self.nav_items) - - def __len__(self): - return len(self.nav_items) - - def walk_pages(self): - """ - Returns each page in the site in turn. - - Additionally this sets the active status of the pages and headers, - in the site navigation, so that the rendered navbar can correctly - highlight the currently active page and/or header item. - """ - page = self.homepage - page.set_active() - self.url_context.set_current_url(page.abs_url) - self.file_context.set_current_path(page.input_path) - yield page - while page.next_page: - page.set_active(False) - page = page.next_page - page.set_active() - self.url_context.set_current_url(page.abs_url) - self.file_context.set_current_path(page.input_path) - yield page - page.set_active(False) - - @property - def source_files(self): - if not hasattr(self, '_source_files'): - self._source_files = set([page.input_path for page in self.pages]) - return self._source_files - - -class URLContext(object): - """ - The URLContext is used to ensure that we can generate the appropriate - relative URLs to other pages from any given page in the site. - - We use relative URLs so that static sites can be deployed to any location - without having to specify what the path component on the host will be - if the documentation is not hosted at the root path. - """ - - def __init__(self): - self.base_path = '/' - self.force_abs_urls = False - - def set_current_url(self, current_url): - self.base_path = os.path.dirname(current_url) - - def make_relative(self, url): - """ - Given a URL path return it as a relative URL, - given the context of the current page. - """ - if self.force_abs_urls: - abs_url = '%s/%s' % (self.base_path.rstrip('/'), utils.path_to_url(url.lstrip('/'))) - return abs_url - - suffix = '/' if (url.endswith('/') and len(url) > 1) else '' - # Workaround for bug on `os.path.relpath()` in Python 2.6 - if self.base_path == '/': - if url == '/': - # Workaround for static assets - return '.' - return url.lstrip('/') - # Under Python 2.6, relative_path adds an extra '/' at the end. - relative_path = os.path.relpath(url, start=self.base_path) - relative_path = relative_path.rstrip('/') + suffix - - return utils.path_to_url(relative_path) - - -class FileContext(object): - """ - The FileContext is used to ensure that we can generate the appropriate - full path for other pages given their relative path from a particular page. - - This is used when we have relative hyperlinks in the documentation, so that - we can ensure that they point to markdown documents that actually exist - in the `pages` config. - """ - def __init__(self): - self.current_file = None - self.base_path = '' - - def set_current_path(self, current_path): - self.current_file = current_path - self.base_path = os.path.dirname(current_path) - - def make_absolute(self, path): - """ - Given a relative file path return it as a POSIX-style - absolute filepath, given the context of the current page. - """ - return os.path.normpath(os.path.join(self.base_path, path)) - - -class Page(object): - def __init__(self, title, path, url_context, config): - - self._title = title - self.abs_url = utils.get_url_path(path, config['use_directory_urls']) - self.active = False - self.url_context = url_context - - # Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds. - # See https://reproducible-builds.org/specs/source-date-epoch/ - if 'SOURCE_DATE_EPOCH' in os.environ: - self.update_date = datetime.datetime.utcfromtimestamp( - int(os.environ['SOURCE_DATE_EPOCH']) - ).strftime("%Y-%m-%d") - else: - self.update_date = datetime.datetime.now().strftime("%Y-%m-%d") - - # Relative and absolute paths to the input markdown file and output html file. - self.input_path = path - self.output_path = utils.get_html_path(path) - self.abs_input_path = os.path.join(config['docs_dir'], self.input_path) - self.abs_output_path = os.path.join(config['site_dir'], self.output_path) - - self.canonical_url = None - if config['site_url']: - self._set_canonical_url(config['site_url']) - - self.edit_url = None - if config['repo_url'] and config['edit_uri']: - self._set_edit_url(config['repo_url'], config['edit_uri']) - - # Placeholders to be filled in later in the build - # process when we have access to the config. - self.markdown = '' - self.meta = {} - self.content = None - self.toc = None - - self.previous_page = None - self.next_page = None - self.ancestors = [] - - def __eq__(self, other): - - def sub_dict(d): - return dict((key, value) for key, value in d.items() - if key in ['title', 'input_path', 'abs_url']) - - return (isinstance(other, self.__class__) - and sub_dict(self.__dict__) == sub_dict(other.__dict__)) - - def __ne__(self, other): - return not self.__eq__(other) - - def __str__(self): - return self.indent_print() - - def __repr__(self): - return "nav.Page(title='{0}', input_path='{1}', url='{2}')".format( - self.title, self.input_path, self.abs_url) - - @property - def title(self): - """ - Get the title for a Markdown document - Check these in order and return the first that has a valid title: - - self._title which is populated from the mkdocs.yml - - self.meta['title'] which comes from the page metadata - - self.markdown - look for the first H1 - - self.input_path - create a title based on the filename - """ - if self._title is not None: - return self._title - elif 'title' in self.meta: - return self.meta['title'] - - title = utils.get_markdown_title(self.markdown) - - if title is not None: - return title - - return _filename_to_title(self.input_path.split(os.path.sep)[-1]) - - @property - def url(self): - return self.url_context.make_relative(self.abs_url) - - @property - def is_homepage(self): - return utils.is_homepage(self.input_path) - - @property - def is_top_level(self): - return len(self.ancestors) == 0 - - def read_source(self, config): - source = config['plugins'].run_event( - 'page_read_source', None, config=config, page=self) - if source is None: - try: - with io.open(self.abs_input_path, 'r', encoding='utf-8-sig') as f: - source = f.read() - except IOError: - log.error('File not found: %s', self.abs_input_path) - raise - - self.markdown, self.meta = meta.get_data(source) - - def _set_canonical_url(self, base): - if not base.endswith('/'): - base += '/' - self.canonical_url = utils.urljoin(base, self.abs_url.lstrip('/')) - - def _set_edit_url(self, repo_url, edit_uri): - # Normalize URL from Windows path '\\' -> '/' - input_path_url = self.input_path.replace('\\', '/') - self.edit_url = utils.urljoin(repo_url, edit_uri + input_path_url) - - def indent_print(self, depth=0): - indent = ' ' * depth - active_marker = ' [*]' if self.active else '' - title = self.title if (self.title is not None) else '[blank]' - return '%s%s - %s%s\n' % (indent, title, self.abs_url, active_marker) - - def set_active(self, active=True): - self.active = active - for ancestor in self.ancestors: - ancestor.set_active(active) - - def render(self, config, site_navigation=None): - """ - Convert the Markdown source file to HTML as per the config and - site_navigation. - - """ - - extensions = [ - RelativePathExtension(site_navigation, config['strict']) - ] + config['markdown_extensions'] - - md = markdown.Markdown( - extensions=extensions, - extension_configs=config['mdx_configs'] or {} - ) - self.content = md.convert(self.markdown) - self.toc = toc.TableOfContents(getattr(md, 'toc', '')) - - -class Header(object): - def __init__(self, title, children): - self.title, self.children = title, children - self.active = False - self.ancestors = [] - - def __str__(self): - return self.indent_print() - - @property - def is_top_level(self): - return len(self.ancestors) == 0 - - def indent_print(self, depth=0): - indent = ' ' * depth - active_marker = ' [*]' if self.active else '' - ret = '%s%s%s\n' % (indent, self.title, active_marker) - for item in self.children: - ret += item.indent_print(depth + 1) - return ret - - def set_active(self, active=True): - self.active = active - for ancestor in self.ancestors: - ancestor.set_active(active) - - -def _follow(config_line, url_context, config, header=None, title=None): - - if isinstance(config_line, utils.string_types): - path = os.path.normpath(config_line) - page = Page(title, path, url_context, config) - - if header: - page.ancestors = header.ancestors + [header, ] - header.children.append(page) - - yield page - raise StopIteration - - elif not isinstance(config_line, dict): - msg = ("Line in 'page' config is of type {0}, dict or string " - "expected. Config: {1}").format(type(config_line), config_line) - raise exceptions.ConfigurationError(msg) - - if len(config_line) > 1: - raise exceptions.ConfigurationError( - "Page configs should be in the format 'name: markdown.md'. The " - "config contains an invalid entry: {0}".format(config_line)) - elif len(config_line) == 0: - log.warning("Ignoring empty line in the pages config.") - raise StopIteration - - next_cat_or_title, subpages_or_path = next(iter(config_line.items())) - - if isinstance(subpages_or_path, utils.string_types): - path = subpages_or_path - for sub in _follow(path, url_context, config, header=header, title=next_cat_or_title): - yield sub - raise StopIteration - - elif not isinstance(subpages_or_path, list): - msg = ("Line in 'page' config is of type {0}, list or string " - "expected for sub pages. Config: {1}" - ).format(type(config_line), config_line) - raise exceptions.ConfigurationError(msg) - - next_header = Header(title=next_cat_or_title, children=[]) - if header: - next_header.ancestors = [header] - header.children.append(next_header) - yield next_header - - subpages = subpages_or_path - - for subpage in subpages: - for sub in _follow(subpage, url_context, config, next_header): - yield sub - - -def _generate_site_navigation(config, url_context): - """ - Returns a list of Page and Header instances that represent the - top level site navigation. - """ - nav_items = [] - pages = [] - - previous = None - - for config_line in config['pages']: - - for page_or_header in _follow( - config_line, url_context, config): - - if isinstance(page_or_header, Header): - - if page_or_header.is_top_level: - nav_items.append(page_or_header) - - elif isinstance(page_or_header, Page): - - if page_or_header.is_top_level: - nav_items.append(page_or_header) - - pages.append(page_or_header) - - if previous: - page_or_header.previous_page = previous - previous.next_page = page_or_header - previous = page_or_header - - if len(pages) == 0: - raise exceptions.ConfigurationError( - "No pages found in the pages config. " - "Remove it entirely to enable automatic page discovery.") - - return (nav_items, pages) diff --git a/mkdocs/plugins.py b/mkdocs/plugins.py index 69d99ed82f..8cd60e2d36 100644 --- a/mkdocs/plugins.py +++ b/mkdocs/plugins.py @@ -1,14 +1,11 @@ -# coding: utf-8 - """ Implements the plugin API for MkDocs. """ -from __future__ import unicode_literals -import pkg_resources import logging +import importlib_metadata from collections import OrderedDict from mkdocs.config.base import Config @@ -18,21 +15,29 @@ EVENTS = ( - 'config', 'pre_build', 'nav', 'env', 'pre_template', 'template_context', + 'config', 'pre_build', 'files', 'nav', 'env', 'pre_template', 'template_context', 'post_template', 'pre_page', 'page_read_source', 'page_markdown', - 'page_content', 'page_context', 'post_page', 'post_build', 'serve' + 'page_content', 'page_context', 'post_page', 'post_build', 'serve', 'build_error' ) def get_plugins(): - """ Return a dict of all installed Plugins by name. """ + """ Return a dict of all installed Plugins as {name: EntryPoint}. """ + + plugins = importlib_metadata.entry_points(group='mkdocs.plugins') + + # Allow third-party plugins to override core plugins + pluginmap = {} + for plugin in plugins: + if plugin.name in pluginmap and plugin.value.startswith("mkdocs.contrib."): + continue - plugins = pkg_resources.iter_entry_points(group='mkdocs.plugins') + pluginmap[plugin.name] = plugin - return dict((plugin.name, plugin) for plugin in plugins) + return pluginmap -class BasePlugin(object): +class BasePlugin: """ Plugin base class. @@ -42,10 +47,10 @@ class BasePlugin(object): config_scheme = () config = {} - def load_config(self, options): + def load_config(self, options, config_file_path=None): """ Load config from a dict of options. Returns a tuple of (errors, warnings).""" - self.config = Config(schema=self.config_scheme) + self.config = Config(schema=self.config_scheme, config_file_path=config_file_path) self.config.load_dict(options) return self.config.validate() @@ -61,7 +66,7 @@ class PluginCollection(OrderedDict): """ def __init__(self, *args, **kwargs): - super(PluginCollection, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.events = {x: [] for x in EVENTS} def _register_event(self, event_name, method): @@ -71,27 +76,32 @@ def _register_event(self, event_name, method): def __setitem__(self, key, value, **kwargs): if not isinstance(value, BasePlugin): raise TypeError( - '{0}.{1} only accepts values which are instances of {3}.{4} ' + '{}.{} only accepts values which are instances of {}.{} ' 'sublcasses'.format(self.__module__, self.__name__, BasePlugin.__module__, BasePlugin.__name__)) - super(PluginCollection, self).__setitem__(key, value, **kwargs) + super().__setitem__(key, value, **kwargs) # Register all of the event methods defined for this Plugin. for event_name in (x for x in dir(value) if x.startswith('on_')): method = getattr(value, event_name) if callable(method): self._register_event(event_name[3:], method) - def run_event(self, name, item, **kwargs): + def run_event(self, name, item=None, **kwargs): """ Run all registered methods of an event. - `item` is the object to be modified and returned by the event method. + `item` is the object to be modified or replaced and returned by the event method. + If it isn't given the event method creates a new object to be returned. All other keywords are variables for context, but would not generally be modified by the event method. """ + pass_item = item is not None for method in self.events[name]: - result = method(item, **kwargs) + if pass_item: + result = method(item, **kwargs) + else: + result = method(**kwargs) # keep item if method returned `None` if result is not None: item = result diff --git a/mkdocs/relative_path_ext.py b/mkdocs/relative_path_ext.py deleted file mode 100644 index 253d6784ca..0000000000 --- a/mkdocs/relative_path_ext.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -# Relative Path Markdown Extension - -During the MkDocs build we rewrite URLs that link to local -Markdown or media files. Using the following pages configuration -we can look at how the output is changed. - - pages: - - ['index.md'] - - ['tutorial/install.md'] - - ['tutorial/intro.md'] - -## Markdown URLs - -When linking from `install.md` to `intro.md` the link would -simply be `[intro](intro.md)`. However, when we build -`install.md` we place it in a directory to create nicer URLs. -This means that the path to `intro.md` becomes `../intro/` - -## Media URLs - -To make it easier to work with media files and store them all -under one directory we re-write those to all be based on the -root. So, with the following markdown to add an image. - - ![The initial MkDocs layout](img/initial-layout.png) - -The output would depend on the location of the Markdown file it -was added too. - -Source file | Generated Path | Image Path | -------------------- | ----------------- | ---------------------------- | -index.md | / | ./img/initial-layout.png | -tutorial/install.md | tutorial/install/ | ../img/initial-layout.png | -tutorial/intro.md | tutorial/intro/ | ../../img/initial-layout.png | - -""" - -from __future__ import unicode_literals - -import logging -import os - -from markdown.extensions import Extension -from markdown.treeprocessors import Treeprocessor -from markdown.util import AMP_SUBSTITUTE - -from mkdocs import utils -from mkdocs.exceptions import MarkdownNotFound - -log = logging.getLogger(__name__) - - -def path_to_url(url, nav, strict): - - scheme, netloc, path, params, query, fragment = ( - utils.urlparse(url)) - - if scheme or netloc or not path or AMP_SUBSTITUTE in url: - # Ignore URLs unless they are a relative link to a markdown file. - # AMP_SUBSTITUTE is used internally by Markdown only for email,which is - # not a relative link. As urlparse errors on them, skip explicitly - return url - - if nav and not utils.is_markdown_file(path): - path = utils.create_relative_media_url(nav, path) - elif nav: - # If the site navigation has been provided, then validate - # the internal hyperlink, making sure the target actually exists. - target_file = nav.file_context.make_absolute(path) - - if target_file.startswith(os.path.sep): - target_file = target_file[1:] - - if target_file not in nav.source_files: - source_file = nav.file_context.current_file - msg = ( - 'The page "%s" contained a hyperlink to "%s" which ' - 'is not listed in the "pages" configuration.' - ) % (source_file, target_file) - - # In strict mode raise an error at this point. - if strict: - raise MarkdownNotFound(msg) - # Otherwise, when strict mode isn't enabled, log a warning - # to the user and leave the URL as it is. - log.warning(msg) - return url - path = utils.get_url_path(target_file, nav.use_directory_urls) - path = nav.url_context.make_relative(path) - else: - path = utils.get_url_path(path).lstrip('/') - - # Convert the .md hyperlink to a relative hyperlink to the HTML page. - fragments = (scheme, netloc, path, params, query, fragment) - url = utils.urlunparse(fragments) - return url - - -class RelativePathTreeprocessor(Treeprocessor): - - def __init__(self, site_navigation, strict): - self.site_navigation = site_navigation - self.strict = strict - - def run(self, root): - """Update urls on anchors and images to make them relative - - Iterates through the full document tree looking for specific - tags and then makes them relative based on the site navigation - """ - - for element in root.iter(): - - if element.tag == 'a': - key = 'href' - elif element.tag == 'img': - key = 'src' - else: - continue - - url = element.get(key) - new_url = path_to_url(url, self.site_navigation, self.strict) - element.set(key, new_url) - - return root - - -class RelativePathExtension(Extension): - """ - The Extension class is what we pass to markdown, it then - registers the Treeprocessor. - """ - - def __init__(self, site_navigation, strict): - self.site_navigation = site_navigation - self.strict = strict - - def extendMarkdown(self, md, md_globals): - relpath = RelativePathTreeprocessor(self.site_navigation, self.strict) - md.treeprocessors.add("relpath", relpath, "_end") diff --git a/mkdocs/structure/__init__.py b/mkdocs/structure/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mkdocs/structure/files.py b/mkdocs/structure/files.py new file mode 100644 index 0000000000..2626462595 --- /dev/null +++ b/mkdocs/structure/files.py @@ -0,0 +1,278 @@ +import fnmatch +import os +import logging +from urllib.parse import quote as urlquote + +from mkdocs import utils + + +log = logging.getLogger(__name__) + + +class Files: + """ A collection of File objects. """ + def __init__(self, files): + self._files = files + + def __iter__(self): + return iter(self._files) + + def __len__(self): + return len(self._files) + + def __contains__(self, path): + return path in self.src_paths + + @property + def src_paths(self): + return {file.src_path: file for file in self._files} + + def get_file_from_path(self, path): + """ Return a File instance with File.src_path equal to path. """ + return self.src_paths.get(os.path.normpath(path)) + + def append(self, file): + """ Append file to Files collection. """ + self._files.append(file) + + def remove(self, file): + """ Remove file from Files collection. """ + self._files.remove(file) + + def copy_static_files(self, dirty=False): + """ Copy static files from source to destination. """ + for file in self: + if not file.is_documentation_page(): + file.copy_file(dirty) + + def documentation_pages(self): + """ Return iterable of all Markdown page file objects. """ + return [file for file in self if file.is_documentation_page()] + + def static_pages(self): + """ Return iterable of all static page file objects. """ + return [file for file in self if file.is_static_page()] + + def media_files(self): + """ Return iterable of all file objects which are not documentation or static pages. """ + return [file for file in self if file.is_media_file()] + + def javascript_files(self): + """ Return iterable of all javascript file objects. """ + return [file for file in self if file.is_javascript()] + + def css_files(self): + """ Return iterable of all CSS file objects. """ + return [file for file in self if file.is_css()] + + def add_files_from_theme(self, env, config): + """ Retrieve static files from Jinja environment and add to collection. """ + def filter(name): + # '.*' filters dot files/dirs at root level whereas '*/.*' filters nested levels + patterns = ['.*', '*/.*', '*.py', '*.pyc', '*.html', '*readme*', 'mkdocs_theme.yml'] + # Exclude translation files + patterns.append("locales/*") + patterns.extend(f'*{x}' for x in utils.markdown_extensions) + patterns.extend(config['theme'].static_templates) + for pattern in patterns: + if fnmatch.fnmatch(name.lower(), pattern): + return False + return True + for path in env.list_templates(filter_func=filter): + # Theme files do not override docs_dir files + path = os.path.normpath(path) + if path not in self: + for dir in config['theme'].dirs: + # Find the first theme dir which contains path + if os.path.isfile(os.path.join(dir, path)): + self.append(File(path, dir, config['site_dir'], config['use_directory_urls'])) + break + + +class File: + """ + A MkDocs File object. + + Points to the source and destination locations of a file. + + The `path` argument must be a path that exists relative to `src_dir`. + + The `src_dir` and `dest_dir` must be absolute paths on the local file system. + + The `use_directory_urls` argument controls how destination paths are generated. If `False`, a Markdown file is + mapped to an HTML file of the same name (the file extension is changed to `.html`). If True, a Markdown file is + mapped to an HTML index file (`index.html`) nested in a directory using the "name" of the file in `path`. The + `use_directory_urls` argument has no effect on non-Markdown files. + + File objects have the following properties, which are Unicode strings: + + File.src_path + The pure path of the source file relative to the source directory. + + File.abs_src_path + The absolute concrete path of the source file. + + File.dest_path + The pure path of the destination file relative to the destination directory. + + File.abs_dest_path + The absolute concrete path of the destination file. + + File.url + The url of the destination file relative to the destination directory as a string. + """ + def __init__(self, path, src_dir, dest_dir, use_directory_urls): + self.page = None + self.src_path = os.path.normpath(path) + self.abs_src_path = os.path.normpath(os.path.join(src_dir, self.src_path)) + self.name = self._get_stem() + self.dest_path = self._get_dest_path(use_directory_urls) + self.abs_dest_path = os.path.normpath(os.path.join(dest_dir, self.dest_path)) + self.url = self._get_url(use_directory_urls) + + def __eq__(self, other): + return ( + isinstance(other, self.__class__) and + self.src_path == other.src_path and + self.abs_src_path == other.abs_src_path and + self.url == other.url + ) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return "File(src_path='{}', dest_path='{}', name='{}', url='{}')".format( + self.src_path, self.dest_path, self.name, self.url + ) + + def _get_stem(self): + """ Return the name of the file without it's extension. """ + filename = os.path.basename(self.src_path) + stem, ext = os.path.splitext(filename) + return 'index' if stem in ('index', 'README') else stem + + def _get_dest_path(self, use_directory_urls): + """ Return destination path based on source path. """ + if self.is_documentation_page(): + parent, filename = os.path.split(self.src_path) + if not use_directory_urls or self.name == 'index': + # index.md or README.md => index.html + # foo.md => foo.html + return os.path.join(parent, self.name + '.html') + else: + # foo.md => foo/index.html + return os.path.join(parent, self.name, 'index.html') + return self.src_path + + def _get_url(self, use_directory_urls): + """ Return url based in destination path. """ + url = self.dest_path.replace(os.path.sep, '/') + dirname, filename = os.path.split(url) + if use_directory_urls and filename == 'index.html': + if dirname == '': + url = '.' + else: + url = dirname + '/' + return urlquote(url) + + def url_relative_to(self, other): + """ Return url for file relative to other file. """ + return utils.get_relative_url(self.url, other.url if isinstance(other, File) else other) + + def copy_file(self, dirty=False): + """ Copy source file to destination, ensuring parent directories exist. """ + if dirty and not self.is_modified(): + log.debug(f"Skip copying unmodified file: '{self.src_path}'") + else: + log.debug(f"Copying media file: '{self.src_path}'") + utils.copy_file(self.abs_src_path, self.abs_dest_path) + + def is_modified(self): + if os.path.isfile(self.abs_dest_path): + return os.path.getmtime(self.abs_dest_path) < os.path.getmtime(self.abs_src_path) + return True + + def is_documentation_page(self): + """ Return True if file is a Markdown page. """ + return os.path.splitext(self.src_path)[1] in utils.markdown_extensions + + def is_static_page(self): + """ Return True if file is a static page (html, xml, json). """ + return os.path.splitext(self.src_path)[1] in ( + '.html', + '.htm', + '.xml', + '.json', + ) + + def is_media_file(self): + """ Return True if file is not a documentation or static page. """ + return not (self.is_documentation_page() or self.is_static_page()) + + def is_javascript(self): + """ Return True if file is a JavaScript file. """ + return os.path.splitext(self.src_path)[1] in ( + '.js', + '.javascript', + ) + + def is_css(self): + """ Return True if file is a CSS file. """ + return os.path.splitext(self.src_path)[1] in ( + '.css', + ) + + +def get_files(config): + """ Walk the `docs_dir` and return a Files collection. """ + files = [] + exclude = ['.*', '/templates'] + + for source_dir, dirnames, filenames in os.walk(config['docs_dir'], followlinks=True): + relative_dir = os.path.relpath(source_dir, config['docs_dir']) + + for dirname in list(dirnames): + path = os.path.normpath(os.path.join(relative_dir, dirname)) + # Skip any excluded directories + if _filter_paths(basename=dirname, path=path, is_dir=True, exclude=exclude): + dirnames.remove(dirname) + dirnames.sort() + + for filename in _sort_files(filenames): + path = os.path.normpath(os.path.join(relative_dir, filename)) + # Skip any excluded files + if _filter_paths(basename=filename, path=path, is_dir=False, exclude=exclude): + continue + # Skip README.md if an index file also exists in dir + if filename.lower() == 'readme.md' and 'index.md' in filenames: + log.warning(f"Both index.md and readme.md found. Skipping readme.md from {source_dir}") + continue + files.append(File(path, config['docs_dir'], config['site_dir'], config['use_directory_urls'])) + + return Files(files) + + +def _sort_files(filenames): + """ Always sort `index` or `README` as first filename in list. """ + + def key(f): + if os.path.splitext(f)[0] in ['index', 'README']: + return (0,) + return (1, f) + + return sorted(filenames, key=key) + + +def _filter_paths(basename, path, is_dir, exclude): + """ .gitignore style file filtering. """ + for item in exclude: + # Items ending in '/' apply only to directories. + if item.endswith('/') and not is_dir: + continue + # Items starting with '/' apply to the whole path. + # In any other cases just the basename is used. + match = path if item.startswith('/') else basename + if fnmatch.fnmatch(match, item.strip('/')): + return True + return False diff --git a/mkdocs/structure/nav.py b/mkdocs/structure/nav.py new file mode 100644 index 0000000000..dac1beef99 --- /dev/null +++ b/mkdocs/structure/nav.py @@ -0,0 +1,191 @@ +import logging +from urllib.parse import urlsplit + +from mkdocs.structure.pages import Page +from mkdocs.utils import nest_paths + +log = logging.getLogger(__name__) + + +class Navigation: + def __init__(self, items, pages): + self.items = items # Nested List with full navigation of Sections, Pages, and Links. + self.pages = pages # Flat List of subset of Pages in nav, in order. + + self.homepage = None + for page in pages: + if page.is_homepage: + self.homepage = page + break + + def __repr__(self): + return '\n'.join([item._indent_print() for item in self]) + + def __iter__(self): + return iter(self.items) + + def __len__(self): + return len(self.items) + + +class Section: + def __init__(self, title, children): + self.title = title + self.children = children + + self.parent = None + self.active = False + + self.is_section = True + self.is_page = False + self.is_link = False + + def __repr__(self): + return f"Section(title='{self.title}')" + + def _get_active(self): + """ Return active status of section. """ + return self.__active + + def _set_active(self, value): + """ Set active status of section and ancestors. """ + self.__active = bool(value) + if self.parent is not None: + self.parent.active = bool(value) + + active = property(_get_active, _set_active) + + @property + def ancestors(self): + if self.parent is None: + return [] + return [self.parent] + self.parent.ancestors + + def _indent_print(self, depth=0): + ret = ['{}{}'.format(' ' * depth, repr(self))] + for item in self.children: + ret.append(item._indent_print(depth + 1)) + return '\n'.join(ret) + + +class Link: + def __init__(self, title, url): + self.title = title + self.url = url + self.parent = None + + # These should never change but are included for consistency with sections and pages. + self.children = None + self.active = False + self.is_section = False + self.is_page = False + self.is_link = True + + def __repr__(self): + title = f"'{self.title}'" if (self.title is not None) else '[blank]' + return f"Link(title={title}, url='{self.url}')" + + @property + def ancestors(self): + if self.parent is None: + return [] + return [self.parent] + self.parent.ancestors + + def _indent_print(self, depth=0): + return '{}{}'.format(' ' * depth, repr(self)) + + +def get_navigation(files, config): + """ Build site navigation from config and files.""" + nav_config = config['nav'] or nest_paths(f.src_path for f in files.documentation_pages()) + items = _data_to_navigation(nav_config, files, config) + if not isinstance(items, list): + items = [items] + + # Get only the pages from the navigation, ignoring any sections and links. + pages = _get_by_type(items, Page) + + # Include next, previous and parent links. + _add_previous_and_next_links(pages) + _add_parent_links(items) + + missing_from_config = [file for file in files.documentation_pages() if file.page is None] + if missing_from_config: + log.info( + 'The following pages exist in the docs directory, but are not ' + 'included in the "nav" configuration:\n - {}'.format( + '\n - '.join([file.src_path for file in missing_from_config])) + ) + # Any documentation files not found in the nav should still have an associated page, so we + # create them here. The Page object will automatically be assigned to `file.page` during + # its creation (and this is the only way in which these page objects are accessible). + for file in missing_from_config: + Page(None, file, config) + + links = _get_by_type(items, Link) + for link in links: + scheme, netloc, path, query, fragment = urlsplit(link.url) + if scheme or netloc: + log.debug( + "An external link to '{}' is included in " + "the 'nav' configuration.".format(link.url) + ) + elif link.url.startswith('/'): + log.debug( + "An absolute path to '{}' is included in the 'nav' configuration, " + "which presumably points to an external resource.".format(link.url) + ) + else: + msg = ( + "A relative path to '{}' is included in the 'nav' configuration, " + "which is not found in the documentation files".format(link.url) + ) + log.warning(msg) + return Navigation(items, pages) + + +def _data_to_navigation(data, files, config): + if isinstance(data, dict): + return [ + _data_to_navigation((key, value), files, config) + if isinstance(value, str) else + Section(title=key, children=_data_to_navigation(value, files, config)) + for key, value in data.items() + ] + elif isinstance(data, list): + return [ + _data_to_navigation(item, files, config)[0] + if isinstance(item, dict) and len(item) == 1 else + _data_to_navigation(item, files, config) + for item in data + ] + title, path = data if isinstance(data, tuple) else (None, data) + file = files.get_file_from_path(path) + if file: + return Page(title, file, config) + return Link(title, path) + + +def _get_by_type(nav, T): + ret = [] + for item in nav: + if isinstance(item, T): + ret.append(item) + if item.children: + ret.extend(_get_by_type(item.children, T)) + return ret + + +def _add_parent_links(nav): + for item in nav: + if item.is_section: + for child in item.children: + child.parent = item + _add_parent_links(item.children) + + +def _add_previous_and_next_links(pages): + bookended = [None] + pages + [None] + zipped = zip(bookended[:-2], bookended[1:-1], bookended[2:]) + for page0, page1, page2 in zipped: + page1.previous_page, page1.next_page = page0, page2 diff --git a/mkdocs/structure/pages.py b/mkdocs/structure/pages.py new file mode 100644 index 0000000000..76eede6a76 --- /dev/null +++ b/mkdocs/structure/pages.py @@ -0,0 +1,243 @@ +import os +import logging +from urllib.parse import urlsplit, urlunsplit, urljoin +from urllib.parse import unquote as urlunquote + +import markdown +from markdown.extensions import Extension +from markdown.treeprocessors import Treeprocessor +from markdown.util import AMP_SUBSTITUTE + +from mkdocs.structure.toc import get_toc +from mkdocs.utils import meta, get_build_date, get_markdown_title + +log = logging.getLogger(__name__) + + +class Page: + def __init__(self, title, file, config): + file.page = self + self.file = file + self.title = title + + # Navigation attributes + self.parent = None + self.children = None + self.previous_page = None + self.next_page = None + self.active = False + + self.is_section = False + self.is_page = True + self.is_link = False + + self.update_date = get_build_date() + + self._set_canonical_url(config.get('site_url', None)) + self._set_edit_url(config.get('repo_url', None), config.get('edit_uri', None)) + + # Placeholders to be filled in later in the build process. + self.markdown = None + self.content = None + self.toc = [] + self.meta = {} + + def __eq__(self, other): + return ( + isinstance(other, self.__class__) and + self.title == other.title and + self.file == other.file + ) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + title = f"'{self.title}'" if (self.title is not None) else '[blank]' + return "Page(title={}, url='{}')".format(title, self.abs_url or self.file.url) + + def _indent_print(self, depth=0): + return '{}{}'.format(' ' * depth, repr(self)) + + def _get_active(self): + """ Return active status of page. """ + return self.__active + + def _set_active(self, value): + """ Set active status of page and ancestors. """ + self.__active = bool(value) + if self.parent is not None: + self.parent.active = bool(value) + + active = property(_get_active, _set_active) + + @property + def is_index(self): + return self.file.name == 'index' + + @property + def is_top_level(self): + return self.parent is None + + @property + def is_homepage(self): + return self.is_top_level and self.is_index and self.file.url in ['.', 'index.html'] + + @property + def url(self): + return '' if self.file.url == '.' else self.file.url + + @property + def ancestors(self): + if self.parent is None: + return [] + return [self.parent] + self.parent.ancestors + + def _set_canonical_url(self, base): + if base: + if not base.endswith('/'): + base += '/' + self.canonical_url = urljoin(base, self.url) + self.abs_url = urlsplit(self.canonical_url).path + else: + self.canonical_url = None + self.abs_url = None + + def _set_edit_url(self, repo_url, edit_uri): + if repo_url and edit_uri: + src_path = self.file.src_path.replace('\\', '/') + self.edit_url = urljoin(repo_url, edit_uri + src_path) + else: + self.edit_url = None + + def read_source(self, config): + source = config['plugins'].run_event( + 'page_read_source', page=self, config=config + ) + if source is None: + try: + with open(self.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f: + source = f.read() + except OSError: + log.error(f'File not found: {self.file.src_path}') + raise + except ValueError: + log.error(f'Encoding error reading file: {self.file.src_path}') + raise + + self.markdown, self.meta = meta.get_data(source) + self._set_title() + + def _set_title(self): + """ + Set the title for a Markdown document. + + Check these in order and use the first that returns a valid title: + - value provided on init (passed in from config) + - value of metadata 'title' + - content of the first H1 in Markdown content + - convert filename to title + """ + if self.title is not None: + return + + if 'title' in self.meta: + self.title = self.meta['title'] + return + + title = get_markdown_title(self.markdown) + + if title is None: + if self.is_homepage: + title = 'Home' + else: + title = self.file.name.replace('-', ' ').replace('_', ' ') + # Capitalize if the filename was all lowercase, otherwise leave it as-is. + if title.lower() == title: + title = title.capitalize() + + self.title = title + + def render(self, config, files): + """ + Convert the Markdown source file to HTML as per the config. + """ + + extensions = [ + _RelativePathExtension(self.file, files) + ] + config['markdown_extensions'] + + md = markdown.Markdown( + extensions=extensions, + extension_configs=config['mdx_configs'] or {} + ) + self.content = md.convert(self.markdown) + self.toc = get_toc(getattr(md, 'toc_tokens', [])) + + +class _RelativePathTreeprocessor(Treeprocessor): + def __init__(self, file, files): + self.file = file + self.files = files + + def run(self, root): + """ + Update urls on anchors and images to make them relative + + Iterates through the full document tree looking for specific + tags and then makes them relative based on the site navigation + """ + for element in root.iter(): + if element.tag == 'a': + key = 'href' + elif element.tag == 'img': + key = 'src' + else: + continue + + url = element.get(key) + new_url = self.path_to_url(url) + element.set(key, new_url) + + return root + + def path_to_url(self, url): + scheme, netloc, path, query, fragment = urlsplit(url) + + if (scheme or netloc or not path or url.startswith('/') or url.startswith('\\') + or AMP_SUBSTITUTE in url or '.' not in os.path.split(path)[-1]): + # Ignore URLs unless they are a relative link to a source file. + # AMP_SUBSTITUTE is used internally by Markdown only for email. + # No '.' in the last part of a path indicates path does not point to a file. + return url + + # Determine the filepath of the target. + target_path = os.path.join(os.path.dirname(self.file.src_path), urlunquote(path)) + target_path = os.path.normpath(target_path).lstrip(os.sep) + + # Validate that the target exists in files collection. + if target_path not in self.files: + log.warning( + f"Documentation file '{self.file.src_path}' contains a link to " + f"'{target_path}' which is not found in the documentation files." + ) + return url + target_file = self.files.get_file_from_path(target_path) + path = target_file.url_relative_to(self.file) + components = (scheme, netloc, path, query, fragment) + return urlunsplit(components) + + +class _RelativePathExtension(Extension): + """ + The Extension class is what we pass to markdown, it then + registers the Treeprocessor. + """ + + def __init__(self, file, files): + self.file = file + self.files = files + + def extendMarkdown(self, md): + relpath = _RelativePathTreeprocessor(self.file, self.files) + md.treeprocessors.register(relpath, "relpath", 0) diff --git a/mkdocs/structure/toc.py b/mkdocs/structure/toc.py new file mode 100644 index 0000000000..72250ffeff --- /dev/null +++ b/mkdocs/structure/toc.py @@ -0,0 +1,62 @@ +""" +Deals with generating the per-page table of contents. + +For the sake of simplicity we use the Python-Markdown `toc` extension to +generate a list of dicts for each toc item, and then store it as AnchorLinks to +maintain compatibility with older versions of MkDocs. +""" + + +def get_toc(toc_tokens): + toc = [_parse_toc_token(i) for i in toc_tokens] + # For the table of contents, always mark the first element as active + if len(toc): + toc[0].active = True + return TableOfContents(toc) + + +class TableOfContents: + """ + Represents the table of contents for a given page. + """ + def __init__(self, items): + self.items = items + + def __iter__(self): + return iter(self.items) + + def __len__(self): + return len(self.items) + + def __str__(self): + return ''.join([str(item) for item in self]) + + +class AnchorLink: + """ + A single entry in the table of contents. + """ + def __init__(self, title, id, level): + self.title, self.id, self.level = title, id, level + self.children = [] + + @property + def url(self): + return '#' + self.id + + def __str__(self): + return self.indent_print() + + def indent_print(self, depth=0): + indent = ' ' * depth + ret = f'{indent}{self.title} - {self.url}\n' + for item in self.children: + ret += item.indent_print(depth + 1) + return ret + + +def _parse_toc_token(token): + anchor = AnchorLink(token['name'], token['id'], token['level']) + for i in token['children']: + anchor.children.append(_parse_toc_token(i)) + return anchor diff --git a/mkdocs/templates/sitemap.xml b/mkdocs/templates/sitemap.xml index 68ad772586..e3a935a6a5 100644 --- a/mkdocs/templates/sitemap.xml +++ b/mkdocs/templates/sitemap.xml @@ -1,20 +1,12 @@ -{% for nav_item in nav %} - {% if nav_item.children %} - {% for nav_item in nav_item.children %} +{%- for file in pages -%} + {% if not file.page.is_link %} - {{ config.site_url }}{{ nav_item.abs_url }} - {{nav_item.update_date}} - daily + {% if file.page.canonical_url %}{{ file.page.canonical_url|e }}{% else %}{{ file.page.abs_url|e }}{% endif %} + {% if file.page.update_date %}{{file.page.update_date}}{% endif %} + daily - {% endfor %} - {% else %} - - {{ config.site_url }}{{ nav_item.abs_url }} - {{nav_item.update_date}} - daily - - {% endif %} + {%- endif -%} {% endfor %} diff --git a/mkdocs/tests/babel_cmd_tests.py b/mkdocs/tests/babel_cmd_tests.py new file mode 100644 index 0000000000..1a47738a33 --- /dev/null +++ b/mkdocs/tests/babel_cmd_tests.py @@ -0,0 +1,348 @@ +import unittest +from distutils.dist import Distribution +from distutils.errors import DistutilsOptionError +from os import path + +from mkdocs.commands import babel + +BASE_DIR = path.normpath(path.join(path.abspath(path.dirname(__file__)), '../../')) + + +class ThemeMixinTests(unittest.TestCase): + + def test_dict_entry_point(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = { + 'mkdocs.themes': [ + 'mkdocs = mkdocs.themes.mkdocs' + ] + } + inst.theme = 'mkdocs' + self.assertEqual(inst.get_theme_dir(), path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')) + + def test_ini_entry_point(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + inst.theme = 'mkdocs' + self.assertEqual(inst.get_theme_dir(), path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')) + + def test_one_entry_point_as_default(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = { + 'mkdocs.themes': [ + 'mkdocs = mkdocs.themes.mkdocs' + ] + } + inst.theme = None + self.assertEqual(inst.get_theme_dir(), path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')) + + def test_multiple_entry_points(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = { + 'mkdocs.themes': [ + 'mkdocs = mkdocs.themes.mkdocs', + 'readthedocs = mkdocs.themes.readthedocs', + ] + } + inst.theme = 'readthedocs' + self.assertEqual(inst.get_theme_dir(), path.join(BASE_DIR, 'mkdocs', 'themes', 'readthedocs')) + + def test_multiple_entry_points_no_default(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = { + 'mkdocs.themes': [ + 'mkdocs = mkdocs.themes.mkdocs', + 'readthedocs = mkdocs.themes.readthedocs', + ] + } + inst.theme = None + self.assertRaises(DistutilsOptionError, inst.get_theme_dir) + + def test_no_entry_points(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = {} + inst.theme = 'mkdocs' + self.assertRaises(DistutilsOptionError, inst.get_theme_dir) + + def test_undefined_entry_point(self): + inst = babel.ThemeMixin() + inst.distribution = Distribution() + inst.distribution.entry_points = { + 'mkdocs.themes': [ + 'mkdocs = mkdocs.themes.mkdocs' + ] + } + inst.theme = 'undefined' + self.assertRaises(DistutilsOptionError, inst.get_theme_dir) + + +class CommandTests(unittest.TestCase): + + def test_compile_catalog(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.compile_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.finalize_options() + self.assertEqual(cmd.directory, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_compile_catalog_default_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.compile_catalog(dist) + cmd.initialize_options() + self.assertIsNone(cmd.theme) + cmd.finalize_options() + self.assertEqual(cmd.theme, 'mkdocs') + self.assertEqual(cmd.directory, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_compile_catalog_ignore_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.compile_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.directory = 'foo/bar' + cmd.finalize_options() + self.assertEqual(cmd.directory, 'foo/bar') + + def test_extract_messages(self): + dist = Distribution(dict(name='foo', version='1.2')) + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.extract_messages(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.finalize_options() + self.assertEqual(cmd.input_paths, [path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')]) + self.assertEqual(cmd.output_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.mapping_file, babel.DEFAULT_MAPPING_FILE) + self.assertEqual(cmd.project, 'foo') + self.assertEqual(cmd.version, '1.2') + + def test_extract_messages_default_theme(self): + dist = Distribution(dict(name='foo', version='1.2')) + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.extract_messages(dist) + cmd.initialize_options() + self.assertIsNone(cmd.theme) + cmd.finalize_options() + self.assertEqual(cmd.theme, 'mkdocs') + self.assertEqual(cmd.input_paths, [path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')]) + self.assertEqual(cmd.output_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + + def test_extract_messages_ingore_theme(self): + dist = Distribution(dict(name='foo', version='1.2')) + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.extract_messages(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.input_paths = 'mkdocs/tests' + cmd.output_file = 'foo/bar/messages.pot' + cmd.finalize_options() + self.assertEqual(cmd.input_paths, ['mkdocs/tests']) + self.assertEqual(cmd.output_file, 'foo/bar/messages.pot') + + def test_extract_messages_ingore_theme_for_input(self): + dist = Distribution(dict(name='foo', version='1.2')) + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.extract_messages(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.input_paths = 'mkdocs/tests' + cmd.finalize_options() + self.assertEqual(cmd.input_paths, ['mkdocs/tests']) + self.assertEqual(cmd.output_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + + def test_extract_messages_ingore_theme_for_output(self): + dist = Distribution(dict(name='foo', version='1.2')) + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.extract_messages(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.output_file = 'foo/bar/messages.pot' + cmd.finalize_options() + self.assertEqual(cmd.input_paths, [path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs')]) + self.assertEqual(cmd.output_file, 'foo/bar/messages.pot') + + def test_init_catalog(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.init_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.finalize_options() + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_init_catalog_default_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.init_catalog(dist) + cmd.initialize_options() + cmd.locale = 'en' + self.assertIsNone(cmd.theme) + cmd.finalize_options() + self.assertEqual(cmd.theme, 'mkdocs') + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_init_catalog_ignore_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.init_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.input_file = 'mkdocs/themes/mkdocs/messages.pot' + cmd.output_dir = 'foo/bar' + cmd.finalize_options() + self.assertEqual(cmd.input_file, 'mkdocs/themes/mkdocs/messages.pot') + self.assertEqual(cmd.output_dir, 'foo/bar') + + def test_init_catalog_ignore_theme_for_input(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.init_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.input_file = 'mkdocs/themes/mkdocs/messages.pot' + cmd.finalize_options() + self.assertEqual(cmd.input_file, 'mkdocs/themes/mkdocs/messages.pot') + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_init_catalog_ignore_theme_for_output(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.init_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.output_dir = 'foo/bar' + cmd.finalize_options() + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, 'foo/bar') + + def test_update_catalog(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.update_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.finalize_options() + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_update_catalog_default_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.update_catalog(dist) + cmd.initialize_options() + cmd.locale = 'en' + self.assertIsNone(cmd.theme) + cmd.finalize_options() + self.assertEqual(cmd.theme, 'mkdocs') + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_update_catalog_ignore_theme(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.update_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.input_file = 'mkdocs/themes/readthedocs/messages.pot' + cmd.output_dir = 'foo/bar' + cmd.finalize_options() + self.assertEqual(cmd.input_file, 'mkdocs/themes/readthedocs/messages.pot') + self.assertEqual(cmd.output_dir, 'foo/bar') + + def test_update_catalog_ignore_theme_for_input(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.update_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.input_file = 'mkdocs/themes/mkdocs/messages.pot' + cmd.finalize_options() + self.assertEqual(cmd.input_file, 'mkdocs/themes/mkdocs/messages.pot') + self.assertEqual(cmd.output_dir, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/locales')) + + def test_update_catalog_ignore_theme_for_output(self): + dist = Distribution() + dist.entry_points = ''' + [mkdocs.themes] + mkdocs = mkdocs.themes.mkdocs + ''' + cmd = babel.update_catalog(dist) + cmd.initialize_options() + cmd.theme = 'mkdocs' + cmd.locale = 'en' + cmd.output_dir = 'foo/bar' + cmd.finalize_options() + self.assertEqual(cmd.input_file, path.join(BASE_DIR, 'mkdocs', 'themes', 'mkdocs/messages.pot')) + self.assertEqual(cmd.output_dir, 'foo/bar') diff --git a/mkdocs/tests/base.py b/mkdocs/tests/base.py index 51cfee36a8..cf42585053 100644 --- a/mkdocs/tests/base.py +++ b/mkdocs/tests/base.py @@ -1,21 +1,22 @@ -from __future__ import unicode_literals import textwrap import markdown import os +from functools import wraps +from tempfile import TemporaryDirectory -from mkdocs import toc from mkdocs import config +from mkdocs import utils def dedent(text): return textwrap.dedent(text).strip() -def markdown_to_toc(markdown_source): +def get_markdown_toc(markdown_source): + """ Return TOC generated by Markdown parser from Markdown source text. """ md = markdown.Markdown(extensions=['toc']) md.convert(markdown_source) - toc_output = md.toc - return toc.TableOfContents(toc_output) + return md.toc_tokens def load_config(**cfg): @@ -31,9 +32,97 @@ def load_config(**cfg): if 'docs_dir' not in cfg: # Point to an actual dir to avoid a 'does not exist' error on validation. cfg['docs_dir'] = os.path.join(path_base, 'docs') - conf = config.Config(schema=config.DEFAULT_SCHEMA) + conf = config.Config(schema=config.defaults.get_schema(), config_file_path=cfg['config_file_path']) conf.load_dict(cfg) errors_warnings = conf.validate() assert(errors_warnings == ([], [])), errors_warnings return conf + + +def tempdir(files=None, **kw): + """ + A decorator for building a temporary directory with prepopulated files. + + The temporary directory and files are created just before the wrapped function is called and are destroyed + immediately after the wrapped function returns. + + The `files` keyword should be a dict of file paths as keys and strings of file content as values. + If `files` is a list, then each item is assumed to be a path of an empty file. All other + keywords are passed to `tempfile.TemporaryDirectory` to create the parent directory. + + In the following example, two files are created in the temporary directory and then are destroyed when + the function exits: + + @tempdir(files={ + 'foo.txt': 'foo content', + 'bar.txt': 'bar content' + }) + def example(self, tdir): + assert os.path.isfile(os.path.join(tdir, 'foo.txt')) + pth = os.path.join(tdir, 'bar.txt') + assert os.path.isfile(pth) + with open(pth, 'r', encoding='utf-8') as f: + assert f.read() == 'bar content' + """ + files = {f: '' for f in files} if isinstance(files, (list, tuple)) else files or {} + + kw['prefix'] = 'mkdocs_test-' + kw.get('prefix', '') + + def decorator(fn): + @wraps(fn) + def wrapper(self, *args): + with TemporaryDirectory(**kw) as td: + for path, content in files.items(): + pth = os.path.join(td, path) + utils.write_file(content.encode(encoding='utf-8'), pth) + return fn(self, td, *args) + return wrapper + return decorator + + +class PathAssertionMixin: + """ + Assertion methods for testing paths. + + Each method accepts one or more strings, which are first joined using os.path.join. + """ + + def assertPathsEqual(self, a, b, msg=None): + self.assertEqual(a.replace('\\', '/'), b.replace('\\', '/')) + + def assertPathExists(self, *parts): + path = os.path.join(*parts) + if not os.path.exists(path): + msg = self._formatMessage(None, f"The path '{path}' does not exist") + raise self.failureException(msg) + + def assertPathNotExists(self, *parts): + path = os.path.join(*parts) + if os.path.exists(path): + msg = self._formatMessage(None, f"The path '{path}' does exist") + raise self.failureException(msg) + + def assertPathIsFile(self, *parts): + path = os.path.join(*parts) + if not os.path.isfile(path): + msg = self._formatMessage(None, f"The path '{path}' is not a file that exists") + raise self.failureException(msg) + + def assertPathNotFile(self, *parts): + path = os.path.join(*parts) + if os.path.isfile(path): + msg = self._formatMessage(None, f"The path '{path}' is a file that exists") + raise self.failureException(msg) + + def assertPathIsDir(self, *parts): + path = os.path.join(*parts) + if not os.path.isdir(path): + msg = self._formatMessage(None, f"The path '{path}' is not a directory that exists") + raise self.failureException(msg) + + def assertPathNotDir(self, *parts): + path = os.path.join(*parts) + if os.path.isfile(path): + msg = self._formatMessage(None, f"The path '{path}' is a directory that exists") + raise self.failureException(msg) diff --git a/mkdocs/tests/build_tests.py b/mkdocs/tests/build_tests.py index ac5f5116ae..87795e7fb1 100644 --- a/mkdocs/tests/build_tests.py +++ b/mkdocs/tests/build_tests.py @@ -1,496 +1,522 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals -import os -import shutil -import tempfile +from unittest import mock import unittest -import mock -import io -try: - from itertools import izip as zip -except ImportError: - # In Py3 use builtin zip function - pass - - -from mkdocs import nav +from mkdocs.exceptions import PluginError +from mkdocs.structure.pages import Page +from mkdocs.structure.files import File, Files +from mkdocs.structure.nav import get_navigation from mkdocs.commands import build -from mkdocs.exceptions import MarkdownNotFound -from mkdocs.tests.base import dedent, load_config +from mkdocs.tests.base import load_config, tempdir, PathAssertionMixin from mkdocs.utils import meta -def build_page(title, path, config, md_src=None): +def build_page(title, path, config, md_src=''): """ Helper which returns a Page object. """ - sitenav = nav.SiteNavigation(config) - page = nav.Page(title, path, sitenav.url_context, config) - if md_src: - # Fake page.read_source() - page.markdown, page.meta = meta.get_data(md_src) - return page, sitenav - - -class BuildTests(unittest.TestCase): - - def test_empty_document(self): - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config) - page.render(config, nav) - - self.assertEqual(page.content, '') - self.assertEqual(len(list(page.toc)), 0) - self.assertEqual(page.meta, {}) - self.assertEqual(page.title, 'Home') - - def test_convert_markdown(self): - """ - Ensure that basic Markdown -> HTML and TOC works. - """ - md_text = dedent(""" - title: custom title - - # Heading 1 - - This is some text. - - # Heading 2 - - And some more text. - """) - - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - - expected_html = dedent(""" -

Heading 1

-

This is some text.

-

Heading 2

-

And some more text.

- """) - - expected_toc = dedent(""" - Heading 1 - #heading-1 - Heading 2 - #heading-2 - """) - - expected_meta = {'title': 'custom title'} - - self.assertEqual(page.content.strip(), expected_html) - self.assertEqual(str(page.toc).strip(), expected_toc) - self.assertEqual(page.meta, expected_meta) - self.assertEqual(page.title, 'custom title') - - def test_convert_internal_link(self): - md_text = 'An [internal link](internal.md) to another document.' - expected = '

An internal link to another document.

' - config = load_config(pages=['index.md', 'internal.md']) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_convert_multiple_internal_links(self): - md_text = '[First link](first.md) [second link](second.md).' - expected = '

First link second link.

' - config = load_config(pages=['index.md', 'first.md', 'second.md']) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_convert_internal_link_differing_directory(self): - md_text = 'An [internal link](../internal.md) to another document.' - expected = '

An internal link to another document.

' - config = load_config(pages=['foo/bar.md', 'internal.md']) - page, nav = build_page(None, 'foo/bar.md', config, md_text) - page.render(config) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_convert_internal_link_with_anchor(self): - md_text = 'An [internal link](internal.md#section1.1) to another document.' - expected = '

An internal link to another document.

' - config = load_config(pages=['index.md', 'internal.md']) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_convert_internal_media(self): - """Test relative image URL's are the same for different base_urls""" - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - ] + files = Files([File(path, config['docs_dir'], config['site_dir'], config['use_directory_urls'])]) + page = Page(title, list(files)[0], config) + # Fake page.read_source() + page.markdown, page.meta = meta.get_data(md_src) + return page, files - config = load_config(pages=pages) - site_navigation = nav.SiteNavigation(config) - expected_results = ( - './img/initial-layout.png', - '../img/initial-layout.png', - '../img/initial-layout.png', - ) +class BuildTests(PathAssertionMixin, unittest.TestCase): - template = '

The initial MkDocs layout

' + def _get_env_with_null_translations(self, config): + env = config['theme'].get_env() + env.add_extension('jinja2.ext.i18n') + env.install_null_translations() + return env - for (page, expected) in zip(site_navigation.walk_pages(), expected_results): - page.markdown = '![The initial MkDocs layout](img/initial-layout.png)' - page.render(config, site_navigation) - self.assertEqual(page.content, template % expected) + # Test build.get_context - def test_convert_internal_asbolute_media(self): - """Test absolute image URL's are correct for different base_urls""" - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', + def test_context_base_url_homepage(self): + nav_cfg = [ + {'Home': 'index.md'} ] + cfg = load_config(nav=nav_cfg, use_directory_urls=False) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[0]) + self.assertEqual(context['base_url'], '.') - config = load_config(pages=pages) - site_navigation = nav.SiteNavigation(config) - - expected_results = ( - './img/initial-layout.png', - '../img/initial-layout.png', - '../../img/initial-layout.png', - ) - - template = '

The initial MkDocs layout

' - - for (page, expected) in zip(site_navigation.walk_pages(), expected_results): - page.markdown = '![The initial MkDocs layout](/img/initial-layout.png)' - page.render(config, site_navigation) - self.assertEqual(page.content, template % expected) - - def test_dont_convert_code_block_urls(self): - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', + def test_context_base_url_homepage_use_directory_urls(self): + nav_cfg = [ + {'Home': 'index.md'} ] - - config = load_config(pages=pages) - site_navigation = nav.SiteNavigation(config) - - expected = dedent(""" -

An HTML Anchor::

-
<a href="index.md">My example link</a>
-        
- """) - - for page in site_navigation.walk_pages(): - page.markdown = 'An HTML Anchor::\n\n My example link\n' - page.render(config, site_navigation) - self.assertEqual(page.content, expected) - - def test_anchor_only_link(self): - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', + cfg = load_config(nav=nav_cfg) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[0]) + self.assertEqual(context['base_url'], '.') + + def test_context_base_url_nested_page(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Nested': 'foo/bar.md'} ] - - config = load_config(pages=pages) - site_navigation = nav.SiteNavigation(config) - - for page in site_navigation.walk_pages(): - page.markdown = '[test](#test)' - page.render(config, site_navigation) - self.assertEqual(page.content, '

test

') - - def test_ignore_external_link(self): - md_text = 'An [external link](http://example.com/external.md).' - expected = '

An external link.

' - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_not_use_directory_urls(self): - md_text = 'An [internal link](internal.md) to another document.' - expected = '

An internal link to another document.

' - config = load_config(pages=['index.md', 'internal.md'], use_directory_urls=False) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_ignore_email_links(self): - md_text = 'A and an [link](mailto:example@example.com).' - expected = ''.join([ - '

A autolin', - 'k@example.com', - ' and an link.

' + cfg = load_config(nav=nav_cfg, use_directory_urls=False) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) ]) - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected.strip()) - - def test_markdown_table_extension(self): - """ - Ensure that the table extension is supported. - """ - md_text = dedent(""" - First Header | Second Header - -------------- | -------------- - Content Cell 1 | Content Cell 2 - Content Cell 3 | Content Cell 4 - """) - - expected_html = dedent(""" - - - - - - - - - - - - - - - - - -
First HeaderSecond Header
Content Cell 1Content Cell 2
Content Cell 3Content Cell 4
- """) - - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected_html) - - def test_markdown_fenced_code_extension(self): - """ - Ensure that the fenced code extension is supported. - """ - md_text = dedent(""" - ``` - print 'foo' - ``` - """) - - expected_html = dedent(""" -
print 'foo'\n
- """) - - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected_html) - - def test_markdown_custom_extension(self): - """ - Check that an extension applies when requested in the arguments to - `convert_markdown`. - """ - md_text = "foo__bar__baz" - - # Check that the plugin is not active when not requested. - expected_without_smartstrong = "

foobarbaz

" - config = load_config(pages=[{'Home': 'index.md'}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected_without_smartstrong) - - # Check that the plugin is active when requested. - expected_with_smartstrong = "

foo__bar__baz

" - config = load_config(pages=[{'Home': 'index.md'}], markdown_extensions=['smart_strong']) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected_with_smartstrong) - - def test_markdown_duplicate_custom_extension(self): - """ - Duplicated extension names should not cause problems. - """ - md_text = "foo" - config = load_config(pages=[{'Home': 'index.md'}], markdown_extensions=['toc']) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), '

foo

') - - def test_copying_media(self): - docs_dir = tempfile.mkdtemp() - site_dir = tempfile.mkdtemp() - try: - # Create a non-empty markdown file, image, html file, dot file and dot directory. - f = open(os.path.join(docs_dir, 'index.md'), 'w') - f.write(dedent(""" - page_title: custom title - - # Heading 1 - - This is some text. - - # Heading 2 - - And some more text. - """)) - f.close() - open(os.path.join(docs_dir, 'img.jpg'), 'w').close() - open(os.path.join(docs_dir, 'example.html'), 'w').close() - open(os.path.join(docs_dir, '.hidden'), 'w').close() - os.mkdir(os.path.join(docs_dir, '.git')) - open(os.path.join(docs_dir, '.git/hidden'), 'w').close() - - cfg = load_config(docs_dir=docs_dir, site_dir=site_dir) - build.build(cfg) - - # Verify only the markdown (coverted to html) and the image are copied. - self.assertTrue(os.path.isfile(os.path.join(site_dir, 'index.html'))) - self.assertTrue(os.path.isfile(os.path.join(site_dir, 'img.jpg'))) - self.assertTrue(os.path.isfile(os.path.join(site_dir, 'example.html'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, '.hidden'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, '.git/hidden'))) - finally: - shutil.rmtree(docs_dir) - shutil.rmtree(site_dir) - - def test_copy_theme_files(self): - docs_dir = tempfile.mkdtemp() - site_dir = tempfile.mkdtemp() - try: - # Create a non-empty markdown file. - f = open(os.path.join(docs_dir, 'index.md'), 'w') - f.write(dedent(""" - page_title: custom title - - # Heading 1 - - This is some text. - """)) - f.close() - - cfg = load_config(docs_dir=docs_dir, site_dir=site_dir) - build.build(cfg) - - # Verify only theme media are copied, not templates or Python files. - self.assertTrue(os.path.isfile(os.path.join(site_dir, 'index.html'))) - self.assertTrue(os.path.isdir(os.path.join(site_dir, 'js'))) - self.assertTrue(os.path.isdir(os.path.join(site_dir, 'css'))) - self.assertTrue(os.path.isdir(os.path.join(site_dir, 'img'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, '__init__.py'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, '__init__.pyc'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, 'base.html'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, 'content.html'))) - self.assertFalse(os.path.isfile(os.path.join(site_dir, 'nav.html'))) - finally: - shutil.rmtree(docs_dir) - shutil.rmtree(site_dir) - - def test_strict_mode_valid(self): - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[1]) + self.assertEqual(context['base_url'], '..') + + def test_context_base_url_nested_page_use_directory_urls(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Nested': 'foo/bar.md'} ] - - md_text = "[test](internal.md)" - - config = load_config(pages=pages, strict=False) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - - config = load_config(pages=pages, strict=True) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - - def test_strict_mode_invalid(self): - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', + cfg = load_config(nav=nav_cfg) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[1]) + self.assertEqual(context['base_url'], '../..') + + def test_context_base_url_relative_no_page(self): + cfg = load_config(use_directory_urls=False) + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='..') + self.assertEqual(context['base_url'], '..') + + def test_context_base_url_relative_no_page_use_directory_urls(self): + cfg = load_config() + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='..') + self.assertEqual(context['base_url'], '..') + + def test_context_base_url_absolute_no_page(self): + cfg = load_config(use_directory_urls=False) + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='/') + self.assertEqual(context['base_url'], '/') + + def test_context_base_url__absolute_no_page_use_directory_urls(self): + cfg = load_config() + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='/') + self.assertEqual(context['base_url'], '/') + + def test_context_base_url_absolute_nested_no_page(self): + cfg = load_config(use_directory_urls=False) + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='/foo/') + self.assertEqual(context['base_url'], '/foo/') + + def test_context_base_url__absolute_nested_no_page_use_directory_urls(self): + cfg = load_config() + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='/foo/') + self.assertEqual(context['base_url'], '/foo/') + + def test_context_extra_css_js_from_homepage(self): + nav_cfg = [ + {'Home': 'index.md'} ] + cfg = load_config( + nav=nav_cfg, + extra_css=['style.css'], + extra_javascript=['script.js'], + use_directory_urls=False + ) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[0]) + self.assertEqual(context['extra_css'], ['style.css']) + self.assertEqual(context['extra_javascript'], ['script.js']) + + def test_context_extra_css_js_from_nested_page(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Nested': 'foo/bar.md'} + ] + cfg = load_config( + nav=nav_cfg, + extra_css=['style.css'], + extra_javascript=['script.js'], + use_directory_urls=False + ) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[1]) + self.assertEqual(context['extra_css'], ['../style.css']) + self.assertEqual(context['extra_javascript'], ['../script.js']) + + def test_context_extra_css_js_from_nested_page_use_directory_urls(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Nested': 'foo/bar.md'} + ] + cfg = load_config( + nav=nav_cfg, + extra_css=['style.css'], + extra_javascript=['script.js'] + ) + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + nav = get_navigation(files, cfg) + context = build.get_context(nav, files, cfg, nav.pages[1]) + self.assertEqual(context['extra_css'], ['../../style.css']) + self.assertEqual(context['extra_javascript'], ['../../script.js']) - md_text = "[test](bad_link.md)" - - config = load_config(pages=pages, strict=False) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) + def test_context_extra_css_js_no_page(self): + cfg = load_config(extra_css=['style.css'], extra_javascript=['script.js']) + context = build.get_context(mock.Mock(), mock.Mock(), cfg, base_url='..') + self.assertEqual(context['extra_css'], ['../style.css']) + self.assertEqual(context['extra_javascript'], ['../script.js']) - config = load_config(pages=pages, strict=True) - page, nav = build_page(None, 'index.md', config, md_text) - self.assertRaises( - MarkdownNotFound, - page.render, config, nav) + def test_extra_context(self): + cfg = load_config(extra={'a': 1}) + context = build.get_context(mock.Mock(), mock.Mock(), cfg) + self.assertEqual(context['config']['extra']['a'], 1) - def test_absolute_link(self): - pages = [ - 'index.md', - 'sub/index.md', - ] + # Test build._build_theme_template + + @mock.patch('mkdocs.utils.write_file') + @mock.patch('mkdocs.commands.build._build_template', return_value='some content') + def test_build_theme_template(self, mock_build_template, mock_write_file): + cfg = load_config() + env = cfg['theme'].get_env() + build._build_theme_template('main.html', env, mock.Mock(), cfg, mock.Mock()) + mock_write_file.assert_called_once() + mock_build_template.assert_called_once() + + @mock.patch('mkdocs.utils.write_file') + @mock.patch('mkdocs.commands.build._build_template', return_value='some content') + @mock.patch('gzip.GzipFile') + def test_build_sitemap_template(self, mock_gzip_gzipfile, mock_build_template, mock_write_file): + cfg = load_config() + env = cfg['theme'].get_env() + build._build_theme_template('sitemap.xml', env, mock.Mock(), cfg, mock.Mock()) + mock_write_file.assert_called_once() + mock_build_template.assert_called_once() + mock_gzip_gzipfile.assert_called_once() + + @mock.patch('mkdocs.utils.write_file') + @mock.patch('mkdocs.commands.build._build_template', return_value='') + def test_skip_missing_theme_template(self, mock_build_template, mock_write_file): + cfg = load_config() + env = cfg['theme'].get_env() + with self.assertLogs('mkdocs', level='WARN') as cm: + build._build_theme_template('missing.html', env, mock.Mock(), cfg, mock.Mock()) + self.assertEqual( + cm.output, + ["WARNING:mkdocs.commands.build:Template skipped: 'missing.html' not found in theme directories."] + ) + mock_write_file.assert_not_called() + mock_build_template.assert_not_called() + + @mock.patch('mkdocs.utils.write_file') + @mock.patch('mkdocs.commands.build._build_template', return_value='') + def test_skip_theme_template_empty_output(self, mock_build_template, mock_write_file): + cfg = load_config() + env = cfg['theme'].get_env() + with self.assertLogs('mkdocs', level='INFO') as cm: + build._build_theme_template('main.html', env, mock.Mock(), cfg, mock.Mock()) + self.assertEqual( + cm.output, + ["INFO:mkdocs.commands.build:Template skipped: 'main.html' generated empty output."] + ) + mock_write_file.assert_not_called() + mock_build_template.assert_called_once() - md_text = "[test 1](/index.md) [test 2](/sub/index.md)" - config = load_config(pages=pages, strict=True) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - - def test_extension_config(self): - """ - Test that a dictionary of 'markdown_extensions' is recognized as - both a list of extensions and a dictionary of extnesion configs. - """ - md_text = dedent(""" - # A Header - """) - - expected_html = dedent(""" -

A Header

- """) - - config = load_config(pages=[{'Home': 'index.md'}], markdown_extensions=[{'toc': {'permalink': True}}]) - page, nav = build_page(None, 'index.md', config, md_text) - page.render(config, nav) - self.assertEqual(page.content.strip(), expected_html) + # Test build._build_extra_template - def test_extra_context(self): + @mock.patch('mkdocs.commands.build.open', mock.mock_open(read_data='template content')) + def test_build_extra_template(self): + cfg = load_config() + files = Files([ + File('foo.html', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + build._build_extra_template('foo.html', files, cfg, mock.Mock()) - # Same as the default schema, but don't verify the docs_dir exists. - cfg = load_config( - site_name="Site", - extra={ - 'a': 1 - } + @mock.patch('mkdocs.commands.build.open', mock.mock_open(read_data='template content')) + def test_skip_missing_extra_template(self): + cfg = load_config() + files = Files([ + File('foo.html', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + with self.assertLogs('mkdocs', level='INFO') as cm: + build._build_extra_template('missing.html', files, cfg, mock.Mock()) + self.assertEqual( + cm.output, + ["WARNING:mkdocs.commands.build:Template skipped: 'missing.html' not found in docs_dir."] ) - context = build.get_context(mock.Mock(), cfg) + @mock.patch('mkdocs.commands.build.open', side_effect=OSError('Error message.')) + def test_skip_ioerror_extra_template(self, mock_open): + cfg = load_config() + files = Files([ + File('foo.html', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + with self.assertLogs('mkdocs', level='INFO') as cm: + build._build_extra_template('foo.html', files, cfg, mock.Mock()) + self.assertEqual( + cm.output, + ["WARNING:mkdocs.commands.build:Error reading template 'foo.html': Error message."] + ) - self.assertEqual(context['config']['extra']['a'], 1) + @mock.patch('mkdocs.commands.build.open', mock.mock_open(read_data='')) + def test_skip_extra_template_empty_output(self): + cfg = load_config() + files = Files([ + File('foo.html', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + with self.assertLogs('mkdocs', level='INFO') as cm: + build._build_extra_template('foo.html', files, cfg, mock.Mock()) + self.assertEqual( + cm.output, + ["INFO:mkdocs.commands.build:Template skipped: 'foo.html' generated empty output."] + ) - def test_BOM(self): - docs_dir = tempfile.mkdtemp() - site_dir = tempfile.mkdtemp() - try: - # Create an UTF-8 Encoded file with BOM (as Micorsoft editors do). See #1186. - f = io.open(os.path.join(docs_dir, 'index.md'), 'w', encoding='utf-8-sig') - f.write('# An UTF-8 encoded file with a BOM') - f.close() - - cfg = load_config( - docs_dir=docs_dir, - site_dir=site_dir - ) - build.build(cfg) - - # Verify that the file was generated properly. - # If the BOM is not removed, Markdown will return: - # `

\ufeff# An UTF-8 encoded file with a BOM

`. - f = io.open(os.path.join(site_dir, 'index.html'), 'r', encoding='utf-8') - output = f.read() - f.close() - self.assertTrue( - '

An UTF-8 encoded file with a BOM

' in output + # Test build._populate_page + + @tempdir(files={'index.md': 'page content'}) + def test_populate_page(self, docs_dir): + cfg = load_config(docs_dir=docs_dir) + file = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + page = Page('Foo', file, cfg) + build._populate_page(page, cfg, Files([file])) + self.assertEqual(page.content, '

page content

') + + @tempdir(files={'testing.html': '

page content

'}) + def test_populate_page_dirty_modified(self, site_dir): + cfg = load_config(site_dir=site_dir) + file = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + page = Page('Foo', file, cfg) + build._populate_page(page, cfg, Files([file]), dirty=True) + self.assertTrue(page.markdown.startswith('# Welcome to MkDocs')) + self.assertTrue(page.content.startswith('

Welcome to MkDocs

')) + + @tempdir(files={'index.md': 'page content'}) + @tempdir(files={'index.html': '

page content

'}) + def test_populate_page_dirty_not_modified(self, site_dir, docs_dir): + cfg = load_config(docs_dir=docs_dir, site_dir=site_dir) + file = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + page = Page('Foo', file, cfg) + build._populate_page(page, cfg, Files([file]), dirty=True) + # Content is empty as file read was skipped + self.assertEqual(page.markdown, None) + self.assertEqual(page.content, None) + + @tempdir(files={'index.md': 'new page content'}) + @mock.patch('mkdocs.structure.pages.open', side_effect=OSError('Error message.')) + def test_populate_page_read_error(self, docs_dir, mock_open): + cfg = load_config(docs_dir=docs_dir) + file = File('missing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + page = Page('Foo', file, cfg) + with self.assertLogs('mkdocs', level='ERROR') as cm: + self.assertRaises(OSError, build._populate_page, page, cfg, Files([file])) + self.assertEqual( + cm.output, [ + 'ERROR:mkdocs.structure.pages:File not found: missing.md', + "ERROR:mkdocs.commands.build:Error reading page 'missing.md': Error message." + ] + ) + mock_open.assert_called_once() + + @tempdir(files={'index.md': 'page content'}) + @mock.patch('mkdocs.plugins.PluginCollection.run_event', side_effect=PluginError('Error message.')) + def test_populate_page_read_plugin_error(self, docs_dir, mock_open): + cfg = load_config(docs_dir=docs_dir) + file = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + page = Page('Foo', file, cfg) + with self.assertLogs('mkdocs', level='ERROR') as cm: + self.assertRaises(PluginError, build._populate_page, page, cfg, Files([file])) + self.assertEqual( + cm.output, [ + "ERROR:mkdocs.commands.build:Error reading page 'index.md':" + ] + ) + mock_open.assert_called_once() + + # Test build._build_page + + @tempdir() + def test_build_page(self, site_dir): + cfg = load_config(site_dir=site_dir, nav=['index.md'], plugins=[]) + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.markdown = 'page content' + page.content = '

page content

' + build._build_page(page, cfg, files, nav, self._get_env_with_null_translations(cfg)) + self.assertPathIsFile(site_dir, 'index.html') + + # TODO: fix this. It seems that jinja2 chokes on the mock object. Not sure how to resolve. + # @tempdir() + # @mock.patch('jinja2.environment.Template') + # def test_build_page_empty(self, site_dir, mock_template): + # mock_template.render = mock.Mock(return_value='') + # cfg = load_config(site_dir=site_dir, nav=['index.md'], plugins=[]) + # files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + # nav = get_navigation(files, cfg) + # page = files.documentation_pages()[0].page + # # Fake populate page + # page.title = '' + # page.markdown = '' + # page.content = '' + # with self.assertLogs('mkdocs', level='INFO') as cm: + # build._build_page(page, cfg, files, nav, cfg['theme'].get_env()) + # self.assertEqual( + # cm.output, + # ["INFO:mkdocs.commands.build:Page skipped: 'index.md'. Generated empty output."] + # ) + # mock_template.render.assert_called_once() + # self.assertPathNotFile(site_dir, 'index.html') + + @tempdir(files={'index.md': 'page content'}) + @tempdir(files={'index.html': '

page content

'}) + @mock.patch('mkdocs.utils.write_file') + def test_build_page_dirty_modified(self, site_dir, docs_dir, mock_write_file): + cfg = load_config(docs_dir=docs_dir, site_dir=site_dir, nav=['index.md'], plugins=[]) + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.markdown = 'new page content' + page.content = '

new page content

' + build._build_page(page, cfg, files, nav, self._get_env_with_null_translations(cfg), dirty=True) + mock_write_file.assert_not_called() + + @tempdir(files={'testing.html': '

page content

'}) + @mock.patch('mkdocs.utils.write_file') + def test_build_page_dirty_not_modified(self, site_dir, mock_write_file): + cfg = load_config(site_dir=site_dir, nav=['testing.md'], plugins=[]) + files = Files([File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.markdown = 'page content' + page.content = '

page content

' + build._build_page(page, cfg, files, nav, self._get_env_with_null_translations(cfg), dirty=True) + mock_write_file.assert_called_once() + + @tempdir() + def test_build_page_custom_template(self, site_dir): + cfg = load_config(site_dir=site_dir, nav=['index.md'], plugins=[]) + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.meta = {'template': '404.html'} + page.markdown = 'page content' + page.content = '

page content

' + build._build_page(page, cfg, files, nav, self._get_env_with_null_translations(cfg)) + self.assertPathIsFile(site_dir, 'index.html') + + @tempdir() + @mock.patch('mkdocs.utils.write_file', side_effect=OSError('Error message.')) + def test_build_page_error(self, site_dir, mock_write_file): + cfg = load_config(site_dir=site_dir, nav=['index.md'], plugins=[]) + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.markdown = 'page content' + page.content = '

page content

' + with self.assertLogs('mkdocs', level='ERROR') as cm: + self.assertRaises( + OSError, + build._build_page, + page, + cfg, + files, + nav, + self._get_env_with_null_translations(cfg) ) - - finally: - shutil.rmtree(docs_dir) - shutil.rmtree(site_dir) + self.assertEqual( + cm.output, + ["ERROR:mkdocs.commands.build:Error building page 'index.md': Error message."] + ) + mock_write_file.assert_called_once() + + @tempdir() + @mock.patch('mkdocs.plugins.PluginCollection.run_event', side_effect=PluginError('Error message.')) + def test_build_page_plugin_error(self, site_dir, mock_write_file): + cfg = load_config(site_dir=site_dir, nav=['index.md'], plugins=[]) + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + nav = get_navigation(files, cfg) + page = files.documentation_pages()[0].page + # Fake populate page + page.title = 'Title' + page.markdown = 'page content' + page.content = '

page content

' + with self.assertLogs('mkdocs', level='ERROR') as cm: + self.assertRaises(PluginError, build._build_page, page, cfg, files, nav, cfg['theme'].get_env()) + self.assertEqual( + cm.output, + ["ERROR:mkdocs.commands.build:Error building page 'index.md':"] + ) + mock_write_file.assert_called_once() + + # Test build.build + + @tempdir(files={ + 'index.md': 'page content', + 'empty.md': '', + 'img.jpg': '', + 'static.html': 'content', + '.hidden': 'content', + '.git/hidden': 'content' + }) + @tempdir() + def test_copying_media(self, site_dir, docs_dir): + cfg = load_config(docs_dir=docs_dir, site_dir=site_dir) + build.build(cfg) + + # Verify that only non-empty md file (converted to html), static HTML file and image are copied. + self.assertPathIsFile(site_dir, 'index.html') + self.assertPathIsFile(site_dir, 'img.jpg') + self.assertPathIsFile(site_dir, 'static.html') + self.assertPathNotExists(site_dir, 'empty.md') + self.assertPathNotExists(site_dir, '.hidden') + self.assertPathNotExists(site_dir, '.git/hidden') + + @tempdir(files={'index.md': 'page content'}) + @tempdir() + def test_copy_theme_files(self, site_dir, docs_dir): + cfg = load_config(docs_dir=docs_dir, site_dir=site_dir) + build.build(cfg) + + # Verify only theme media are copied, not templates, Python or localization files. + self.assertPathIsFile(site_dir, 'index.html') + self.assertPathIsFile(site_dir, '404.html') + self.assertPathIsDir(site_dir, 'js') + self.assertPathIsDir(site_dir, 'css') + self.assertPathIsDir(site_dir, 'img') + self.assertPathIsDir(site_dir, 'fonts') + self.assertPathNotExists(site_dir, '__init__.py') + self.assertPathNotExists(site_dir, '__init__.pyc') + self.assertPathNotExists(site_dir, 'base.html') + self.assertPathNotExists(site_dir, 'content.html') + self.assertPathNotExists(site_dir, 'main.html') + self.assertPathNotExists(site_dir, 'locales') + + # Test build.site_directory_contains_stale_files + + @tempdir(files=['index.html']) + def test_site_dir_contains_stale_files(self, site_dir): + self.assertTrue(build.site_directory_contains_stale_files(site_dir)) + + @tempdir() + def test_not_site_dir_contains_stale_files(self, site_dir): + self.assertFalse(build.site_directory_contains_stale_files(site_dir)) diff --git a/mkdocs/tests/cli_tests.py b/mkdocs/tests/cli_tests.py index 85ab87de2b..31f18cbfc1 100644 --- a/mkdocs/tests/cli_tests.py +++ b/mkdocs/tests/cli_tests.py @@ -1,19 +1,14 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import unittest -import mock +from unittest import mock import logging -import sys import io from click.testing import CliRunner from mkdocs import __main__ as cli -PY3 = sys.version_info[0] == 3 - class CLITests(unittest.TestCase): @@ -28,12 +23,13 @@ def test_serve_default(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr=None, + livereload='livereload', + config_file=None, strict=None, theme=None, - theme_dir=None, - livereload='livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -46,10 +42,7 @@ def test_serve_config_file(self, mock_serve): self.assertEqual(mock_serve.call_count, 1) args, kwargs = mock_serve.call_args self.assertTrue('config_file' in kwargs) - if PY3: - self.assertIsInstance(kwargs['config_file'], io.BufferedReader) - else: - self.assertTrue(isinstance(kwargs['config_file'], file)) + self.assertIsInstance(kwargs['config_file'], io.BufferedReader) self.assertEqual(kwargs['config_file'].name, 'mkdocs.yml') @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -60,12 +53,13 @@ def test_serve_dev_addr(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr='0.0.0.0:80', + livereload='livereload', + config_file=None, strict=None, theme=None, - theme_dir=None, - livereload='livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -76,12 +70,13 @@ def test_serve_strict(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr=None, + livereload='livereload', + config_file=None, strict=True, theme=None, - theme_dir=None, - livereload='livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -92,28 +87,47 @@ def test_serve_theme(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr=None, + livereload='livereload', + config_file=None, strict=None, theme='readthedocs', - theme_dir=None, - livereload='livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) - def test_serve_theme_dir(self, mock_serve): + def test_serve_use_directory_urls(self, mock_serve): result = self.runner.invoke( - cli.cli, ["serve", '--theme-dir', 'custom'], catch_exceptions=False) + cli.cli, ["serve", '--use-directory-urls'], catch_exceptions=False) self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( + dev_addr=None, + livereload='livereload', config_file=None, + strict=None, + theme=None, + use_directory_urls=True, + watch_theme=False + ) + + @mock.patch('mkdocs.commands.serve.serve', autospec=True) + def test_serve_no_directory_urls(self, mock_serve): + + result = self.runner.invoke( + cli.cli, ["serve", '--no-directory-urls'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + mock_serve.assert_called_once_with( dev_addr=None, + livereload='livereload', + config_file=None, strict=None, theme=None, - theme_dir='custom', - livereload='livereload' + use_directory_urls=False, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -124,12 +138,13 @@ def test_serve_livereload(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr=None, + livereload='livereload', + config_file=None, strict=None, theme=None, - theme_dir=None, - livereload='livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -140,12 +155,13 @@ def test_serve_no_livereload(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( - config_file=None, dev_addr=None, + livereload='no-livereload', + config_file=None, strict=None, theme=None, - theme_dir=None, - livereload='no-livereload' + use_directory_urls=None, + watch_theme=False ) @mock.patch('mkdocs.commands.serve.serve', autospec=True) @@ -156,12 +172,30 @@ def test_serve_dirtyreload(self, mock_serve): self.assertEqual(result.exit_code, 0) mock_serve.assert_called_once_with( + dev_addr=None, + livereload='dirty', config_file=None, + strict=None, + theme=None, + use_directory_urls=None, + watch_theme=False + ) + + @mock.patch('mkdocs.commands.serve.serve', autospec=True) + def test_serve_watch_theme(self, mock_serve): + + result = self.runner.invoke( + cli.cli, ["serve", '--watch-theme'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + mock_serve.assert_called_once_with( dev_addr=None, + livereload='livereload', + config_file=None, strict=None, theme=None, - theme_dir=None, - livereload='dirty' + use_directory_urls=None, + watch_theme=True ) @mock.patch('mkdocs.config.load_config', autospec=True) @@ -180,14 +214,15 @@ def test_build_defaults(self, mock_build, mock_load_config): config_file=None, strict=None, theme=None, - theme_dir=None, + use_directory_urls=None, site_dir=None ) - logger = logging.getLogger('mkdocs') - self.assertEqual(logger.level, logging.INFO) + handler = logging._handlers.get('MkDocsStreamHandler') + self.assertEqual(handler.level, logging.INFO) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) - def test_build_clean(self, mock_build): + def test_build_clean(self, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['build', '--clean'], catch_exceptions=False) @@ -198,8 +233,9 @@ def test_build_clean(self, mock_build): self.assertTrue('dirty' in kwargs) self.assertFalse(kwargs['dirty']) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) - def test_build_dirty(self, mock_build): + def test_build_dirty(self, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['build', '--dirty'], catch_exceptions=False) @@ -222,10 +258,7 @@ def test_build_config_file(self, mock_build, mock_load_config): self.assertEqual(mock_load_config.call_count, 1) args, kwargs = mock_load_config.call_args self.assertTrue('config_file' in kwargs) - if PY3: - self.assertIsInstance(kwargs['config_file'], io.BufferedReader) - else: - self.assertTrue(isinstance(kwargs['config_file'], file)) + self.assertIsInstance(kwargs['config_file'], io.BufferedReader) self.assertEqual(kwargs['config_file'].name, 'mkdocs.yml') @mock.patch('mkdocs.config.load_config', autospec=True) @@ -241,7 +274,7 @@ def test_build_strict(self, mock_build, mock_load_config): config_file=None, strict=True, theme=None, - theme_dir=None, + use_directory_urls=None, site_dir=None ) @@ -258,16 +291,16 @@ def test_build_theme(self, mock_build, mock_load_config): config_file=None, strict=None, theme='readthedocs', - theme_dir=None, + use_directory_urls=None, site_dir=None ) @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) - def test_build_theme_dir(self, mock_build, mock_load_config): + def test_build_use_directory_urls(self, mock_build, mock_load_config): result = self.runner.invoke( - cli.cli, ['build', '--theme-dir', 'custom'], catch_exceptions=False) + cli.cli, ['build', '--use-directory-urls'], catch_exceptions=False) self.assertEqual(result.exit_code, 0) self.assertEqual(mock_build.call_count, 1) @@ -275,7 +308,24 @@ def test_build_theme_dir(self, mock_build, mock_load_config): config_file=None, strict=None, theme=None, - theme_dir='custom', + use_directory_urls=True, + site_dir=None + ) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + def test_build_no_directory_urls(self, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['build', '--no-directory-urls'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + config_file=None, + strict=None, + theme=None, + use_directory_urls=False, site_dir=None ) @@ -292,31 +342,33 @@ def test_build_site_dir(self, mock_build, mock_load_config): config_file=None, strict=None, theme=None, - theme_dir=None, - site_dir='custom' + use_directory_urls=None, + site_dir='custom', ) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) - def test_build_verbose(self, mock_build): + def test_build_verbose(self, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['build', '--verbose'], catch_exceptions=False) self.assertEqual(result.exit_code, 0) self.assertEqual(mock_build.call_count, 1) - logger = logging.getLogger('mkdocs') - self.assertEqual(logger.level, logging.DEBUG) + handler = logging._handlers.get('MkDocsStreamHandler') + self.assertEqual(handler.level, logging.DEBUG) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) - def test_build_quiet(self, mock_build): + def test_build_quiet(self, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['build', '--quiet'], catch_exceptions=False) self.assertEqual(result.exit_code, 0) self.assertEqual(mock_build.call_count, 1) - logger = logging.getLogger('mkdocs') - self.assertEqual(logger.level, logging.ERROR) + handler = logging._handlers.get('MkDocsStreamHandler') + self.assertEqual(handler.level, logging.ERROR) @mock.patch('mkdocs.commands.new.new', autospec=True) def test_new(self, mock_new): @@ -342,19 +394,26 @@ def test_gh_deploy_defaults(self, mock_gh_deploy, mock_build, mock_load_config): self.assertEqual(g_kwargs['message'], None) self.assertTrue('force' in g_kwargs) self.assertEqual(g_kwargs['force'], False) + self.assertTrue('ignore_version' in g_kwargs) + self.assertEqual(g_kwargs['ignore_version'], False) self.assertEqual(mock_build.call_count, 1) b_args, b_kwargs = mock_build.call_args self.assertTrue('dirty' in b_kwargs) self.assertFalse(b_kwargs['dirty']) mock_load_config.assert_called_once_with( - config_file=None, remote_branch=None, - remote_name=None + remote_name=None, + config_file=None, + strict=None, + theme=None, + use_directory_urls=None, + site_dir=None ) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) - def test_gh_deploy_clean(self, mock_gh_deploy, mock_build): + def test_gh_deploy_clean(self, mock_gh_deploy, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['gh-deploy', '--clean'], catch_exceptions=False) @@ -366,9 +425,10 @@ def test_gh_deploy_clean(self, mock_gh_deploy, mock_build): self.assertTrue('dirty' in kwargs) self.assertFalse(kwargs['dirty']) + @mock.patch('mkdocs.config.load_config', autospec=True) @mock.patch('mkdocs.commands.build.build', autospec=True) @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) - def test_gh_deploy_dirty(self, mock_gh_deploy, mock_build): + def test_gh_deploy_dirty(self, mock_gh_deploy, mock_build, mock_load_config): result = self.runner.invoke( cli.cli, ['gh-deploy', '--dirty'], catch_exceptions=False) @@ -394,10 +454,7 @@ def test_gh_deploy_config_file(self, mock_gh_deploy, mock_build, mock_load_confi self.assertEqual(mock_load_config.call_count, 1) args, kwargs = mock_load_config.call_args self.assertTrue('config_file' in kwargs) - if PY3: - self.assertIsInstance(kwargs['config_file'], io.BufferedReader) - else: - self.assertTrue(isinstance(kwargs['config_file'], file)) + self.assertIsInstance(kwargs['config_file'], io.BufferedReader) self.assertEqual(kwargs['config_file'].name, 'mkdocs.yml') @mock.patch('mkdocs.config.load_config', autospec=True) @@ -428,9 +485,13 @@ def test_gh_deploy_remote_branch(self, mock_gh_deploy, mock_build, mock_load_con self.assertEqual(mock_gh_deploy.call_count, 1) self.assertEqual(mock_build.call_count, 1) mock_load_config.assert_called_once_with( - config_file=None, remote_branch='foo', - remote_name=None + remote_name=None, + config_file=None, + strict=None, + theme=None, + use_directory_urls=None, + site_dir=None ) @mock.patch('mkdocs.config.load_config', autospec=True) @@ -445,9 +506,13 @@ def test_gh_deploy_remote_name(self, mock_gh_deploy, mock_build, mock_load_confi self.assertEqual(mock_gh_deploy.call_count, 1) self.assertEqual(mock_build.call_count, 1) mock_load_config.assert_called_once_with( - config_file=None, remote_branch=None, - remote_name='foo' + remote_name='foo', + config_file=None, + strict=None, + theme=None, + use_directory_urls=None, + site_dir=None ) @mock.patch('mkdocs.config.load_config', autospec=True) @@ -465,3 +530,124 @@ def test_gh_deploy_force(self, mock_gh_deploy, mock_build, mock_load_config): self.assertEqual(g_kwargs['force'], True) self.assertEqual(mock_build.call_count, 1) self.assertEqual(mock_load_config.call_count, 1) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_ignore_version(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--ignore-version'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + g_args, g_kwargs = mock_gh_deploy.call_args + self.assertTrue('ignore_version' in g_kwargs) + self.assertEqual(g_kwargs['ignore_version'], True) + self.assertEqual(mock_build.call_count, 1) + self.assertEqual(mock_load_config.call_count, 1) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_strict(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--strict'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + remote_branch=None, + remote_name=None, + config_file=None, + strict=True, + theme=None, + use_directory_urls=None, + site_dir=None + ) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_theme(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--theme', 'readthedocs'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + remote_branch=None, + remote_name=None, + config_file=None, + strict=None, + theme='readthedocs', + use_directory_urls=None, + site_dir=None + ) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_use_directory_urls(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--use-directory-urls'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + remote_branch=None, + remote_name=None, + config_file=None, + strict=None, + theme=None, + use_directory_urls=True, + site_dir=None + ) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_no_directory_urls(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--no-directory-urls'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + remote_branch=None, + remote_name=None, + config_file=None, + strict=None, + theme=None, + use_directory_urls=False, + site_dir=None + ) + + @mock.patch('mkdocs.config.load_config', autospec=True) + @mock.patch('mkdocs.commands.build.build', autospec=True) + @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True) + def test_gh_deploy_site_dir(self, mock_gh_deploy, mock_build, mock_load_config): + + result = self.runner.invoke( + cli.cli, ['gh-deploy', '--site-dir', 'custom'], catch_exceptions=False) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(mock_gh_deploy.call_count, 1) + self.assertEqual(mock_build.call_count, 1) + mock_load_config.assert_called_once_with( + remote_branch=None, + remote_name=None, + config_file=None, + strict=None, + theme=None, + use_directory_urls=None, + site_dir='custom' + ) diff --git a/mkdocs/tests/config/base_tests.py b/mkdocs/tests/config/base_tests.py index ce56cd932b..e6dbde31f1 100644 --- a/mkdocs/tests/config/base_tests.py +++ b/mkdocs/tests/config/base_tests.py @@ -1,7 +1,7 @@ -from __future__ import unicode_literals import os import tempfile import unittest +from tempfile import TemporaryDirectory from mkdocs import exceptions from mkdocs.config import base, defaults @@ -12,7 +12,7 @@ class ConfigBaseTests(unittest.TestCase): def test_unrecognised_keys(self): - c = base.Config(schema=defaults.DEFAULT_SCHEMA) + c = base.Config(schema=defaults.get_schema()) c.load_dict({ 'not_a_valid_config_option': "test" }) @@ -26,7 +26,7 @@ def test_unrecognised_keys(self): def test_missing_required(self): - c = base.Config(schema=defaults.DEFAULT_SCHEMA) + c = base.Config(schema=defaults.get_schema()) errors, warnings = c.validate() @@ -42,7 +42,9 @@ def test_load_from_file(self): Allows users to specify a config other than the default `mkdocs.yml`. """ - config_file = tempfile.NamedTemporaryFile('w', delete=False) + temp_dir = TemporaryDirectory() + config_file = open(os.path.join(temp_dir.name, 'mkdocs.yml'), 'w') + os.mkdir(os.path.join(temp_dir.name, 'docs')) try: config_file.write("site_name: MkDocs Test\n") config_file.flush() @@ -52,7 +54,77 @@ def test_load_from_file(self): self.assertTrue(isinstance(cfg, base.Config)) self.assertEqual(cfg['site_name'], 'MkDocs Test') finally: - os.remove(config_file.name) + temp_dir.cleanup() + + def test_load_default_file(self): + """ + test that `mkdocs.yml` will be loaded when '--config' is not set. + """ + + temp_dir = TemporaryDirectory() + config_file = open(os.path.join(temp_dir.name, 'mkdocs.yml'), 'w') + os.mkdir(os.path.join(temp_dir.name, 'docs')) + old_dir = os.getcwd() + try: + os.chdir(temp_dir.name) + config_file.write("site_name: MkDocs Test\n") + config_file.flush() + config_file.close() + + cfg = base.load_config(config_file=None) + self.assertTrue(isinstance(cfg, base.Config)) + self.assertEqual(cfg['site_name'], 'MkDocs Test') + finally: + os.chdir(old_dir) + temp_dir.cleanup() + + def test_load_default_file_with_yaml(self): + """ + test that `mkdocs.yml` will be loaded when '--config' is not set. + """ + + temp_dir = TemporaryDirectory() + config_file = open(os.path.join(temp_dir.name, 'mkdocs.yaml'), 'w') + os.mkdir(os.path.join(temp_dir.name, 'docs')) + old_dir = os.getcwd() + try: + os.chdir(temp_dir.name) + config_file.write("site_name: MkDocs Test\n") + config_file.flush() + config_file.close() + + cfg = base.load_config(config_file=None) + self.assertTrue(isinstance(cfg, base.Config)) + self.assertEqual(cfg['site_name'], 'MkDocs Test') + finally: + os.chdir(old_dir) + temp_dir.cleanup() + + def test_load_default_file_prefer_yml(self): + """ + test that `mkdocs.yml` will be loaded when '--config' is not set. + """ + + temp_dir = TemporaryDirectory() + config_file1 = open(os.path.join(temp_dir.name, 'mkdocs.yml'), 'w') + config_file2 = open(os.path.join(temp_dir.name, 'mkdocs.yaml'), 'w') + os.mkdir(os.path.join(temp_dir.name, 'docs')) + old_dir = os.getcwd() + try: + os.chdir(temp_dir.name) + config_file1.write("site_name: MkDocs Test1\n") + config_file1.flush() + config_file1.close() + config_file2.write("site_name: MkDocs Test2\n") + config_file2.flush() + config_file2.close() + + cfg = base.load_config(config_file=None) + self.assertTrue(isinstance(cfg, base.Config)) + self.assertEqual(cfg['site_name'], 'MkDocs Test1') + finally: + os.chdir(old_dir) + temp_dir.cleanup() def test_load_from_missing_file(self): @@ -64,7 +136,12 @@ def test_load_from_open_file(self): `load_config` can accept an open file descriptor. """ - config_file = tempfile.NamedTemporaryFile('r+', delete=False) + temp_dir = TemporaryDirectory() + temp_path = temp_dir.name + config_fname = os.path.join(temp_path, 'mkdocs.yml') + + config_file = open(config_fname, 'w+') + os.mkdir(os.path.join(temp_path, 'docs')) try: config_file.write("site_name: MkDocs Test\n") config_file.flush() @@ -75,7 +152,7 @@ def test_load_from_open_file(self): # load_config will always close the file self.assertTrue(config_file.closed) finally: - os.remove(config_file.name) + temp_dir.cleanup() def test_load_from_closed_file(self): """ @@ -83,7 +160,10 @@ def test_load_from_closed_file(self): Ensure `load_config` reloads the closed file. """ - config_file = tempfile.NamedTemporaryFile('w', delete=False) + temp_dir = TemporaryDirectory() + config_file = open(os.path.join(temp_dir.name, 'mkdocs.yml'), 'w') + os.mkdir(os.path.join(temp_dir.name, 'docs')) + try: config_file.write("site_name: MkDocs Test\n") config_file.flush() @@ -93,7 +173,7 @@ def test_load_from_closed_file(self): self.assertTrue(isinstance(cfg, base.Config)) self.assertEqual(cfg['site_name'], 'MkDocs Test') finally: - os.remove(config_file.name) + temp_dir.cleanup() def test_load_from_deleted_file(self): """ @@ -118,11 +198,11 @@ def test_load_missing_required(self): config_file = tempfile.NamedTemporaryFile('w', delete=False) try: config_file.write( - "site_dir: output\nsite_uri: http://www.mkdocs.org\n") + "site_dir: output\nsite_uri: https://www.mkdocs.org\n") config_file.flush() config_file.close() - self.assertRaises(exceptions.ConfigurationError, + self.assertRaises(exceptions.Abort, base.load_config, config_file=config_file.name) finally: os.remove(config_file.name) @@ -234,3 +314,30 @@ def post_validation(self, config, key_name): ('invalid_option', 'run_validation warning'), ('invalid_option', 'post_validation warning'), ]) + + def test_load_from_file_with_relative_paths(self): + """ + When explicitly setting a config file, paths should be relative to the + config file, not the working directory. + """ + + config_dir = TemporaryDirectory() + config_fname = os.path.join(config_dir.name, 'mkdocs.yml') + docs_dir = os.path.join(config_dir.name, 'src') + os.mkdir(docs_dir) + + config_file = open(config_fname, 'w') + + try: + config_file.write("docs_dir: src\nsite_name: MkDocs Test\n") + config_file.flush() + config_file.close() + + cfg = base.load_config(config_file=config_file) + self.assertTrue(isinstance(cfg, base.Config)) + self.assertEqual(cfg['site_name'], 'MkDocs Test') + self.assertEqual(cfg['docs_dir'], docs_dir) + self.assertEqual(cfg.config_file_path, config_fname) + self.assertIsInstance(cfg.config_file_path, str) + finally: + config_dir.cleanup() diff --git a/mkdocs/tests/config/config_options_tests.py b/mkdocs/tests/config/config_options_tests.py index 87394fe53a..64996aee9a 100644 --- a/mkdocs/tests/config/config_options_tests.py +++ b/mkdocs/tests/config/config_options_tests.py @@ -1,11 +1,12 @@ -from __future__ import unicode_literals - import os +import sys import unittest +from unittest.mock import patch import mkdocs -from mkdocs import utils from mkdocs.config import config_options +from mkdocs.config.base import Config +from mkdocs.tests.base import tempdir class OptionallyRequiredTest(unittest.TestCase): @@ -49,7 +50,7 @@ class TypeTest(unittest.TestCase): def test_single_type(self): - option = config_options.Type(utils.string_types) + option = config_options.Type(str) value = option.validate("Testing") self.assertEqual(value, "Testing") @@ -66,7 +67,7 @@ def test_multiple_types(self): option.validate, {'a': 1}) def test_length(self): - option = config_options.Type(utils.string_types, length=7) + option = config_options.Type(str, length=7) value = option.validate("Testing") self.assertEqual(value, "Testing") @@ -75,6 +76,89 @@ def test_length(self): option.validate, "Testing Long") +class ChoiceTest(unittest.TestCase): + + def test_valid_choice(self): + option = config_options.Choice(('python', 'node')) + value = option.validate('python') + self.assertEqual(value, 'python') + + def test_invalid_choice(self): + option = config_options.Choice(('python', 'node')) + self.assertRaises( + config_options.ValidationError, option.validate, 'go') + + def test_invalid_choices(self): + self.assertRaises(ValueError, config_options.Choice, '') + self.assertRaises(ValueError, config_options.Choice, []) + self.assertRaises(ValueError, config_options.Choice, 5) + + +class DeprecatedTest(unittest.TestCase): + + def test_deprecated_option_simple(self): + option = config_options.Deprecated() + option.pre_validation({'d': 'value'}, 'd') + self.assertEqual(len(option.warnings), 1) + option.validate('value') + + def test_deprecated_option_message(self): + msg = 'custom message for {} key' + option = config_options.Deprecated(message=msg) + option.pre_validation({'d': 'value'}, 'd') + self.assertEqual(len(option.warnings), 1) + self.assertEqual(option.warnings[0], msg.format('d')) + + def test_deprecated_option_with_type(self): + option = config_options.Deprecated(option_type=config_options.Type(str)) + option.pre_validation({'d': 'value'}, 'd') + self.assertEqual(len(option.warnings), 1) + option.validate('value') + + def test_deprecated_option_with_invalid_type(self): + option = config_options.Deprecated(option_type=config_options.Type(list)) + config = {'d': 'string'} + option.pre_validation({'d': 'value'}, 'd') + self.assertEqual(len(option.warnings), 1) + self.assertRaises( + config_options.ValidationError, + option.validate, + config['d'] + ) + + def test_deprecated_option_with_type_undefined(self): + option = config_options.Deprecated(option_type=config_options.Type(str)) + option.validate(None) + + def test_deprecated_option_move(self): + option = config_options.Deprecated(moved_to='new') + config = {'old': 'value'} + option.pre_validation(config, 'old') + self.assertEqual(len(option.warnings), 1) + self.assertEqual(config, {'new': 'value'}) + + def test_deprecated_option_move_complex(self): + option = config_options.Deprecated(moved_to='foo.bar') + config = {'old': 'value'} + option.pre_validation(config, 'old') + self.assertEqual(len(option.warnings), 1) + self.assertEqual(config, {'foo': {'bar': 'value'}}) + + def test_deprecated_option_move_existing(self): + option = config_options.Deprecated(moved_to='foo.bar') + config = {'old': 'value', 'foo': {'existing': 'existing'}} + option.pre_validation(config, 'old') + self.assertEqual(len(option.warnings), 1) + self.assertEqual(config, {'foo': {'existing': 'existing', 'bar': 'value'}}) + + def test_deprecated_option_move_invalid(self): + option = config_options.Deprecated(moved_to='foo.bar') + config = {'old': 'value', 'foo': 'wrong type'} + option.pre_validation(config, 'old') + self.assertEqual(len(option.warnings), 1) + self.assertEqual(config, {'old': 'value', 'foo': 'wrong type'}) + + class IpAddressTest(unittest.TestCase): def test_valid_address(self): @@ -82,17 +166,17 @@ def test_valid_address(self): option = config_options.IpAddress() value = option.validate(addr) - self.assertEqual(utils.text_type(value), addr) + self.assertEqual(str(value), addr) self.assertEqual(value.host, '127.0.0.1') self.assertEqual(value.port, 8000) def test_valid_IPv6_address(self): - addr = '[::1]:8000' + addr = '::1:8000' option = config_options.IpAddress() value = option.validate(addr) - self.assertEqual(utils.text_type(value), addr) - self.assertEqual(value.host, '[::1]') + self.assertEqual(str(value), addr) + self.assertEqual(value.host, '::1') self.assertEqual(value.port, 8000) def test_named_address(self): @@ -100,7 +184,7 @@ def test_named_address(self): option = config_options.IpAddress() value = option.validate(addr) - self.assertEqual(utils.text_type(value), addr) + self.assertEqual(str(value), addr) self.assertEqual(value.host, 'localhost') self.assertEqual(value.port, 8000) @@ -109,10 +193,29 @@ def test_default_address(self): option = config_options.IpAddress(default=addr) value = option.validate(None) - self.assertEqual(utils.text_type(value), addr) + self.assertEqual(str(value), addr) self.assertEqual(value.host, '127.0.0.1') self.assertEqual(value.port, 8000) + @unittest.skipIf( + sys.version_info < (3, 9, 5), + "Leading zeros allowed in IP addresses before Python3.9.5", + ) + def test_invalid_leading_zeros(self): + addr = '127.000.000.001:8000' + option = config_options.IpAddress(default=addr) + self.assertRaises( + config_options.ValidationError, + option.validate, addr + ) + + def test_invalid_address_range(self): + option = config_options.IpAddress() + self.assertRaises( + config_options.ValidationError, + option.validate, '277.0.0.1:8000' + ) + def test_invalid_address_format(self): option = config_options.IpAddress() self.assertRaises( @@ -141,25 +244,54 @@ def test_invalid_address_missing_port(self): option.validate, '127.0.0.1' ) + def test_unsupported_address(self): + option = config_options.IpAddress() + value = option.validate('0.0.0.0:8000') + option.post_validation({'dev_addr': value}, 'dev_addr') + self.assertEqual(len(option.warnings), 1) + + def test_unsupported_IPv6_address(self): + option = config_options.IpAddress() + value = option.validate(':::8000') + option.post_validation({'dev_addr': value}, 'dev_addr') + self.assertEqual(len(option.warnings), 1) + + def test_invalid_IPv6_address(self): + # The server will error out with this so we treat it as invalid. + option = config_options.IpAddress() + self.assertRaises( + config_options.ValidationError, + option.validate, '[::1]:8000' + ) + class URLTest(unittest.TestCase): def test_valid_url(self): + option = config_options.URL() - url = "http://mkdocs.org" + self.assertEqual(option.validate("https://mkdocs.org"), "https://mkdocs.org") + self.assertEqual(option.validate(""), "") - option = config_options.URL() - value = option.validate(url) - self.assertEqual(value, url) + def test_valid_url_is_dir(self): + option = config_options.URL(is_dir=True) - def test_invalid_url(self): + self.assertEqual(option.validate("http://mkdocs.org/"), "http://mkdocs.org/") + self.assertEqual(option.validate("https://mkdocs.org"), "https://mkdocs.org/") + def test_invalid_url(self): option = config_options.URL() + self.assertRaises(config_options.ValidationError, option.validate, "www.mkdocs.org") + self.assertRaises(config_options.ValidationError, + option.validate, "//mkdocs.org/test") + self.assertRaises(config_options.ValidationError, + option.validate, "http:/mkdocs.org/") + self.assertRaises(config_options.ValidationError, + option.validate, "/hello/") - def test_invalid(self): - + def test_invalid_type(self): option = config_options.URL() self.assertRaises(config_options.ValidationError, option.validate, 1) @@ -172,7 +304,6 @@ def test_repo_name_github(self): option = config_options.RepoURL() config = {'repo_url': "https://github.com/mkdocs/mkdocs"} option.post_validation(config, 'repo_url') - self.assertEqual(config['repo_url'], config['repo_url']) self.assertEqual(config['repo_name'], "GitHub") def test_repo_name_bitbucket(self): @@ -180,15 +311,20 @@ def test_repo_name_bitbucket(self): option = config_options.RepoURL() config = {'repo_url': "https://bitbucket.org/gutworth/six/"} option.post_validation(config, 'repo_url') - self.assertEqual(config['repo_url'], config['repo_url']) self.assertEqual(config['repo_name'], "Bitbucket") + def test_repo_name_gitlab(self): + + option = config_options.RepoURL() + config = {'repo_url': "https://gitlab.com/gitlab-org/gitlab-ce/"} + option.post_validation(config, 'repo_url') + self.assertEqual(config['repo_name'], "GitLab") + def test_repo_name_custom(self): option = config_options.RepoURL() config = {'repo_url': "https://launchpad.net/python-tuskarclient"} option.post_validation(config, 'repo_url') - self.assertEqual(config['repo_url'], config['repo_url']) self.assertEqual(config['repo_name'], "Launchpad") def test_edit_uri_github(self): @@ -205,6 +341,13 @@ def test_edit_uri_bitbucket(self): option.post_validation(config, 'repo_url') self.assertEqual(config['edit_uri'], 'src/default/docs/') + def test_edit_uri_gitlab(self): + + option = config_options.RepoURL() + config = {'repo_url': "https://gitlab.com/gitlab-org/gitlab-ce/"} + option.post_validation(config, 'repo_url') + self.assertEqual(config['edit_uri'], 'edit/master/docs/') + def test_edit_uri_custom(self): option = config_options.RepoURL() @@ -260,19 +403,95 @@ def test_incorrect_type_type_error(self): self.assertRaises(config_options.ValidationError, option.validate, []) - def test_doc_dir_is_config_dir(self): + def test_dir_unicode(self): + cfg = Config( + [('dir', config_options.Dir())], + config_file_path=os.path.join(os.path.abspath('.'), 'mkdocs.yml'), + ) test_config = { - 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml'), - 'docs_dir': '.' + 'dir': 'юникод' } - docs_dir = config_options.Dir() + cfg.load_dict(test_config) - test_config['docs_dir'] = docs_dir.validate(test_config['docs_dir']) + fails, warns = cfg.validate() - self.assertRaises(config_options.ValidationError, - docs_dir.post_validation, test_config, 'docs_dir') + self.assertEqual(len(fails), 0) + self.assertEqual(len(warns), 0) + self.assertIsInstance(cfg['dir'], str) + + def test_dir_filesystemencoding(self): + cfg = Config( + [('dir', config_options.Dir())], + config_file_path=os.path.join(os.path.abspath('.'), 'mkdocs.yml'), + ) + + test_config = { + 'dir': 'Übersicht'.encode(encoding=sys.getfilesystemencoding()) + } + + cfg.load_dict(test_config) + + fails, warns = cfg.validate() + + # str does not include byte strings so validation fails + self.assertEqual(len(fails), 1) + self.assertEqual(len(warns), 0) + + def test_dir_bad_encoding_fails(self): + cfg = Config( + [('dir', config_options.Dir())], + config_file_path=os.path.join(os.path.abspath('.'), 'mkdocs.yml'), + ) + + test_config = { + 'dir': 'юникод'.encode(encoding='ISO 8859-5') + } + + cfg.load_dict(test_config) + + fails, warns = cfg.validate() + + self.assertEqual(len(fails), 1) + self.assertEqual(len(warns), 0) + + def test_config_dir_prepended(self): + base_path = os.path.abspath('.') + cfg = Config( + [('dir', config_options.Dir())], + config_file_path=os.path.join(base_path, 'mkdocs.yml'), + ) + + test_config = { + 'dir': 'foo' + } + + cfg.load_dict(test_config) + + fails, warns = cfg.validate() + + self.assertEqual(len(fails), 0) + self.assertEqual(len(warns), 0) + self.assertIsInstance(cfg['dir'], str) + self.assertEqual(cfg['dir'], os.path.join(base_path, 'foo')) + + def test_dir_is_config_dir_fails(self): + cfg = Config( + [('dir', config_options.Dir())], + config_file_path=os.path.join(os.path.abspath('.'), 'mkdocs.yml'), + ) + + test_config = { + 'dir': '.' + } + + cfg.load_dict(test_config) + + fails, warns = cfg.validate() + + self.assertEqual(len(fails), 1) + self.assertEqual(len(warns), 0) class SiteDirTest(unittest.TestCase): @@ -282,12 +501,23 @@ def validate_config(self, config): site_dir = config_options.SiteDir() docs_dir = config_options.Dir() - config['config_file_path'] = os.path.join(os.path.abspath('..'), 'mkdocs.yml') + fname = os.path.join(os.path.abspath('..'), 'mkdocs.yml') config['docs_dir'] = docs_dir.validate(config['docs_dir']) config['site_dir'] = site_dir.validate(config['site_dir']) - site_dir.post_validation(config, 'site_dir') - return True # No errors were raised + + schema = [ + ('site_dir', site_dir), + ('docs_dir', docs_dir), + ] + cfg = Config(schema, fname) + cfg.load_dict(config) + failed, warned = cfg.validate() + + if failed: + raise config_options.ValidationError(failed) + + return True def test_doc_dir_in_site_dir(self): @@ -410,12 +640,72 @@ def test_theme_invalid_type(self): self.assertRaises(config_options.ValidationError, option.validate, config) + def test_post_validation_none_theme_name_and_missing_custom_dir(self): + + config = { + 'theme': { + 'name': None + } + } + option = config_options.Theme() + self.assertRaises(config_options.ValidationError, + option.post_validation, config, 'theme') + + @tempdir() + def test_post_validation_inexisting_custom_dir(self, abs_base_path): + + config = { + 'theme': { + 'name': None, + 'custom_dir': abs_base_path + '/inexisting_custom_dir', + } + } + option = config_options.Theme() + self.assertRaises(config_options.ValidationError, + option.post_validation, config, 'theme') + + def test_post_validation_locale_none(self): + + config = { + 'theme': { + 'name': 'mkdocs', + 'locale': None + } + } + option = config_options.Theme() + self.assertRaises(config_options.ValidationError, + option.post_validation, config, 'theme') + + def test_post_validation_locale_invalid_type(self): + + config = { + 'theme': { + 'name': 'mkdocs', + 'locale': 0 + } + } + option = config_options.Theme() + self.assertRaises(config_options.ValidationError, + option.post_validation, config, 'theme') + + def test_post_validation_locale(self): + + config = { + 'theme': { + 'name': 'mkdocs', + 'locale': 'fr' + } + } + option = config_options.Theme() + option.post_validation(config, 'theme') + self.assertEqual('fr', config['theme']['locale'].language) -class PagesTest(unittest.TestCase): + +class NavTest(unittest.TestCase): def test_old_format(self): - option = config_options.Pages() + option = config_options.Nav() self.assertRaises( config_options.ValidationError, option.validate, @@ -424,7 +714,7 @@ def test_old_format(self): def test_provided_dict(self): - option = config_options.Pages() + option = config_options.Nav() value = option.validate([ 'index.md', {"Page": "page.md"} @@ -435,7 +725,7 @@ def test_provided_dict(self): def test_provided_empty(self): - option = config_options.Pages() + option = config_options.Nav() value = option.validate([]) self.assertEqual(None, value) @@ -443,13 +733,13 @@ def test_provided_empty(self): def test_invalid_type(self): - option = config_options.Pages() + option = config_options.Nav() self.assertRaises(config_options.ValidationError, option.validate, {}) def test_invalid_config(self): - option = config_options.Pages() + option = config_options.Nav() self.assertRaises(config_options.ValidationError, option.validate, [[], 1]) @@ -465,7 +755,8 @@ def test_defined(self): class MarkdownExtensionsTest(unittest.TestCase): - def test_simple_list(self): + @patch('markdown.Markdown') + def test_simple_list(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': ['foo', 'bar'] @@ -477,7 +768,8 @@ def test_simple_list(self): 'mdx_configs': {} }, config) - def test_list_dicts(self): + @patch('markdown.Markdown') + def test_list_dicts(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': [ @@ -496,7 +788,8 @@ def test_list_dicts(self): } }, config) - def test_mixed_list(self): + @patch('markdown.Markdown') + def test_mixed_list(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': [ @@ -513,7 +806,28 @@ def test_mixed_list(self): } }, config) - def test_builtins(self): + @patch('markdown.Markdown') + def test_dict_of_dicts(self, mockMd): + option = config_options.MarkdownExtensions() + config = { + 'markdown_extensions': { + 'foo': {'foo_option': 'foo value'}, + 'bar': {'bar_option': 'bar value'}, + 'baz': {} + } + } + config['markdown_extensions'] = option.validate(config['markdown_extensions']) + option.post_validation(config, 'markdown_extensions') + self.assertEqual({ + 'markdown_extensions': ['foo', 'bar', 'baz'], + 'mdx_configs': { + 'foo': {'foo_option': 'foo value'}, + 'bar': {'bar_option': 'bar value'} + } + }, config) + + @patch('markdown.Markdown') + def test_builtins(self, mockMd): option = config_options.MarkdownExtensions(builtins=['meta', 'toc']) config = { 'markdown_extensions': ['foo', 'bar'] @@ -551,7 +865,8 @@ def test_builtins_config(self): 'mdx_configs': {'toc': {'permalink': True}} }, config) - def test_configkey(self): + @patch('markdown.Markdown') + def test_configkey(self, mockMd): option = config_options.MarkdownExtensions(configkey='bar') config = { 'markdown_extensions': [ @@ -579,12 +894,14 @@ def test_none(self): 'mdx_configs': {} }, config) - def test_not_list(self): + @patch('markdown.Markdown') + def test_not_list(self, mockMd): option = config_options.MarkdownExtensions() self.assertRaises(config_options.ValidationError, option.validate, 'not a list') - def test_invalid_config_option(self): + @patch('markdown.Markdown') + def test_invalid_config_option(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': [ @@ -596,7 +913,8 @@ def test_invalid_config_option(self): option.validate, config['markdown_extensions'] ) - def test_invalid_config_item(self): + @patch('markdown.Markdown') + def test_invalid_config_item(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': [ @@ -608,7 +926,8 @@ def test_invalid_config_item(self): option.validate, config['markdown_extensions'] ) - def test_invalid_dict_item(self): + @patch('markdown.Markdown') + def test_invalid_dict_item(self, mockMd): option = config_options.MarkdownExtensions() config = { 'markdown_extensions': [ @@ -619,3 +938,13 @@ def test_invalid_dict_item(self): config_options.ValidationError, option.validate, config['markdown_extensions'] ) + + def test_unknown_extension(self): + option = config_options.MarkdownExtensions() + config = { + 'markdown_extensions': ['unknown'] + } + self.assertRaises( + config_options.ValidationError, + option.validate, config['markdown_extensions'] + ) diff --git a/mkdocs/tests/config/config_tests.py b/mkdocs/tests/config/config_tests.py index ebfdba48b3..8f9b50ebc3 100644 --- a/mkdocs/tests/config/config_tests.py +++ b/mkdocs/tests/config/config_tests.py @@ -1,24 +1,19 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import os -import shutil import tempfile import unittest +from tempfile import TemporaryDirectory import mkdocs from mkdocs import config -from mkdocs import utils from mkdocs.config import config_options +from mkdocs.config import defaults from mkdocs.exceptions import ConfigurationError +from mkdocs.localization import parse_locale from mkdocs.tests.base import dedent -def ensure_utf(string): - return string.encode('utf-8') if not utils.PY3 else string - - class ConfigTests(unittest.TestCase): def test_missing_config_file(self): @@ -27,7 +22,7 @@ def load_missing_config(): self.assertRaises(ConfigurationError, load_missing_config) def test_missing_site_name(self): - c = config.Config(schema=config.DEFAULT_SCHEMA) + c = config.Config(schema=defaults.get_schema()) c.load_dict({}) errors, warnings = c.validate() self.assertEqual(len(errors), 1) @@ -54,7 +49,7 @@ def test_invalid_config(self): """) config_file = tempfile.NamedTemporaryFile('w', delete=False) try: - config_file.write(ensure_utf(file_contents)) + config_file.write(file_contents) config_file.flush() config_file.close() @@ -81,155 +76,174 @@ def test_config_option(self): pages: - 'Introduction': 'index.md' """) - config_file = tempfile.NamedTemporaryFile('w', delete=False) - try: - config_file.write(ensure_utf(file_contents)) + with TemporaryDirectory() as temp_path: + os.mkdir(os.path.join(temp_path, 'docs')) + config_path = os.path.join(temp_path, 'mkdocs.yml') + config_file = open(config_path, 'w') + + config_file.write(file_contents) config_file.flush() config_file.close() result = config.load_config(config_file=config_file.name) self.assertEqual(result['site_name'], expected_result['site_name']) self.assertEqual(result['pages'], expected_result['pages']) - finally: - os.remove(config_file.name) def test_theme(self): - - mytheme = tempfile.mkdtemp() - custom = tempfile.mkdtemp() - - configs = [ - dict(), # default theme - {"theme": "readthedocs"}, # builtin theme - {"theme_dir": mytheme}, # custom only - {"theme": "readthedocs", "theme_dir": custom}, # builtin and custom - {"theme": {'name': 'readthedocs'}}, # builtin as complex - {"theme": {'name': None, 'custom_dir': mytheme}}, # custom only as complex - {"theme": {'name': 'readthedocs', 'custom_dir': custom}}, # builtin and custom as complex - { # user defined variables - 'theme': { - 'name': 'mkdocs', - 'static_templates': ['foo.html'], - 'show_sidebar': False, - 'some_var': 'bar' + with TemporaryDirectory() as mytheme, TemporaryDirectory() as custom: + configs = [ + dict(), # default theme + {"theme": "readthedocs"}, # builtin theme + {"theme": {'name': 'readthedocs'}}, # builtin as complex + {"theme": {'name': None, 'custom_dir': mytheme}}, # custom only as complex + {"theme": {'name': 'readthedocs', 'custom_dir': custom}}, # builtin and custom as complex + { # user defined variables + 'theme': { + 'name': 'mkdocs', + 'locale': 'fr', + 'static_templates': ['foo.html'], + 'show_sidebar': False, + 'some_var': 'bar' + } } - } - ] - - mkdocs_dir = os.path.abspath(os.path.dirname(mkdocs.__file__)) - mkdocs_templates_dir = os.path.join(mkdocs_dir, 'templates') - theme_dir = os.path.abspath(os.path.join(mkdocs_dir, 'themes')) - - results = ( - { - 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml'], - 'vars': {'include_search_page': False, 'search_index_only': False} - }, { - 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml'], - 'vars': {'include_search_page': True, 'search_index_only': False} - }, { - 'dirs': [mytheme, mkdocs_templates_dir], - 'static_templates': ['sitemap.xml'], - 'vars': {} - }, { - 'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml'], - 'vars': {'include_search_page': True, 'search_index_only': False} - }, { - 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml'], - 'vars': {'include_search_page': True, 'search_index_only': False} - }, { - 'dirs': [mytheme, mkdocs_templates_dir], - 'static_templates': ['sitemap.xml'], - 'vars': {} - }, { - 'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml'], - 'vars': {'include_search_page': True, 'search_index_only': False} - }, { - 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir], - 'static_templates': ['404.html', 'sitemap.xml', 'foo.html'], - 'vars': { - 'show_sidebar': False, - 'some_var': 'bar', - 'include_search_page': False, - 'search_index_only': False + ] + + mkdocs_dir = os.path.abspath(os.path.dirname(mkdocs.__file__)) + mkdocs_templates_dir = os.path.join(mkdocs_dir, 'templates') + theme_dir = os.path.abspath(os.path.join(mkdocs_dir, 'themes')) + + results = ( + { + 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir], + 'static_templates': ['404.html', 'sitemap.xml'], + 'vars': { + 'locale': parse_locale('en'), + 'include_search_page': False, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_style': 'github', + 'hljs_languages': [], + 'navigation_depth': 2, + 'nav_style': 'primary', + 'shortcuts': {'help': 191, 'next': 78, 'previous': 80, 'search': 83} + } + }, { + 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], + 'static_templates': ['404.html', 'sitemap.xml'], + 'vars': { + 'locale': parse_locale('en'), + 'include_search_page': True, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_languages': [], + 'include_homepage_in_sidebar': True, + 'prev_next_buttons_location': 'bottom', + 'navigation_depth': 4, + 'sticky_navigation': True, + 'titles_only': False, + 'collapse_navigation': True + } + }, { + 'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], + 'static_templates': ['404.html', 'sitemap.xml'], + 'vars': { + 'locale': parse_locale('en'), + 'include_search_page': True, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_languages': [], + 'include_homepage_in_sidebar': True, + 'prev_next_buttons_location': 'bottom', + 'navigation_depth': 4, + 'sticky_navigation': True, + 'titles_only': False, + 'collapse_navigation': True + } + }, { + 'dirs': [mytheme, mkdocs_templates_dir], + 'static_templates': ['sitemap.xml'], + 'vars': {'locale': parse_locale('en')} + }, { + 'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir], + 'static_templates': ['404.html', 'sitemap.xml'], + 'vars': { + 'locale': parse_locale('en'), + 'include_search_page': True, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_languages': [], + 'include_homepage_in_sidebar': True, + 'prev_next_buttons_location': 'bottom', + 'navigation_depth': 4, + 'sticky_navigation': True, + 'titles_only': False, + 'collapse_navigation': True + } + }, { + 'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir], + 'static_templates': ['404.html', 'sitemap.xml', 'foo.html'], + 'vars': { + 'locale': parse_locale('fr'), + 'show_sidebar': False, + 'some_var': 'bar', + 'include_search_page': False, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_style': 'github', + 'hljs_languages': [], + 'navigation_depth': 2, + 'nav_style': 'primary', + 'shortcuts': {'help': 191, 'next': 78, 'previous': 80, 'search': 83} + } } - } - ) - - for config_contents, result in zip(configs, results): + ) - c = config.Config(schema=( - ('theme', config_options.Theme(default='mkdocs')), - ('theme_dir', config_options.ThemeDir(exists=True)), - )) - c.load_dict(config_contents) - errors, warnings = c.validate() - self.assertEqual(len(errors), 0) - self.assertEqual(c['theme'].dirs, result['dirs']) - self.assertEqual(c['theme'].static_templates, set(result['static_templates'])) - self.assertEqual(dict([(k, c['theme'][k]) for k in iter(c['theme'])]), result['vars']) + for config_contents, result in zip(configs, results): - def test_default_pages(self): - tmp_dir = tempfile.mkdtemp() - try: - open(os.path.join(tmp_dir, 'index.md'), 'w').close() - open(os.path.join(tmp_dir, 'about.md'), 'w').close() - conf = config.Config(schema=config.DEFAULT_SCHEMA) - conf.load_dict({ - 'site_name': 'Example', - 'docs_dir': tmp_dir, - 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml') - }) - conf.validate() - self.assertEqual(['index.md', 'about.md'], conf['pages']) - finally: - shutil.rmtree(tmp_dir) + c = config.Config(schema=(('theme', config_options.Theme(default='mkdocs')),)) + c.load_dict(config_contents) + errors, warnings = c.validate() + self.assertEqual(len(errors), 0) + self.assertEqual(c['theme'].dirs, result['dirs']) + self.assertEqual(c['theme'].static_templates, set(result['static_templates'])) + self.assertEqual({k: c['theme'][k] for k in iter(c['theme'])}, result['vars']) - def test_default_pages_nested(self): - tmp_dir = tempfile.mkdtemp() - try: - open(os.path.join(tmp_dir, 'index.md'), 'w').close() - open(os.path.join(tmp_dir, 'getting-started.md'), 'w').close() - open(os.path.join(tmp_dir, 'about.md'), 'w').close() - os.makedirs(os.path.join(tmp_dir, 'subA')) - open(os.path.join(tmp_dir, 'subA', 'index.md'), 'w').close() - os.makedirs(os.path.join(tmp_dir, 'subA', 'subA1')) - open(os.path.join(tmp_dir, 'subA', 'subA1', 'index.md'), 'w').close() - os.makedirs(os.path.join(tmp_dir, 'subC')) - open(os.path.join(tmp_dir, 'subC', 'index.md'), 'w').close() - os.makedirs(os.path.join(tmp_dir, 'subB')) - open(os.path.join(tmp_dir, 'subB', 'index.md'), 'w').close() - conf = config.Config(schema=config.DEFAULT_SCHEMA) - conf.load_dict({ - 'site_name': 'Example', - 'docs_dir': tmp_dir, - 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml') - }) - conf.validate() - self.assertEqual([ - 'index.md', - 'about.md', - 'getting-started.md', - {'subA': [ - os.path.join('subA', 'index.md'), - {'subA1': [ - os.path.join('subA', 'subA1', 'index.md') - ]} - ]}, - {'subB': [ - os.path.join('subB', 'index.md') - ]}, - {'subC': [ - os.path.join('subC', 'index.md') - ]} - ], conf['pages']) - finally: - shutil.rmtree(tmp_dir) + def test_empty_nav(self): + conf = config.Config(schema=defaults.get_schema()) + conf.load_dict({ + 'site_name': 'Example', + 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml') + }) + conf.validate() + self.assertEqual(conf['nav'], None) + + def test_copy_pages_to_nav(self): + # TODO: remove this when pages config setting is fully deprecated. + conf = config.Config(schema=defaults.get_schema()) + conf.load_dict({ + 'site_name': 'Example', + 'pages': ['index.md', 'about.md'], + 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml') + }) + conf.validate() + self.assertEqual(conf['nav'], ['index.md', 'about.md']) + + def test_dont_overwrite_nav_with_pages(self): + # TODO: remove this when pages config setting is fully deprecated. + conf = config.Config(schema=defaults.get_schema()) + conf.load_dict({ + 'site_name': 'Example', + 'pages': ['index.md', 'about.md'], + 'nav': ['foo.md', 'bar.md'], + 'config_file_path': os.path.join(os.path.abspath('.'), 'mkdocs.yml') + }) + conf.validate() + self.assertEqual(conf['nav'], ['foo.md', 'bar.md']) def test_doc_dir_in_site_dir(self): @@ -241,7 +255,7 @@ def test_doc_dir_in_site_dir(self): {'docs_dir': '.', 'site_dir': '.'}, {'docs_dir': 'docs', 'site_dir': ''}, {'docs_dir': '', 'site_dir': ''}, - {'docs_dir': j('..', 'mkdocs', 'docs'), 'site_dir': 'docs'}, + {'docs_dir': 'docs', 'site_dir': 'docs'}, ) conf = { @@ -257,7 +271,7 @@ def test_doc_dir_in_site_dir(self): c = config.Config(schema=( ('docs_dir', config_options.Dir(default='docs')), ('site_dir', config_options.SiteDir(default='site')), - ('config_file_path', config_options.Type(utils.string_types)) + ('config_file_path', config_options.Type(str)) )) c.load_dict(patch) @@ -265,3 +279,19 @@ def test_doc_dir_in_site_dir(self): self.assertEqual(len(errors), 1) self.assertEqual(warnings, []) + + def testConfigInstancesUnique(self): + conf = mkdocs.config.Config(mkdocs.config.defaults.get_schema()) + conf.load_dict({'site_name': 'foo'}) + conf.validate() + self.assertIsNone(conf['mdx_configs'].get('toc')) + + conf = mkdocs.config.Config(mkdocs.config.defaults.get_schema()) + conf.load_dict({'site_name': 'foo', 'markdown_extensions': [{"toc": {"permalink": "aaa"}}]}) + conf.validate() + self.assertEqual(conf['mdx_configs'].get('toc'), {'permalink': 'aaa'}) + + conf = mkdocs.config.Config(mkdocs.config.defaults.get_schema()) + conf.load_dict({'site_name': 'foo'}) + conf.validate() + self.assertIsNone(conf['mdx_configs'].get('toc')) diff --git a/mkdocs/tests/gh_deploy_tests.py b/mkdocs/tests/gh_deploy_tests.py index b08e28df41..f2301df803 100644 --- a/mkdocs/tests/gh_deploy_tests.py +++ b/mkdocs/tests/gh_deploy_tests.py @@ -1,10 +1,11 @@ -from __future__ import unicode_literals - import unittest -import mock +from unittest import mock +from ghp_import import GhpError -from mkdocs.config import load_config +from mkdocs.tests.base import load_config from mkdocs.commands import gh_deploy +from mkdocs.exceptions import Abort +from mkdocs import __version__ class TestGitHubDeploy(unittest.TestCase): @@ -28,7 +29,7 @@ def test_get_current_sha(self, mock_popeno): mock_popeno().communicate.return_value = (b'6d98394\n', b'') - self.assertEqual(gh_deploy._get_current_sha(), u'6d98394') + self.assertEqual(gh_deploy._get_current_sha('.'), '6d98394') @mock.patch('subprocess.Popen') def test_get_remote_url_ssh(self, mock_popeno): @@ -38,7 +39,7 @@ def test_get_remote_url_ssh(self, mock_popeno): b'' ) - expected = (u'git@', u'mkdocs/mkdocs.git') + expected = ('git@', 'mkdocs/mkdocs.git') self.assertEqual(expected, gh_deploy._get_remote_url('origin')) @mock.patch('subprocess.Popen') @@ -49,7 +50,7 @@ def test_get_remote_url_http(self, mock_popeno): b'' ) - expected = (u'https://', u'mkdocs/mkdocs.git') + expected = ('https://', 'mkdocs/mkdocs.git') self.assertEqual(expected, gh_deploy._get_remote_url('origin')) @mock.patch('subprocess.Popen') @@ -66,8 +67,9 @@ def test_get_remote_url_enterprise(self, mock_popeno): @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') @mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None)) - @mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, '')) - def test_deploy(self, mock_import, get_remote, get_sha, is_repo): + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') + def test_deploy(self, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', @@ -77,9 +79,10 @@ def test_deploy(self, mock_import, get_remote, get_sha, is_repo): @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') @mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None)) - @mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, '')) + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') @mock.patch('os.path.isfile', return_value=False) - def test_deploy_no_cname(self, mock_isfile, mock_import, get_remote, + def test_deploy_no_cname(self, mock_isfile, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( @@ -90,25 +93,96 @@ def test_deploy_no_cname(self, mock_isfile, mock_import, get_remote, @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') @mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=( - u'git@', u'mkdocs/mkdocs.git')) - @mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, '')) - def test_deploy_hostname(self, mock_import, get_remote, get_sha, is_repo): + 'git@', 'mkdocs/mkdocs.git')) + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') + def test_deploy_hostname(self, mock_import, check_version, get_remote, get_sha, is_repo): + + config = load_config( + remote_branch='test', + ) + gh_deploy.gh_deploy(config) + + @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) + @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') + @mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None)) + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') + def test_deploy_ignore_version_default(self, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config) + check_version.assert_called_once() - @mock.patch('mkdocs.utils.ghp_import.ghp_import') + @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) + @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') + @mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None)) + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') + def test_deploy_ignore_version(self, mock_import, check_version, get_remote, get_sha, is_repo): + + config = load_config( + remote_branch='test', + ) + gh_deploy.gh_deploy(config, ignore_version=True) + check_version.assert_not_called() + + @mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True) + @mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas') + @mock.patch('mkdocs.commands.gh_deploy._check_version') + @mock.patch('ghp_import.ghp_import') @mock.patch('mkdocs.commands.gh_deploy.log') - def test_deploy_error(self, mock_log, mock_import): + def test_deploy_error(self, mock_log, mock_import, check_version, get_sha, is_repo): error_string = 'TestError123' - mock_import.return_value = (False, error_string) + mock_import.side_effect = GhpError(error_string) config = load_config( remote_branch='test', ) - self.assertRaises(SystemExit, gh_deploy.gh_deploy, config) - mock_log.error.assert_called_once_with('Failed to deploy to GitHub with error: \n%s', - error_string) + self.assertRaises(Abort, gh_deploy.gh_deploy, config) + mock_log.error.assert_called_once_with( + f'Failed to deploy to GitHub with error: \n{error_string}' + ) + + +class TestGitHubDeployLogs(unittest.TestCase): + + @mock.patch('subprocess.Popen') + def test_mkdocs_newer(self, mock_popeno): + + mock_popeno().communicate.return_value = (b'Deployed 12345678 with MkDocs version: 0.1.2\n', b'') + + with self.assertLogs('mkdocs', level='INFO') as cm: + gh_deploy._check_version('gh-pages') + self.assertEqual( + cm.output, ['INFO:mkdocs.commands.gh_deploy:Previous deployment was done with MkDocs ' + 'version 0.1.2; you are deploying with a newer version ({})'.format(__version__)] + ) + + @mock.patch('subprocess.Popen') + def test_mkdocs_older(self, mock_popeno): + + mock_popeno().communicate.return_value = (b'Deployed 12345678 with MkDocs version: 10.1.2\n', b'') + + with self.assertLogs('mkdocs', level='ERROR') as cm: + self.assertRaises(Abort, gh_deploy._check_version, 'gh-pages') + self.assertEqual( + cm.output, ['ERROR:mkdocs.commands.gh_deploy:Deployment terminated: Previous deployment was made with ' + 'MkDocs version 10.1.2; you are attempting to deploy with an older version ({}). Use ' + '--ignore-version to deploy anyway.'.format(__version__)] + ) + + @mock.patch('subprocess.Popen') + def test_version_unknown(self, mock_popeno): + + mock_popeno().communicate.return_value = (b'No version specified\n', b'') + + with self.assertLogs('mkdocs', level='WARNING') as cm: + gh_deploy._check_version('gh-pages') + self.assertEqual( + cm.output, + ['WARNING:mkdocs.commands.gh_deploy:Version check skipped: No version specified in previous deployment.'] + ) diff --git a/mkdocs/tests/integration.py b/mkdocs/tests/integration.py index 0ea7b653fc..ebbe88978d 100644 --- a/mkdocs/tests/integration.py +++ b/mkdocs/tests/integration.py @@ -14,7 +14,6 @@ - Build documentation other than just MkDocs as it is relatively simple. """ -from __future__ import unicode_literals import click import logging @@ -50,7 +49,7 @@ def main(output=None): log.debug("Building installed themes.") for theme in sorted(MKDOCS_THEMES): - log.debug("Building theme: {0}".format(theme)) + log.debug(f"Building theme: {theme}") project_dir = os.path.dirname(MKDOCS_CONFIG) out = os.path.join(output, theme) command = base_cmd + [out, '--theme', theme] @@ -58,13 +57,13 @@ def main(output=None): log.debug("Building test projects.") for project in os.listdir(TEST_PROJECTS): - log.debug("Building test project: {0}".format(project)) + log.debug(f"Building test project: {project}") project_dir = os.path.join(TEST_PROJECTS, project) out = os.path.join(output, project) command = base_cmd + [out, ] subprocess.check_call(command, cwd=project_dir) - log.debug("Theme and integration builds are in {0}".format(output)) + log.debug(f"Theme and integration builds are in {output}") if __name__ == '__main__': diff --git a/mkdocs/tests/integration/complicated_config/mkdocs.yml b/mkdocs/tests/integration/complicated_config/mkdocs.yml index f84936cc25..2694eb2a93 100644 --- a/mkdocs/tests/integration/complicated_config/mkdocs.yml +++ b/mkdocs/tests/integration/complicated_config/mkdocs.yml @@ -1,6 +1,6 @@ site_name: My Docs -pages: +nav: - Home: index.md - User Guide: - Writing your docs: index.md @@ -18,10 +18,10 @@ site_dir: output theme: name: mkdocs custom_dir: theme_tweaks + analytics: {gtag: 'G-ABC123'} copyright: "Dougal Matthews" -google_analytics: ["1", "2"] -dev_addr: 0.0.0.0:8000 +dev_addr: ::1:8000 use_directory_urls: false repo_url: https://github.com/mkdocs/mkdocs/tree/master/mkdocs/tests/integration diff --git a/mkdocs/tests/integration/minimal/docs/testing.md b/mkdocs/tests/integration/minimal/docs/testing.md index da37213adb..0e680e6857 100644 --- a/mkdocs/tests/integration/minimal/docs/testing.md +++ b/mkdocs/tests/integration/minimal/docs/testing.md @@ -1,6 +1,6 @@ # Welcome to MkDocs -For full documentation visit [mkdocs.org](http://mkdocs.org). +For full documentation visit [mkdocs.org](https://www.mkdocs.org). ## Commands diff --git a/mkdocs/tests/integration/minimal/mkdocs.yml b/mkdocs/tests/integration/minimal/mkdocs.yml index f4d5b08c94..ff21753366 100644 --- a/mkdocs/tests/integration/minimal/mkdocs.yml +++ b/mkdocs/tests/integration/minimal/mkdocs.yml @@ -1,6 +1,6 @@ site_name: MyTest -pages: +nav: - 'testing.md' site_author: "Tom Christie & Dougal Matthews" diff --git a/mkdocs/tests/integration/subpages/docs/index.md b/mkdocs/tests/integration/subpages/docs/index.md index e4801fa6f4..9700881581 100644 --- a/mkdocs/tests/integration/subpages/docs/index.md +++ b/mkdocs/tests/integration/subpages/docs/index.md @@ -1,4 +1,4 @@ -# Test sub pages and referencing images +## Test sub pages and referencing images ## Reference an image in: / diff --git a/mkdocs/tests/integration/subpages/docs/metadata.md b/mkdocs/tests/integration/subpages/docs/metadata.md new file mode 100644 index 0000000000..d871ea26db --- /dev/null +++ b/mkdocs/tests/integration/subpages/docs/metadata.md @@ -0,0 +1,5 @@ +title: A Page Title + +# Welcome to MkDocs + +Some page content goes here. diff --git a/mkdocs/tests/integration/subpages/docs/page-title.md b/mkdocs/tests/integration/subpages/docs/page-title.md new file mode 100644 index 0000000000..26075f1ca2 --- /dev/null +++ b/mkdocs/tests/integration/subpages/docs/page-title.md @@ -0,0 +1 @@ +Page content. diff --git a/mkdocs/tests/integration/subpages/docs/pageTitle.md b/mkdocs/tests/integration/subpages/docs/pageTitle.md new file mode 100644 index 0000000000..26075f1ca2 --- /dev/null +++ b/mkdocs/tests/integration/subpages/docs/pageTitle.md @@ -0,0 +1 @@ +Page content. diff --git "a/mkdocs/tests/integration/unicode/docs/\303\234bersicht.md" "b/mkdocs/tests/integration/unicode/docs/\303\234bersicht.md" index da37213adb..f60b3b1e61 100644 --- "a/mkdocs/tests/integration/unicode/docs/\303\234bersicht.md" +++ "b/mkdocs/tests/integration/unicode/docs/\303\234bersicht.md" @@ -1,13 +1,13 @@ -# Welcome to MkDocs +Welcome to MkDocs -For full documentation visit [mkdocs.org](http://mkdocs.org). +For full documentation visit [mkdocs.org](https://www.mkdocs.org). ## Commands * `mkdocs new [dir-name]` - Create a new project. * `mkdocs serve` - Start the live-reloading docs server. * `mkdocs build` - Build the documentation site. -* `mkdocs help` - Print this help message. +* `mkdocs -h` - Print this help message. ## Project layout diff --git "a/mkdocs/tests/integration/unicode/docs/\342\231\252.md" "b/mkdocs/tests/integration/unicode/docs/\342\231\252.md" index da37213adb..1ddff18be0 100644 --- "a/mkdocs/tests/integration/unicode/docs/\342\231\252.md" +++ "b/mkdocs/tests/integration/unicode/docs/\342\231\252.md" @@ -1,6 +1,6 @@ -# Welcome to MkDocs +Welcome to MkDocs -For full documentation visit [mkdocs.org](http://mkdocs.org). +For full documentation visit [mkdocs.org](https://www.mkdocs.org). ## Commands diff --git a/mkdocs/tests/livereload_tests.py b/mkdocs/tests/livereload_tests.py new file mode 100644 index 0000000000..6ec81fda85 --- /dev/null +++ b/mkdocs/tests/livereload_tests.py @@ -0,0 +1,572 @@ +#!/usr/bin/env python + +import contextlib +import email +import io +import os +import sys +import threading +import time +import unittest +from pathlib import Path +from unittest import mock + +from mkdocs.livereload import LiveReloadServer +from mkdocs.tests.base import tempdir + + +class FakeRequest: + def __init__(self, content): + self.in_file = io.BytesIO(content.encode()) + self.out_file = io.BytesIO() + self.out_file.close = lambda: None + + def makefile(self, *args, **kwargs): + return self.in_file + + def sendall(self, data): + self.out_file.write(data) + + +@contextlib.contextmanager +def testing_server(root, builder=lambda: None, mount_path="/"): + """Create the server and start most of its parts, but don't listen on a socket.""" + with mock.patch("socket.socket"): + server = LiveReloadServer( + builder, + host="localhost", + port=0, + root=root, + mount_path=mount_path, + polling_interval=0.2, + bind_and_activate=False, + ) + server.setup_environ() + server.observer.start() + thread = threading.Thread(target=server._build_loop, daemon=True) + thread.start() + yield server + server.shutdown() + thread.join() + + +def do_request(server, content): + request = FakeRequest(content + " HTTP/1.1") + server.RequestHandlerClass(request, ("127.0.0.1", 0), server) + response = request.out_file.getvalue() + + headers, _, content = response.partition(b"\r\n\r\n") + status, _, headers = headers.partition(b"\r\n") + status = status.split(None, 1)[1].decode() + + headers = email.message_from_bytes(headers) + headers["_status"] = status + return headers, content.decode() + + +SCRIPT_REGEX = ( + r'' +) + + +class BuildTests(unittest.TestCase): + @tempdir({"test.css": "div { color: red; }"}) + def test_serves_normal_file(self, site_dir): + with testing_server(site_dir) as server: + headers, output = do_request(server, "GET /test.css") + self.assertEqual(output, "div { color: red; }") + self.assertEqual(headers["_status"], "200 OK") + self.assertEqual(headers.get("content-length"), str(len(output))) + + @tempdir({"docs/foo.docs": "docs1", "mkdocs.yml": "yml1"}) + @tempdir({"foo.site": "original"}) + def test_basic_rebuild(self, site_dir, origin_dir): + docs_dir = Path(origin_dir, "docs") + + started_building = threading.Event() + + def rebuild(): + started_building.set() + Path(site_dir, "foo.site").write_text( + Path(docs_dir, "foo.docs").read_text() + Path(origin_dir, "mkdocs.yml").read_text() + ) + + with testing_server(site_dir, rebuild) as server: + server.watch(docs_dir, rebuild) + server.watch(Path(origin_dir, "mkdocs.yml"), rebuild) + time.sleep(0.01) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "original") + + Path(docs_dir, "foo.docs").write_text("docs2") + self.assertTrue(started_building.wait(timeout=10)) + started_building.clear() + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "docs2yml1") + + Path(origin_dir, "mkdocs.yml").write_text("yml2") + self.assertTrue(started_building.wait(timeout=10)) + started_building.clear() + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "docs2yml2") + + @tempdir({"foo.docs": "a"}) + @tempdir({"foo.site": "original"}) + def test_rebuild_after_delete(self, site_dir, docs_dir): + started_building = threading.Event() + + def rebuild(): + started_building.set() + Path(site_dir, "foo.site").unlink() + + with testing_server(site_dir, rebuild) as server: + server.watch(docs_dir, rebuild) + time.sleep(0.01) + + Path(docs_dir, "foo.docs").write_text("b") + self.assertTrue(started_building.wait(timeout=10)) + + with self.assertLogs("mkdocs.livereload"): + _, output = do_request(server, "GET /foo.site") + + self.assertIn("404", output) + + @tempdir({"aaa": "something"}) + def test_rebuild_after_rename(self, site_dir): + started_building = threading.Event() + + with testing_server(site_dir, started_building.set) as server: + server.watch(site_dir) + time.sleep(0.01) + + Path(site_dir, "aaa").rename(Path(site_dir, "bbb")) + self.assertTrue(started_building.wait(timeout=10)) + + @tempdir() + def test_rebuild_on_edit(self, site_dir): + started_building = threading.Event() + + with open(Path(site_dir, "test"), "wb") as f: + time.sleep(0.01) + + with testing_server(site_dir, started_building.set) as server: + server.watch(site_dir) + time.sleep(0.01) + + f.write(b"hi\n") + f.flush() + + self.assertTrue(started_building.wait(timeout=10)) + + @tempdir({"foo.docs": "a"}) + @tempdir({"foo.site": "original"}) + def test_custom_action_warns(self, site_dir, docs_dir): + started_building = threading.Event() + + def rebuild(): + started_building.set() + content = Path(docs_dir, "foo.docs").read_text() + Path(site_dir, "foo.site").write_text(content * 5) + + with testing_server(site_dir) as server: + with self.assertWarnsRegex(DeprecationWarning, "func") as cm: + server.watch(docs_dir, rebuild) + time.sleep(0.01) + self.assertIn("livereload_tests.py", cm.filename) + + Path(docs_dir, "foo.docs").write_text("b") + self.assertTrue(started_building.wait(timeout=10)) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "bbbbb") + + @tempdir({"foo.docs": "docs1"}) + @tempdir({"foo.extra": "extra1"}) + @tempdir({"foo.site": "original"}) + def test_multiple_dirs_can_cause_rebuild(self, site_dir, extra_dir, docs_dir): + started_building = threading.Barrier(2) + + def rebuild(): + started_building.wait(timeout=10) + content1 = Path(docs_dir, "foo.docs").read_text() + content2 = Path(extra_dir, "foo.extra").read_text() + Path(site_dir, "foo.site").write_text(content1 + content2) + + with testing_server(site_dir, rebuild) as server: + server.watch(docs_dir) + server.watch(extra_dir) + time.sleep(0.01) + + Path(docs_dir, "foo.docs").write_text("docs2") + started_building.wait(timeout=10) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "docs2extra1") + + Path(extra_dir, "foo.extra").write_text("extra2") + started_building.wait(timeout=10) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "docs2extra2") + + @tempdir({"foo.docs": "docs1"}) + @tempdir({"foo.extra": "extra1"}) + @tempdir({"foo.site": "original"}) + def test_multiple_dirs_changes_rebuild_only_once(self, site_dir, extra_dir, docs_dir): + started_building = threading.Event() + + def rebuild(): + self.assertFalse(started_building.is_set()) + started_building.set() + content1 = Path(docs_dir, "foo.docs").read_text() + content2 = Path(extra_dir, "foo.extra").read_text() + Path(site_dir, "foo.site").write_text(content1 + content2) + + with testing_server(site_dir, rebuild) as server: + server.watch(docs_dir) + server.watch(extra_dir) + time.sleep(0.01) + + _, output = do_request(server, "GET /foo.site") + Path(docs_dir, "foo.docs").write_text("docs2") + Path(extra_dir, "foo.extra").write_text("extra2") + self.assertTrue(started_building.wait(timeout=10)) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "docs2extra2") + + @tempdir({"foo.docs": "a"}) + @tempdir({"foo.site": "original"}) + def test_change_is_detected_while_building(self, site_dir, docs_dir): + before_finished_building = threading.Barrier(2) + can_finish_building = threading.Event() + + def rebuild(): + content = Path(docs_dir, "foo.docs").read_text() + Path(site_dir, "foo.site").write_text(content * 5) + before_finished_building.wait(timeout=10) + self.assertTrue(can_finish_building.wait(timeout=10)) + + with testing_server(site_dir, rebuild) as server: + server.watch(docs_dir) + time.sleep(0.01) + + Path(docs_dir, "foo.docs").write_text("b") + before_finished_building.wait(timeout=10) + Path(docs_dir, "foo.docs").write_text("c") + can_finish_building.set() + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "bbbbb") + + before_finished_building.wait(timeout=10) + + _, output = do_request(server, "GET /foo.site") + self.assertEqual(output, "ccccc") + + @tempdir( + { + "normal.html": "hello", + "no_body.html": "

hi", + "empty.html": "", + "multi_body.html": "foobar", + } + ) + def test_serves_modified_html(self, site_dir): + with testing_server(site_dir) as server: + headers, output = do_request(server, "GET /normal.html") + self.assertRegex(output, fr"^hello{SCRIPT_REGEX}$") + self.assertEqual(headers.get("content-type"), "text/html") + self.assertEqual(headers.get("content-length"), str(len(output))) + + _, output = do_request(server, "GET /no_body.html") + self.assertRegex(output, fr"^

hi{SCRIPT_REGEX}$") + + headers, output = do_request(server, "GET /empty.html") + self.assertRegex(output, fr"^{SCRIPT_REGEX}$") + self.assertEqual(headers.get("content-length"), str(len(output))) + + _, output = do_request(server, "GET /multi_body.html") + self.assertRegex(output, fr"^foobar{SCRIPT_REGEX}$") + + @tempdir({"index.html": "aaa", "foo/index.html": "bbb"}) + def test_serves_directory_index(self, site_dir): + with testing_server(site_dir) as server: + headers, output = do_request(server, "GET /") + self.assertRegex(output, fr"^aaa{SCRIPT_REGEX}$") + self.assertEqual(headers["_status"], "200 OK") + self.assertEqual(headers.get("content-type"), "text/html") + self.assertEqual(headers.get("content-length"), str(len(output))) + + for path in "/foo/", "/foo/index.html": + _, output = do_request(server, "GET /foo/") + self.assertRegex(output, fr"^bbb{SCRIPT_REGEX}$") + + with self.assertLogs("mkdocs.livereload"): + headers, _ = do_request(server, "GET /foo/index.html/") + self.assertEqual(headers["_status"], "404 Not Found") + + @tempdir({"foo/bar/index.html": "aaa"}) + def test_redirects_to_directory(self, site_dir): + with testing_server(site_dir, mount_path="/sub") as server: + with self.assertLogs("mkdocs.livereload"): + headers, _ = do_request(server, "GET /sub/foo/bar") + self.assertEqual(headers["_status"], "302 Found") + self.assertEqual(headers.get("location"), "/sub/foo/bar/") + + @tempdir({"я.html": "aaa", "测试2/index.html": "bbb"}) + def test_serves_with_unicode_characters(self, site_dir): + with testing_server(site_dir) as server: + _, output = do_request(server, "GET /я.html") + self.assertRegex(output, fr"^aaa{SCRIPT_REGEX}$") + _, output = do_request(server, "GET /%D1%8F.html") + self.assertRegex(output, fr"^aaa{SCRIPT_REGEX}$") + + with self.assertLogs("mkdocs.livereload"): + headers, _ = do_request(server, "GET /%D1.html") + self.assertEqual(headers["_status"], "404 Not Found") + + _, output = do_request(server, "GET /测试2/") + self.assertRegex(output, fr"^bbb{SCRIPT_REGEX}$") + _, output = do_request(server, "GET /%E6%B5%8B%E8%AF%952/index.html") + self.assertRegex(output, fr"^bbb{SCRIPT_REGEX}$") + + @tempdir() + def test_serves_js(self, site_dir): + with testing_server(site_dir) as server: + for mount_path in "/", "/sub/": + server.mount_path = mount_path + + headers, output = do_request(server, "GET /js/livereload.js") + self.assertIn("function livereload", output) + self.assertEqual(headers["_status"], "200 OK") + self.assertEqual(headers.get("content-type"), "application/javascript") + + @tempdir() + def test_serves_polling_instantly(self, site_dir): + with testing_server(site_dir) as server: + _, output = do_request(server, "GET /livereload/0/0") + self.assertTrue(output.isdigit()) + + @tempdir() + @tempdir() + def test_serves_polling_after_event(self, site_dir, docs_dir): + with testing_server(site_dir) as server: + initial_epoch = server._visible_epoch + + server.watch(docs_dir) + time.sleep(0.01) + + Path(docs_dir, "foo.docs").write_text("b") + + _, output = do_request(server, f"GET /livereload/{initial_epoch}/0") + + self.assertNotEqual(server._visible_epoch, initial_epoch) + self.assertEqual(output, str(server._visible_epoch)) + + @tempdir() + def test_serves_polling_with_timeout(self, site_dir): + with testing_server(site_dir) as server: + server.poll_response_timeout = 0.2 + initial_epoch = server._visible_epoch + + start_time = time.monotonic() + _, output = do_request(server, f"GET /livereload/{initial_epoch}/0") + self.assertGreaterEqual(time.monotonic(), start_time + 0.2) + self.assertEqual(output, str(initial_epoch)) + + @tempdir() + def test_error_handler(self, site_dir): + with testing_server(site_dir) as server: + server.error_handler = lambda code: b"[%d]" % code + with self.assertLogs("mkdocs.livereload") as cm: + headers, output = do_request(server, "GET /missing") + + self.assertEqual(headers["_status"], "404 Not Found") + self.assertEqual(output, "[404]") + self.assertRegex( + "\n".join(cm.output), + r'^WARNING:mkdocs.livereload:.*"GET /missing HTTP/1.1" code 404', + ) + + @tempdir() + def test_bad_error_handler(self, site_dir): + self.maxDiff = None + with testing_server(site_dir) as server: + server.error_handler = lambda code: 0 / 0 + with self.assertLogs("mkdocs.livereload") as cm: + headers, output = do_request(server, "GET /missing") + + self.assertEqual(headers["_status"], "404 Not Found") + self.assertIn("404", output) + self.assertRegex( + "\n".join(cm.output), r"Failed to render an error message[\s\S]+/missing.+code 404" + ) + + @tempdir( + { + "test.html": "\nhi", + "test.xml": '\n', + "test.css": "div { color: red; }", + "test.js": "use strict;", + "test.json": '{"a": "b"}', + } + ) + def test_mime_types(self, site_dir): + with testing_server(site_dir) as server: + headers, _ = do_request(server, "GET /test.html") + self.assertEqual(headers.get("content-type"), "text/html") + + headers, _ = do_request(server, "GET /test.xml") + self.assertIn(headers.get("content-type"), ["text/xml", "application/xml"]) + + headers, _ = do_request(server, "GET /test.css") + self.assertEqual(headers.get("content-type"), "text/css") + + headers, _ = do_request(server, "GET /test.js") + self.assertEqual(headers.get("content-type"), "application/javascript") + + headers, _ = do_request(server, "GET /test.json") + self.assertEqual(headers.get("content-type"), "application/json") + + @tempdir({"index.html": "aaa", "sub/sub.html": "bbb"}) + def test_serves_from_mount_path(self, site_dir): + with testing_server(site_dir, mount_path="/sub") as server: + headers, output = do_request(server, "GET /sub/") + self.assertRegex(output, fr"^aaa{SCRIPT_REGEX}$") + self.assertEqual(headers.get("content-type"), "text/html") + + _, output = do_request(server, "GET /sub/sub/sub.html") + self.assertRegex(output, fr"^bbb{SCRIPT_REGEX}$") + + with self.assertLogs("mkdocs.livereload"): + headers, _ = do_request(server, "GET /sub/sub.html") + self.assertEqual(headers["_status"], "404 Not Found") + + @tempdir() + def test_redirects_to_mount_path(self, site_dir): + with testing_server(site_dir, mount_path="/mount/path") as server: + with self.assertLogs("mkdocs.livereload"): + headers, _ = do_request(server, "GET /") + self.assertEqual(headers["_status"], "302 Found") + self.assertEqual(headers.get("location"), "/mount/path/") + + @tempdir({"mkdocs.yml": "original", "mkdocs2.yml": "original"}, prefix="tmp_dir") + @tempdir(prefix="origin_dir") + @tempdir({"subdir/foo.md": "original"}, prefix="dest_docs_dir") + def test_watches_direct_symlinks(self, dest_docs_dir, origin_dir, tmp_dir): + try: + Path(origin_dir, "docs").symlink_to(dest_docs_dir, target_is_directory=True) + Path(origin_dir, "mkdocs.yml").symlink_to(Path(tmp_dir, "mkdocs.yml")) + except NotImplementedError: # PyPy on Windows + self.skipTest("Creating symlinks not supported") + + started_building = threading.Event() + + def wait_for_build(): + result = started_building.wait(timeout=10) + started_building.clear() + with self.assertLogs("mkdocs.livereload"): + do_request(server, "GET /") + return result + + with testing_server(tmp_dir, started_building.set) as server: + server.watch(Path(origin_dir, "docs")) + server.watch(Path(origin_dir, "mkdocs.yml")) + time.sleep(0.01) + + Path(origin_dir, "unrelated.md").write_text("foo") + self.assertFalse(started_building.wait(timeout=0.5)) + + Path(tmp_dir, "mkdocs.yml").write_text("edited") + self.assertTrue(wait_for_build()) + + Path(dest_docs_dir, "subdir", "foo.md").write_text("edited") + self.assertTrue(wait_for_build()) + + @tempdir(["file_dest_1.md", "file_dest_2.md", "file_dest_unused.md"], prefix="tmp_dir") + @tempdir(["file_under.md"], prefix="dir_to_link_to") + @tempdir() + def test_watches_through_symlinks(self, docs_dir, dir_to_link_to, tmp_dir): + try: + Path(docs_dir, "link1.md").symlink_to(Path(tmp_dir, "file_dest_1.md")) + Path(docs_dir, "linked_dir").symlink_to(dir_to_link_to, target_is_directory=True) + + Path(dir_to_link_to, "sublink.md").symlink_to(Path(tmp_dir, "file_dest_2.md")) + except NotImplementedError: # PyPy on Windows + self.skipTest("Creating symlinks not supported") + + started_building = threading.Event() + + def wait_for_build(): + result = started_building.wait(timeout=10) + started_building.clear() + with self.assertLogs("mkdocs.livereload"): + do_request(server, "GET /") + return result + + with testing_server(docs_dir, started_building.set) as server: + server.watch(docs_dir) + time.sleep(0.01) + + Path(tmp_dir, "file_dest_1.md").write_text("edited") + self.assertTrue(wait_for_build()) + + Path(dir_to_link_to, "file_under.md").write_text("edited") + self.assertTrue(wait_for_build()) + + Path(tmp_dir, "file_dest_2.md").write_text("edited") + self.assertTrue(wait_for_build()) + + Path(docs_dir, "link1.md").unlink() + self.assertTrue(wait_for_build()) + + Path(tmp_dir, "file_dest_unused.md").write_text("edited") + self.assertFalse(started_building.wait(timeout=0.5)) + + @tempdir(prefix="site_dir") + @tempdir(["docs/unused.md", "README.md"], prefix="origin_dir") + def test_watches_through_relative_symlinks(self, origin_dir, site_dir): + docs_dir = Path(origin_dir, "docs") + old_cwd = os.getcwd() + os.chdir(docs_dir) + try: + Path(docs_dir, "README.md").symlink_to(Path("..", "README.md")) + except NotImplementedError: # PyPy on Windows + self.skipTest("Creating symlinks not supported") + finally: + os.chdir(old_cwd) + + started_building = threading.Event() + + with testing_server(docs_dir, started_building.set) as server: + server.watch(docs_dir) + time.sleep(0.01) + + Path(origin_dir, "README.md").write_text("edited") + self.assertTrue(started_building.wait(timeout=10)) + + @tempdir() + def test_watch_with_broken_symlinks(self, docs_dir): + Path(docs_dir, "subdir").mkdir() + + try: + if sys.platform != "win32": + Path(docs_dir, "subdir", "circular").symlink_to(Path(docs_dir)) + + Path(docs_dir, "broken_1").symlink_to(Path(docs_dir, "oh no")) + Path(docs_dir, "broken_2").symlink_to(Path(docs_dir, "oh no"), target_is_directory=True) + Path(docs_dir, "broken_3").symlink_to(Path(docs_dir, "broken_2")) + except NotImplementedError: # PyPy on Windows + self.skipTest("Creating symlinks not supported") + + started_building = threading.Event() + with testing_server(docs_dir, started_building.set) as server: + server.watch(docs_dir) + time.sleep(0.01) + + Path(docs_dir, "subdir", "test").write_text("test") + self.assertTrue(started_building.wait(timeout=10)) diff --git a/mkdocs/tests/localization_tests.py b/mkdocs/tests/localization_tests.py new file mode 100644 index 0000000000..704c798993 --- /dev/null +++ b/mkdocs/tests/localization_tests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# coding: utf-8 + +from __future__ import unicode_literals + +import unittest + +from mkdocs.localization import install_translations, parse_locale +from mkdocs.tests.base import tempdir +from mkdocs.config.base import ValidationError + + +class LocalizationTests(unittest.TestCase): + + def setUp(self): + self.env = unittest.mock.Mock() + + def test_jinja_extension_installed(self): + install_translations(self.env, parse_locale('en'), []) + self.env.add_extension.assert_called_once_with('jinja2.ext.i18n') + + def test_valid_language(self): + locale = parse_locale('en') + self.assertEqual(locale.language, 'en') + + def test_valid_language_territory(self): + locale = parse_locale('en_US') + self.assertEqual(locale.language, 'en') + self.assertEqual(locale.territory, 'US') + self.assertEqual(str(locale), 'en_US') + + def test_unknown_locale(self): + self.assertRaises(ValidationError, parse_locale, 'foo') + + def test_invalid_locale(self): + self.assertRaises(ValidationError, parse_locale, '42') + + @tempdir() + def test_no_translations_found(self, dir_without_translations): + install_translations(self.env, parse_locale('fr_CA'), [dir_without_translations]) + self.env.install_null_translations.assert_called_once() + + @tempdir + def test_translations_found(self, tdir): + translations = unittest.mock.Mock() + + with unittest.mock.patch('mkdocs.localization.Translations.load', return_value=translations): + install_translations(self.env, parse_locale('en'), [tdir]) + + self.env.install_gettext_translations.assert_called_once_with(translations) + + @tempdir() + @tempdir() + def test_merge_translations(self, custom_dir, theme_dir): + custom_dir_translations = unittest.mock.Mock() + theme_dir_translations = unittest.mock.Mock() + + def side_effet(*args, **kwargs): + dirname = args[0] + if dirname.startswith(custom_dir): + return custom_dir_translations + elif dirname.startswith(theme_dir): + return theme_dir_translations + else: + self.fail() + + with unittest.mock.patch('mkdocs.localization.Translations.load', side_effect=side_effet): + install_translations(self.env, parse_locale('en'), [custom_dir, theme_dir]) + + theme_dir_translations.merge.assert_called_once_with(custom_dir_translations) diff --git a/mkdocs/tests/nav_tests.py b/mkdocs/tests/nav_tests.py deleted file mode 100644 index d8648b1ca3..0000000000 --- a/mkdocs/tests/nav_tests.py +++ /dev/null @@ -1,850 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -from __future__ import unicode_literals -import mock -import os -import unittest - -from mkdocs import nav -from mkdocs.exceptions import ConfigurationError -from mkdocs.tests.base import dedent, load_config - - -class SiteNavigationTests(unittest.TestCase): - def test_simple_toc(self): - pages = [ - {'Home': 'index.md'}, - {'About': 'about.md'} - ] - expected = dedent(""" - Home - / - About - /about/ - """) - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 2) - self.assertEqual(len(site_navigation.pages), 2) - - def test_empty_toc_item(self): - pages = [ - 'index.md', - {'About': 'about.md'} - ] - expected = dedent(""" - Home - / - About - /about/ - """) - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 2) - self.assertEqual(len(site_navigation.pages), 2) - - def test_indented_toc(self): - pages = [ - {'Home': 'index.md'}, - {'API Guide': [ - {'Running': 'api-guide/running.md'}, - {'Testing': 'api-guide/testing.md'}, - {'Debugging': 'api-guide/debugging.md'}, - ]}, - {'About': [ - {'Release notes': 'about/release-notes.md'}, - {'License': 'about/license.md'} - ]} - ] - expected = dedent(""" - Home - / - API Guide - Running - /api-guide/running/ - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ - About - Release notes - /about/release-notes/ - License - /about/license/ - """) - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 3) - self.assertEqual(len(site_navigation.pages), 6) - - def test_nested_ungrouped(self): - pages = [ - {'Home': 'index.md'}, - {'Contact': 'about/contact.md'}, - {'License Title': 'about/sub/license.md'}, - ] - expected = dedent(""" - Home - / - Contact - /about/contact/ - License Title - /about/sub/license/ - """) - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 3) - self.assertEqual(len(site_navigation.pages), 3) - - def test_nested_ungrouped_no_titles(self): - pages = [ - 'index.md', - 'about/contact.md', - 'about/sub/license.md' - ] - expected = dedent(""" - Home - / - Contact - /about/contact/ - License - /about/sub/license/ - """) - - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 3) - self.assertEqual(len(site_navigation.pages), 3) - - @mock.patch.object(os.path, 'sep', '\\') - def test_nested_ungrouped_no_titles_windows(self): - pages = [ - 'index.md', - 'about\\contact.md', - 'about\\sub\\license.md', - ] - expected = dedent(""" - Home - / - Contact - /about/contact/ - License - /about/sub/license/ - """) - - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - self.assertEqual(str(site_navigation).strip(), expected) - self.assertEqual(len(site_navigation.nav_items), 3) - self.assertEqual(len(site_navigation.pages), 3) - - def test_walk_simple_toc(self): - pages = [ - {'Home': 'index.md'}, - {'About': 'about.md'} - ] - expected = [ - dedent(""" - Home - / [*] - About - /about/ - """), - dedent(""" - Home - / - About - /about/ [*] - """) - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - for index, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(str(site_navigation).strip(), expected[index]) - - def test_walk_empty_toc(self): - pages = [ - 'index.md', - {'About': 'about.md'} - ] - expected = [ - dedent(""" - Home - / [*] - About - /about/ - """), - dedent(""" - Home - / - About - /about/ [*] - """) - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - for index, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(str(site_navigation).strip(), expected[index]) - - def test_walk_indented_toc(self): - pages = [ - {'Home': 'index.md'}, - {'API Guide': [ - {'Running': 'api-guide/running.md'}, - {'Testing': 'api-guide/testing.md'}, - {'Debugging': 'api-guide/debugging.md'}, - ]}, - {'About': [ - {'Release notes': 'about/release-notes.md'}, - {'License': 'about/license.md'} - ]} - ] - expected = [ - dedent(""" - Home - / [*] - API Guide - Running - /api-guide/running/ - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ - About - Release notes - /about/release-notes/ - License - /about/license/ - """), - dedent(""" - Home - / - API Guide [*] - Running - /api-guide/running/ [*] - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ - About - Release notes - /about/release-notes/ - License - /about/license/ - """), - dedent(""" - Home - / - API Guide [*] - Running - /api-guide/running/ - Testing - /api-guide/testing/ [*] - Debugging - /api-guide/debugging/ - About - Release notes - /about/release-notes/ - License - /about/license/ - """), - dedent(""" - Home - / - API Guide [*] - Running - /api-guide/running/ - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ [*] - About - Release notes - /about/release-notes/ - License - /about/license/ - """), - dedent(""" - Home - / - API Guide - Running - /api-guide/running/ - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ - About [*] - Release notes - /about/release-notes/ [*] - License - /about/license/ - """), - dedent(""" - Home - / - API Guide - Running - /api-guide/running/ - Testing - /api-guide/testing/ - Debugging - /api-guide/debugging/ - About [*] - Release notes - /about/release-notes/ - License - /about/license/ [*] - """) - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - for index, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(str(site_navigation).strip(), expected[index]) - - def test_base_url(self): - pages = [ - 'index.md' - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages, use_directory_urls=False)) - base_url = site_navigation.url_context.make_relative('/') - self.assertEqual(base_url, '.') - - def test_relative_md_links_have_slash(self): - pages = [ - 'index.md', - 'user-guide/styling-your-docs.md' - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages, use_directory_urls=False)) - site_navigation.url_context.base_path = "/user-guide/configuration" - url = site_navigation.url_context.make_relative('/user-guide/styling-your-docs/') - self.assertEqual(url, '../styling-your-docs/') - - def test_generate_site_navigation(self): - """ - Verify inferring page titles based on the filename - """ - - pages = [ - 'index.md', - 'api-guide/running.md', - 'about/notes.md', - 'about/sub/license.md', - ] - - url_context = nav.URLContext() - nav_items, pages = nav._generate_site_navigation(load_config(pages=pages), url_context) - - self.assertEqual([n.title for n in nav_items], - ['Home', 'Running', 'Notes', 'License']) - self.assertEqual([n.url for n in nav_items], [ - '.', - 'api-guide/running/', - 'about/notes/', - 'about/sub/license/' - ]) - self.assertEqual([p.title for p in pages], - ['Home', 'Running', 'Notes', 'License']) - - @mock.patch.object(os.path, 'sep', '\\') - def test_generate_site_navigation_windows(self): - """ - Verify inferring page titles based on the filename with a windows path - """ - pages = [ - 'index.md', - 'api-guide\\running.md', - 'about\\notes.md', - 'about\\sub\\license.md', - ] - - url_context = nav.URLContext() - nav_items, pages = nav._generate_site_navigation(load_config(pages=pages), url_context) - - self.assertEqual([n.title for n in nav_items], - ['Home', 'Running', 'Notes', 'License']) - self.assertEqual([n.url for n in nav_items], [ - '.', - 'api-guide/running/', - 'about/notes/', - 'about/sub/license/' - ]) - self.assertEqual([p.title for p in pages], - ['Home', 'Running', 'Notes', 'License']) - - def test_force_abs_urls(self): - """ - Verify force absolute URLs - """ - - pages = [ - 'index.md', - 'api-guide/running.md', - 'about/notes.md', - 'about/sub/license.md', - ] - - url_context = nav.URLContext() - url_context.force_abs_urls = True - nav_items, pages = nav._generate_site_navigation(load_config(pages=pages), url_context) - - self.assertEqual([n.title for n in nav_items], - ['Home', 'Running', 'Notes', 'License']) - self.assertEqual([n.url for n in nav_items], [ - '/', - '/api-guide/running/', - '/about/notes/', - '/about/sub/license/' - ]) - - def test_force_abs_urls_with_base(self): - """ - Verify force absolute URLs - """ - - pages = [ - 'index.md', - 'api-guide/running.md', - 'about/notes.md', - 'about/sub/license.md', - ] - - url_context = nav.URLContext() - url_context.force_abs_urls = True - url_context.base_path = '/foo/' - nav_items, pages = nav._generate_site_navigation(load_config(pages=pages), url_context) - - self.assertEqual([n.title for n in nav_items], - ['Home', 'Running', 'Notes', 'License']) - self.assertEqual([n.url for n in nav_items], [ - '/foo/', - '/foo/api-guide/running/', - '/foo/about/notes/', - '/foo/about/sub/license/' - ]) - - def test_invalid_pages_config(self): - - bad_page = {"a": "index.md", "b": "index.md"} # extra key - - def _test(): - return nav._generate_site_navigation(load_config(pages=[bad_page, ]), None) - - self.assertRaises(ConfigurationError, _test) - - def test_pages_config(self): - - bad_page = {} # empty - - def _test(): - return nav._generate_site_navigation(load_config(pages=[bad_page, ]), None) - - self.assertRaises(ConfigurationError, _test) - - def test_ancestors(self): - - pages = [ - {'Home': 'index.md'}, - {'API Guide': [ - {'Running': 'api-guide/running.md'}, - {'Testing': 'api-guide/testing.md'}, - {'Debugging': 'api-guide/debugging.md'}, - {'Advanced': [ - {'Part 1': 'api-guide/advanced/part-1.md'}, - ]}, - ]}, - {'About': [ - {'Release notes': 'about/release-notes.md'}, - {'License': 'about/license.md'} - ]} - ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - - ancestors = ( - [], - [site_navigation.nav_items[1]], - [site_navigation.nav_items[1]], - [site_navigation.nav_items[1]], - [site_navigation.nav_items[1], - site_navigation.pages[4].ancestors[-1]], - [site_navigation.nav_items[2]], - [site_navigation.nav_items[2]], - ) - - self.assertEqual(len(site_navigation.pages), len(ancestors)) - - for i, (page, expected_ancestor) in enumerate( - zip(site_navigation.pages, ancestors)): - self.assertEqual(page.ancestors, expected_ancestor, - "Failed on ancestor test {0}".format(i)) - - def test_nesting(self): - - pages = [ - {'Home': 'index.md'}, - {'Install': [ - {'Pre-install': 'install/install-pre.md'}, - {'The install': 'install/install-actual.md'}, - {'Post install': 'install/install-post.md'}, - ]}, - {'Guide': [ - {'Tutorial': [ - {'Getting Started': 'guide/tutorial/running.md'}, - {'Advanced Features': 'guide/tutorial/testing.md'}, - {'Further Reading': 'guide/tutorial/debugging.md'}, - ]}, - {'API Reference': [ - {'Feature 1': 'guide/api-ref/running.md'}, - {'Feature 2': 'guide/api-ref/testing.md'}, - {'Feature 3': 'guide/api-ref/debugging.md'}, - ]}, - {'Testing': 'guide/testing.md'}, - {'Deploying': 'guide/deploying.md'}, - ]} - ] - - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - - self.assertEqual([n.title for n in site_navigation.nav_items], - ['Home', 'Install', 'Guide']) - self.assertEqual(len(site_navigation.pages), 12) - - expected = dedent(""" - Home - / - Install - Pre-install - /install/install-pre/ - The install - /install/install-actual/ - Post install - /install/install-post/ - Guide - Tutorial - Getting Started - /guide/tutorial/running/ - Advanced Features - /guide/tutorial/testing/ - Further Reading - /guide/tutorial/debugging/ - API Reference - Feature 1 - /guide/api-ref/running/ - Feature 2 - /guide/api-ref/testing/ - Feature 3 - /guide/api-ref/debugging/ - Testing - /guide/testing/ - Deploying - /guide/deploying/ - """) - - self.maxDiff = None - self.assertEqual(str(site_navigation).strip(), expected) - - def test_edit_uri(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Basic test - repo_url = 'http://example.com/' - edit_uri = 'edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2], - repo_url + edit_uri + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_sub_dir(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Basic test - repo_url = 'http://example.com/foo/' - edit_uri = 'edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2], - repo_url + edit_uri + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_missing_slash(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Ensure the '/' is added to the repo_url and edit_uri - repo_url = 'http://example.com' - edit_uri = 'edit/master/docs' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + '/' + edit_uri + '/' + pages[0], - repo_url + '/' + edit_uri + '/' + pages[1], - repo_url + '/' + edit_uri + '/' + pages[2], - repo_url + '/' + edit_uri + '/' + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_sub_dir_missing_slash(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Basic test - repo_url = 'http://example.com/foo' - edit_uri = 'edit/master/docs' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + '/' + edit_uri + '/' + pages[0], - repo_url + '/' + edit_uri + '/' + pages[1], - repo_url + '/' + edit_uri + '/' + pages[2], - repo_url + '/' + edit_uri + '/' + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_query_string(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Ensure query strings are supported - repo_url = 'http://example.com' - edit_uri = '?query=edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2], - repo_url + edit_uri + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_fragment(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub/internal.md', - 'sub1/sub2/internal.md', - ] - - # Ensure fragment strings are supported - repo_url = 'http://example.com' - edit_uri = '#fragment/edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2], - repo_url + edit_uri + pages[3], - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Basic test - repo_url = 'http://example.com/' - edit_uri = 'edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2].replace('\\', '/'), - repo_url + edit_uri + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_sub_dir_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Basic test - repo_url = 'http://example.com/foo/' - edit_uri = 'edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2].replace('\\', '/'), - repo_url + edit_uri + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_missing_slash_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Ensure the '/' is added to the repo_url and edit_uri - repo_url = 'http://example.com' - edit_uri = 'edit/master/docs' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + '/' + edit_uri + '/' + pages[0], - repo_url + '/' + edit_uri + '/' + pages[1], - repo_url + '/' + edit_uri + '/' + pages[2].replace('\\', '/'), - repo_url + '/' + edit_uri + '/' + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_sub_dir_missing_slash_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Ensure the '/' is added to the repo_url and edit_uri - repo_url = 'http://example.com/foo' - edit_uri = 'edit/master/docs' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + '/' + edit_uri + '/' + pages[0], - repo_url + '/' + edit_uri + '/' + pages[1], - repo_url + '/' + edit_uri + '/' + pages[2].replace('\\', '/'), - repo_url + '/' + edit_uri + '/' + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_query_string_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Ensure query strings are supported - repo_url = 'http://example.com' - edit_uri = '?query=edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2].replace('\\', '/'), - repo_url + edit_uri + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) - - def test_edit_uri_fragment_windows(self): - - pages = [ - 'index.md', - 'internal.md', - 'sub\\internal.md', - 'sub1\\sub2\\internal.md', - ] - - # Ensure fragment strings are supported - repo_url = 'http://example.com' - edit_uri = '#fragment/edit/master/docs/' - - site_navigation = nav.SiteNavigation(load_config( - pages=pages, - repo_url=repo_url, - edit_uri=edit_uri, - site_dir='site', - site_url='', - use_directory_urls=True - )) - - expected_results = ( - repo_url + edit_uri + pages[0], - repo_url + edit_uri + pages[1], - repo_url + edit_uri + pages[2].replace('\\', '/'), - repo_url + edit_uri + pages[3].replace('\\', '/'), - ) - - for idx, page in enumerate(site_navigation.walk_pages()): - self.assertEqual(page.edit_url, expected_results[idx]) diff --git a/mkdocs/tests/new_tests.py b/mkdocs/tests/new_tests.py index 0b81dd025a..735fdf5d8d 100644 --- a/mkdocs/tests/new_tests.py +++ b/mkdocs/tests/new_tests.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import tempfile import unittest import os diff --git a/mkdocs/tests/plugin_tests.py b/mkdocs/tests/plugin_tests.py index 6fa4091a6f..295a75d15e 100644 --- a/mkdocs/tests/plugin_tests.py +++ b/mkdocs/tests/plugin_tests.py @@ -1,46 +1,65 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import unittest -import mock +from unittest import mock +import os from mkdocs import plugins -from mkdocs import utils from mkdocs import config +from mkdocs.commands import build +from mkdocs.exceptions import BuildError, PluginError, Abort +from mkdocs.tests.base import load_config class DummyPlugin(plugins.BasePlugin): config_scheme = ( - ('foo', config.config_options.Type(utils.string_types, default='default foo')), - ('bar', config.config_options.Type(int, default=0)) + ('foo', config.config_options.Type(str, default='default foo')), + ('bar', config.config_options.Type(int, default=0)), + ('dir', config.config_options.Dir(exists=False)), ) def on_pre_page(self, content, **kwargs): - """ prepend `foo` config value to page content. """ - return ' '.join((self.config['foo'], content)) + """ modify page content by prepending `foo` config value. """ + return '{} {}'.format(self.config['foo'], content) def on_nav(self, item, **kwargs): """ do nothing (return None) to not modify item. """ return None + def on_page_read_source(self, **kwargs): + """ create new source by prepending `foo` config value to 'source'. """ + return '{} {}'.format(self.config['foo'], 'source') + + def on_pre_build(self, **kwargs): + """ do nothing (return None). """ + return None + class TestPluginClass(unittest.TestCase): def test_valid_plugin_options(self): + test_dir = 'test' options = { - 'foo': 'some value' + 'foo': 'some value', + 'dir': test_dir, } + cfg_fname = os.path.join('tmp', 'test', 'fname.yml') + cfg_fname = os.path.abspath(cfg_fname) + + cfg_dirname = os.path.dirname(cfg_fname) + expected = os.path.join(cfg_dirname, test_dir) + expected = { 'foo': 'some value', - 'bar': 0 + 'bar': 0, + 'dir': expected, } plugin = DummyPlugin() - errors, warnings = plugin.load_config(options) + errors, warnings = plugin.load_config(options, config_file_path=cfg_fname) self.assertEqual(plugin.config, expected) self.assertEqual(errors, []) self.assertEqual(warnings, []) @@ -105,6 +124,20 @@ def test_event_returns_None(self): collection['foo'] = plugin self.assertEqual(collection.run_event('nav', 'nav item'), 'nav item') + def test_event_empty_item(self): + collection = plugins.PluginCollection() + plugin = DummyPlugin() + plugin.load_config({'foo': 'new'}) + collection['foo'] = plugin + self.assertEqual(collection.run_event('page_read_source'), 'new source') + + def test_event_empty_item_returns_None(self): + collection = plugins.PluginCollection() + plugin = DummyPlugin() + plugin.load_config({'foo': 'new'}) + collection['foo'] = plugin + self.assertEqual(collection.run_event('pre_build'), None) + def test_run_undefined_event_on_collection(self): collection = plugins.PluginCollection() self.assertEqual(collection.run_event('pre_page', 'page content'), 'page content') @@ -113,12 +146,71 @@ def test_run_unknown_event_on_collection(self): collection = plugins.PluginCollection() self.assertRaises(KeyError, collection.run_event, 'unknown', 'page content') + def test_run_build_error_event(self): + build_errors = [] + + class PluginRaisingError(plugins.BasePlugin): + def __init__(self, error_on): + self.error_on = error_on + + def on_pre_page(self, page, **kwargs): + if self.error_on == 'pre_page': + raise BuildError('pre page error') + return page + + def on_page_markdown(self, markdown, **kwargs): + if self.error_on == 'page_markdown': + raise BuildError('page markdown error') + return markdown + + def on_page_content(self, html, **kwargs): + if self.error_on == 'page_content': + raise PluginError('page content error') + return html + + def on_post_page(self, html, **kwargs): + if self.error_on == 'post_page': + raise ValueError('post page error') + + def on_build_error(self, error, **kwargs): + build_errors.append(error) + + cfg = load_config() + cfg['plugins']['errorplugin'] = PluginRaisingError(error_on='pre_page') + self.assertRaises(Abort, build.build, cfg) + + cfg = load_config() + cfg['plugins']['errorplugin'] = PluginRaisingError(error_on='page_markdown') + self.assertRaises(Abort, build.build, cfg) + + cfg = load_config() + cfg['plugins']['errorplugin'] = PluginRaisingError(error_on='page_content') + self.assertRaises(Abort, build.build, cfg) + + cfg = load_config() + cfg['plugins']['errorplugin'] = PluginRaisingError(error_on='post_page') + self.assertRaises(ValueError, build.build, cfg) + + cfg = load_config() + cfg['plugins']['errorplugin'] = PluginRaisingError(error_on='') + build.build(cfg) + + self.assertEqual(len(build_errors), 4) + self.assertIs(build_errors[0].__class__, BuildError) + self.assertEqual(str(build_errors[0]), 'pre page error') + self.assertIs(build_errors[1].__class__, BuildError) + self.assertEqual(str(build_errors[1]), 'page markdown error') + self.assertIs(build_errors[2].__class__, PluginError) + self.assertEqual(str(build_errors[2]), 'page content error') + self.assertIs(build_errors[3].__class__, ValueError) + self.assertEqual(str(build_errors[3]), 'post page error') + MockEntryPoint = mock.Mock() MockEntryPoint.configure_mock(**{'name': 'sample', 'load.return_value': DummyPlugin}) -@mock.patch('pkg_resources.iter_entry_points', return_value=[MockEntryPoint]) +@mock.patch('importlib_metadata.entry_points', return_value=[MockEntryPoint]) class TestPluginConfig(unittest.TestCase): def test_plugin_config_without_options(self, mock_class): @@ -132,7 +224,8 @@ def test_plugin_config_without_options(self, mock_class): self.assertIsInstance(cfg['plugins']['sample'], plugins.BasePlugin) expected = { 'foo': 'default foo', - 'bar': 0 + 'bar': 0, + 'dir': None, } self.assertEqual(cfg['plugins']['sample'].config, expected) @@ -154,7 +247,31 @@ def test_plugin_config_with_options(self, mock_class): self.assertIsInstance(cfg['plugins']['sample'], plugins.BasePlugin) expected = { 'foo': 'foo value', - 'bar': 42 + 'bar': 42, + 'dir': None, + } + self.assertEqual(cfg['plugins']['sample'].config, expected) + + def test_plugin_config_as_dict(self, mock_class): + + cfg = { + 'plugins': { + 'sample': { + 'foo': 'foo value', + 'bar': 42 + } + } + } + option = config.config_options.Plugins() + cfg['plugins'] = option.validate(cfg['plugins']) + + self.assertIsInstance(cfg['plugins'], plugins.PluginCollection) + self.assertIn('sample', cfg['plugins']) + self.assertIsInstance(cfg['plugins']['sample'], plugins.BasePlugin) + expected = { + 'foo': 'foo value', + 'bar': 42, + 'dir': None, } self.assertEqual(cfg['plugins']['sample'].config, expected) @@ -194,7 +311,8 @@ def test_plugin_config_none_with_default(self, mock_class): self.assertIsInstance(cfg['plugins']['sample'], plugins.BasePlugin) expected = { 'foo': 'default foo', - 'bar': 0 + 'bar': 0, + 'dir': None, } self.assertEqual(cfg['plugins']['sample'].config, expected) diff --git a/mkdocs/tests/search_tests.py b/mkdocs/tests/search_tests.py index 244dff6d0e..439faea741 100644 --- a/mkdocs/tests/search_tests.py +++ b/mkdocs/tests/search_tests.py @@ -1,36 +1,284 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import unittest +from unittest import mock +import json -from mkdocs import nav -from mkdocs.contrib.legacy_search import search_index as search -from mkdocs.tests.base import dedent, markdown_to_toc, load_config +from mkdocs.structure.files import File +from mkdocs.structure.pages import Page +from mkdocs.structure.toc import get_toc +from mkdocs.contrib import search +from mkdocs.contrib.search import search_index +from mkdocs.config.config_options import ValidationError +from mkdocs.tests.base import dedent, get_markdown_toc, load_config def strip_whitespace(string): return string.replace("\n", "").replace(" ", "") -class SearchTests(unittest.TestCase): - - def test_html_stripper(self): - - stripper = search.HTMLStripper() +class SearchConfigTests(unittest.TestCase): + + def test_lang_default(self): + option = search.LangOption(default=['en']) + value = option.validate(None) + self.assertEqual(['en'], value) + + def test_lang_str(self): + option = search.LangOption() + value = option.validate('en') + self.assertEqual(['en'], value) + + def test_lang_list(self): + option = search.LangOption() + value = option.validate(['en']) + self.assertEqual(['en'], value) + + def test_lang_multi_list(self): + option = search.LangOption() + value = option.validate(['en', 'es', 'fr']) + self.assertEqual(['en', 'es', 'fr'], value) + + def test_lang_no_default_none(self): + option = search.LangOption() + value = option.validate(None) + self.assertIsNone(value) + + def test_lang_no_default_str(self): + option = search.LangOption(default=[]) + value = option.validate('en') + self.assertEqual(['en'], value) + + def test_lang_no_default_list(self): + option = search.LangOption(default=[]) + value = option.validate(['en']) + self.assertEqual(['en'], value) + + def test_lang_bad_type(self): + option = search.LangOption() + self.assertRaises(ValidationError, option.validate, {}) + + def test_lang_bad_code(self): + option = search.LangOption() + value = option.validate(['foo']) + self.assertEqual(['en'], value) + + def test_lang_good_and_bad_code(self): + option = search.LangOption() + value = option.validate(['en', 'foo']) + self.assertEqual(['en'], value) + + def test_lang_missing_and_with_territory(self): + option = search.LangOption() + value = option.validate(['zh_CN', 'pt_BR', 'fr']) + self.assertEqual(['fr', 'en', 'pt'], value) + + +class SearchPluginTests(unittest.TestCase): + + def test_plugin_config_defaults(self): + expected = { + 'lang': None, + 'separator': r'[\s\-]+', + 'min_search_length': 3, + 'prebuild_index': False, + 'indexing': 'full' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_plugin_config_lang(self): + expected = { + 'lang': ['es'], + 'separator': r'[\s\-]+', + 'min_search_length': 3, + 'prebuild_index': False, + 'indexing': 'full' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({'lang': 'es'}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_plugin_config_separator(self): + expected = { + 'lang': None, + 'separator': r'[\s\-\.]+', + 'min_search_length': 3, + 'prebuild_index': False, + 'indexing': 'full' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({'separator': r'[\s\-\.]+'}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_plugin_config_min_search_length(self): + expected = { + 'lang': None, + 'separator': r'[\s\-]+', + 'min_search_length': 2, + 'prebuild_index': False, + 'indexing': 'full' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({'min_search_length': 2}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_plugin_config_prebuild_index(self): + expected = { + 'lang': None, + 'separator': r'[\s\-]+', + 'min_search_length': 3, + 'prebuild_index': True, + 'indexing': 'full' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({'prebuild_index': True}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_plugin_config_indexing(self): + expected = { + 'lang': None, + 'separator': r'[\s\-]+', + 'min_search_length': 3, + 'prebuild_index': False, + 'indexing': 'titles' + } + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({'indexing': 'titles'}) + self.assertEqual(plugin.config, expected) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + def test_event_on_config_defaults(self): + plugin = search.SearchPlugin() + plugin.load_config({}) + result = plugin.on_config(load_config(theme='mkdocs', extra_javascript=[])) + self.assertFalse(result['theme']['search_index_only']) + self.assertFalse(result['theme']['include_search_page']) + self.assertEqual(result['theme'].static_templates, {'404.html', 'sitemap.xml'}) + self.assertEqual(len(result['theme'].dirs), 3) + self.assertEqual(result['extra_javascript'], ['search/main.js']) + self.assertEqual(plugin.config['lang'], [result['theme']['locale'].language]) + + def test_event_on_config_lang(self): + plugin = search.SearchPlugin() + plugin.load_config({'lang': 'es'}) + result = plugin.on_config(load_config(theme='mkdocs', extra_javascript=[])) + self.assertFalse(result['theme']['search_index_only']) + self.assertFalse(result['theme']['include_search_page']) + self.assertEqual(result['theme'].static_templates, {'404.html', 'sitemap.xml'}) + self.assertEqual(len(result['theme'].dirs), 3) + self.assertEqual(result['extra_javascript'], ['search/main.js']) + self.assertEqual(plugin.config['lang'], ['es']) + + def test_event_on_config_theme_locale(self): + plugin = search.SearchPlugin() + plugin.load_config({}) + result = plugin.on_config(load_config(theme={'name': 'mkdocs', 'locale': 'fr'}, extra_javascript=[])) + self.assertFalse(result['theme']['search_index_only']) + self.assertFalse(result['theme']['include_search_page']) + self.assertEqual(result['theme'].static_templates, {'404.html', 'sitemap.xml'}) + self.assertEqual(len(result['theme'].dirs), 3) + self.assertEqual(result['extra_javascript'], ['search/main.js']) + self.assertEqual(plugin.config['lang'], [result['theme']['locale'].language]) + + def test_event_on_config_include_search_page(self): + plugin = search.SearchPlugin() + plugin.load_config({}) + config = load_config(theme={'name': 'mkdocs', 'include_search_page': True}, extra_javascript=[]) + result = plugin.on_config(config) + self.assertFalse(result['theme']['search_index_only']) + self.assertTrue(result['theme']['include_search_page']) + self.assertEqual(result['theme'].static_templates, {'404.html', 'sitemap.xml', 'search.html'}) + self.assertEqual(len(result['theme'].dirs), 3) + self.assertEqual(result['extra_javascript'], ['search/main.js']) + + def test_event_on_config_search_index_only(self): + plugin = search.SearchPlugin() + plugin.load_config({}) + config = load_config(theme={'name': 'mkdocs', 'search_index_only': True}, extra_javascript=[]) + result = plugin.on_config(config) + self.assertTrue(result['theme']['search_index_only']) + self.assertFalse(result['theme']['include_search_page']) + self.assertEqual(result['theme'].static_templates, {'404.html', 'sitemap.xml'}) + self.assertEqual(len(result['theme'].dirs), 2) + self.assertEqual(len(result['extra_javascript']), 0) + + @mock.patch('mkdocs.utils.write_file', autospec=True) + @mock.patch('mkdocs.utils.copy_file', autospec=True) + def test_event_on_post_build_defaults(self, mock_copy_file, mock_write_file): + plugin = search.SearchPlugin() + plugin.load_config({}) + config = load_config(theme='mkdocs') + plugin.on_config(config) + plugin.on_pre_build(config) + plugin.on_post_build(config) + self.assertEqual(mock_copy_file.call_count, 0) + self.assertEqual(mock_write_file.call_count, 1) + + @mock.patch('mkdocs.utils.write_file', autospec=True) + @mock.patch('mkdocs.utils.copy_file', autospec=True) + def test_event_on_post_build_single_lang(self, mock_copy_file, mock_write_file): + plugin = search.SearchPlugin() + plugin.load_config({'lang': ['es']}) + config = load_config(theme='mkdocs') + plugin.on_pre_build(config) + plugin.on_post_build(config) + self.assertEqual(mock_copy_file.call_count, 2) + self.assertEqual(mock_write_file.call_count, 1) + + @mock.patch('mkdocs.utils.write_file', autospec=True) + @mock.patch('mkdocs.utils.copy_file', autospec=True) + def test_event_on_post_build_multi_lang(self, mock_copy_file, mock_write_file): + plugin = search.SearchPlugin() + plugin.load_config({'lang': ['es', 'fr']}) + config = load_config(theme='mkdocs') + plugin.on_pre_build(config) + plugin.on_post_build(config) + self.assertEqual(mock_copy_file.call_count, 4) + self.assertEqual(mock_write_file.call_count, 1) + + @mock.patch('mkdocs.utils.write_file', autospec=True) + @mock.patch('mkdocs.utils.copy_file', autospec=True) + def test_event_on_post_build_search_index_only(self, mock_copy_file, mock_write_file): + plugin = search.SearchPlugin() + plugin.load_config({'lang': ['es']}) + config = load_config(theme={'name': 'mkdocs', 'search_index_only': True}) + plugin.on_pre_build(config) + plugin.on_post_build(config) + self.assertEqual(mock_copy_file.call_count, 0) + self.assertEqual(mock_write_file.call_count, 1) + + +class SearchIndexTests(unittest.TestCase): + + def test_html_stripping(self): + + stripper = search_index.ContentParser() stripper.feed("

Testing

Content

") - self.assertEquals(stripper.data, ["Testing", "Content"]) + self.assertEqual(stripper.stripped_html, "Testing\nContent") def test_content_parser(self): - parser = search.ContentParser() + parser = search_index.ContentParser() parser.feed('

Title

TEST') parser.close() - self.assertEquals(parser.data, [search.ContentSection( + self.assertEqual(parser.data, [search_index.ContentSection( text=["TEST"], id_="title", title="Title" @@ -38,12 +286,12 @@ def test_content_parser(self): def test_content_parser_no_id(self): - parser = search.ContentParser() + parser = search_index.ContentParser() parser.feed("

Title

TEST") parser.close() - self.assertEquals(parser.data, [search.ContentSection( + self.assertEqual(parser.data, [search_index.ContentSection( text=["TEST"], id_=None, title="Title" @@ -51,12 +299,12 @@ def test_content_parser_no_id(self): def test_content_parser_content_before_header(self): - parser = search.ContentParser() + parser = search_index.ContentParser() parser.feed("Content Before H1

Title

TEST") parser.close() - self.assertEquals(parser.data, [search.ContentSection( + self.assertEqual(parser.data, [search_index.ContentSection( text=["TEST"], id_=None, title="Title" @@ -64,25 +312,25 @@ def test_content_parser_content_before_header(self): def test_content_parser_no_sections(self): - parser = search.ContentParser() + parser = search_index.ContentParser() parser.feed("No H1 or H2TitleTEST") - self.assertEquals(parser.data, []) + self.assertEqual(parser.data, []) def test_find_toc_by_id(self): """ Test finding the relevant TOC item by the tag ID. """ - index = search.SearchIndex() + index = search_index.SearchIndex() md = dedent(""" # Heading 1 ## Heading 2 ### Heading 3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) toc_item = index._find_toc_by_id(toc, "heading-1") self.assertEqual(toc_item.url, "#heading-1") @@ -107,34 +355,50 @@ def test_create_search_index(self):

Content 3

""" + base_cfg = load_config() pages = [ - {'Home': 'index.md'}, - {'About': 'about.md'}, + Page( + 'Home', + File( + 'index.md', + base_cfg['docs_dir'], + base_cfg['site_dir'], + base_cfg['use_directory_urls']), + base_cfg), + Page( + 'About', + File( + 'about.md', + base_cfg['docs_dir'], + base_cfg['site_dir'], + base_cfg['use_directory_urls']), + base_cfg) ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - md = dedent(""" # Heading 1 ## Heading 2 ### Heading 3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) full_content = ''.join("""Heading{0}Content{0}""".format(i) for i in range(1, 4)) - for page in site_navigation: + plugin = search.SearchPlugin() + errors, warnings = plugin.load_config({}) + + for page in pages: # Fake page.read_source() and page.render() page.markdown = md page.toc = toc page.content = html_content - index = search.SearchIndex() + index = search_index.SearchIndex(**plugin.config) index.add_entry_from_context(page) self.assertEqual(len(index._entries), 4) - loc = page.abs_url + loc = page.url self.assertEqual(index._entries[0]['title'], page.title) self.assertEqual(strip_whitespace(index._entries[0]['text']), full_content) @@ -142,12 +406,210 @@ def test_create_search_index(self): self.assertEqual(index._entries[1]['title'], "Heading 1") self.assertEqual(index._entries[1]['text'], "Content 1") - self.assertEqual(index._entries[1]['location'], "{0}#heading-1".format(loc)) + self.assertEqual(index._entries[1]['location'], f"{loc}#heading-1") self.assertEqual(index._entries[2]['title'], "Heading 2") self.assertEqual(strip_whitespace(index._entries[2]['text']), "Content2") - self.assertEqual(index._entries[2]['location'], "{0}#heading-2".format(loc)) + self.assertEqual(index._entries[2]['location'], f"{loc}#heading-2") self.assertEqual(index._entries[3]['title'], "Heading 3") self.assertEqual(strip_whitespace(index._entries[3]['text']), "Content3") - self.assertEqual(index._entries[3]['location'], "{0}#heading-3".format(loc)) + self.assertEqual(index._entries[3]['location'], f"{loc}#heading-3") + + def test_search_indexing_options(self): + def test_page(title, filename, config): + test_page = Page( + title, File( + filename, + config['docs_dir'], + config['site_dir'], + config['use_directory_urls']), + config) + test_page.content = """ +

Heading 1

+

Content 1

+

Heading 2

+

Content 2

+

Heading 3

+

Content 3

""" + test_page.markdown = dedent(""" + # Heading 1 + ## Heading 2 + ### Heading 3""") + test_page.toc = get_toc(get_markdown_toc(test_page.markdown)) + return test_page + + validate = { + 'full': (lambda data: + self.assertEqual(len(data[0]), 4) and + self.assertTrue([x for x in data[0][0] if x['title'] and x['text']])), + 'sections': (lambda data: + # Sanity + self.assertEqual(len(data[0]), 4) and + # Page + (self.assertEqual(data[0][0]['title'], data[1].title) and + self.assertTrue(data[0][0]['text'])) and + # Headings + self.assertTrue([x for x in data[0][1:] if x['title'] and not x['text']])), + 'titles': (lambda data: + # Sanity + self.assertEqual(len(data[0]), 1) and + self.assertFalse([x for x in data[0] if x['text']])) + } + + for option in ['full', 'sections', 'titles']: + plugin = search.SearchPlugin() + + # Load plugin config, overriding indexing for test case + errors, warnings = plugin.load_config({'indexing': option}) + self.assertEqual(errors, []) + self.assertEqual(warnings, []) + + base_cfg = load_config() + base_cfg['plugins']['search'].config['indexing'] = option + + pages = [ + test_page('Home', 'index.md', base_cfg), + test_page('About', 'about.md', base_cfg) + ] + + for page in pages: + index = search_index.SearchIndex(**plugin.config) + index.add_entry_from_context(page) + data = index.generate_search_index() + validate[option]((json.loads(data)['docs'], page)) + + @mock.patch('subprocess.Popen', autospec=True) + def test_prebuild_index(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.return_value = ('{"mock": "index"}', None) + mock_popen_obj.returncode = 0 + + index = search_index.SearchIndex(prebuild_index=True) + expected = { + 'docs': [], + 'config': {'prebuild_index': True}, + 'index': {'mock': 'index'} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 1) + self.assertEqual(mock_popen_obj.communicate.call_count, 1) + self.assertEqual(result, expected) + + @mock.patch('subprocess.Popen', autospec=True) + def test_prebuild_index_returns_error(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.return_value = ('', 'Some Error') + mock_popen_obj.returncode = 0 + + index = search_index.SearchIndex(prebuild_index=True) + expected = { + 'docs': [], + 'config': {'prebuild_index': True} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 1) + self.assertEqual(mock_popen_obj.communicate.call_count, 1) + self.assertEqual(result, expected) + + @mock.patch('subprocess.Popen', autospec=True) + def test_prebuild_index_raises_ioerror(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.side_effect = OSError + mock_popen_obj.returncode = 1 + + index = search_index.SearchIndex(prebuild_index=True) + expected = { + 'docs': [], + 'config': {'prebuild_index': True} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 1) + self.assertEqual(mock_popen_obj.communicate.call_count, 1) + self.assertEqual(result, expected) + + @mock.patch('subprocess.Popen', autospec=True, side_effect=OSError) + def test_prebuild_index_raises_oserror(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.return_value = ('', '') + mock_popen_obj.returncode = 0 + + index = search_index.SearchIndex(prebuild_index=True) + expected = { + 'docs': [], + 'config': {'prebuild_index': True} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 1) + self.assertEqual(mock_popen_obj.communicate.call_count, 0) + self.assertEqual(result, expected) + + @mock.patch('subprocess.Popen', autospec=True) + def test_prebuild_index_false(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.return_value = ('', '') + mock_popen_obj.returncode = 0 + + index = search_index.SearchIndex(prebuild_index=False) + expected = { + 'docs': [], + 'config': {'prebuild_index': False} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 0) + self.assertEqual(mock_popen_obj.communicate.call_count, 0) + self.assertEqual(result, expected) + + @unittest.skipUnless(search_index.haslunrpy, 'lunr.py is not installed') + @mock.patch('mkdocs.contrib.search.search_index.lunr', autospec=True) + def test_prebuild_index_python(self, mock_lunr): + mock_lunr.return_value.serialize.return_value = {'mock': 'index'} + index = search_index.SearchIndex(prebuild_index='python', lang='en') + expected = { + 'docs': [], + 'config': {'prebuild_index': 'python', 'lang': 'en'}, + 'index': {'mock': 'index'} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_lunr.call_count, 1) + self.assertEqual(result, expected) + + @unittest.skipIf(search_index.haslunrpy, 'lunr.py is installed') + def test_prebuild_index_python_missing_lunr(self): + # When the lunr.py dependencies are not installed no prebuilt index is created. + index = search_index.SearchIndex(prebuild_index='python', lang='en') + expected = { + 'docs': [], + 'config': {'prebuild_index': 'python', 'lang': 'en'} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(result, expected) + + @mock.patch('subprocess.Popen', autospec=True) + def test_prebuild_index_node(self, mock_popen): + # See https://stackoverflow.com/a/36501078/866026 + mock_popen.return_value = mock.Mock() + mock_popen_obj = mock_popen.return_value + mock_popen_obj.communicate.return_value = ('{"mock": "index"}', None) + mock_popen_obj.returncode = 0 + + index = search_index.SearchIndex(prebuild_index='node') + expected = { + 'docs': [], + 'config': {'prebuild_index': 'node'}, + 'index': {'mock': 'index'} + } + result = json.loads(index.generate_search_index()) + self.assertEqual(mock_popen.call_count, 1) + self.assertEqual(mock_popen_obj.communicate.call_count, 1) + self.assertEqual(result, expected) diff --git a/mkdocs/tests/structure/__init__.py b/mkdocs/tests/structure/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mkdocs/tests/structure/file_tests.py b/mkdocs/tests/structure/file_tests.py new file mode 100644 index 0000000000..b1b399a0d7 --- /dev/null +++ b/mkdocs/tests/structure/file_tests.py @@ -0,0 +1,699 @@ +import unittest +import os +from unittest import mock + +from mkdocs.structure.files import Files, File, get_files, _sort_files, _filter_paths +from mkdocs.tests.base import load_config, tempdir, PathAssertionMixin + + +class TestFiles(PathAssertionMixin, unittest.TestCase): + + def test_file_eq(self): + file = File('a.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertTrue(file == File('a.md', '/path/to/docs', '/path/to/site', use_directory_urls=False)) + + def test_file_ne(self): + file = File('a.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + # Different filename + self.assertTrue(file != File('b.md', '/path/to/docs', '/path/to/site', use_directory_urls=False)) + # Different src_path + self.assertTrue(file != File('a.md', '/path/to/other', '/path/to/site', use_directory_urls=False)) + # Different URL + self.assertTrue(file != File('a.md', '/path/to/docs', '/path/to/site', use_directory_urls=True)) + + def test_sort_files(self): + self.assertEqual( + _sort_files(['b.md', 'bb.md', 'a.md', 'index.md', 'aa.md']), + ['index.md', 'a.md', 'aa.md', 'b.md', 'bb.md'] + ) + + self.assertEqual( + _sort_files(['b.md', 'index.html', 'a.md', 'index.md']), + ['index.html', 'index.md', 'a.md', 'b.md'] + ) + + self.assertEqual( + _sort_files(['a.md', 'index.md', 'b.md', 'index.html']), + ['index.md', 'index.html', 'a.md', 'b.md'] + ) + + self.assertEqual( + _sort_files(['.md', '_.md', 'a.md', 'index.md', '1.md']), + ['index.md', '.md', '1.md', '_.md', 'a.md'] + ) + + self.assertEqual( + _sort_files(['a.md', 'b.md', 'a.md']), + ['a.md', 'a.md', 'b.md'] + ) + + self.assertEqual( + _sort_files(['A.md', 'B.md', 'README.md']), + ['README.md', 'A.md', 'B.md'] + ) + + def test_md_file(self): + f = File('foo.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo.md') + self.assertPathsEqual(f.dest_path, 'foo.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo.html') + self.assertEqual(f.url, 'foo.html') + self.assertEqual(f.name, 'foo') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_file_use_directory_urls(self): + f = File('foo.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo.md') + self.assertPathsEqual(f.dest_path, 'foo/index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/index.html') + self.assertEqual(f.url, 'foo/') + self.assertEqual(f.name, 'foo') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_file_nested(self): + f = File('foo/bar.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/bar.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.md') + self.assertPathsEqual(f.dest_path, 'foo/bar.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.html') + self.assertEqual(f.url, 'foo/bar.html') + self.assertEqual(f.name, 'bar') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_file_nested_use_directory_urls(self): + f = File('foo/bar.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/bar.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.md') + self.assertPathsEqual(f.dest_path, 'foo/bar/index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar/index.html') + self.assertEqual(f.url, 'foo/bar/') + self.assertEqual(f.name, 'bar') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_index_file(self): + f = File('index.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'index.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/index.md') + self.assertPathsEqual(f.dest_path, 'index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/index.html') + self.assertEqual(f.url, 'index.html') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_readme_index_file(self): + f = File('README.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'README.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/README.md') + self.assertPathsEqual(f.dest_path, 'index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/index.html') + self.assertEqual(f.url, 'index.html') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_index_file_use_directory_urls(self): + f = File('index.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'index.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/index.md') + self.assertPathsEqual(f.dest_path, 'index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/index.html') + self.assertEqual(f.url, '.') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_readme_index_file_use_directory_urls(self): + f = File('README.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'README.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/README.md') + self.assertPathsEqual(f.dest_path, 'index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/index.html') + self.assertEqual(f.url, '.') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_index_file_nested(self): + f = File('foo/index.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/index.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/index.md') + self.assertPathsEqual(f.dest_path, 'foo/index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/index.html') + self.assertEqual(f.url, 'foo/index.html') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_md_index_file_nested_use_directory_urls(self): + f = File('foo/index.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/index.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/index.md') + self.assertPathsEqual(f.dest_path, 'foo/index.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/index.html') + self.assertEqual(f.url, 'foo/') + self.assertEqual(f.name, 'index') + self.assertTrue(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_static_file(self): + f = File('foo/bar.html', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/bar.html') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.html') + self.assertPathsEqual(f.dest_path, 'foo/bar.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.html') + self.assertEqual(f.url, 'foo/bar.html') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertTrue(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_static_file_use_directory_urls(self): + f = File('foo/bar.html', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/bar.html') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.html') + self.assertPathsEqual(f.dest_path, 'foo/bar.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.html') + self.assertEqual(f.url, 'foo/bar.html') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertTrue(f.is_static_page()) + self.assertFalse(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_media_file(self): + f = File('foo/bar.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/bar.jpg') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.jpg') + self.assertPathsEqual(f.dest_path, 'foo/bar.jpg') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.jpg') + self.assertEqual(f.url, 'foo/bar.jpg') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_media_file_use_directory_urls(self): + f = File('foo/bar.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/bar.jpg') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.jpg') + self.assertPathsEqual(f.dest_path, 'foo/bar.jpg') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.jpg') + self.assertEqual(f.url, 'foo/bar.jpg') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_javascript_file(self): + f = File('foo/bar.js', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/bar.js') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.js') + self.assertPathsEqual(f.dest_path, 'foo/bar.js') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.js') + self.assertEqual(f.url, 'foo/bar.js') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertTrue(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_javascript_file_use_directory_urls(self): + f = File('foo/bar.js', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/bar.js') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.js') + self.assertPathsEqual(f.dest_path, 'foo/bar.js') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.js') + self.assertEqual(f.url, 'foo/bar.js') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertTrue(f.is_javascript()) + self.assertFalse(f.is_css()) + + def test_css_file(self): + f = File('foo/bar.css', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo/bar.css') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.css') + self.assertPathsEqual(f.dest_path, 'foo/bar.css') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.css') + self.assertEqual(f.url, 'foo/bar.css') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertTrue(f.is_css()) + + def test_css_file_use_directory_urls(self): + f = File('foo/bar.css', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertPathsEqual(f.src_path, 'foo/bar.css') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo/bar.css') + self.assertPathsEqual(f.dest_path, 'foo/bar.css') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo/bar.css') + self.assertEqual(f.url, 'foo/bar.css') + self.assertEqual(f.name, 'bar') + self.assertFalse(f.is_documentation_page()) + self.assertFalse(f.is_static_page()) + self.assertTrue(f.is_media_file()) + self.assertFalse(f.is_javascript()) + self.assertTrue(f.is_css()) + + def test_file_name_with_space(self): + f = File('foo bar.md', '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertPathsEqual(f.src_path, 'foo bar.md') + self.assertPathsEqual(f.abs_src_path, '/path/to/docs/foo bar.md') + self.assertPathsEqual(f.dest_path, 'foo bar.html') + self.assertPathsEqual(f.abs_dest_path, '/path/to/site/foo bar.html') + self.assertEqual(f.url, 'foo%20bar.html') + self.assertEqual(f.name, 'foo bar') + + def test_files(self): + fs = [ + File('index.md', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.md', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.html', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.js', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.css', '/path/to/docs', '/path/to/site', use_directory_urls=True) + ] + files = Files(fs) + self.assertEqual([f for f in files], fs) + self.assertEqual(len(files), 6) + self.assertEqual(files.documentation_pages(), [fs[0], fs[1]]) + self.assertEqual(files.static_pages(), [fs[2]]) + self.assertEqual(files.media_files(), [fs[3], fs[4], fs[5]]) + self.assertEqual(files.javascript_files(), [fs[4]]) + self.assertEqual(files.css_files(), [fs[5]]) + self.assertEqual(files.get_file_from_path('foo/bar.jpg'), fs[3]) + self.assertEqual(files.get_file_from_path('foo/bar.jpg'), fs[3]) + self.assertEqual(files.get_file_from_path('missing.jpg'), None) + self.assertTrue(fs[2].src_path in files) + self.assertTrue(fs[2].src_path in files) + extra_file = File('extra.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertFalse(extra_file.src_path in files) + files.append(extra_file) + self.assertEqual(len(files), 7) + self.assertTrue(extra_file.src_path in files) + self.assertEqual(files.documentation_pages(), [fs[0], fs[1], extra_file]) + + @tempdir(files=[ + 'favicon.ico', + 'index.md' + ]) + @tempdir(files=[ + 'base.html', + 'favicon.ico', + 'style.css', + 'foo.md', + 'README', + '.ignore.txt', + '.ignore/file.txt', + 'foo/.ignore.txt', + 'foo/.ignore/file.txt' + ]) + def test_add_files_from_theme(self, tdir, ddir): + config = load_config(docs_dir=ddir, theme={'name': None, 'custom_dir': tdir}) + env = config['theme'].get_env() + files = get_files(config) + self.assertEqual( + [file.src_path for file in files], + ['index.md', 'favicon.ico'] + ) + files.add_files_from_theme(env, config) + self.assertEqual( + [file.src_path for file in files], + ['index.md', 'favicon.ico', 'style.css'] + ) + # Ensure theme file does not override docs_dir file + self.assertEqual( + files.get_file_from_path('favicon.ico').abs_src_path, + os.path.normpath(os.path.join(ddir, 'favicon.ico')) + ) + + def test_filter_paths(self): + # Root level file + self.assertFalse(_filter_paths('foo.md', 'foo.md', False, ['bar.md'])) + self.assertTrue(_filter_paths('foo.md', 'foo.md', False, ['foo.md'])) + + # Nested file + self.assertFalse(_filter_paths('foo.md', 'baz/foo.md', False, ['bar.md'])) + self.assertTrue(_filter_paths('foo.md', 'baz/foo.md', False, ['foo.md'])) + + # Wildcard + self.assertFalse(_filter_paths('foo.md', 'foo.md', False, ['*.txt'])) + self.assertTrue(_filter_paths('foo.md', 'foo.md', False, ['*.md'])) + + # Root level dir + self.assertFalse(_filter_paths('bar', 'bar', True, ['/baz'])) + self.assertFalse(_filter_paths('bar', 'bar', True, ['/baz/'])) + self.assertTrue(_filter_paths('bar', 'bar', True, ['/bar'])) + self.assertTrue(_filter_paths('bar', 'bar', True, ['/bar/'])) + + # Nested dir + self.assertFalse(_filter_paths('bar', 'foo/bar', True, ['/bar'])) + self.assertFalse(_filter_paths('bar', 'foo/bar', True, ['/bar/'])) + self.assertTrue(_filter_paths('bar', 'foo/bar', True, ['bar/'])) + + # Files that look like dirs (no extension). Note that `is_dir` is `False`. + self.assertFalse(_filter_paths('bar', 'bar', False, ['bar/'])) + self.assertFalse(_filter_paths('bar', 'foo/bar', False, ['bar/'])) + + def test_get_relative_url_use_directory_urls(self): + to_files = [ + 'index.md', + 'foo/index.md', + 'foo/bar/index.md', + 'foo/bar/baz/index.md', + 'foo.md', + 'foo/bar.md', + 'foo/bar/baz.md' + ] + + to_file_urls = [ + '.', + 'foo/', + 'foo/bar/', + 'foo/bar/baz/', + 'foo/', + 'foo/bar/', + 'foo/bar/baz/' + ] + + from_file = File('img.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=True) + expected = [ + 'img.jpg', # img.jpg relative to . + '../img.jpg', # img.jpg relative to foo/ + '../../img.jpg', # img.jpg relative to foo/bar/ + '../../../img.jpg', # img.jpg relative to foo/bar/baz/ + '../img.jpg', # img.jpg relative to foo + '../../img.jpg', # img.jpg relative to foo/bar + '../../../img.jpg' # img.jpg relative to foo/bar/baz + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertEqual(from_file.url, 'img.jpg') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('foo/img.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=True) + expected = [ + 'foo/img.jpg', # foo/img.jpg relative to . + 'img.jpg', # foo/img.jpg relative to foo/ + '../img.jpg', # foo/img.jpg relative to foo/bar/ + '../../img.jpg', # foo/img.jpg relative to foo/bar/baz/ + 'img.jpg', # foo/img.jpg relative to foo + '../img.jpg', # foo/img.jpg relative to foo/bar + '../../img.jpg' # foo/img.jpg relative to foo/bar/baz + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertEqual(from_file.url, 'foo/img.jpg') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('index.html', '/path/to/docs', '/path/to/site', use_directory_urls=True) + expected = [ + '.', # . relative to . + '..', # . relative to foo/ + '../..', # . relative to foo/bar/ + '../../..', # . relative to foo/bar/baz/ + '..', # . relative to foo + '../..', # . relative to foo/bar + '../../..' # . relative to foo/bar/baz + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertEqual(from_file.url, '.') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('file.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + expected = [ + 'file/', # file relative to . + '../file/', # file relative to foo/ + '../../file/', # file relative to foo/bar/ + '../../../file/', # file relative to foo/bar/baz/ + '../file/', # file relative to foo + '../../file/', # file relative to foo/bar + '../../../file/' # file relative to foo/bar/baz + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertEqual(from_file.url, 'file/') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + def test_get_relative_url(self): + to_files = [ + 'index.md', + 'foo/index.md', + 'foo/bar/index.md', + 'foo/bar/baz/index.md', + 'foo.md', + 'foo/bar.md', + 'foo/bar/baz.md' + ] + + to_file_urls = [ + 'index.html', + 'foo/index.html', + 'foo/bar/index.html', + 'foo/bar/baz/index.html', + 'foo.html', + 'foo/bar.html', + 'foo/bar/baz.html' + ] + + from_file = File('img.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=False) + expected = [ + 'img.jpg', # img.jpg relative to . + '../img.jpg', # img.jpg relative to foo/ + '../../img.jpg', # img.jpg relative to foo/bar/ + '../../../img.jpg', # img.jpg relative to foo/bar/baz/ + 'img.jpg', # img.jpg relative to foo.html + '../img.jpg', # img.jpg relative to foo/bar.html + '../../img.jpg' # img.jpg relative to foo/bar/baz.html + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertEqual(from_file.url, 'img.jpg') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('foo/img.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=False) + expected = [ + 'foo/img.jpg', # foo/img.jpg relative to . + 'img.jpg', # foo/img.jpg relative to foo/ + '../img.jpg', # foo/img.jpg relative to foo/bar/ + '../../img.jpg', # foo/img.jpg relative to foo/bar/baz/ + 'foo/img.jpg', # foo/img.jpg relative to foo.html + 'img.jpg', # foo/img.jpg relative to foo/bar.html + '../img.jpg' # foo/img.jpg relative to foo/bar/baz.html + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertEqual(from_file.url, 'foo/img.jpg') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('index.html', '/path/to/docs', '/path/to/site', use_directory_urls=False) + expected = [ + 'index.html', # index.html relative to . + '../index.html', # index.html relative to foo/ + '../../index.html', # index.html relative to foo/bar/ + '../../../index.html', # index.html relative to foo/bar/baz/ + 'index.html', # index.html relative to foo.html + '../index.html', # index.html relative to foo/bar.html + '../../index.html' # index.html relative to foo/bar/baz.html + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertEqual(from_file.url, 'index.html') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + from_file = File('file.html', '/path/to/docs', '/path/to/site', use_directory_urls=False) + expected = [ + 'file.html', # file.html relative to . + '../file.html', # file.html relative to foo/ + '../../file.html', # file.html relative to foo/bar/ + '../../../file.html', # file.html relative to foo/bar/baz/ + 'file.html', # file.html relative to foo.html + '../file.html', # file.html relative to foo/bar.html + '../../file.html' # file.html relative to foo/bar/baz.html + ] + + for i, filename in enumerate(to_files): + file = File(filename, '/path/to/docs', '/path/to/site', use_directory_urls=False) + self.assertEqual(from_file.url, 'file.html') + self.assertEqual(file.url, to_file_urls[i]) + self.assertEqual(from_file.url_relative_to(file.url), expected[i]) + self.assertEqual(from_file.url_relative_to(file), expected[i]) + + @tempdir(files=[ + 'index.md', + 'bar.css', + 'bar.html', + 'bar.jpg', + 'bar.js', + 'bar.md', + '.dotfile', + 'templates/foo.html' + ]) + def test_get_files(self, tdir): + config = load_config(docs_dir=tdir, extra_css=['bar.css'], extra_javascript=['bar.js']) + files = get_files(config) + expected = ['index.md', 'bar.css', 'bar.html', 'bar.jpg', 'bar.js', 'bar.md'] + self.assertIsInstance(files, Files) + self.assertEqual(len(files), len(expected)) + self.assertEqual([f.src_path for f in files], expected) + + @tempdir(files=[ + 'README.md', + 'foo.md' + ]) + def test_get_files_include_readme_without_index(self, tdir): + config = load_config(docs_dir=tdir) + files = get_files(config) + expected = ['README.md', 'foo.md'] + self.assertIsInstance(files, Files) + self.assertEqual(len(files), len(expected)) + self.assertEqual([f.src_path for f in files], expected) + + @tempdir(files=[ + 'index.md', + 'README.md', + 'foo.md' + ]) + def test_get_files_exclude_readme_with_index(self, tdir): + config = load_config(docs_dir=tdir) + files = get_files(config) + expected = ['index.md', 'foo.md'] + self.assertIsInstance(files, Files) + self.assertEqual(len(files), len(expected)) + self.assertEqual([f.src_path for f in files], expected) + + @tempdir() + @tempdir(files={'test.txt': 'source content'}) + def test_copy_file(self, src_dir, dest_dir): + file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) + dest_path = os.path.join(dest_dir, 'test.txt') + self.assertPathNotExists(dest_path) + file.copy_file() + self.assertPathIsFile(dest_path) + + @tempdir(files={'test.txt': 'destination content'}) + @tempdir(files={'test.txt': 'source content'}) + def test_copy_file_clean_modified(self, src_dir, dest_dir): + file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) + file.is_modified = mock.Mock(return_value=True) + dest_path = os.path.join(dest_dir, 'test.txt') + file.copy_file(dirty=False) + self.assertPathIsFile(dest_path) + with open(dest_path, 'r', encoding='utf-8') as f: + self.assertEqual(f.read(), 'source content') + + @tempdir(files={'test.txt': 'destination content'}) + @tempdir(files={'test.txt': 'source content'}) + def test_copy_file_dirty_modified(self, src_dir, dest_dir): + file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) + file.is_modified = mock.Mock(return_value=True) + dest_path = os.path.join(dest_dir, 'test.txt') + file.copy_file(dirty=True) + self.assertPathIsFile(dest_path) + with open(dest_path, 'r', encoding='utf-8') as f: + self.assertEqual(f.read(), 'source content') + + @tempdir(files={'test.txt': 'destination content'}) + @tempdir(files={'test.txt': 'source content'}) + def test_copy_file_dirty_not_modified(self, src_dir, dest_dir): + file = File('test.txt', src_dir, dest_dir, use_directory_urls=False) + file.is_modified = mock.Mock(return_value=False) + dest_path = os.path.join(dest_dir, 'test.txt') + file.copy_file(dirty=True) + self.assertPathIsFile(dest_path) + with open(dest_path, 'r', encoding='utf-8') as f: + self.assertEqual(f.read(), 'destination content') + + def test_files_append_remove_src_paths(self): + fs = [ + File('index.md', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.md', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.html', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.jpg', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.js', '/path/to/docs', '/path/to/site', use_directory_urls=True), + File('foo/bar.css', '/path/to/docs', '/path/to/site', use_directory_urls=True) + ] + files = Files(fs) + self.assertEqual(len(files), 6) + self.assertEqual(len(files.src_paths), 6) + extra_file = File('extra.md', '/path/to/docs', '/path/to/site', use_directory_urls=True) + self.assertFalse(extra_file.src_path in files) + files.append(extra_file) + self.assertEqual(len(files), 7) + self.assertEqual(len(files.src_paths), 7) + self.assertTrue(extra_file.src_path in files) + files.remove(extra_file) + self.assertEqual(len(files), 6) + self.assertEqual(len(files.src_paths), 6) + self.assertFalse(extra_file.src_path in files) diff --git a/mkdocs/tests/structure/nav_tests.py b/mkdocs/tests/structure/nav_tests.py new file mode 100644 index 0000000000..8184923680 --- /dev/null +++ b/mkdocs/tests/structure/nav_tests.py @@ -0,0 +1,395 @@ +#!/usr/bin/env python + +import sys +import unittest + +from mkdocs.structure.nav import get_navigation, _get_by_type, Section +from mkdocs.structure.files import File, Files +from mkdocs.structure.pages import Page +from mkdocs.tests.base import dedent, load_config + + +class SiteNavigationTests(unittest.TestCase): + + maxDiff = None + + def test_simple_nav(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'About': 'about.md'} + ] + expected = dedent(""" + Page(title='Home', url='/') + Page(title='About', url='/about/') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files( + [File(list(item.values())[0], cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + for item in nav_cfg] + ) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 2) + self.assertEqual(len(site_navigation.pages), 2) + self.assertEqual(repr(site_navigation.homepage), "Page(title='Home', url='/')") + + def test_nav_no_directory_urls(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'About': 'about.md'} + ] + expected = dedent(""" + Page(title='Home', url='/index.html') + Page(title='About', url='/about.html') + """) + cfg = load_config(nav=nav_cfg, use_directory_urls=False, site_url='http://example.com/') + files = Files( + [File(list(item.values())[0], cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + for item in nav_cfg] + ) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 2) + self.assertEqual(len(site_navigation.pages), 2) + self.assertEqual(repr(site_navigation.homepage), "Page(title='Home', url='/index.html')") + + def test_nav_missing_page(self): + nav_cfg = [ + {'Home': 'index.md'} + ] + expected = dedent(""" + Page(title='Home', url='/') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('page_not_in_nav.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 1) + self.assertEqual(len(site_navigation.pages), 1) + for file in files: + self.assertIsInstance(file.page, Page) + + def test_nav_no_title(self): + nav_cfg = [ + 'index.md', + {'About': 'about.md'} + ] + expected = dedent(""" + Page(title=[blank], url='/') + Page(title='About', url='/about/') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([ + File(nav_cfg[0], cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File(nav_cfg[1]['About'], cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 2) + self.assertEqual(len(site_navigation.pages), 2) + + def test_nav_external_links(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Local': '/local.html'}, + {'External': 'http://example.com/external.html'} + ] + expected = dedent(""" + Page(title='Home', url='/') + Link(title='Local', url='/local.html') + Link(title='External', url='http://example.com/external.html') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + with self.assertLogs('mkdocs', level='DEBUG') as cm: + site_navigation = get_navigation(files, cfg) + self.assertEqual( + cm.output, + [ + "DEBUG:mkdocs.structure.nav:An absolute path to '/local.html' is included in the " + "'nav' configuration, which presumably points to an external resource.", + "DEBUG:mkdocs.structure.nav:An external link to 'http://example.com/external.html' " + "is included in the 'nav' configuration." + ] + ) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 1) + + def test_nav_bad_links(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Missing': 'missing.html'}, + {'Bad External': 'example.com'} + ] + expected = dedent(""" + Page(title='Home', url='/') + Link(title='Missing', url='missing.html') + Link(title='Bad External', url='example.com') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])]) + with self.assertLogs('mkdocs', level='WARNING') as cm: + site_navigation = get_navigation(files, cfg) + self.assertEqual( + cm.output, + [ + "WARNING:mkdocs.structure.nav:A relative path to 'missing.html' is included " + "in the 'nav' configuration, which is not found in the documentation files", + "WARNING:mkdocs.structure.nav:A relative path to 'example.com' is included " + "in the 'nav' configuration, which is not found in the documentation files" + ] + ) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 1) + + def test_indented_nav(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'API Guide': [ + {'Running': 'api-guide/running.md'}, + {'Testing': 'api-guide/testing.md'}, + {'Debugging': 'api-guide/debugging.md'}, + {'Advanced': [ + {'Part 1': 'api-guide/advanced/part-1.md'}, + ]}, + ]}, + {'About': [ + {'Release notes': 'about/release-notes.md'}, + {'License': '/license.html'} + ]}, + {'External': 'https://example.com/'} + ] + expected = dedent(""" + Page(title='Home', url='/') + Section(title='API Guide') + Page(title='Running', url='/api-guide/running/') + Page(title='Testing', url='/api-guide/testing/') + Page(title='Debugging', url='/api-guide/debugging/') + Section(title='Advanced') + Page(title='Part 1', url='/api-guide/advanced/part-1/') + Section(title='About') + Page(title='Release notes', url='/about/release-notes/') + Link(title='License', url='/license.html') + Link(title='External', url='https://example.com/') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/running.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/debugging.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/advanced/part-1.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about/release-notes.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 4) + self.assertEqual(len(site_navigation.pages), 6) + self.assertEqual(repr(site_navigation.homepage), "Page(title='Home', url='/')") + self.assertIsNone(site_navigation.items[0].parent) + self.assertEqual(site_navigation.items[0].ancestors, []) + self.assertIsNone(site_navigation.items[1].parent) + self.assertEqual(site_navigation.items[1].ancestors, []) + self.assertEqual(len(site_navigation.items[1].children), 4) + self.assertEqual(repr(site_navigation.items[1].children[0].parent), "Section(title='API Guide')") + self.assertEqual(site_navigation.items[1].children[0].ancestors, [site_navigation.items[1]]) + self.assertEqual(repr(site_navigation.items[1].children[1].parent), "Section(title='API Guide')") + self.assertEqual(site_navigation.items[1].children[1].ancestors, [site_navigation.items[1]]) + self.assertEqual(repr(site_navigation.items[1].children[2].parent), "Section(title='API Guide')") + self.assertEqual(site_navigation.items[1].children[2].ancestors, [site_navigation.items[1]]) + self.assertEqual(repr(site_navigation.items[1].children[3].parent), "Section(title='API Guide')") + self.assertEqual(site_navigation.items[1].children[3].ancestors, [site_navigation.items[1]]) + self.assertEqual(len(site_navigation.items[1].children[3].children), 1) + self.assertEqual(repr(site_navigation.items[1].children[3].children[0].parent), "Section(title='Advanced')") + self.assertEqual(site_navigation.items[1].children[3].children[0].ancestors, + [site_navigation.items[1].children[3], site_navigation.items[1]]) + self.assertIsNone(site_navigation.items[2].parent) + self.assertEqual(len(site_navigation.items[2].children), 2) + self.assertEqual(repr(site_navigation.items[2].children[0].parent), "Section(title='About')") + self.assertEqual(site_navigation.items[2].children[0].ancestors, [site_navigation.items[2]]) + self.assertEqual(repr(site_navigation.items[2].children[1].parent), "Section(title='About')") + self.assertEqual(site_navigation.items[2].children[1].ancestors, [site_navigation.items[2]]) + self.assertIsNone(site_navigation.items[3].parent) + self.assertEqual(site_navigation.items[3].ancestors, []) + self.assertIsNone(site_navigation.items[3].children) + + def test_nested_ungrouped_nav(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'Contact': 'about/contact.md'}, + {'License Title': 'about/sub/license.md'}, + ] + expected = dedent(""" + Page(title='Home', url='/') + Page(title='Contact', url='/about/contact/') + Page(title='License Title', url='/about/sub/license/') + """) + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files( + [File(list(item.values())[0], cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + for item in nav_cfg] + ) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 3) + + def test_nested_ungrouped_nav_no_titles(self): + nav_cfg = [ + 'index.md', + 'about/contact.md', + 'about/sub/license.md' + ] + expected = dedent(""" + Page(title=[blank], url='/') + Page(title=[blank], url='/about/contact/') + Page(title=[blank], url='/about/sub/license/') + """) + + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files( + [File(item, cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) for item in nav_cfg] + ) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 3) + self.assertEqual(repr(site_navigation.homepage), "Page(title=[blank], url='/')") + + @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") + def test_nested_ungrouped_no_titles_windows(self): + nav_cfg = [ + 'index.md', + 'about\\contact.md', + 'about\\sub\\license.md', + ] + expected = dedent(""" + Page(title=[blank], url='/') + Page(title=[blank], url='/about/contact/') + Page(title=[blank], url='/about/sub/license/') + """) + + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files( + [File(item, cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) for item in nav_cfg] + ) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 3) + + def test_nav_from_files(self): + expected = dedent(""" + Page(title=[blank], url='/') + Page(title=[blank], url='/about/') + """) + cfg = load_config(site_url='http://example.com/') + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 2) + self.assertEqual(len(site_navigation.pages), 2) + self.assertEqual(repr(site_navigation.homepage), "Page(title=[blank], url='/')") + + def test_nav_from_nested_files(self): + expected = dedent(""" + Page(title=[blank], url='/') + Section(title='About') + Page(title=[blank], url='/about/license/') + Page(title=[blank], url='/about/release-notes/') + Section(title='Api guide') + Page(title=[blank], url='/api-guide/debugging/') + Page(title=[blank], url='/api-guide/running/') + Page(title=[blank], url='/api-guide/testing/') + Section(title='Advanced') + Page(title=[blank], url='/api-guide/advanced/part-1/') + """) + cfg = load_config(site_url='http://example.com/') + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about/license.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about/release-notes.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/debugging.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/running.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/advanced/part-1.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(str(site_navigation).strip(), expected) + self.assertEqual(len(site_navigation.items), 3) + self.assertEqual(len(site_navigation.pages), 7) + self.assertEqual(repr(site_navigation.homepage), "Page(title=[blank], url='/')") + + def test_active(self): + nav_cfg = [ + {'Home': 'index.md'}, + {'API Guide': [ + {'Running': 'api-guide/running.md'}, + {'Testing': 'api-guide/testing.md'}, + {'Debugging': 'api-guide/debugging.md'}, + {'Advanced': [ + {'Part 1': 'api-guide/advanced/part-1.md'}, + ]}, + ]}, + {'About': [ + {'Release notes': 'about/release-notes.md'}, + {'License': 'about/license.md'} + ]} + ] + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([ + File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/running.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/debugging.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('api-guide/advanced/part-1.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about/release-notes.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + File('about/license.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), + ]) + site_navigation = get_navigation(files, cfg) + # Confirm nothing is active + self.assertTrue(all(page.active is False for page in site_navigation.pages)) + self.assertTrue(all(item.active is False for item in site_navigation.items)) + # Activate + site_navigation.items[1].children[3].children[0].active = True + # Confirm ancestors are activated + self.assertTrue(site_navigation.items[1].children[3].children[0].active) + self.assertTrue(site_navigation.items[1].children[3].active) + self.assertTrue(site_navigation.items[1].active) + # Confirm non-ancestors are not activated + self.assertFalse(site_navigation.items[0].active) + self.assertFalse(site_navigation.items[1].children[0].active) + self.assertFalse(site_navigation.items[1].children[1].active) + self.assertFalse(site_navigation.items[1].children[2].active) + self.assertFalse(site_navigation.items[2].active) + self.assertFalse(site_navigation.items[2].children[0].active) + self.assertFalse(site_navigation.items[2].children[1].active) + # Deactivate + site_navigation.items[1].children[3].children[0].active = False + # Confirm ancestors are deactivated + self.assertFalse(site_navigation.items[1].children[3].children[0].active) + self.assertFalse(site_navigation.items[1].children[3].active) + self.assertFalse(site_navigation.items[1].active) + + def test_get_by_type_nested_sections(self): + nav_cfg = [ + {'Section 1': [ + {'Section 2': [ + {'Page': 'page.md'} + ]} + ]} + ] + cfg = load_config(nav=nav_cfg, site_url='http://example.com/') + files = Files([ + File('page.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + ]) + site_navigation = get_navigation(files, cfg) + self.assertEqual(len(_get_by_type(site_navigation, Section)), 2) diff --git a/mkdocs/tests/structure/page_tests.py b/mkdocs/tests/structure/page_tests.py new file mode 100644 index 0000000000..095f4f11ae --- /dev/null +++ b/mkdocs/tests/structure/page_tests.py @@ -0,0 +1,852 @@ +import unittest +import os +import sys +from unittest import mock +from tempfile import TemporaryDirectory + +from mkdocs.structure.pages import Page +from mkdocs.structure.files import File, Files +from mkdocs.tests.base import load_config, dedent + + +class PageTests(unittest.TestCase): + + DOCS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../integration/subpages/docs') + + def test_homepage(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + self.assertIsNone(fl.page) + pg = Page('Foo', fl, cfg) + self.assertEqual(fl.page, pg) + self.assertEqual(pg.url, '') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertTrue(pg.is_homepage) + self.assertTrue(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_nested_index_page(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('sub1/index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + pg.parent = 'foo' + self.assertEqual(pg.url, 'sub1/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertTrue(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertFalse(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, 'foo') + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_nested_index_page_no_parent(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('sub1/index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + pg.parent = None # non-homepage at nav root level; see #1919. + self.assertEqual(pg.url, 'sub1/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertTrue(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_nested_index_page_no_parent_no_directory_urls(self): + cfg = load_config(docs_dir=self.DOCS_DIR, use_directory_urls=False) + fl = File('sub1/index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + pg.parent = None # non-homepage at nav root level; see #1919. + self.assertEqual(pg.url, 'sub1/index.html') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertTrue(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_nested_nonindex_page(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('sub1/non-index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + pg.parent = 'foo' + self.assertEqual(pg.url, 'sub1/non-index/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertFalse(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, 'foo') + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_page_defaults(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertRegex(pg.update_date, r'\d{4}-\d{2}-\d{2}') + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_page_no_directory_url(self): + cfg = load_config(use_directory_urls=False) + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'testing.html') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_page_canonical_url(self): + cfg = load_config(site_url='http://example.com') + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, '/testing/') + self.assertEqual(pg.canonical_url, 'http://example.com/testing/') + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_page_canonical_url_nested(self): + cfg = load_config(site_url='http://example.com/foo/') + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, '/foo/testing/') + self.assertEqual(pg.canonical_url, 'http://example.com/foo/testing/') + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_page_canonical_url_nested_no_slash(self): + cfg = load_config(site_url='http://example.com/foo') + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, '/foo/testing/') + self.assertEqual(pg.canonical_url, 'http://example.com/foo/testing/') + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertEqual(pg.markdown, None) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Foo') + self.assertEqual(pg.toc, []) + + def test_predefined_page_title(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Page Title', fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('# Welcome to MkDocs\n')) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Page Title') + self.assertEqual(pg.toc, []) + + def test_page_title_from_markdown(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('# Welcome to MkDocs\n')) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Welcome to MkDocs') + self.assertEqual(pg.toc, []) + + def test_page_title_from_meta(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('metadata.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, 'metadata/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('# Welcome to MkDocs\n')) + self.assertEqual(pg.meta, {'title': 'A Page Title'}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'A Page Title') + self.assertEqual(pg.toc, []) + + def test_page_title_from_filename(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('page-title.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, 'page-title/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('Page content.\n')) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Page title') + self.assertEqual(pg.toc, []) + + def test_page_title_from_capitalized_filename(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('pageTitle.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, 'pageTitle/') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertFalse(pg.is_homepage) + self.assertFalse(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('Page content.\n')) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'pageTitle') + self.assertEqual(pg.toc, []) + + def test_page_title_from_homepage_filename(self): + cfg = load_config(docs_dir=self.DOCS_DIR) + fl = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.url, '') + self.assertEqual(pg.abs_url, None) + self.assertEqual(pg.canonical_url, None) + self.assertEqual(pg.edit_url, None) + self.assertEqual(pg.file, fl) + self.assertEqual(pg.content, None) + self.assertTrue(pg.is_homepage) + self.assertTrue(pg.is_index) + self.assertTrue(pg.is_page) + self.assertFalse(pg.is_section) + self.assertTrue(pg.is_top_level) + self.assertTrue(pg.markdown.startswith('## Test')) + self.assertEqual(pg.meta, {}) + self.assertEqual(pg.next_page, None) + self.assertEqual(pg.parent, None) + self.assertEqual(pg.previous_page, None) + self.assertEqual(pg.title, 'Home') + self.assertEqual(pg.toc, []) + + def test_page_eq(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertTrue(pg == Page('Foo', fl, cfg)) + + def test_page_ne(self): + cfg = load_config() + f1 = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + f2 = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', f1, cfg) + # Different Title + self.assertTrue(pg != Page('Bar', f1, cfg)) + # Different File + self.assertTrue(pg != Page('Foo', f2, cfg)) + + def test_BOM(self): + md_src = '# An UTF-8 encoded file with a BOM' + with TemporaryDirectory() as docs_dir: + # We don't use mkdocs.tests.base.tempdir decorator here due to uniqueness of this test. + cfg = load_config(docs_dir=docs_dir) + fl = File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page(None, fl, cfg) + # Create an UTF-8 Encoded file with BOM (as Microsoft editors do). See #1186 + with open(fl.abs_src_path, 'w', encoding='utf-8-sig') as f: + f.write(md_src) + # Now read the file. + pg.read_source(cfg) + # Ensure the BOM (`\ufeff`) is removed + self.assertNotIn('\ufeff', pg.markdown) + self.assertEqual(pg.markdown, md_src) + self.assertEqual(pg.meta, {}) + + def test_page_edit_url(self): + configs = [ + { + 'repo_url': 'http://github.com/mkdocs/mkdocs' + }, + { + 'repo_url': 'https://github.com/mkdocs/mkdocs/' + }, { + 'repo_url': 'http://example.com' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': 'edit/master' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '?query=edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '?query=edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '#edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '#edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '' # Set to blank value + }, { + # Nothing defined + } + ] + + expected = [ + 'http://github.com/mkdocs/mkdocs/edit/master/docs/testing.md', + 'https://github.com/mkdocs/mkdocs/edit/master/docs/testing.md', + None, + 'http://example.com/edit/master/testing.md', + 'http://example.com/edit/master/testing.md', + 'http://example.com/edit/master/testing.md', + 'http://example.com/edit/master/testing.md', + 'http://example.com/edit/master/testing.md', + 'http://example.com/foo/edit/master/testing.md', + 'http://example.com/foo/edit/master/testing.md', + 'http://example.com?query=edit/master/testing.md', + 'http://example.com/?query=edit/master/testing.md', + 'http://example.com#edit/master/testing.md', + 'http://example.com/#edit/master/testing.md', + None, + None + ] + + for i, c in enumerate(configs): + cfg = load_config(**c) + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'testing/') + self.assertEqual(pg.edit_url, expected[i]) + + def test_nested_page_edit_url(self): + configs = [ + { + 'repo_url': 'http://github.com/mkdocs/mkdocs' + }, + { + 'repo_url': 'https://github.com/mkdocs/mkdocs/' + }, { + 'repo_url': 'http://example.com' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': 'edit/master' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '?query=edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '?query=edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '#edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '#edit/master/' + } + ] + + expected = [ + 'http://github.com/mkdocs/mkdocs/edit/master/docs/sub1/non-index.md', + 'https://github.com/mkdocs/mkdocs/edit/master/docs/sub1/non-index.md', + None, + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/foo/edit/master/sub1/non-index.md', + 'http://example.com/foo/edit/master/sub1/non-index.md', + 'http://example.com?query=edit/master/sub1/non-index.md', + 'http://example.com/?query=edit/master/sub1/non-index.md', + 'http://example.com#edit/master/sub1/non-index.md', + 'http://example.com/#edit/master/sub1/non-index.md' + ] + + for i, c in enumerate(configs): + c['docs_dir'] = self.DOCS_DIR + cfg = load_config(**c) + fl = File('sub1/non-index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'sub1/non-index/') + self.assertEqual(pg.edit_url, expected[i]) + + @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") + def test_nested_page_edit_url_windows(self): + configs = [ + { + 'repo_url': 'http://github.com/mkdocs/mkdocs' + }, + { + 'repo_url': 'https://github.com/mkdocs/mkdocs/' + }, { + 'repo_url': 'http://example.com' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': 'edit/master' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': '/edit/master/' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': '/edit/master' + }, { + 'repo_url': 'http://example.com/foo/', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com/foo', + 'edit_uri': 'edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '?query=edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '?query=edit/master/' + }, { + 'repo_url': 'http://example.com', + 'edit_uri': '#edit/master' + }, { + 'repo_url': 'http://example.com/', + 'edit_uri': '#edit/master/' + } + ] + + expected = [ + 'http://github.com/mkdocs/mkdocs/edit/master/docs/sub1/non-index.md', + 'https://github.com/mkdocs/mkdocs/edit/master/docs/sub1/non-index.md', + None, + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/edit/master/sub1/non-index.md', + 'http://example.com/foo/edit/master/sub1/non-index.md', + 'http://example.com/foo/edit/master/sub1/non-index.md', + 'http://example.com?query=edit/master/sub1/non-index.md', + 'http://example.com/?query=edit/master/sub1/non-index.md', + 'http://example.com#edit/master/sub1/non-index.md', + 'http://example.com/#edit/master/sub1/non-index.md' + ] + + for i, c in enumerate(configs): + c['docs_dir'] = self.DOCS_DIR + cfg = load_config(**c) + fl = File('sub1\\non-index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.url, 'sub1/non-index/') + self.assertEqual(pg.edit_url, expected[i]) + + def test_page_render(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + pg.read_source(cfg) + self.assertEqual(pg.content, None) + self.assertEqual(pg.toc, []) + pg.render(cfg, [fl]) + self.assertTrue(pg.content.startswith( + '

Welcome to MkDocs

\n' + )) + self.assertEqual(str(pg.toc).strip(), dedent(""" + Welcome to MkDocs - #welcome-to-mkdocs + Commands - #commands + Project layout - #project-layout + """)) + + def test_missing_page(self): + cfg = load_config() + fl = File('missing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertRaises(OSError, pg.read_source, cfg) + + +class SourceDateEpochTests(unittest.TestCase): + + def setUp(self): + self.default = os.environ.get('SOURCE_DATE_EPOCH', None) + os.environ['SOURCE_DATE_EPOCH'] = '0' + + def test_source_date_epoch(self): + cfg = load_config() + fl = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']) + pg = Page('Foo', fl, cfg) + self.assertEqual(pg.update_date, '1970-01-01') + + def tearDown(self): + if self.default is not None: + os.environ['SOURCE_DATE_EPOCH'] = self.default + else: + del os.environ['SOURCE_DATE_EPOCH'] + + +class RelativePathExtensionTests(unittest.TestCase): + + DOCS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../integration/subpages/docs') + + def get_rendered_result(self, files): + cfg = load_config(docs_dir=self.DOCS_DIR) + fs = [] + for f in files: + fs.append(File(f.replace('/', os.sep), cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])) + pg = Page('Foo', fs[0], cfg) + pg.read_source(cfg) + pg.render(cfg, Files(fs)) + return pg.content + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](non-index.md)')) + def test_relative_html_link(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'non-index.md']), + '

link

' # No trailing / + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](index.md)')) + def test_relative_html_link_index(self): + self.assertEqual( + self.get_rendered_result(['non-index.md', 'index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](sub2/index.md)')) + def test_relative_html_link_sub_index(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'sub2/index.md']), + '

link

' # No trailing / + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](sub2/non-index.md)')) + def test_relative_html_link_sub_page(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'sub2/non-index.md']), + '

link

' # No trailing / + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](file%20name.md)')) + def test_relative_html_link_with_encoded_space(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'file name.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](file name.md)')) + def test_relative_html_link_with_unencoded_space(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'file name.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](../index.md)')) + def test_relative_html_link_parent_index(self): + self.assertEqual( + self.get_rendered_result(['sub2/non-index.md', 'index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](non-index.md#hash)')) + def test_relative_html_link_hash(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'non-index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](sub2/index.md#hash)')) + def test_relative_html_link_sub_index_hash(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'sub2/index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](sub2/non-index.md#hash)')) + def test_relative_html_link_sub_page_hash(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'sub2/non-index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](#hash)')) + def test_relative_html_link_hash_only(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + '

link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='![image](image.png)')) + def test_relative_image_link_from_homepage(self): + self.assertEqual( + self.get_rendered_result(['index.md', 'image.png']), + '

image

' # no opening ./ + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='![image](../image.png)')) + def test_relative_image_link_from_subpage(self): + self.assertEqual( + self.get_rendered_result(['sub2/non-index.md', 'image.png']), + '

image

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='![image](image.png)')) + def test_relative_image_link_from_sibling(self): + self.assertEqual( + self.get_rendered_result(['non-index.md', 'image.png']), + '

image

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='*__not__ a link*.')) + def test_no_links(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + '

not a link.

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[link](non-existent.md)')) + def test_bad_relative_html_link(self): + with self.assertLogs('mkdocs', level='WARNING') as cm: + self.assertEqual( + self.get_rendered_result(['index.md']), + '

link

' + ) + self.assertEqual( + cm.output, + ["WARNING:mkdocs.structure.pages:Documentation file 'index.md' contains a link " + "to 'non-existent.md' which is not found in the documentation files."] + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[external](http://example.com/index.md)')) + def test_external_link(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + '

external

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[absolute link](/path/to/file.md)')) + def test_absolute_link(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + '

absolute link

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='[absolute local path](\\image.png)')) + def test_absolute_win_local_path(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + '

absolute local path

' + ) + + @mock.patch('mkdocs.structure.pages.open', mock.mock_open(read_data='')) + def test_email_link(self): + self.assertEqual( + self.get_rendered_result(['index.md']), + # Markdown's default behavior is to obscure email addresses by entity-encoding them. + # The following is equivalent to: '

mail@example.com

' + '

mail@' + 'example.com

' + ) diff --git a/mkdocs/tests/toc_tests.py b/mkdocs/tests/structure/toc_tests.py similarity index 68% rename from mkdocs/tests/toc_tests.py rename to mkdocs/tests/structure/toc_tests.py index 16a1318901..591d4f7ba4 100644 --- a/mkdocs/tests/toc_tests.py +++ b/mkdocs/tests/structure/toc_tests.py @@ -1,10 +1,8 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals import unittest - -from mkdocs.tests.base import dedent, markdown_to_toc +from mkdocs.structure.toc import get_toc +from mkdocs.tests.base import dedent, get_markdown_toc class TableOfContentsTests(unittest.TestCase): @@ -20,8 +18,9 @@ def test_indented_toc(self): Heading 2 - #heading-2 Heading 3 - #heading-3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 1) def test_indented_toc_html(self): md = dedent(""" @@ -34,8 +33,9 @@ def test_indented_toc_html(self): Heading 2 - #heading-2 Heading 3 - #heading-3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 1) def test_flat_toc(self): md = dedent(""" @@ -48,8 +48,9 @@ def test_flat_toc(self): Heading 2 - #heading-2 Heading 3 - #heading-3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 3) def test_flat_h2_toc(self): md = dedent(""" @@ -62,8 +63,9 @@ def test_flat_h2_toc(self): Heading 2 - #heading-2 Heading 3 - #heading-3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 3) def test_mixed_toc(self): md = dedent(""" @@ -80,8 +82,9 @@ def test_mixed_toc(self): Heading 4 - #heading-4 Heading 5 - #heading-5 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 2) def test_mixed_html(self): md = dedent(""" @@ -98,8 +101,9 @@ def test_mixed_html(self): Heading 4 - #heading-4 Heading 5 - #heading-5 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 2) def test_nested_anchor(self): md = dedent(""" @@ -116,8 +120,9 @@ def test_nested_anchor(self): Heading 4 - #heading-4 Heading 5 - #heading-5 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 2) def test_entityref(self): md = dedent(""" @@ -130,5 +135,30 @@ def test_entityref(self): Heading > 2 - #heading-2 Heading < 3 - #heading-3 """) - toc = markdown_to_toc(md) + toc = get_toc(get_markdown_toc(md)) + self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 1) + + def test_charref(self): + md = '# @Header' + expected = '@Header - #header' + toc = get_toc(get_markdown_toc(md)) self.assertEqual(str(toc).strip(), expected) + self.assertEqual(len(toc), 1) + + def test_level(self): + md = dedent(""" + # Heading 1 + ## Heading 1.1 + ### Heading 1.1.1 + ### Heading 1.1.2 + ## Heading 1.2 + """) + toc = get_toc(get_markdown_toc(md)) + + def get_level_sequence(items): + for item in items: + yield item.level + yield from get_level_sequence(item.children) + + self.assertEqual(tuple(get_level_sequence(toc)), (1, 2, 3, 3, 2)) diff --git a/mkdocs/tests/theme_tests.py b/mkdocs/tests/theme_tests.py index fb690840c8..971d6b8136 100644 --- a/mkdocs/tests/theme_tests.py +++ b/mkdocs/tests/theme_tests.py @@ -1,12 +1,11 @@ -from __future__ import unicode_literals - import os import tempfile import unittest -import mock +from unittest import mock import mkdocs from mkdocs.theme import Theme +from localization import parse_locale abs_path = os.path.abspath(os.path.dirname(__file__)) mkdocs_dir = os.path.abspath(os.path.dirname(mkdocs.__file__)) @@ -16,7 +15,7 @@ def get_vars(theme): """ Return dict of theme vars. """ - return dict([(k, theme[k]) for k in iter(theme)]) + return {k: theme[k] for k in iter(theme)} class ThemeTests(unittest.TestCase): @@ -27,8 +26,19 @@ def test_simple_theme(self): theme.dirs, [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir] ) - self.assertEqual(theme.static_templates, set(['404.html', 'sitemap.xml'])) - self.assertEqual(get_vars(theme), {'include_search_page': False, 'search_index_only': False}) + self.assertEqual(theme.static_templates, {'404.html', 'sitemap.xml'}) + self.assertEqual(get_vars(theme), { + 'locale': parse_locale('en'), + 'include_search_page': False, + 'search_index_only': False, + 'analytics': {'gtag': None}, + 'highlightjs': True, + 'hljs_style': 'github', + 'hljs_languages': [], + 'navigation_depth': 2, + 'nav_style': 'primary', + 'shortcuts': {'help': 191, 'next': 78, 'previous': 80, 'search': 83} + }) def test_custom_dir(self): custom = tempfile.mkdtemp() @@ -54,7 +64,7 @@ def static_templates(self): theme = Theme(name='mkdocs', static_templates='foo.html') self.assertEqual( theme.static_templates, - set(['404.html', 'sitemap.xml', 'foo.html']) + {'404.html', 'sitemap.xml', 'foo.html'} ) def test_vars(self): @@ -67,11 +77,11 @@ def test_vars(self): self.assertTrue('new' in theme) self.assertEqual(theme['new'], 42) - @mock.patch('mkdocs.utils.yaml_load', return_value={}) + @mock.patch('mkdocs.utils.yaml_load', return_value=None) def test_no_theme_config(self, m): theme = Theme(name='mkdocs') self.assertEqual(m.call_count, 1) - self.assertEqual(theme.static_templates, set(['sitemap.xml'])) + self.assertEqual(theme.static_templates, {'sitemap.xml'}) def test_inherited_theme(self): m = mock.Mock(side_effect=[ @@ -90,5 +100,5 @@ def test_inherited_theme(self): ] ) self.assertEqual( - theme.static_templates, set(['sitemap.xml', 'child.html', 'parent.html']) + theme.static_templates, {'sitemap.xml', 'child.html', 'parent.html'} ) diff --git a/mkdocs/tests/utils/babel_stub_tests.py b/mkdocs/tests/utils/babel_stub_tests.py new file mode 100644 index 0000000000..65ac3da4f5 --- /dev/null +++ b/mkdocs/tests/utils/babel_stub_tests.py @@ -0,0 +1,50 @@ +import unittest +from mkdocs.utils.babel_stub import Locale, UnknownLocaleError + + +class BabelStubTests(unittest.TestCase): + + def test_locale_language_only(self): + locale = Locale('es') + self.assertEqual(locale.language, 'es') + self.assertEqual(locale.territory, '') + self.assertEqual(str(locale), 'es') + + def test_locale_language_territory(self): + locale = Locale('es', 'ES') + self.assertEqual(locale.language, 'es') + self.assertEqual(locale.territory, 'ES') + self.assertEqual(str(locale), 'es_ES') + + def test_parse_locale_language_only(self): + locale = Locale.parse('fr', '_') + self.assertEqual(locale.language, 'fr') + self.assertEqual(locale.territory, '') + self.assertEqual(str(locale), 'fr') + + def test_parse_locale_language_territory(self): + locale = Locale.parse('fr_FR', '_') + self.assertEqual(locale.language, 'fr') + self.assertEqual(locale.territory, 'FR') + self.assertEqual(str(locale), 'fr_FR') + + def test_parse_locale_language_territory_sep(self): + locale = Locale.parse('fr-FR', '-') + self.assertEqual(locale.language, 'fr') + self.assertEqual(locale.territory, 'FR') + self.assertEqual(str(locale), 'fr_FR') + + def test_parse_locale_bad_type(self): + self.assertRaises(TypeError, Locale.parse, ['list'], '_') + + def test_parse_locale_invalid_characters(self): + self.assertRaises(ValueError, Locale.parse, '42', '_') + + def test_parse_locale_bad_format(self): + self.assertRaises(ValueError, Locale.parse, 'en-GB', '_') + + def test_parse_locale_bad_format_sep(self): + self.assertRaises(ValueError, Locale.parse, 'en_GB', '-') + + def test_parse_locale_unknown_locale(self): + self.assertRaises(UnknownLocaleError, Locale.parse, 'foo', '_') diff --git a/mkdocs/tests/utils/ghp_import_tests.py b/mkdocs/tests/utils/ghp_import_tests.py deleted file mode 100644 index c65337c446..0000000000 --- a/mkdocs/tests/utils/ghp_import_tests.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -from __future__ import unicode_literals - -import mock -import os -import subprocess -import tempfile -import unittest -import shutil - -from mkdocs.utils import ghp_import - - -class UtilsTests(unittest.TestCase): - - @mock.patch('subprocess.call', auto_spec=True) - @mock.patch('subprocess.Popen', auto_spec=True) - def test_try_rebase(self, mock_popen, mock_call): - - popen = mock.Mock() - mock_popen.return_value = popen - popen.communicate.return_value = ( - '4c82346e4b1b816be89dd709d35a6b169aa3df61\n', '') - popen.wait.return_value = 0 - - ghp_import.try_rebase('origin', 'gh-pages') - - mock_popen.assert_called_once_with( - ['git', 'rev-list', '--max-count=1', 'origin/gh-pages'], - stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - mock_call.assert_called_once_with( - ['git', 'update-ref', 'refs/heads/gh-pages', - '4c82346e4b1b816be89dd709d35a6b169aa3df61']) - - @mock.patch('subprocess.Popen', auto_spec=True) - def test_get_prev_commit(self, mock_popen): - - popen = mock.Mock() - mock_popen.return_value = popen - popen.communicate.return_value = ( - b'4c82346e4b1b816be89dd709d35a6b169aa3df61\n', '') - popen.wait.return_value = 0 - - result = ghp_import.get_prev_commit('test-branch') - - self.assertEqual(result, u'4c82346e4b1b816be89dd709d35a6b169aa3df61') - mock_popen.assert_called_once_with( - ['git', 'rev-list', '--max-count=1', 'test-branch', '--'], - stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - @mock.patch('subprocess.Popen', auto_spec=True) - def test_get_config(self, mock_popen): - - popen = mock.Mock() - mock_popen.return_value = popen - popen.communicate.return_value = ( - b'Dougal Matthews\n', '') - - result = ghp_import.get_config('user.name') - - self.assertEqual(result, u'Dougal Matthews') - mock_popen.assert_called_once_with( - ['git', 'config', 'user.name'], - stdout=subprocess.PIPE, stdin=subprocess.PIPE) - - @mock.patch('mkdocs.utils.ghp_import.get_prev_commit') - @mock.patch('mkdocs.utils.ghp_import.get_config') - def test_start_commit(self, mock_get_config, mock_get_prev_commit): - - pipe = mock.Mock() - mock_get_config.side_effect = ['username', 'email'] - mock_get_prev_commit.return_value = 'SHA' - - ghp_import.start_commit(pipe, 'test-branch', 'test-message') - - mock_get_prev_commit.assert_called_once_with('test-branch') - self.assertEqual(pipe.stdin.write.call_count, 5) - - @mock.patch('mkdocs.utils.ghp_import.try_rebase', return_value=True) - @mock.patch('mkdocs.utils.ghp_import.get_prev_commit', return_value='sha') - @mock.patch('mkdocs.utils.ghp_import.get_config', return_value='config') - @mock.patch('subprocess.call', auto_spec=True) - @mock.patch('subprocess.Popen', auto_spec=True) - def test_ghp_import(self, mock_popen, mock_call, mock_get_config, - mock_get_prev_commit, mock_try_rebase): - - directory = tempfile.mkdtemp() - open(os.path.join(directory, 'file'), 'a').close() - - try: - popen = mock.Mock() - mock_popen.return_value = popen - popen.communicate.return_value = ('', '') - popen.wait.return_value = 0 - - ghp_import.ghp_import(directory, "test message", - remote='fake-remote-name', - branch='fake-branch-name') - - self.assertEqual(mock_popen.call_count, 2) - self.assertEqual(mock_call.call_count, 0) - finally: - shutil.rmtree(directory) - - @mock.patch('mkdocs.utils.ghp_import.try_rebase', return_value=True) - @mock.patch('mkdocs.utils.ghp_import.get_prev_commit', return_value='sha') - @mock.patch('mkdocs.utils.ghp_import.get_config', return_value='config') - @mock.patch('mkdocs.utils.ghp_import.run_import') - @mock.patch('subprocess.call', auto_spec=True) - @mock.patch('subprocess.Popen', auto_spec=True) - def test_ghp_import_error(self, mock_popen, mock_call, mock_get_config, - mock_run_import, mock_get_prev_commit, mock_try_rebase): - - directory = tempfile.mkdtemp() - open(os.path.join(directory, 'file'), 'a').close() - - try: - popen = mock.Mock() - mock_popen.return_value = popen - - error_string = 'TestError123' - popen.communicate.return_value = ('', error_string) - popen.wait.return_value = 1 - - result, ghp_error = ghp_import.ghp_import(directory, "test message", - remote='fake-remote-name', - branch='fake-branch-name') - - self.assertEqual(result, False) - self.assertEqual(ghp_error, error_string) - finally: - shutil.rmtree(directory) diff --git a/mkdocs/tests/utils/utils_tests.py b/mkdocs/tests/utils/utils_tests.py index c65390705e..4054e746fe 100644 --- a/mkdocs/tests/utils/utils_tests.py +++ b/mkdocs/tests/utils/utils_tests.py @@ -1,17 +1,41 @@ #!/usr/bin/env python -# coding: utf-8 -from __future__ import unicode_literals -import mock +from unittest import mock import os import unittest import tempfile import shutil import stat - -from mkdocs import nav, utils, exceptions -from mkdocs.tests.base import dedent, load_config +import datetime +import logging + +from mkdocs import utils, exceptions +from mkdocs.structure.files import File +from mkdocs.structure.pages import Page +from mkdocs.tests.base import dedent, load_config, tempdir + +BASEYML = """ +INHERIT: parent.yml +foo: bar +baz: + sub1: replaced + sub3: new +deep1: + deep2-1: + deep3-1: replaced +""" +PARENTYML = """ +foo: foo +baz: + sub1: 1 + sub2: 2 +deep1: + deep2-1: + deep3-1: foo + deep3-2: bar + deep2-2: baz +""" class UtilsTests(unittest.TestCase): @@ -59,77 +83,184 @@ def test_is_html_file(self): is_html = utils.is_html_file(path) self.assertEqual(is_html, expected_result) + def test_get_relative_url(self): + expected_results = { + ('foo/bar', 'foo'): 'bar', + ('foo/bar.txt', 'foo'): 'bar.txt', + ('foo', 'foo/bar'): '..', + ('foo', 'foo/bar.txt'): '.', + ('foo/../../bar', '.'): 'bar', + ('foo/../../bar', 'foo'): '../bar', + ('foo//./bar/baz', 'foo/bar/baz'): '.', + ('a/b/.././../c', '.'): 'c', + ('a/b/c/d/ee', 'a/b/c/d/e'): '../ee', + ('a/b/c/d/ee', 'a/b/z/d/e'): '../../../c/d/ee', + ('foo', 'bar.'): 'foo', + ('foo', 'bar./'): '../foo', + ('foo', 'foo/bar./'): '..', + ('foo', 'foo/bar./.'): '..', + ('foo', 'foo/bar././'): '..', + ('foo/', 'foo/bar././'): '../', + ('foo', 'foo'): '.', + ('.foo', '.foo'): '.foo', + ('.foo/', '.foo'): '.foo/', + ('.foo', '.foo/'): '.', + ('.foo/', '.foo/'): './', + ('///', ''): './', + ('a///', ''): 'a/', + ('a///', 'a'): './', + ('.', 'here'): '..', + ('..', 'here'): '..', + ('../..', 'here'): '..', + ('../../a', 'here'): '../a', + ('..', 'here.txt'): '.', + ('a', ''): 'a', + ('a', '..'): 'a', + ('a', 'b'): '../a', + ('a', 'b/..'): '../a', # The dots are considered a file. Documenting a long-standing bug. + ('a', 'b/../..'): 'a', + ('a/..../b', 'a/../b'): '../a/..../b', + ('a/я/b', 'a/я/c'): '../b', + ('a/я/b', 'a/яя/c'): '../../я/b', + } + for (url, other), expected_result in expected_results.items(): + # Leading slash intentionally ignored + self.assertEqual(utils.get_relative_url(url, other), expected_result) + self.assertEqual(utils.get_relative_url('/' + url, other), expected_result) + self.assertEqual(utils.get_relative_url(url, '/' + other), expected_result) + self.assertEqual(utils.get_relative_url('/' + url, '/' + other), expected_result) + + def test_get_relative_url_empty(self): + for url in ['', '.', '/.']: + for other in ['', '.', '/', '/.']: + self.assertEqual(utils.get_relative_url(url, other), '.') + + self.assertEqual(utils.get_relative_url('/', ''), './') + self.assertEqual(utils.get_relative_url('/', '/'), './') + self.assertEqual(utils.get_relative_url('/', '.'), './') + self.assertEqual(utils.get_relative_url('/', '/.'), './') + def test_create_media_urls(self): - pages = [ - {'Home': 'index.md'}, - {'About': 'about.md'}, - {'Sub': [ - {'Sub Home': 'index.md'}, - {'Sub About': 'about.md'}, - ]} - ] expected_results = { - 'https://media.cdn.org/jq.js': 'https://media.cdn.org/jq.js', - 'http://media.cdn.org/jquery.js': 'http://media.cdn.org/jquery.js', - '//media.cdn.org/jquery.js': '//media.cdn.org/jquery.js', - 'media.cdn.org/jquery.js': './media.cdn.org/jquery.js', - 'local/file/jquery.js': './local/file/jquery.js', - 'image.png': './image.png', + 'https://media.cdn.org/jq.js': [ + 'https://media.cdn.org/jq.js', + 'https://media.cdn.org/jq.js', + 'https://media.cdn.org/jq.js' + ], + 'http://media.cdn.org/jquery.js': [ + 'http://media.cdn.org/jquery.js', + 'http://media.cdn.org/jquery.js', + 'http://media.cdn.org/jquery.js' + ], + '//media.cdn.org/jquery.js': [ + '//media.cdn.org/jquery.js', + '//media.cdn.org/jquery.js', + '//media.cdn.org/jquery.js' + ], + 'media.cdn.org/jquery.js': [ + 'media.cdn.org/jquery.js', + 'media.cdn.org/jquery.js', + '../media.cdn.org/jquery.js' + ], + 'local/file/jquery.js': [ + 'local/file/jquery.js', + 'local/file/jquery.js', + '../local/file/jquery.js' + ], + 'local\\windows\\file\\jquery.js': [ + 'local/windows/file/jquery.js', + 'local/windows/file/jquery.js', + '../local/windows/file/jquery.js' + ], + 'image.png': [ + 'image.png', + 'image.png', + '../image.png' + ], + 'style.css?v=20180308c': [ + 'style.css?v=20180308c', + 'style.css?v=20180308c', + '../style.css?v=20180308c' + ], + '#some_id': [ + '#some_id', + '#some_id', + '#some_id' + ] } - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - for path, expected_result in expected_results.items(): - urls = utils.create_media_urls(site_navigation, [path]) - self.assertEqual(urls[0], expected_result) - - def test_create_relative_media_url_sub_index(self): - ''' - test special case where there's a sub/index.md page - ''' + cfg = load_config(use_directory_urls=False) pages = [ - {'Home': 'index.md'}, - {'Sub': [ - {'Sub Home': '/subpage/index.md'}, - - ]} + Page('Home', File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg), + Page('About', File('about.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg), + Page('FooBar', File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg) ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - site_navigation.url_context.set_current_url('/subpage/') - site_navigation.file_context.current_file = "subpage/index.md" - def assertPathGenerated(declared, expected): - url = utils.create_relative_media_url(site_navigation, declared) - self.assertEqual(url, expected) + for i, page in enumerate(pages): + urls = utils.create_media_urls(expected_results.keys(), page) + self.assertEqual([v[i] for v in expected_results.values()], urls) - assertPathGenerated("img.png", "./img.png") - assertPathGenerated("./img.png", "./img.png") - assertPathGenerated("/img.png", "../img.png") + def test_create_media_urls_use_directory_urls(self): - def test_create_relative_media_url_sub_index_windows(self): - ''' - test special case where there's a sub/index.md page and we are on Windows. - current_file paths uses backslash in Windows - ''' + expected_results = { + 'https://media.cdn.org/jq.js': [ + 'https://media.cdn.org/jq.js', + 'https://media.cdn.org/jq.js', + 'https://media.cdn.org/jq.js' + ], + 'http://media.cdn.org/jquery.js': [ + 'http://media.cdn.org/jquery.js', + 'http://media.cdn.org/jquery.js', + 'http://media.cdn.org/jquery.js' + ], + '//media.cdn.org/jquery.js': [ + '//media.cdn.org/jquery.js', + '//media.cdn.org/jquery.js', + '//media.cdn.org/jquery.js' + ], + 'media.cdn.org/jquery.js': [ + 'media.cdn.org/jquery.js', + '../media.cdn.org/jquery.js', + '../../media.cdn.org/jquery.js' + ], + 'local/file/jquery.js': [ + 'local/file/jquery.js', + '../local/file/jquery.js', + '../../local/file/jquery.js' + ], + 'local\\windows\\file\\jquery.js': [ + 'local/windows/file/jquery.js', + '../local/windows/file/jquery.js', + '../../local/windows/file/jquery.js' + ], + 'image.png': [ + 'image.png', + '../image.png', + '../../image.png' + ], + 'style.css?v=20180308c': [ + 'style.css?v=20180308c', + '../style.css?v=20180308c', + '../../style.css?v=20180308c' + ], + '#some_id': [ + '#some_id', + '#some_id', + '#some_id' + ] + } + cfg = load_config(use_directory_urls=True) pages = [ - {'Home': 'index.md'}, - {'Sub': [ - {'Sub Home': '/level1/level2/index.md'}, - - ]} + Page('Home', File('index.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg), + Page('About', File('about.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg), + Page('FooBar', File('foo/bar.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls']), cfg) ] - site_navigation = nav.SiteNavigation(load_config(pages=pages)) - site_navigation.url_context.set_current_url('/level1/level2') - site_navigation.file_context.current_file = "level1\\level2\\index.md" - - def assertPathGenerated(declared, expected): - url = utils.create_relative_media_url(site_navigation, declared) - self.assertEqual(url, expected) - assertPathGenerated("img.png", "./img.png") - assertPathGenerated("./img.png", "./img.png") - assertPathGenerated("/img.png", "../img.png") + for i, page in enumerate(pages): + urls = utils.create_media_urls(expected_results.keys(), page) + self.assertEqual([v[i] for v in expected_results.values()], urls) def test_reduce_list(self): self.assertEqual( @@ -143,17 +274,17 @@ def test_get_themes(self): sorted(utils.get_theme_names()), ['mkdocs', 'readthedocs']) - @mock.patch('pkg_resources.iter_entry_points', autospec=True) + @mock.patch('importlib_metadata.entry_points', autospec=True) def test_get_theme_dir(self, mock_iter): path = 'some/path' theme = mock.Mock() theme.name = 'mkdocs2' - theme.dist.key = 'mkdocs2' + theme.dist.name = 'mkdocs2' theme.load().__file__ = os.path.join(path, '__init__.py') - mock_iter.return_value = iter([theme]) + mock_iter.return_value = [theme] self.assertEqual(utils.get_theme_dir(theme.name), os.path.abspath(path)) @@ -161,53 +292,51 @@ def test_get_theme_dir_keyerror(self): self.assertRaises(KeyError, utils.get_theme_dir, 'nonexistanttheme') - @mock.patch('pkg_resources.iter_entry_points', autospec=True) + @mock.patch('importlib_metadata.entry_points', autospec=True) def test_get_theme_dir_importerror(self, mock_iter): theme = mock.Mock() theme.name = 'mkdocs2' - theme.dist.key = 'mkdocs2' + theme.dist.name = 'mkdocs2' theme.load.side_effect = ImportError() - mock_iter.return_value = iter([theme]) + mock_iter.return_value = [theme] self.assertRaises(ImportError, utils.get_theme_dir, theme.name) - @mock.patch('pkg_resources.iter_entry_points', autospec=True) + @mock.patch('importlib_metadata.entry_points', autospec=True) def test_get_themes_warning(self, mock_iter): theme1 = mock.Mock() theme1.name = 'mkdocs2' - theme1.dist.key = 'mkdocs2' + theme1.dist.name = 'mkdocs2' theme1.load().__file__ = "some/path1" theme2 = mock.Mock() theme2.name = 'mkdocs2' - theme2.dist.key = 'mkdocs3' + theme2.dist.name = 'mkdocs3' theme2.load().__file__ = "some/path2" - mock_iter.return_value = iter([theme1, theme2]) + mock_iter.return_value = [theme1, theme2] self.assertEqual( sorted(utils.get_theme_names()), sorted(['mkdocs2', ])) - @mock.patch('pkg_resources.iter_entry_points', autospec=True) - @mock.patch('pkg_resources.get_entry_map', autospec=True) - def test_get_themes_error(self, mock_get, mock_iter): + @mock.patch('importlib_metadata.entry_points', autospec=True) + def test_get_themes_error(self, mock_iter): theme1 = mock.Mock() theme1.name = 'mkdocs' - theme1.dist.key = 'mkdocs' + theme1.dist.name = 'mkdocs' theme1.load().__file__ = "some/path1" theme2 = mock.Mock() theme2.name = 'mkdocs' - theme2.dist.key = 'mkdocs2' + theme2.dist.name = 'mkdocs2' theme2.load().__file__ = "some/path2" - mock_iter.return_value = iter([theme1, theme2]) - mock_get.return_value = {'mkdocs': theme1, } + mock_iter.return_value = [theme1, theme2] self.assertRaises(exceptions.ConfigurationError, utils.get_theme_names) @@ -248,11 +377,59 @@ def test_unicode_yaml(self): key2: - value ''' - ) + ).encode('utf-8') + + config = utils.yaml_load(yaml_src) + self.assertTrue(isinstance(config['key'], str)) + self.assertTrue(isinstance(config['key2'][0], str)) + + @mock.patch.dict(os.environ, {'VARNAME': 'Hello, World!', 'BOOLVAR': 'false'}) + def test_env_var_in_yaml(self): + yaml_src = dedent( + ''' + key1: !ENV VARNAME + key2: !ENV UNDEFINED + key3: !ENV [UNDEFINED, default] + key4: !ENV [UNDEFINED, VARNAME, default] + key5: !ENV BOOLVAR + ''' + ) config = utils.yaml_load(yaml_src) - self.assertTrue(isinstance(config['key'], utils.text_type)) - self.assertTrue(isinstance(config['key2'][0], utils.text_type)) + self.assertIsInstance(config['key1'], str) + self.assertEqual(config['key1'], 'Hello, World!') + self.assertIsNone(config['key2']) + self.assertIsInstance(config['key3'], str) + self.assertEqual(config['key3'], 'default') + self.assertIsInstance(config['key4'], str) + self.assertEqual(config['key4'], 'Hello, World!') + self.assertIs(config['key5'], False) + + @tempdir(files={'base.yml': BASEYML, 'parent.yml': PARENTYML}) + def test_yaml_inheritance(self, tdir): + expected = { + 'foo': 'bar', + 'baz': { + 'sub1': 'replaced', + 'sub2': 2, + 'sub3': 'new' + }, + 'deep1': { + 'deep2-1': { + 'deep3-1': 'replaced', + 'deep3-2': 'bar' + }, + 'deep2-2': 'baz' + } + } + with open(os.path.join(tdir, 'base.yml')) as fd: + result = utils.yaml_load(fd) + self.assertEqual(result, expected) + + @tempdir(files={'base.yml': BASEYML}) + def test_yaml_inheritance_missing_parent(self, tdir): + with open(os.path.join(tdir, 'base.yml')) as fd: + self.assertRaises(exceptions.ConfigurationError, utils.yaml_load, fd) def test_copy_files(self): src_paths = [ @@ -321,3 +498,155 @@ def test_copy_files_without_permissions(self): os.chmod(src, stat.S_IRUSR | stat.S_IWUSR) shutil.rmtree(src_dir) shutil.rmtree(dst_dir) + + def test_mm_meta_data(self): + doc = dedent( + """ + Title: Foo Bar + Date: 2018-07-10 + Summary: Line one + Line two + Tags: foo + Tags: bar + + Doc body + """ + ) + self.assertEqual( + utils.meta.get_data(doc), + ( + "Doc body", + { + 'title': 'Foo Bar', + 'date': '2018-07-10', + 'summary': 'Line one Line two', + 'tags': 'foo bar' + } + ) + ) + + def test_mm_meta_data_blank_first_line(self): + doc = '\nfoo: bar\nDoc body' + self.assertEqual(utils.meta.get_data(doc), (doc.lstrip(), {})) + + def test_yaml_meta_data(self): + doc = dedent( + """ + --- + Title: Foo Bar + Date: 2018-07-10 + Summary: Line one + Line two + Tags: + - foo + - bar + --- + Doc body + """ + ) + self.assertEqual( + utils.meta.get_data(doc), + ( + "Doc body", + { + 'Title': 'Foo Bar', + 'Date': datetime.date(2018, 7, 10), + 'Summary': 'Line one Line two', + 'Tags': ['foo', 'bar'] + } + ) + ) + + def test_yaml_meta_data_not_dict(self): + doc = dedent( + """ + --- + - List item + --- + Doc body + """ + ) + self.assertEqual(utils.meta.get_data(doc), (doc, {})) + + def test_yaml_meta_data_invalid(self): + doc = dedent( + """ + --- + foo: bar: baz + --- + Doc body + """ + ) + self.assertEqual(utils.meta.get_data(doc), (doc, {})) + + def test_no_meta_data(self): + doc = dedent( + """ + Doc body + """ + ) + self.assertEqual(utils.meta.get_data(doc), (doc, {})) + + +class LogCounterTests(unittest.TestCase): + def setUp(self): + self.log = logging.getLogger('dummy') + self.log.propagate = False + self.log.setLevel(1) + self.counter = utils.CountHandler() + self.log.addHandler(self.counter) + + def tearDown(self): + self.log.removeHandler(self.counter) + + def test_default_values(self): + self.assertEqual(self.counter.get_counts(), []) + + def test_count_critical(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.critical('msg') + self.assertEqual(self.counter.get_counts(), [('CRITICAL', 1)]) + + def test_count_error(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.error('msg') + self.assertEqual(self.counter.get_counts(), [('ERROR', 1)]) + + def test_count_warning(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.warning('msg') + self.assertEqual(self.counter.get_counts(), [('WARNING', 1)]) + + def test_count_info(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.info('msg') + self.assertEqual(self.counter.get_counts(), [('INFO', 1)]) + + def test_count_debug(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.debug('msg') + self.assertEqual(self.counter.get_counts(), [('DEBUG', 1)]) + + def test_count_multiple(self): + self.assertEqual(self.counter.get_counts(), []) + self.log.warning('msg 1') + self.assertEqual(self.counter.get_counts(), [('WARNING', 1)]) + self.log.warning('msg 2') + self.assertEqual(self.counter.get_counts(), [('WARNING', 2)]) + self.log.debug('msg 3') + self.assertEqual(self.counter.get_counts(), [('WARNING', 2), ('DEBUG', 1)]) + self.log.error('mdg 4') + self.assertEqual(self.counter.get_counts(), [('ERROR', 1), ('WARNING', 2), ('DEBUG', 1)]) + + def test_log_level(self): + self.assertEqual(self.counter.get_counts(), []) + self.counter.setLevel(logging.ERROR) + self.log.error('counted') + self.log.warning('not counted') + self.log.info('not counted') + self.assertEqual(self.counter.get_counts(), [('ERROR', 1)]) + self.counter.setLevel(logging.WARNING) + self.log.error('counted') + self.log.warning('counted') + self.log.info('not counted') + self.assertEqual(self.counter.get_counts(), [('ERROR', 2), ('WARNING', 1)]) diff --git a/mkdocs/theme.py b/mkdocs/theme.py index e67f56a7c3..d02874962f 100644 --- a/mkdocs/theme.py +++ b/mkdocs/theme.py @@ -1,6 +1,3 @@ -# coding: utf-8 - -from __future__ import unicode_literals import os import jinja2 import logging @@ -8,11 +5,12 @@ from mkdocs import utils from mkdocs.utils import filters from mkdocs.config.base import ValidationError +from mkdocs import localization log = logging.getLogger(__name__) -class Theme(object): +class Theme: """ A Theme object. @@ -30,7 +28,7 @@ class Theme(object): def __init__(self, name=None, **user_config): self.name = name - self._vars = {} + self._vars = {'locale': 'en'} # MkDocs provided static templates are always included package_dir = os.path.abspath(os.path.dirname(__file__)) @@ -53,10 +51,13 @@ def __init__(self, name=None, **user_config): self.static_templates.update(user_config.pop('static_templates', [])) self._vars.update(user_config) + # Validate locale and convert to Locale object + self._vars['locale'] = localization.parse_locale(self._vars['locale']) + def __repr__(self): - return "{0}(name='{1}', dirs={2}, static_templates={3}, {4})".format( + return "{}(name='{}', dirs={}, static_templates={}, {})".format( self.__class__.__name__, self.name, self.dirs, list(self.static_templates), - ', '.join('{0}={1}'.format(k, repr(v)) for k, v in self._vars.items()) + ', '.join(f'{k}={v!r}' for k, v in self._vars.items()) ) def __getitem__(self, key): @@ -81,24 +82,24 @@ def _load_theme_config(self, name): file_path = os.path.join(theme_dir, 'mkdocs_theme.yml') with open(file_path, 'rb') as f: theme_config = utils.yaml_load(f) - except IOError as e: + if theme_config is None: + theme_config = {} + except OSError as e: log.debug(e) - # TODO: Change this warning to an error in a future version - log.warning( - "The theme '{0}' does not appear to have a configuration file. " - "Please upgrade to a current version of the theme.".format(name) + raise ValidationError( + f"The theme '{name}' does not appear to have a configuration file. " + f"Please upgrade to a current version of the theme." ) - return - log.debug("Loaded theme configuration for '%s' from '%s': %s", name, file_path, theme_config) + log.debug(f"Loaded theme configuration for '{name}' from '{file_path}': {theme_config}") parent_theme = theme_config.pop('extends', None) if parent_theme: themes = utils.get_theme_names() if parent_theme not in themes: raise ValidationError( - "The theme '{0}' inherits from '{1}', which does not appear to be installed. " - "The available installed themes are: {2}".format(name, parent_theme, ', '.join(themes)) + f"The theme '{name}' inherits from '{parent_theme}', which does not appear to be installed. " + f"The available installed themes are: {', '.join(themes)}" ) self._load_theme_config(parent_theme) @@ -109,6 +110,9 @@ def get_env(self): """ Return a Jinja environment for the theme. """ loader = jinja2.FileSystemLoader(self.dirs) - env = jinja2.Environment(loader=loader) + # No autoreload because editing a template in the middle of a build is not useful. + env = jinja2.Environment(loader=loader, auto_reload=False) env.filters['tojson'] = filters.tojson + env.filters['url'] = filters.url_filter + localization.install_translations(env, self._vars['locale'], self.dirs) return env diff --git a/mkdocs/themes/babel.cfg b/mkdocs/themes/babel.cfg new file mode 100644 index 0000000000..6e03abf212 --- /dev/null +++ b/mkdocs/themes/babel.cfg @@ -0,0 +1,6 @@ +[jinja2: **.html] +ignore_tags = script,style +include_attrs = alt title summary + +[extractors] +jinja2 = jinja2.ext:babel_extract diff --git a/mkdocs/themes/mkdocs/404.html b/mkdocs/themes/mkdocs/404.html index c45fda8b9f..c0503d7469 100644 --- a/mkdocs/themes/mkdocs/404.html +++ b/mkdocs/themes/mkdocs/404.html @@ -5,7 +5,7 @@

404

-

Page not found

+

{% trans %}Page not found{% endtrans %}

diff --git a/mkdocs/themes/mkdocs/base.html b/mkdocs/themes/mkdocs/base.html index 115d0c7aa8..e07ee989d0 100644 --- a/mkdocs/themes/mkdocs/base.html +++ b/mkdocs/themes/mkdocs/base.html @@ -1,5 +1,5 @@ - + {%- block site_meta %} @@ -8,8 +8,8 @@ {% if page and page.is_homepage %}{% endif %} {% if config.site_author %}{% endif %} {% if page and page.canonical_url %}{% endif %} - {% if config.site_favicon %} - {% else %}{% endif %} + {% if config.site_favicon %} + {% else %}{% endif %} {%- endblock %} {%- block htmltitle %} @@ -17,34 +17,46 @@ {%- endblock %} {%- block styles %} - - - - + + + + {%- if config.theme.highlightjs %} + + {%- endif %} {%- for path in extra_css %} {%- endfor %} {%- endblock %} {%- block libs %} - - - - - - + + + + {%- if config.theme.highlightjs %} + + {%- for lang in config.theme.hljs_languages %} + + {%- endfor %} + + {%- endif %} {%- endblock %} {%- block analytics %} - {%- if config.google_analytics %} + {%- if config.theme.analytics.gtag %} + + + {%- elif config.google_analytics %} - + + {%- for path in extra_javascript %} - + {%- endfor %} {%- endblock %} diff --git a/mkdocs/themes/mkdocs/css/base.css b/mkdocs/themes/mkdocs/css/base.css index ea9f2e90d0..13f6c9188f 100644 --- a/mkdocs/themes/mkdocs/css/base.css +++ b/mkdocs/themes/mkdocs/css/base.css @@ -1,24 +1,36 @@ -body { - padding-top: 70px; - background: url(../img/grid.png) repeat-x; - background-attachment: fixed; +html { + /* csslint ignore:start */ + /* The nav header is 3.5rem high, plus 20px for the margin-top of the + main container. */ + scroll-padding-top: calc(3.5rem + 20px); + /* csslint ignore:end */ +} + +/* Replacement for `body { background-attachment: fixed; }`, which has + performance issues when scrolling on large displays. See #1394. */ +body::before { + content: ' '; + position: fixed; + width: 100%; + height: 100%; + top: 0; + left: 0; background-color: #f8f8f8; + background: url(../img/grid.png) repeat-x; + will-change: transform; + z-index: -1; } body > .container { + margin-top: 20px; min-height: 400px; } -ul.nav .main { - font-weight: bold; -} - -.col-md-3 { - padding-left: 0; -} - -.col-md-9 { - padding-bottom: 100px; +.navbar.fixed-top { /* csslint allow: adjoining-classes */ + /* csslint ignore:start */ + position: -webkit-sticky; + position: sticky; + /* csslint ignore:end */ } .source-links { @@ -36,44 +48,6 @@ ul.nav .main { margin: 20px auto 30px auto; } -/* - * The code below adds some padding to the top of the current anchor target so - * that, when navigating to it, the header isn't hidden by the navbar at the - * top. This is especially complicated because we want to *remove* the padding - * after navigation so that hovering over the header shows the permalink icon - * correctly. Thus, we create a CSS animation to remove the extra padding after - * a second. We have two animations so that navigating to an anchor within the - * page always restarts the animation. - * - * See for more details. - */ -:target::before { - content: ""; - display: block; - margin-top: -75px; - height: 75px; - pointer-events: none; - animation: 0s 1s forwards collapse-anchor-padding-1; -} - -.clicky :target::before { - animation-name: collapse-anchor-padding-2; -} - -@keyframes collapse-anchor-padding-1 { - to { - margin-top: 0; - height: 0; - } -} - -@keyframes collapse-anchor-padding-2 { - to { - margin-top: 0; - height: 0; - } -} - h1 { color: #444; font-weight: 400; @@ -111,11 +85,12 @@ code { } pre code { + display: block; background: transparent; border: none; white-space: pre; word-wrap: normal; - font-family: monospace,serif; + font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; } @@ -155,22 +130,45 @@ footer { * sections of docs content. */ -/* By default it's not affixed in mobile views, so undo that */ .bs-sidebar.affix { /* csslint allow: adjoining-classes */ - position: static; + /* csslint ignore:start */ + position: -webkit-sticky; + position: sticky; + /* csslint ignore:end */ + /* The nav header is 3.5rem high, plus 20px for the margin-top of the + main container. */ + top: calc(3.5rem + 20px); } -.bs-sidebar.well { /* csslint allow: adjoining-classes */ +.bs-sidebar.card { /* csslint allow: adjoining-classes */ padding: 0; max-height: 90%; overflow-y: auto; } +/* Toggle (vertically flip) sidebar collapse icon */ +.bs-sidebar .navbar-toggler span { + -moz-transform: scale(1, -1); + -webkit-transform: scale(1, -1); + -o-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); +} + +.bs-sidebar .navbar-toggler.collapsed span { /* csslint allow: adjoining-classes */ + -moz-transform: scale(1, 1); + -webkit-transform: scale(1, 1); + -o-transform: scale(1, 1); + -ms-transform: scale(1, 1); + transform: scale(1, 1); +} + /* First level of nav */ -.bs-sidenav { +.bs-sidebar > .navbar-collapse > .nav { padding-top: 10px; padding-bottom: 10px; border-radius: 5px; + width: 100%; } /* All levels of nav */ @@ -184,55 +182,24 @@ footer { text-decoration: none; border-right: 1px solid; } -.bs-sidebar .nav > .active > a, -.bs-sidebar .nav > .active:hover > a, -.bs-sidebar .nav > .active:focus > a { +.bs-sidebar .nav > li > a.active, +.bs-sidebar .nav > li > a.active:hover, +.bs-sidebar .nav > li > a.active:focus { font-weight: bold; background-color: transparent; border-right: 1px solid; } -/* Nav: second level (shown on .active) */ -.bs-sidebar .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - margin-bottom: 8px; -} -.bs-sidebar .nav .nav > li > a { - padding-top: 3px; - padding-bottom: 3px; - padding-left: 30px; - font-size: 90%; +.bs-sidebar .nav .nav .nav { + margin-left: 1em; } -/* Show and affix the side nav when space allows it */ -@media (min-width: 992px) { - .bs-sidebar .nav > .active > ul { - display: block; - } - /* Widen the fixed sidebar */ - .bs-sidebar.affix, /* csslint allow: adjoining-classes */ - .bs-sidebar.affix-bottom { /* csslint allow: adjoining-classes */ - width: 213px; - } - .bs-sidebar.affix { /* csslint allow: adjoining-classes */ - position: fixed; /* Undo the static from mobile first approach */ - top: 80px; - } - .bs-sidebar.affix-bottom { /* csslint allow: adjoining-classes */ - position: absolute; /* Undo the static from mobile first approach */ - } - .bs-sidebar.affix-bottom .bs-sidenav, /* csslint allow: adjoining-classes */ - .bs-sidebar.affix .bs-sidenav { /* csslint allow: adjoining-classes */ - margin-top: 0; - margin-bottom: 0; - } +.bs-sidebar .nav > li > a { + font-weight: bold; } -@media (min-width: 1200px) { - /* Widen the fixed sidebar again */ - .bs-sidebar.affix-bottom, /* csslint allow: adjoining-classes */ - .bs-sidebar.affix { /* csslint allow: adjoining-classes */ - width: 263px; - } + +.bs-sidebar .nav .nav > li > a { + font-weight: normal; } .headerlink { @@ -279,26 +246,25 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } - -.dropdown-submenu { - position: relative; +@media (max-width: 991.98px) { + .navbar-collapse.show { /* csslint allow: adjoining-classes */ + overflow-y: auto; + max-height: calc(100vh - 3.5rem); + } } -.dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - -webkit-border-radius: 0 6px 6px 6px; - -moz-border-radius: 0 6px 6px; - border-radius: 0 6px 6px 6px; +.dropdown-item.open { /* csslint allow: adjoining-classes */ + color: #fff; + background-color: #2FA4E7; } -.dropdown-submenu:hover>.dropdown-menu { - display: block; +.dropdown-submenu > .dropdown-menu { + margin: 0 0 0 1.5rem; + padding: 0; + border-width: 0; } -.dropdown-submenu>a:after { +.dropdown-submenu > a::after { display: block; content: " "; float: right; @@ -312,18 +278,41 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head margin-right: -10px; } -.dropdown-submenu:hover>a:after { +.dropdown-submenu:hover > a::after { border-left-color: #fff; } -.dropdown-submenu.pull-left { /* csslint allow: adjoining-classes */ - float: none; +@media (min-width: 992px) { + .dropdown-menu { + overflow-y: auto; + max-height: calc(100vh - 3.5rem); + } + + .dropdown-submenu { + position: relative; + } + + .dropdown-submenu > .dropdown-menu { + /* csslint ignore:start */ + position: fixed !important; + /* csslint ignore:end */ + margin-top: -9px; + margin-left: -2px; + border-width: 1px; + padding: 0.5rem 0; + } + + .dropdown-submenu.pull-left { /* csslint allow: adjoining-classes */ + float: none; + } + + .dropdown-submenu.pull-left > .dropdown-menu { /* csslint allow: adjoining-classes */ + left: -100%; + margin-left: 10px; + } } -.dropdown-submenu.pull-left>.dropdown-menu { /* csslint allow: adjoining-classes */ - left: -100%; - margin-left: 10px; - -webkit-border-radius: 6px 0 6px 6px; - -moz-border-radius: 6px 0 6px 6px; - border-radius: 6px 0 6px 6px; +@media print { + /* Remove sidebar when print */ + .col-md-3 { display: none; } } diff --git a/mkdocs/themes/mkdocs/css/bootstrap-custom.min.css b/mkdocs/themes/mkdocs/css/bootstrap-custom.min.css deleted file mode 100644 index d85b1dcdf6..0000000000 --- a/mkdocs/themes/mkdocs/css/bootstrap-custom.min.css +++ /dev/null @@ -1 +0,0 @@ -/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{margin:.67em 0;font-size:2em}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{height:0;-moz-box-sizing:content-box;box-sizing:content-box}mark{color:#000;background:#ff0}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid #c0c0c0}legend{padding:0;border:0}button,input,select,textarea{margin:0;font-family:inherit;font-size:100%}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{padding:0;box-sizing:border-box}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:2cm .5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#555;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#2fa4e7;text-decoration:none}a:hover,a:focus{color:#157ab5;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}img{vertical-align:middle}.img-responsive{display:block;height:auto;max-width:100%}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;height:auto;max-width:100%;padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:#317eac}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{margin-top:20px;margin-bottom:10px}h1 small,h2 small,h3 small,h1 .small,h2 .small,h3 .small{font-size:65%}h4,h5,h6{margin-top:10px;margin-bottom:10px}h4 small,h5 small,h6 small,h4 .small,h5 .small,h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media(min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-muted{color:#999}.text-primary{color:#2fa4e7}.text-primary:hover{color:#178acc}.text-warning{color:#c09853}.text-warning:hover{color:#a47e3c}.text-danger{color:#b94a48}.text-danger:hover{color:#953b39}.text-success{color:#468847}.text-success:hover{color:#356635}.text-info{color:#3a87ad}.text-info:hover{color:#2d6987}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}.list-inline>li:first-child{padding-left:0}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.428571429}dt{font-weight:bold}dd{margin-left:0}@media(min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}blockquote p:last-child{margin-bottom:0}blockquote small,blockquote .small{display:block;line-height:1.428571429;color:#999}blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small,blockquote.pull-right .small{text-align:right}blockquote.pull-right small:before,blockquote.pull-right .small:before{content:''}blockquote.pull-right small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.428571429}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;white-space:nowrap;background-color:#f9f2f4;border-radius:4px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}@media(min-width:768px){.container{width:750px}}@media(min-width:992px){.container{width:970px}}@media(min-width:1200px){.container{width:1170px}}.row{margin-right:-15px;margin-left:-15px}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666666666666%}.col-xs-10{width:83.33333333333334%}.col-xs-9{width:75%}.col-xs-8{width:66.66666666666666%}.col-xs-7{width:58.333333333333336%}.col-xs-6{width:50%}.col-xs-5{width:41.66666666666667%}.col-xs-4{width:33.33333333333333%}.col-xs-3{width:25%}.col-xs-2{width:16.666666666666664%}.col-xs-1{width:8.333333333333332%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666666666666%}.col-xs-pull-10{right:83.33333333333334%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666666666666%}.col-xs-pull-7{right:58.333333333333336%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666666666667%}.col-xs-pull-4{right:33.33333333333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.666666666666664%}.col-xs-pull-1{right:8.333333333333332%}.col-xs-pull-0{right:0}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666666666666%}.col-xs-push-10{left:83.33333333333334%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666666666666%}.col-xs-push-7{left:58.333333333333336%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666666666667%}.col-xs-push-4{left:33.33333333333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.666666666666664%}.col-xs-push-1{left:8.333333333333332%}.col-xs-push-0{left:0}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666666666666%}.col-xs-offset-10{margin-left:83.33333333333334%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666666666666%}.col-xs-offset-7{margin-left:58.333333333333336%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666666666667%}.col-xs-offset-4{margin-left:33.33333333333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.666666666666664%}.col-xs-offset-1{margin-left:8.333333333333332%}.col-xs-offset-0{margin-left:0}@media(min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666666666666%}.col-sm-10{width:83.33333333333334%}.col-sm-9{width:75%}.col-sm-8{width:66.66666666666666%}.col-sm-7{width:58.333333333333336%}.col-sm-6{width:50%}.col-sm-5{width:41.66666666666667%}.col-sm-4{width:33.33333333333333%}.col-sm-3{width:25%}.col-sm-2{width:16.666666666666664%}.col-sm-1{width:8.333333333333332%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666666666666%}.col-sm-pull-10{right:83.33333333333334%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666666666666%}.col-sm-pull-7{right:58.333333333333336%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666666666667%}.col-sm-pull-4{right:33.33333333333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.666666666666664%}.col-sm-pull-1{right:8.333333333333332%}.col-sm-pull-0{right:0}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666666666666%}.col-sm-push-10{left:83.33333333333334%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666666666666%}.col-sm-push-7{left:58.333333333333336%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666666666667%}.col-sm-push-4{left:33.33333333333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.666666666666664%}.col-sm-push-1{left:8.333333333333332%}.col-sm-push-0{left:0}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666666666666%}.col-sm-offset-10{margin-left:83.33333333333334%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666666666666%}.col-sm-offset-7{margin-left:58.333333333333336%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666666666667%}.col-sm-offset-4{margin-left:33.33333333333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.666666666666664%}.col-sm-offset-1{margin-left:8.333333333333332%}.col-sm-offset-0{margin-left:0}}@media(min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666666666666%}.col-md-10{width:83.33333333333334%}.col-md-9{width:75%}.col-md-8{width:66.66666666666666%}.col-md-7{width:58.333333333333336%}.col-md-6{width:50%}.col-md-5{width:41.66666666666667%}.col-md-4{width:33.33333333333333%}.col-md-3{width:25%}.col-md-2{width:16.666666666666664%}.col-md-1{width:8.333333333333332%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666666666666%}.col-md-pull-10{right:83.33333333333334%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666666666666%}.col-md-pull-7{right:58.333333333333336%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666666666667%}.col-md-pull-4{right:33.33333333333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.666666666666664%}.col-md-pull-1{right:8.333333333333332%}.col-md-pull-0{right:0}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666666666666%}.col-md-push-10{left:83.33333333333334%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666666666666%}.col-md-push-7{left:58.333333333333336%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666666666667%}.col-md-push-4{left:33.33333333333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.666666666666664%}.col-md-push-1{left:8.333333333333332%}.col-md-push-0{left:0}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666666666666%}.col-md-offset-10{margin-left:83.33333333333334%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666666666666%}.col-md-offset-7{margin-left:58.333333333333336%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666666666667%}.col-md-offset-4{margin-left:33.33333333333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.666666666666664%}.col-md-offset-1{margin-left:8.333333333333332%}.col-md-offset-0{margin-left:0}}@media(min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666666666666%}.col-lg-10{width:83.33333333333334%}.col-lg-9{width:75%}.col-lg-8{width:66.66666666666666%}.col-lg-7{width:58.333333333333336%}.col-lg-6{width:50%}.col-lg-5{width:41.66666666666667%}.col-lg-4{width:33.33333333333333%}.col-lg-3{width:25%}.col-lg-2{width:16.666666666666664%}.col-lg-1{width:8.333333333333332%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666666666666%}.col-lg-pull-10{right:83.33333333333334%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666666666666%}.col-lg-pull-7{right:58.333333333333336%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666666666667%}.col-lg-pull-4{right:33.33333333333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.666666666666664%}.col-lg-pull-1{right:8.333333333333332%}.col-lg-pull-0{right:0}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666666666666%}.col-lg-push-10{left:83.33333333333334%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666666666666%}.col-lg-push-7{left:58.333333333333336%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666666666667%}.col-lg-push-4{left:33.33333333333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.666666666666664%}.col-lg-push-1{left:8.333333333333332%}.col-lg-push-0{left:0}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666666666666%}.col-lg-offset-10{margin-left:83.33333333333334%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666666666666%}.col-lg-offset-7{margin-left:58.333333333333336%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666666666667%}.col-lg-offset-4{margin-left:33.33333333333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.666666666666664%}.col-lg-offset-1{margin-left:8.333333333333332%}.col-lg-offset-0{margin-left:0}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*="col-"]{position:static;display:table-column;float:none}table td[class*="col-"],table th[class*="col-"]{display:table-cell;float:none}.table>thead>tr>.active,.table>tbody>tr>.active,.table>tfoot>tr>.active,.table>thead>.active>td,.table>tbody>.active>td,.table>tfoot>.active>td,.table>thead>.active>th,.table>tbody>.active>th,.table>tfoot>.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>.active:hover,.table-hover>tbody>.active:hover>td,.table-hover>tbody>.active:hover>th{background-color:#e8e8e8}.table>thead>tr>.success,.table>tbody>tr>.success,.table>tfoot>tr>.success,.table>thead>.success>td,.table>tbody>.success>td,.table>tfoot>.success>td,.table>thead>.success>th,.table>tbody>.success>th,.table>tfoot>.success>th{background-color:#dff0d8}.table-hover>tbody>tr>.success:hover,.table-hover>tbody>.success:hover>td,.table-hover>tbody>.success:hover>th{background-color:#d0e9c6}.table>thead>tr>.danger,.table>tbody>tr>.danger,.table>tfoot>tr>.danger,.table>thead>.danger>td,.table>tbody>.danger>td,.table>tfoot>.danger>td,.table>thead>.danger>th,.table>tbody>.danger>th,.table>tfoot>.danger>th{background-color:#f2dede}.table-hover>tbody>tr>.danger:hover,.table-hover>tbody>.danger:hover>td,.table-hover>tbody>.danger:hover>th{background-color:#ebcccc}.table>thead>tr>.warning,.table>tbody>tr>.warning,.table>tfoot>tr>.warning,.table>thead>.warning>td,.table>tbody>.warning>td,.table>tfoot>.warning>td,.table>thead>.warning>th,.table>tbody>.warning>th,.table>tfoot>.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>.warning:hover,.table-hover>tbody>.warning:hover>td,.table-hover>tbody>.warning:hover>th{background-color:#faf2cc}@media(max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;border:1px solid #ddd;-ms-overflow-style:-ms-autohiding-scrollbar;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#555;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}select[multiple],select[size]{height:auto}select optgroup{font-family:inherit;font-size:inherit;font-style:inherit}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button{height:auto}output{display:block;padding-top:9px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.form-control{display:block;width:100%;height:38px;padding:8px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control:-moz-placeholder{color:#999}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}textarea.form-control{height:auto}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;padding-left:20px;margin-top:10px;margin-bottom:10px;vertical-align:middle}.radio label,.checkbox label{display:inline;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:normal;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm{height:auto}.input-lg{height:54px;padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:54px;line-height:54px}textarea.input-lg{height:auto}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#c09853}.has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.has-warning .input-group-addon{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#b94a48}.has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.has-error .input-group-addon{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#468847}.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.has-success .input-group-addon{color:#468847;background-color:#dff0d8;border-color:#468847}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#959595}@media(min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block}.form-inline select.form-control{width:auto}.form-inline .radio,.form-inline .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:none;margin-left:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:9px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:29px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-control-static{padding-top:9px}@media(min-width:768px){.form-horizontal .control-label{text-align:right}}.btn{display:inline-block;padding:8px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#555;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#555;background-color:#fff;border-color:rgba(0,0,0,0.1)}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#555;background-color:#ebebeb;border-color:rgba(0,0,0,0.1)}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:rgba(0,0,0,0.1)}.btn-default .badge{color:#fff;background-color:#fff}.btn-primary{color:#fff;background-color:#2fa4e7;border-color:#2fa4e7}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#1990d5;border-color:#1684c2}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#2fa4e7;border-color:#2fa4e7}.btn-primary .badge{color:#2fa4e7;background-color:#fff}.btn-warning{color:#fff;background-color:#dd5600;border-color:#dd5600}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#b44600;border-color:#a03e00}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#dd5600;border-color:#dd5600}.btn-warning .badge{color:#dd5600;background-color:#fff}.btn-danger{color:#fff;background-color:#c71c22;border-color:#c71c22}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#a3171c;border-color:#911419}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#c71c22;border-color:#c71c22}.btn-danger .badge{color:#c71c22;background-color:#fff}.btn-success{color:#fff;background-color:#73a839;border-color:#73a839}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#5e8a2f;border-color:#547a29}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#73a839;border-color:#73a839}.btn-success .badge{color:#73a839;background-color:#fff}.btn-info{color:#fff;background-color:#033c73;border-color:#033c73}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#02274b;border-color:#011d37}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#033c73;border-color:#033c73}.btn-info .badge{color:#033c73;background-color:#fff}.btn-link{font-weight:normal;color:#2fa4e7;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#157ab5;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg{padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:normal;line-height:1;-moz-osx-font-smoothing:grayscale}.glyphicon:empty{width:1em}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.428571429;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#fff;text-decoration:none;background-color:#2fa4e7}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#2fa4e7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media(min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar .btn-group{float:left}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn{padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-bottom-left-radius:4px;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;border-collapse:separate;table-layout:fixed}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}[data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*="col-"]{float:none;padding-right:0;padding-left:0}.input-group .form-control{width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:54px;padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:54px;line-height:54px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:8px 12px;font-size:14px;font-weight:normal;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:14px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;white-space:nowrap}.input-group-btn:first-child>.btn{margin-right:-1px}.input-group-btn:last-child>.btn{margin-left:-1px}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-4px}.input-group-btn>.btn:hover,.input-group-btn>.btn:active{z-index:2}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#2fa4e7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.428571429;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#2fa4e7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}@media(min-width:768px){.navbar{border-radius:4px}}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}@media(min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;padding-right:15px;padding-left:15px;overflow-x:visible;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse.in{overflow-y:auto}@media(min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.container>.navbar-header,.container>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media(min-width:768px){.container>.navbar-header,.container>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media(min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media(min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media(min-width:768px){.navbar>.container .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media(min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media(max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media(min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media(min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:6px;margin-right:-15px;margin-bottom:6px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}@media(min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block}.navbar-form select.form-control{width:auto}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{float:none;margin-left:0}}@media(max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media(min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-nav.pull-right>li>.dropdown-menu,.navbar-nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar-btn{margin-top:6px;margin-bottom:6px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media(min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#2fa4e7;border-color:#1995dc}.navbar-default .navbar-brand{color:#fff}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#fff;background-color:none}.navbar-default .navbar-text{color:#ddd}.navbar-default .navbar-nav>li>a{color:#fff}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#fff;background-color:#178acc}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;background-color:#178acc}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ddd;background-color:transparent}.navbar-default .navbar-toggle{border-color:#178acc}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#178acc}.navbar-default .navbar-toggle .icon-bar{background-color:#fff}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#1995dc}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#fff;background-color:#178acc}@media(max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#fff}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:#178acc}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#178acc}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ddd;background-color:transparent}}.navbar-default .navbar-link{color:#fff}.navbar-default .navbar-link:hover{color:#fff}.navbar-inverse{background-color:#033c73;border-color:#022f5a}.navbar-inverse .navbar-brand{color:#fff}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:none}.navbar-inverse .navbar-text{color:#fff}.navbar-inverse .navbar-nav>li>a{color:#fff}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:#022f5a}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#022f5a}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#022f5a}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#022f5a}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#022a50}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#022f5a}@media(max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#022f5a}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#022f5a}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#fff}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:#022f5a}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#022f5a}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-inverse .navbar-link{color:#fff}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:8px 12px;margin-left:-1px;line-height:1.428571429;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#eee}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#999;cursor:default;background-color:#f5f5f5;border-color:#f5f5f5}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:14px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:#808080}.label-primary{background-color:#2fa4e7}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#178acc}.label-success{background-color:#73a839}.label-success[href]:hover,.label-success[href]:focus{background-color:#59822c}.label-info{background-color:#033c73}.label-info[href]:hover,.label-info[href]:focus{background-color:#022241}.label-warning{background-color:#dd5600}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#aa4200}.label-danger{background-color:#c71c22}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#9a161a}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#999;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#2fa4e7;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;font-size:21px;font-weight:200;line-height:2.1428571435;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{line-height:1;color:inherit}.jumbotron p{line-height:1.4}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{display:block;height:auto;max-width:100%;margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#2fa4e7}.thumbnail .caption{padding:9px;color:#555}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#356635}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#2d6987}.alert-warning{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.alert-warning hr{border-top-color:#f8e5be}.alert-warning .alert-link{color:#a47e3c}.alert-danger{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-danger hr{border-top-color:#e6c1c7}.alert-danger .alert-link{color:#953b39}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#2fa4e7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#73a839}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#033c73}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#dd5600}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#c71c22}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#2fa4e7;border-color:#2fa4e7}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e6f4fc}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0}.panel>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.list-group .list-group-item:last-child{border-bottom:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child th,.panel>.table>tbody:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:last-child>th,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:last-child>td,.panel>.table-responsive>.table-bordered>thead>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-group .panel{margin-bottom:0;overflow:hidden;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#555;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#ddd}.panel-primary>.panel-heading{color:#fff;background-color:#2fa4e7;border-color:#ddd}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-success{border-color:#ddd}.panel-success>.panel-heading{color:#468847;background-color:#73a839;border-color:#ddd}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-warning{border-color:#ddd}.panel-warning>.panel-heading{color:#c09853;background-color:#dd5600;border-color:#ddd}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-danger{border-color:#ddd}.panel-danger>.panel-heading{color:#b94a48;background-color:#c71c22;border-color:#ddd}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-info{border-color:#ddd}.panel-info>.panel-heading{color:#3a87ad;background-color:#033c73;border-color:#ddd}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:bold;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:auto;overflow-y:scroll}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;z-index:1050;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{min-height:16.428571429px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.428571429}.modal-body{position:relative;padding:20px}.modal-footer{padding:19px 20px 20px;margin-top:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media screen and (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}}.tooltip{position:absolute;z-index:1030;display:block;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:rgba(0,0,0,0.9);border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:rgba(0,0,0,0.9);border-width:5px 5px 0}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-top-color:rgba(0,0,0,0.9);border-width:5px 5px 0}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-top-color:rgba(0,0,0,0.9);border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:rgba(0,0,0,0.9);border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:rgba(0,0,0,0.9);border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:rgba(0,0,0,0.9);border-width:0 5px 5px}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-bottom-color:rgba(0,0,0,0.9);border-width:0 5px 5px}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-bottom-color:rgba(0,0,0,0.9);border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0;content:" "}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0;content:" "}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0;content:" "}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0;content:" "}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;height:auto;max-width:100%;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6);opacity:.5;filter:alpha(opacity=50)}.carousel-control.left{background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.5) 0),color-stop(rgba(0,0,0,0.0001) 100%));background-image:linear-gradient(to right,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000',endColorstr='#00000000',GradientType=1)}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.0001) 0),color-stop(rgba(0,0,0,0.5) 100%));background-image:linear-gradient(to right,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000',endColorstr='#80000000',GradientType=1)}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;outline:0;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicons-chevron-left,.carousel-control .glyphicons-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,tr.visible-xs,th.visible-xs,td.visible-xs{display:none!important}@media(max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block!important}table.visible-xs.visible-sm{display:table}tr.visible-xs.visible-sm{display:table-row!important}th.visible-xs.visible-sm,td.visible-xs.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-xs.visible-md{display:block!important}table.visible-xs.visible-md{display:table}tr.visible-xs.visible-md{display:table-row!important}th.visible-xs.visible-md,td.visible-xs.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-xs.visible-lg{display:block!important}table.visible-xs.visible-lg{display:table}tr.visible-xs.visible-lg{display:table-row!important}th.visible-xs.visible-lg,td.visible-xs.visible-lg{display:table-cell!important}}.visible-sm,tr.visible-sm,th.visible-sm,td.visible-sm{display:none!important}@media(max-width:767px){.visible-sm.visible-xs{display:block!important}table.visible-sm.visible-xs{display:table}tr.visible-sm.visible-xs{display:table-row!important}th.visible-sm.visible-xs,td.visible-sm.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-sm.visible-md{display:block!important}table.visible-sm.visible-md{display:table}tr.visible-sm.visible-md{display:table-row!important}th.visible-sm.visible-md,td.visible-sm.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-sm.visible-lg{display:block!important}table.visible-sm.visible-lg{display:table}tr.visible-sm.visible-lg{display:table-row!important}th.visible-sm.visible-lg,td.visible-sm.visible-lg{display:table-cell!important}}.visible-md,tr.visible-md,th.visible-md,td.visible-md{display:none!important}@media(max-width:767px){.visible-md.visible-xs{display:block!important}table.visible-md.visible-xs{display:table}tr.visible-md.visible-xs{display:table-row!important}th.visible-md.visible-xs,td.visible-md.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block!important}table.visible-md.visible-sm{display:table}tr.visible-md.visible-sm{display:table-row!important}th.visible-md.visible-sm,td.visible-md.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-md.visible-lg{display:block!important}table.visible-md.visible-lg{display:table}tr.visible-md.visible-lg{display:table-row!important}th.visible-md.visible-lg,td.visible-md.visible-lg{display:table-cell!important}}.visible-lg,tr.visible-lg,th.visible-lg,td.visible-lg{display:none!important}@media(max-width:767px){.visible-lg.visible-xs{display:block!important}table.visible-lg.visible-xs{display:table}tr.visible-lg.visible-xs{display:table-row!important}th.visible-lg.visible-xs,td.visible-lg.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block!important}table.visible-lg.visible-sm{display:table}tr.visible-lg.visible-sm{display:table-row!important}th.visible-lg.visible-sm,td.visible-lg.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-lg.visible-md{display:block!important}table.visible-lg.visible-md{display:table}tr.visible-lg.visible-md{display:table-row!important}th.visible-lg.visible-md,td.visible-lg.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}.hidden-xs{display:block!important}table.hidden-xs{display:table}tr.hidden-xs{display:table-row!important}th.hidden-xs,td.hidden-xs{display:table-cell!important}@media(max-width:767px){.hidden-xs,tr.hidden-xs,th.hidden-xs,td.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm,tr.hidden-xs.hidden-sm,th.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-xs.hidden-md,tr.hidden-xs.hidden-md,th.hidden-xs.hidden-md,td.hidden-xs.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-xs.hidden-lg,tr.hidden-xs.hidden-lg,th.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg{display:none!important}}.hidden-sm{display:block!important}table.hidden-sm{display:table}tr.hidden-sm{display:table-row!important}th.hidden-sm,td.hidden-sm{display:table-cell!important}@media(max-width:767px){.hidden-sm.hidden-xs,tr.hidden-sm.hidden-xs,th.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-sm,tr.hidden-sm,th.hidden-sm,td.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-sm.hidden-md,tr.hidden-sm.hidden-md,th.hidden-sm.hidden-md,td.hidden-sm.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-sm.hidden-lg,tr.hidden-sm.hidden-lg,th.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg{display:none!important}}.hidden-md{display:block!important}table.hidden-md{display:table}tr.hidden-md{display:table-row!important}th.hidden-md,td.hidden-md{display:table-cell!important}@media(max-width:767px){.hidden-md.hidden-xs,tr.hidden-md.hidden-xs,th.hidden-md.hidden-xs,td.hidden-md.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-md.hidden-sm,tr.hidden-md.hidden-sm,th.hidden-md.hidden-sm,td.hidden-md.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-md,tr.hidden-md,th.hidden-md,td.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-md.hidden-lg,tr.hidden-md.hidden-lg,th.hidden-md.hidden-lg,td.hidden-md.hidden-lg{display:none!important}}.hidden-lg{display:block!important}table.hidden-lg{display:table}tr.hidden-lg{display:table-row!important}th.hidden-lg,td.hidden-lg{display:table-cell!important}@media(max-width:767px){.hidden-lg.hidden-xs,tr.hidden-lg.hidden-xs,th.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm,tr.hidden-lg.hidden-sm,th.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-lg.hidden-md,tr.hidden-lg.hidden-md,th.hidden-lg.hidden-md,td.hidden-lg.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-lg,tr.hidden-lg,th.hidden-lg,td.hidden-lg{display:none!important}}.visible-print,tr.visible-print,th.visible-print,td.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}.hidden-print,tr.hidden-print,th.hidden-print,td.hidden-print{display:none!important}}.navbar{background-image:-webkit-linear-gradient(#54b4eb,#2fa4e7 60%,#1d9ce5);background-image:linear-gradient(#54b4eb,#2fa4e7 60%,#1d9ce5);background-repeat:no-repeat;border-bottom:1px solid #178acc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff54b4eb',endColorstr='#ff1d9ce5',GradientType=0);filter:none;-webkit-box-shadow:0 1px 10px rgba(0,0,0,0.1);box-shadow:0 1px 10px rgba(0,0,0,0.1)}.navbar .navbar-nav>li>a,.navbar-brand{text-shadow:0 1px 0 rgba(0,0,0,0.1)}.navbar-inverse{background-image:-webkit-linear-gradient(#04519b,#044687 60%,#033769);background-image:linear-gradient(#04519b,#044687 60%,#033769);background-repeat:no-repeat;border-bottom:1px solid #022241;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff04519b',endColorstr='#ff033769',GradientType=0);filter:none}.btn{text-shadow:0 1px 0 rgba(0,0,0,0.1)}.btn .caret{border-top-color:#fff}.btn-default{background-image:-webkit-linear-gradient(#fff,#fff 60%,#f5f5f5);background-image:linear-gradient(#fff,#fff 60%,#f5f5f5);background-repeat:no-repeat;border-bottom:1px solid #e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff5f5f5',GradientType=0);filter:none}.btn-default:hover{color:#555}.btn-default .caret{border-top-color:#555}.btn-default{background-image:-webkit-linear-gradient(#fff,#fff 60%,#f5f5f5);background-image:linear-gradient(#fff,#fff 60%,#f5f5f5);background-repeat:no-repeat;border-bottom:1px solid #e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff5f5f5',GradientType=0);filter:none}.btn-primary{background-image:-webkit-linear-gradient(#54b4eb,#2fa4e7 60%,#1d9ce5);background-image:linear-gradient(#54b4eb,#2fa4e7 60%,#1d9ce5);background-repeat:no-repeat;border-bottom:1px solid #178acc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff54b4eb',endColorstr='#ff1d9ce5',GradientType=0);filter:none}.btn-success{background-image:-webkit-linear-gradient(#88c149,#73a839 60%,#699934);background-image:linear-gradient(#88c149,#73a839 60%,#699934);background-repeat:no-repeat;border-bottom:1px solid #59822c;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff88c149',endColorstr='#ff699934',GradientType=0);filter:none}.btn-info{background-image:-webkit-linear-gradient(#04519b,#033c73 60%,#02325f);background-image:linear-gradient(#04519b,#033c73 60%,#02325f);background-repeat:no-repeat;border-bottom:1px solid #022241;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff04519b',endColorstr='#ff02325f',GradientType=0);filter:none}.btn-warning{background-image:-webkit-linear-gradient(#ff6707,#dd5600 60%,#c94e00);background-image:linear-gradient(#ff6707,#dd5600 60%,#c94e00);background-repeat:no-repeat;border-bottom:1px solid #aa4200;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff6707',endColorstr='#ffc94e00',GradientType=0);filter:none}.btn-danger{background-image:-webkit-linear-gradient(#e12b31,#c71c22 60%,#b5191f);background-image:linear-gradient(#e12b31,#c71c22 60%,#b5191f);background-repeat:no-repeat;border-bottom:1px solid #9a161a;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe12b31',endColorstr='#ffb5191f',GradientType=0);filter:none}.pagination .active>a,.pagination .active>a:hover{border-color:#ddd}.panel-primary .panel-heading,.panel-success .panel-heading,.panel-warning .panel-heading,.panel-danger .panel-heading,.panel-info .panel-heading,.panel-primary .panel-title,.panel-success .panel-title,.panel-warning .panel-title,.panel-danger .panel-title,.panel-info .panel-title{color:#fff}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed} \ No newline at end of file diff --git a/mkdocs/themes/mkdocs/css/bootstrap.min.css b/mkdocs/themes/mkdocs/css/bootstrap.min.css new file mode 100644 index 0000000000..4ce503d7fd --- /dev/null +++ b/mkdocs/themes/mkdocs/css/bootstrap.min.css @@ -0,0 +1,12 @@ +/*! + * Bootswatch v4.1.3 + * Homepage: https://bootswatch.com + * Copyright 2012-2018 Thomas Park + * Licensed under MIT + * Based on Bootstrap +*//*! + * Bootstrap v4.1.3 (https://getbootstrap.com/) + * Copyright 2011-2018 The Bootstrap Authors + * Copyright 2011-2018 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */:root{--blue:#033C73;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#C71C22;--orange:#fd7e14;--yellow:#DD5600;--green:#73A839;--teal:#20c997;--cyan:#2FA4E7;--white:#fff;--gray:#868e96;--gray-dark:#343a40;--primary:#2FA4E7;--secondary:#e9ecef;--success:#73A839;--info:#033C73;--warning:#DD5600;--danger:#C71C22;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-family-monospace:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}*,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0 !important}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:0.5rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-original-title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#2FA4E7;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#157ab5;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):hover,a:not([href]):not([tabindex]):focus{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}pre,code,kbd,samp{font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:0.75rem;padding-bottom:0.75rem;color:#868e96;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:0.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{padding:0;border-style:none}input[type="radio"],input[type="checkbox"]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}input[type="date"],input[type="time"],input[type="datetime-local"],input[type="month"]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{outline-offset:-2px;-webkit-appearance:none}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none !important}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{margin-bottom:0.5rem;font-family:inherit;font-weight:500;line-height:1.2;color:#2FA4E7}h1,.h1{font-size:2.5rem}h2,.h2{font-size:2rem}h3,.h3{font-size:1.75rem}h4,.h4{font-size:1.5rem}h5,.h5{font-size:1.25rem}h6,.h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,0.1)}small,.small{font-size:80%;font-weight:400}mark,.mark{padding:0.2em;background-color:#fcf8e3}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:0.5rem}.initialism{font-size:90%;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote-footer{display:block;font-size:80%;color:#868e96}.blockquote-footer::before{content:"\2014 \00A0"}.img-fluid{max-width:100%;height:auto}.img-thumbnail{padding:0.25rem;background-color:#fff;border:1px solid #dee2e6;border-radius:0.25rem;max-width:100%;height:auto}.figure{display:inline-block}.figure-img{margin-bottom:0.5rem;line-height:1}.figure-caption{font-size:90%;color:#868e96}code{font-size:87.5%;color:#e83e8c;word-break:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:87.5%;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:100%;font-weight:700}pre{display:block;font-size:87.5%;color:#212529}pre code{font-size:inherit;color:inherit;word-break:normal}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width: 576px){.container{max-width:540px}}@media (min-width: 768px){.container{max-width:720px}}@media (min-width: 992px){.container{max-width:960px}}@media (min-width: 1200px){.container{max-width:1140px}}.container-fluid{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*="col-"]{padding-right:0;padding-left:0}.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12,.col,.col-auto,.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm,.col-sm-auto,.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12,.col-md,.col-md-auto,.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg,.col-lg-auto,.col-xl-1,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl,.col-xl-auto{position:relative;width:100%;min-height:1px;padding-right:15px;padding-left:15px}.col{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-1{-webkit-box-flex:0;-ms-flex:0 0 8.3333333333%;flex:0 0 8.3333333333%;max-width:8.3333333333%}.col-2{-webkit-box-flex:0;-ms-flex:0 0 16.6666666667%;flex:0 0 16.6666666667%;max-width:16.6666666667%}.col-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-4{-webkit-box-flex:0;-ms-flex:0 0 33.3333333333%;flex:0 0 33.3333333333%;max-width:33.3333333333%}.col-5{-webkit-box-flex:0;-ms-flex:0 0 41.6666666667%;flex:0 0 41.6666666667%;max-width:41.6666666667%}.col-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-7{-webkit-box-flex:0;-ms-flex:0 0 58.3333333333%;flex:0 0 58.3333333333%;max-width:58.3333333333%}.col-8{-webkit-box-flex:0;-ms-flex:0 0 66.6666666667%;flex:0 0 66.6666666667%;max-width:66.6666666667%}.col-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-10{-webkit-box-flex:0;-ms-flex:0 0 83.3333333333%;flex:0 0 83.3333333333%;max-width:83.3333333333%}.col-11{-webkit-box-flex:0;-ms-flex:0 0 91.6666666667%;flex:0 0 91.6666666667%;max-width:91.6666666667%}.col-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-1{margin-left:8.3333333333%}.offset-2{margin-left:16.6666666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.3333333333%}.offset-5{margin-left:41.6666666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.3333333333%}.offset-8{margin-left:66.6666666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.3333333333%}.offset-11{margin-left:91.6666666667%}@media (min-width: 576px){.col-sm{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-sm-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-sm-1{-webkit-box-flex:0;-ms-flex:0 0 8.3333333333%;flex:0 0 8.3333333333%;max-width:8.3333333333%}.col-sm-2{-webkit-box-flex:0;-ms-flex:0 0 16.6666666667%;flex:0 0 16.6666666667%;max-width:16.6666666667%}.col-sm-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-sm-4{-webkit-box-flex:0;-ms-flex:0 0 33.3333333333%;flex:0 0 33.3333333333%;max-width:33.3333333333%}.col-sm-5{-webkit-box-flex:0;-ms-flex:0 0 41.6666666667%;flex:0 0 41.6666666667%;max-width:41.6666666667%}.col-sm-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-sm-7{-webkit-box-flex:0;-ms-flex:0 0 58.3333333333%;flex:0 0 58.3333333333%;max-width:58.3333333333%}.col-sm-8{-webkit-box-flex:0;-ms-flex:0 0 66.6666666667%;flex:0 0 66.6666666667%;max-width:66.6666666667%}.col-sm-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-sm-10{-webkit-box-flex:0;-ms-flex:0 0 83.3333333333%;flex:0 0 83.3333333333%;max-width:83.3333333333%}.col-sm-11{-webkit-box-flex:0;-ms-flex:0 0 91.6666666667%;flex:0 0 91.6666666667%;max-width:91.6666666667%}.col-sm-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-sm-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-sm-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-sm-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-sm-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-sm-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-sm-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-sm-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-sm-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-sm-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-sm-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-sm-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-sm-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-sm-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-sm-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-sm-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.3333333333%}.offset-sm-2{margin-left:16.6666666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.3333333333%}.offset-sm-5{margin-left:41.6666666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.3333333333%}.offset-sm-8{margin-left:66.6666666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.3333333333%}.offset-sm-11{margin-left:91.6666666667%}}@media (min-width: 768px){.col-md{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-md-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-md-1{-webkit-box-flex:0;-ms-flex:0 0 8.3333333333%;flex:0 0 8.3333333333%;max-width:8.3333333333%}.col-md-2{-webkit-box-flex:0;-ms-flex:0 0 16.6666666667%;flex:0 0 16.6666666667%;max-width:16.6666666667%}.col-md-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-md-4{-webkit-box-flex:0;-ms-flex:0 0 33.3333333333%;flex:0 0 33.3333333333%;max-width:33.3333333333%}.col-md-5{-webkit-box-flex:0;-ms-flex:0 0 41.6666666667%;flex:0 0 41.6666666667%;max-width:41.6666666667%}.col-md-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-md-7{-webkit-box-flex:0;-ms-flex:0 0 58.3333333333%;flex:0 0 58.3333333333%;max-width:58.3333333333%}.col-md-8{-webkit-box-flex:0;-ms-flex:0 0 66.6666666667%;flex:0 0 66.6666666667%;max-width:66.6666666667%}.col-md-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-md-10{-webkit-box-flex:0;-ms-flex:0 0 83.3333333333%;flex:0 0 83.3333333333%;max-width:83.3333333333%}.col-md-11{-webkit-box-flex:0;-ms-flex:0 0 91.6666666667%;flex:0 0 91.6666666667%;max-width:91.6666666667%}.col-md-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-md-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-md-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-md-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-md-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-md-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-md-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-md-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-md-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-md-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-md-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-md-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-md-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-md-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-md-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-md-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.3333333333%}.offset-md-2{margin-left:16.6666666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.3333333333%}.offset-md-5{margin-left:41.6666666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.3333333333%}.offset-md-8{margin-left:66.6666666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.3333333333%}.offset-md-11{margin-left:91.6666666667%}}@media (min-width: 992px){.col-lg{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-lg-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-lg-1{-webkit-box-flex:0;-ms-flex:0 0 8.3333333333%;flex:0 0 8.3333333333%;max-width:8.3333333333%}.col-lg-2{-webkit-box-flex:0;-ms-flex:0 0 16.6666666667%;flex:0 0 16.6666666667%;max-width:16.6666666667%}.col-lg-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-lg-4{-webkit-box-flex:0;-ms-flex:0 0 33.3333333333%;flex:0 0 33.3333333333%;max-width:33.3333333333%}.col-lg-5{-webkit-box-flex:0;-ms-flex:0 0 41.6666666667%;flex:0 0 41.6666666667%;max-width:41.6666666667%}.col-lg-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-lg-7{-webkit-box-flex:0;-ms-flex:0 0 58.3333333333%;flex:0 0 58.3333333333%;max-width:58.3333333333%}.col-lg-8{-webkit-box-flex:0;-ms-flex:0 0 66.6666666667%;flex:0 0 66.6666666667%;max-width:66.6666666667%}.col-lg-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-lg-10{-webkit-box-flex:0;-ms-flex:0 0 83.3333333333%;flex:0 0 83.3333333333%;max-width:83.3333333333%}.col-lg-11{-webkit-box-flex:0;-ms-flex:0 0 91.6666666667%;flex:0 0 91.6666666667%;max-width:91.6666666667%}.col-lg-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-lg-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-lg-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-lg-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-lg-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-lg-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-lg-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-lg-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-lg-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-lg-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-lg-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-lg-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-lg-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-lg-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-lg-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-lg-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.3333333333%}.offset-lg-2{margin-left:16.6666666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.3333333333%}.offset-lg-5{margin-left:41.6666666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.3333333333%}.offset-lg-8{margin-left:66.6666666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.3333333333%}.offset-lg-11{margin-left:91.6666666667%}}@media (min-width: 1200px){.col-xl{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-xl-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-xl-1{-webkit-box-flex:0;-ms-flex:0 0 8.3333333333%;flex:0 0 8.3333333333%;max-width:8.3333333333%}.col-xl-2{-webkit-box-flex:0;-ms-flex:0 0 16.6666666667%;flex:0 0 16.6666666667%;max-width:16.6666666667%}.col-xl-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-xl-4{-webkit-box-flex:0;-ms-flex:0 0 33.3333333333%;flex:0 0 33.3333333333%;max-width:33.3333333333%}.col-xl-5{-webkit-box-flex:0;-ms-flex:0 0 41.6666666667%;flex:0 0 41.6666666667%;max-width:41.6666666667%}.col-xl-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-xl-7{-webkit-box-flex:0;-ms-flex:0 0 58.3333333333%;flex:0 0 58.3333333333%;max-width:58.3333333333%}.col-xl-8{-webkit-box-flex:0;-ms-flex:0 0 66.6666666667%;flex:0 0 66.6666666667%;max-width:66.6666666667%}.col-xl-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-xl-10{-webkit-box-flex:0;-ms-flex:0 0 83.3333333333%;flex:0 0 83.3333333333%;max-width:83.3333333333%}.col-xl-11{-webkit-box-flex:0;-ms-flex:0 0 91.6666666667%;flex:0 0 91.6666666667%;max-width:91.6666666667%}.col-xl-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-xl-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-xl-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-xl-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-xl-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-xl-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-xl-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-xl-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-xl-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-xl-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-xl-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-xl-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-xl-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-xl-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-xl-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-xl-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.3333333333%}.offset-xl-2{margin-left:16.6666666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.3333333333%}.offset-xl-5{margin-left:41.6666666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.3333333333%}.offset-xl-8{margin-left:66.6666666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.3333333333%}.offset-xl-11{margin-left:91.6666666667%}}.table{width:100%;margin-bottom:1rem;background-color:transparent}.table th,.table td{padding:0.75rem;vertical-align:top;border-top:1px solid #dee2e6}.table thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6}.table tbody+tbody{border-top:2px solid #dee2e6}.table .table{background-color:#fff}.table-sm th,.table-sm td{padding:0.3rem}.table-bordered{border:1px solid #dee2e6}.table-bordered th,.table-bordered td{border:1px solid #dee2e6}.table-bordered thead th,.table-bordered thead td{border-bottom-width:2px}.table-borderless th,.table-borderless td,.table-borderless thead th,.table-borderless tbody+tbody{border:0}.table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,0.05)}.table-hover tbody tr:hover{background-color:rgba(0,0,0,0.075)}.table-primary,.table-primary>th,.table-primary>td{background-color:#c5e6f8}.table-hover .table-primary:hover{background-color:#aedcf5}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#aedcf5}.table-secondary,.table-secondary>th,.table-secondary>td{background-color:#f9fafb}.table-hover .table-secondary:hover{background-color:#eaedf1}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#eaedf1}.table-success,.table-success>th,.table-success>td{background-color:#d8e7c8}.table-hover .table-success:hover{background-color:#cbdfb6}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#cbdfb6}.table-info,.table-info>th,.table-info>td{background-color:#b8c8d8}.table-hover .table-info:hover{background-color:#a8bbcf}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#a8bbcf}.table-warning,.table-warning>th,.table-warning>td{background-color:#f5d0b8}.table-hover .table-warning:hover{background-color:#f2c1a2}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#f2c1a2}.table-danger,.table-danger>th,.table-danger>td{background-color:#efbfc1}.table-hover .table-danger:hover{background-color:#eaabad}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#eaabad}.table-light,.table-light>th,.table-light>td{background-color:#fdfdfe}.table-hover .table-light:hover{background-color:#ececf6}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#ececf6}.table-dark,.table-dark>th,.table-dark>td{background-color:#c6c8ca}.table-hover .table-dark:hover{background-color:#b9bbbe}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b9bbbe}.table-active,.table-active>th,.table-active>td{background-color:rgba(0,0,0,0.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,0.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,0.075)}.table .thead-dark th{color:#fff;background-color:#212529;border-color:#32383e}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#212529}.table-dark th,.table-dark td,.table-dark thead th{border-color:#32383e}.table-dark.table-bordered{border:0}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,0.05)}.table-dark.table-hover tbody tr:hover{background-color:rgba(255,255,255,0.075)}@media (max-width: 575.98px){.table-responsive-sm{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-sm>.table-bordered{border:0}}@media (max-width: 767.98px){.table-responsive-md{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-md>.table-bordered{border:0}}@media (max-width: 991.98px){.table-responsive-lg{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-lg>.table-bordered{border:0}}@media (max-width: 1199.98px){.table-responsive-xl{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-xl>.table-bordered{border:0}}.table-responsive{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive>.table-bordered{border:0}.form-control{display:block;width:100%;height:calc(2.25rem + 2px);padding:0.375rem 0.75rem;font-size:1rem;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:0.25rem;-webkit-transition:border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out}@media screen and (prefers-reduced-motion: reduce){.form-control{-webkit-transition:none;transition:none}}.form-control::-ms-expand{background-color:transparent;border:0}.form-control:focus{color:#495057;background-color:#fff;border-color:#a1d6f4;outline:0;-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25)}.form-control::-webkit-input-placeholder{color:#868e96;opacity:1}.form-control:-ms-input-placeholder{color:#868e96;opacity:1}.form-control::-ms-input-placeholder{color:#868e96;opacity:1}.form-control::placeholder{color:#868e96;opacity:1}.form-control:disabled,.form-control[readonly]{background-color:#e9ecef;opacity:1}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}.form-control-file,.form-control-range{display:block;width:100%}.col-form-label{padding-top:calc(0.375rem + 1px);padding-bottom:calc(0.375rem + 1px);margin-bottom:0;font-size:inherit;line-height:1.5}.col-form-label-lg{padding-top:calc(0.5rem + 1px);padding-bottom:calc(0.5rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(0.25rem + 1px);padding-bottom:calc(0.25rem + 1px);font-size:0.875rem;line-height:1.5}.form-control-plaintext{display:block;width:100%;padding-top:0.375rem;padding-bottom:0.375rem;margin-bottom:0;line-height:1.5;color:#495057;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext.form-control-sm,.form-control-plaintext.form-control-lg{padding-right:0;padding-left:0}.form-control-sm{height:calc(1.8125rem + 2px);padding:0.25rem 0.5rem;font-size:0.875rem;line-height:1.5;border-radius:0.2rem}.form-control-lg{height:calc(2.875rem + 2px);padding:0.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:0.3rem}select.form-control[size],select.form-control[multiple]{height:auto}textarea.form-control{height:auto}.form-group{margin-bottom:1rem}.form-text{display:block;margin-top:0.25rem}.form-row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.form-row>.col,.form-row>[class*="col-"]{padding-right:5px;padding-left:5px}.form-check{position:relative;display:block;padding-left:1.25rem}.form-check-input{position:absolute;margin-top:0.3rem;margin-left:-1.25rem}.form-check-input:disabled ~ .form-check-label{color:#868e96}.form-check-label{margin-bottom:0}.form-check-inline{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:0;margin-right:0.75rem}.form-check-inline .form-check-input{position:static;margin-top:0;margin-right:0.3125rem;margin-left:0}.valid-feedback{display:none;width:100%;margin-top:0.25rem;font-size:80%;color:#73A839}.valid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:0.25rem 0.5rem;margin-top:.1rem;font-size:0.875rem;line-height:1.5;color:#fff;background-color:rgba(115,168,57,0.9);border-radius:0.25rem}.was-validated .form-control:valid,.form-control.is-valid,.was-validated .custom-select:valid,.custom-select.is-valid{border-color:#73A839}.was-validated .form-control:valid:focus,.form-control.is-valid:focus,.was-validated .custom-select:valid:focus,.custom-select.is-valid:focus{border-color:#73A839;-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.25);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.25)}.was-validated .form-control:valid ~ .valid-feedback,.was-validated .form-control:valid ~ .valid-tooltip,.form-control.is-valid ~ .valid-feedback,.form-control.is-valid ~ .valid-tooltip,.was-validated .custom-select:valid ~ .valid-feedback,.was-validated .custom-select:valid ~ .valid-tooltip,.custom-select.is-valid ~ .valid-feedback,.custom-select.is-valid ~ .valid-tooltip{display:block}.was-validated .form-control-file:valid ~ .valid-feedback,.was-validated .form-control-file:valid ~ .valid-tooltip,.form-control-file.is-valid ~ .valid-feedback,.form-control-file.is-valid ~ .valid-tooltip{display:block}.was-validated .form-check-input:valid ~ .form-check-label,.form-check-input.is-valid ~ .form-check-label{color:#73A839}.was-validated .form-check-input:valid ~ .valid-feedback,.was-validated .form-check-input:valid ~ .valid-tooltip,.form-check-input.is-valid ~ .valid-feedback,.form-check-input.is-valid ~ .valid-tooltip{display:block}.was-validated .custom-control-input:valid ~ .custom-control-label,.custom-control-input.is-valid ~ .custom-control-label{color:#73A839}.was-validated .custom-control-input:valid ~ .custom-control-label::before,.custom-control-input.is-valid ~ .custom-control-label::before{background-color:#b2d789}.was-validated .custom-control-input:valid ~ .valid-feedback,.was-validated .custom-control-input:valid ~ .valid-tooltip,.custom-control-input.is-valid ~ .valid-feedback,.custom-control-input.is-valid ~ .valid-tooltip{display:block}.was-validated .custom-control-input:valid:checked ~ .custom-control-label::before,.custom-control-input.is-valid:checked ~ .custom-control-label::before{background-color:#8dc450}.was-validated .custom-control-input:valid:focus ~ .custom-control-label::before,.custom-control-input.is-valid:focus ~ .custom-control-label::before{-webkit-box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(115,168,57,0.25);box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(115,168,57,0.25)}.was-validated .custom-file-input:valid ~ .custom-file-label,.custom-file-input.is-valid ~ .custom-file-label{border-color:#73A839}.was-validated .custom-file-input:valid ~ .custom-file-label::after,.custom-file-input.is-valid ~ .custom-file-label::after{border-color:inherit}.was-validated .custom-file-input:valid ~ .valid-feedback,.was-validated .custom-file-input:valid ~ .valid-tooltip,.custom-file-input.is-valid ~ .valid-feedback,.custom-file-input.is-valid ~ .valid-tooltip{display:block}.was-validated .custom-file-input:valid:focus ~ .custom-file-label,.custom-file-input.is-valid:focus ~ .custom-file-label{-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.25);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.25)}.invalid-feedback{display:none;width:100%;margin-top:0.25rem;font-size:80%;color:#C71C22}.invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:0.25rem 0.5rem;margin-top:.1rem;font-size:0.875rem;line-height:1.5;color:#fff;background-color:rgba(199,28,34,0.9);border-radius:0.25rem}.was-validated .form-control:invalid,.form-control.is-invalid,.was-validated .custom-select:invalid,.custom-select.is-invalid{border-color:#C71C22}.was-validated .form-control:invalid:focus,.form-control.is-invalid:focus,.was-validated .custom-select:invalid:focus,.custom-select.is-invalid:focus{border-color:#C71C22;-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.25);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.25)}.was-validated .form-control:invalid ~ .invalid-feedback,.was-validated .form-control:invalid ~ .invalid-tooltip,.form-control.is-invalid ~ .invalid-feedback,.form-control.is-invalid ~ .invalid-tooltip,.was-validated .custom-select:invalid ~ .invalid-feedback,.was-validated .custom-select:invalid ~ .invalid-tooltip,.custom-select.is-invalid ~ .invalid-feedback,.custom-select.is-invalid ~ .invalid-tooltip{display:block}.was-validated .form-control-file:invalid ~ .invalid-feedback,.was-validated .form-control-file:invalid ~ .invalid-tooltip,.form-control-file.is-invalid ~ .invalid-feedback,.form-control-file.is-invalid ~ .invalid-tooltip{display:block}.was-validated .form-check-input:invalid ~ .form-check-label,.form-check-input.is-invalid ~ .form-check-label{color:#C71C22}.was-validated .form-check-input:invalid ~ .invalid-feedback,.was-validated .form-check-input:invalid ~ .invalid-tooltip,.form-check-input.is-invalid ~ .invalid-feedback,.form-check-input.is-invalid ~ .invalid-tooltip{display:block}.was-validated .custom-control-input:invalid ~ .custom-control-label,.custom-control-input.is-invalid ~ .custom-control-label{color:#C71C22}.was-validated .custom-control-input:invalid ~ .custom-control-label::before,.custom-control-input.is-invalid ~ .custom-control-label::before{background-color:#ec777b}.was-validated .custom-control-input:invalid ~ .invalid-feedback,.was-validated .custom-control-input:invalid ~ .invalid-tooltip,.custom-control-input.is-invalid ~ .invalid-feedback,.custom-control-input.is-invalid ~ .invalid-tooltip{display:block}.was-validated .custom-control-input:invalid:checked ~ .custom-control-label::before,.custom-control-input.is-invalid:checked ~ .custom-control-label::before{background-color:#e2343a}.was-validated .custom-control-input:invalid:focus ~ .custom-control-label::before,.custom-control-input.is-invalid:focus ~ .custom-control-label::before{-webkit-box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(199,28,34,0.25);box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(199,28,34,0.25)}.was-validated .custom-file-input:invalid ~ .custom-file-label,.custom-file-input.is-invalid ~ .custom-file-label{border-color:#C71C22}.was-validated .custom-file-input:invalid ~ .custom-file-label::after,.custom-file-input.is-invalid ~ .custom-file-label::after{border-color:inherit}.was-validated .custom-file-input:invalid ~ .invalid-feedback,.was-validated .custom-file-input:invalid ~ .invalid-tooltip,.custom-file-input.is-invalid ~ .invalid-feedback,.custom-file-input.is-invalid ~ .invalid-tooltip{display:block}.was-validated .custom-file-input:invalid:focus ~ .custom-file-label,.custom-file-input.is-invalid:focus ~ .custom-file-label{-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.25);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.25)}.form-inline{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.form-inline .form-check{width:100%}@media (min-width: 576px){.form-inline label{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-bottom:0}.form-inline .form-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:0}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-plaintext{display:inline-block}.form-inline .input-group,.form-inline .custom-select{width:auto}.form-inline .form-check{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:auto;padding-left:0}.form-inline .form-check-input{position:relative;margin-top:0;margin-right:0.25rem;margin-left:0}.form-inline .custom-control{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.form-inline .custom-control-label{margin-bottom:0}}.btn{display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:0.375rem 0.75rem;font-size:1rem;line-height:1.5;border-radius:0.25rem;-webkit-transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out}@media screen and (prefers-reduced-motion: reduce){.btn{-webkit-transition:none;transition:none}}.btn:hover,.btn:focus{text-decoration:none}.btn:focus,.btn.focus{outline:0;-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25)}.btn.disabled,.btn:disabled{opacity:0.65}.btn:not(:disabled):not(.disabled){cursor:pointer}a.btn.disabled,fieldset:disabled a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.btn-primary:hover{color:#fff;background-color:#1992d7;border-color:#178acc}.btn-primary:focus,.btn-primary.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.btn-primary:not(:disabled):not(.disabled):active,.btn-primary:not(:disabled):not(.disabled).active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#178acc;border-color:#1682c0}.btn-primary:not(:disabled):not(.disabled):active:focus,.btn-primary:not(:disabled):not(.disabled).active:focus,.show>.btn-primary.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5)}.btn-secondary{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-secondary:hover{color:#212529;background-color:#d3d9df;border-color:#cbd3da}.btn-secondary:focus,.btn-secondary.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5);box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5)}.btn-secondary.disabled,.btn-secondary:disabled{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-secondary:not(:disabled):not(.disabled):active,.btn-secondary:not(:disabled):not(.disabled).active,.show>.btn-secondary.dropdown-toggle{color:#212529;background-color:#cbd3da;border-color:#c4ccd4}.btn-secondary:not(:disabled):not(.disabled):active:focus,.btn-secondary:not(:disabled):not(.disabled).active:focus,.show>.btn-secondary.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5);box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5)}.btn-success{color:#fff;background-color:#73A839;border-color:#73A839}.btn-success:hover{color:#fff;background-color:#5f8b2f;border-color:#59822c}.btn-success:focus,.btn-success.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5)}.btn-success.disabled,.btn-success:disabled{color:#fff;background-color:#73A839;border-color:#73A839}.btn-success:not(:disabled):not(.disabled):active,.btn-success:not(:disabled):not(.disabled).active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#59822c;border-color:#527829}.btn-success:not(:disabled):not(.disabled):active:focus,.btn-success:not(:disabled):not(.disabled).active:focus,.show>.btn-success.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5)}.btn-info{color:#fff;background-color:#033C73;border-color:#033C73}.btn-info:hover{color:#fff;background-color:#02294e;border-color:#022241}.btn-info:focus,.btn-info.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5);box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5)}.btn-info.disabled,.btn-info:disabled{color:#fff;background-color:#033C73;border-color:#033C73}.btn-info:not(:disabled):not(.disabled):active,.btn-info:not(:disabled):not(.disabled).active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#022241;border-color:#011c35}.btn-info:not(:disabled):not(.disabled):active:focus,.btn-info:not(:disabled):not(.disabled).active:focus,.show>.btn-info.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5);box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5)}.btn-warning{color:#fff;background-color:#DD5600;border-color:#DD5600}.btn-warning:hover{color:#fff;background-color:#b74700;border-color:#aa4200}.btn-warning:focus,.btn-warning.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5);box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5)}.btn-warning.disabled,.btn-warning:disabled{color:#fff;background-color:#DD5600;border-color:#DD5600}.btn-warning:not(:disabled):not(.disabled):active,.btn-warning:not(:disabled):not(.disabled).active,.show>.btn-warning.dropdown-toggle{color:#fff;background-color:#aa4200;border-color:#9d3d00}.btn-warning:not(:disabled):not(.disabled):active:focus,.btn-warning:not(:disabled):not(.disabled).active:focus,.show>.btn-warning.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5);box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5)}.btn-danger{color:#fff;background-color:#C71C22;border-color:#C71C22}.btn-danger:hover{color:#fff;background-color:#a5171c;border-color:#9a161a}.btn-danger:focus,.btn-danger.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5)}.btn-danger.disabled,.btn-danger:disabled{color:#fff;background-color:#C71C22;border-color:#C71C22}.btn-danger:not(:disabled):not(.disabled):active,.btn-danger:not(:disabled):not(.disabled).active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#9a161a;border-color:#8f1418}.btn-danger:not(:disabled):not(.disabled):active:focus,.btn-danger:not(:disabled):not(.disabled).active:focus,.show>.btn-danger.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5)}.btn-light{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.btn-light:focus,.btn-light.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5);box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5)}.btn-light.disabled,.btn-light:disabled{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:not(:disabled):not(.disabled):active,.btn-light:not(:disabled):not(.disabled).active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dae0e5;border-color:#d3d9df}.btn-light:not(:disabled):not(.disabled):active:focus,.btn-light:not(:disabled):not(.disabled).active:focus,.show>.btn-light.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5);box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5)}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark:focus,.btn-dark.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5);box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5)}.btn-dark.disabled,.btn-dark:disabled{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:not(:disabled):not(.disabled):active,.btn-dark:not(:disabled):not(.disabled).active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#1d2124;border-color:#171a1d}.btn-dark:not(:disabled):not(.disabled):active:focus,.btn-dark:not(:disabled):not(.disabled).active:focus,.show>.btn-dark.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5);box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5)}.btn-outline-primary{color:#2FA4E7;background-color:transparent;background-image:none;border-color:#2FA4E7}.btn-outline-primary:hover{color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.btn-outline-primary:focus,.btn-outline-primary.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#2FA4E7;background-color:transparent}.btn-outline-primary:not(:disabled):not(.disabled):active,.btn-outline-primary:not(:disabled):not(.disabled).active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.5)}.btn-outline-secondary{color:#e9ecef;background-color:transparent;background-image:none;border-color:#e9ecef}.btn-outline-secondary:hover{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-outline-secondary:focus,.btn-outline-secondary.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5);box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#e9ecef;background-color:transparent}.btn-outline-secondary:not(:disabled):not(.disabled):active,.btn-outline-secondary:not(:disabled):not(.disabled).active,.show>.btn-outline-secondary.dropdown-toggle{color:#212529;background-color:#e9ecef;border-color:#e9ecef}.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5);box-shadow:0 0 0 0.2rem rgba(233,236,239,0.5)}.btn-outline-success{color:#73A839;background-color:transparent;background-image:none;border-color:#73A839}.btn-outline-success:hover{color:#fff;background-color:#73A839;border-color:#73A839}.btn-outline-success:focus,.btn-outline-success.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#73A839;background-color:transparent}.btn-outline-success:not(:disabled):not(.disabled):active,.btn-outline-success:not(:disabled):not(.disabled).active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#73A839;border-color:#73A839}.btn-outline-success:not(:disabled):not(.disabled):active:focus,.btn-outline-success:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-success.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5);box-shadow:0 0 0 0.2rem rgba(115,168,57,0.5)}.btn-outline-info{color:#033C73;background-color:transparent;background-image:none;border-color:#033C73}.btn-outline-info:hover{color:#fff;background-color:#033C73;border-color:#033C73}.btn-outline-info:focus,.btn-outline-info.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5);box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#033C73;background-color:transparent}.btn-outline-info:not(:disabled):not(.disabled):active,.btn-outline-info:not(:disabled):not(.disabled).active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#033C73;border-color:#033C73}.btn-outline-info:not(:disabled):not(.disabled):active:focus,.btn-outline-info:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-info.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5);box-shadow:0 0 0 0.2rem rgba(3,60,115,0.5)}.btn-outline-warning{color:#DD5600;background-color:transparent;background-image:none;border-color:#DD5600}.btn-outline-warning:hover{color:#fff;background-color:#DD5600;border-color:#DD5600}.btn-outline-warning:focus,.btn-outline-warning.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5);box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#DD5600;background-color:transparent}.btn-outline-warning:not(:disabled):not(.disabled):active,.btn-outline-warning:not(:disabled):not(.disabled).active,.show>.btn-outline-warning.dropdown-toggle{color:#fff;background-color:#DD5600;border-color:#DD5600}.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5);box-shadow:0 0 0 0.2rem rgba(221,86,0,0.5)}.btn-outline-danger{color:#C71C22;background-color:transparent;background-image:none;border-color:#C71C22}.btn-outline-danger:hover{color:#fff;background-color:#C71C22;border-color:#C71C22}.btn-outline-danger:focus,.btn-outline-danger.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#C71C22;background-color:transparent}.btn-outline-danger:not(:disabled):not(.disabled):active,.btn-outline-danger:not(:disabled):not(.disabled).active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#C71C22;border-color:#C71C22}.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5);box-shadow:0 0 0 0.2rem rgba(199,28,34,0.5)}.btn-outline-light{color:#f8f9fa;background-color:transparent;background-image:none;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:focus,.btn-outline-light.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5);box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not(:disabled):not(.disabled):active,.btn-outline-light:not(:disabled):not(.disabled).active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:not(:disabled):not(.disabled):active:focus,.btn-outline-light:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-light.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5);box-shadow:0 0 0 0.2rem rgba(248,249,250,0.5)}.btn-outline-dark{color:#343a40;background-color:transparent;background-image:none;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:focus,.btn-outline-dark.focus{-webkit-box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5);box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not(:disabled):not(.disabled):active,.btn-outline-dark:not(:disabled):not(.disabled).active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{-webkit-box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5);box-shadow:0 0 0 0.2rem rgba(52,58,64,0.5)}.btn-link{font-weight:400;color:#2FA4E7;background-color:transparent}.btn-link:hover{color:#157ab5;text-decoration:underline;background-color:transparent;border-color:transparent}.btn-link:focus,.btn-link.focus{text-decoration:underline;border-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link:disabled,.btn-link.disabled{color:#868e96;pointer-events:none}.btn-lg,.btn-group-lg>.btn{padding:0.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:0.3rem}.btn-sm,.btn-group-sm>.btn{padding:0.25rem 0.5rem;font-size:0.875rem;line-height:1.5;border-radius:0.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:0.5rem}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{-webkit-transition:opacity 0.15s linear;transition:opacity 0.15s linear}@media screen and (prefers-reduced-motion: reduce){.fade{-webkit-transition:none;transition:none}}.fade:not(.show){opacity:0}.collapse:not(.show){display:none}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;transition:height 0.35s ease}@media screen and (prefers-reduced-motion: reduce){.collapsing{-webkit-transition:none;transition:none}}.dropup,.dropright,.dropdown,.dropleft{position:relative}.dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:0.255em;vertical-align:0.255em;content:"";border-top:0.3em solid;border-right:0.3em solid transparent;border-bottom:0;border-left:0.3em solid transparent}.dropdown-toggle:empty::after{margin-left:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:0.5rem 0;margin:0.125rem 0 0;font-size:1rem;color:#495057;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,0.15);border-radius:0.25rem}.dropdown-menu-right{right:0;left:auto}.dropup .dropdown-menu{top:auto;bottom:100%;margin-top:0;margin-bottom:0.125rem}.dropup .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:0.255em;vertical-align:0.255em;content:"";border-top:0;border-right:0.3em solid transparent;border-bottom:0.3em solid;border-left:0.3em solid transparent}.dropup .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-menu{top:0;right:auto;left:100%;margin-top:0;margin-left:0.125rem}.dropright .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:0.255em;vertical-align:0.255em;content:"";border-top:0.3em solid transparent;border-right:0;border-bottom:0.3em solid transparent;border-left:0.3em solid}.dropright .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-toggle::after{vertical-align:0}.dropleft .dropdown-menu{top:0;right:100%;left:auto;margin-top:0;margin-right:0.125rem}.dropleft .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:0.255em;vertical-align:0.255em;content:""}.dropleft .dropdown-toggle::after{display:none}.dropleft .dropdown-toggle::before{display:inline-block;width:0;height:0;margin-right:0.255em;vertical-align:0.255em;content:"";border-top:0.3em solid transparent;border-right:0.3em solid;border-bottom:0.3em solid transparent}.dropleft .dropdown-toggle:empty::after{margin-left:0}.dropleft .dropdown-toggle::before{vertical-align:0}.dropdown-menu[x-placement^="top"],.dropdown-menu[x-placement^="right"],.dropdown-menu[x-placement^="bottom"],.dropdown-menu[x-placement^="left"]{right:auto;bottom:auto}.dropdown-divider{height:0;margin:0.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{display:block;width:100%;padding:0.25rem 1.5rem;clear:both;font-weight:400;color:#495057;text-align:inherit;white-space:nowrap;background-color:transparent;border:0}.dropdown-item:hover,.dropdown-item:focus{color:#fff;text-decoration:none;background-color:#2FA4E7}.dropdown-item.active,.dropdown-item:active{color:#fff;text-decoration:none;background-color:#2FA4E7}.dropdown-item.disabled,.dropdown-item:disabled{color:#868e96;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:0.5rem 1.5rem;margin-bottom:0;font-size:0.875rem;color:#868e96;white-space:nowrap}.dropdown-item-text{display:block;padding:0.25rem 1.5rem;color:#495057}.btn-group,.btn-group-vertical{position:relative;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover{z-index:1}.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn.active{z-index:1}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.btn-group-vertical .btn+.btn,.btn-group-vertical .btn+.btn-group,.btn-group-vertical .btn-group+.btn,.btn-group-vertical .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:not(:last-child):not(.dropdown-toggle),.btn-group>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:not(:first-child),.btn-group>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:0.5625rem;padding-left:0.5625rem}.dropdown-toggle-split::after,.dropup .dropdown-toggle-split::after,.dropright .dropdown-toggle-split::after{margin-left:0}.dropleft .dropdown-toggle-split::before{margin-right:0}.btn-sm+.dropdown-toggle-split,.btn-group-sm>.btn+.dropdown-toggle-split{padding-right:0.375rem;padding-left:0.375rem}.btn-lg+.dropdown-toggle-split,.btn-group-lg>.btn+.dropdown-toggle-split{padding-right:0.75rem;padding-left:0.75rem}.btn-group-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.btn-group-vertical .btn,.btn-group-vertical .btn-group{width:100%}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle),.btn-group-vertical>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:not(:first-child),.btn-group-vertical>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-top-right-radius:0}.btn-group-toggle>.btn,.btn-group-toggle>.btn-group>.btn{margin-bottom:0}.btn-group-toggle>.btn input[type="radio"],.btn-group-toggle>.btn input[type="checkbox"],.btn-group-toggle>.btn-group>.btn input[type="radio"],.btn-group-toggle>.btn-group>.btn input[type="checkbox"]{position:absolute;clip:rect(0, 0, 0, 0);pointer-events:none}.input-group{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;width:100%}.input-group>.form-control,.input-group>.custom-select,.input-group>.custom-file{position:relative;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;width:1%;margin-bottom:0}.input-group>.form-control+.form-control,.input-group>.form-control+.custom-select,.input-group>.form-control+.custom-file,.input-group>.custom-select+.form-control,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.custom-file,.input-group>.custom-file+.form-control,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.custom-file{margin-left:-1px}.input-group>.form-control:focus,.input-group>.custom-select:focus,.input-group>.custom-file .custom-file-input:focus ~ .custom-file-label{z-index:3}.input-group>.custom-file .custom-file-input:focus{z-index:4}.input-group>.form-control:not(:last-child),.input-group>.custom-select:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.form-control:not(:first-child),.input-group>.custom-select:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.input-group>.custom-file:not(:last-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label::after{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-file:not(:first-child) .custom-file-label{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-prepend,.input-group-append{display:-webkit-box;display:-ms-flexbox;display:flex}.input-group-prepend .btn,.input-group-append .btn{position:relative;z-index:2}.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.input-group-text,.input-group-append .input-group-text+.btn{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0.375rem 0.75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:center;white-space:nowrap;background-color:#e9ecef;border:1px solid #ced4da;border-radius:0.25rem}.input-group-text input[type="radio"],.input-group-text input[type="checkbox"]{margin-top:0}.input-group-lg>.form-control,.input-group-lg>.input-group-prepend>.input-group-text,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-append>.btn{height:calc(2.875rem + 2px);padding:0.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:0.3rem}.input-group-sm>.form-control,.input-group-sm>.input-group-prepend>.input-group-text,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-append>.btn{height:calc(1.8125rem + 2px);padding:0.25rem 0.5rem;font-size:0.875rem;line-height:1.5;border-radius:0.2rem}.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text,.input-group>.input-group-append:not(:last-child)>.btn,.input-group>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.custom-control{position:relative;display:block;min-height:1.5rem;padding-left:1.5rem}.custom-control-inline{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;margin-right:1rem}.custom-control-input{position:absolute;z-index:-1;opacity:0}.custom-control-input:checked ~ .custom-control-label::before{color:#fff;background-color:#2FA4E7}.custom-control-input:focus ~ .custom-control-label::before{-webkit-box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25)}.custom-control-input:active ~ .custom-control-label::before{color:#fff;background-color:#cfeaf9}.custom-control-input:disabled ~ .custom-control-label{color:#868e96}.custom-control-input:disabled ~ .custom-control-label::before{background-color:#e9ecef}.custom-control-label{position:relative;margin-bottom:0}.custom-control-label::before{position:absolute;top:0.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;pointer-events:none;content:"";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#dee2e6}.custom-control-label::after{position:absolute;top:0.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;content:"";background-repeat:no-repeat;background-position:center center;background-size:50% 50%}.custom-checkbox .custom-control-label::before{border-radius:0.25rem}.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before{background-color:#2FA4E7}.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before{background-color:#2FA4E7}.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before{background-color:rgba(47,164,231,0.5)}.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before{background-color:rgba(47,164,231,0.5)}.custom-radio .custom-control-label::before{border-radius:50%}.custom-radio .custom-control-input:checked ~ .custom-control-label::before{background-color:#2FA4E7}.custom-radio .custom-control-input:checked ~ .custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E")}.custom-radio .custom-control-input:disabled:checked ~ .custom-control-label::before{background-color:rgba(47,164,231,0.5)}.custom-select{display:inline-block;width:100%;height:calc(2.25rem + 2px);padding:0.375rem 1.75rem 0.375rem 0.75rem;line-height:1.5;color:#495057;vertical-align:middle;background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;background-size:8px 10px;border:1px solid #ced4da;border-radius:0.25rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-select:focus{border-color:#a1d6f4;outline:0;-webkit-box-shadow:0 0 0 0.2rem rgba(161,214,244,0.5);box-shadow:0 0 0 0.2rem rgba(161,214,244,0.5)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select[multiple],.custom-select[size]:not([size="1"]){height:auto;padding-right:0.75rem;background-image:none}.custom-select:disabled{color:#868e96;background-color:#e9ecef}.custom-select::-ms-expand{opacity:0}.custom-select-sm{height:calc(1.8125rem + 2px);padding-top:0.375rem;padding-bottom:0.375rem;font-size:75%}.custom-select-lg{height:calc(2.875rem + 2px);padding-top:0.375rem;padding-bottom:0.375rem;font-size:125%}.custom-file{position:relative;display:inline-block;width:100%;height:calc(2.25rem + 2px);margin-bottom:0}.custom-file-input{position:relative;z-index:2;width:100%;height:calc(2.25rem + 2px);margin:0;opacity:0}.custom-file-input:focus ~ .custom-file-label{border-color:#a1d6f4;-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25)}.custom-file-input:focus ~ .custom-file-label::after{border-color:#a1d6f4}.custom-file-input:disabled ~ .custom-file-label{background-color:#e9ecef}.custom-file-input:lang(en) ~ .custom-file-label::after{content:"Browse"}.custom-file-label{position:absolute;top:0;right:0;left:0;z-index:1;height:calc(2.25rem + 2px);padding:0.375rem 0.75rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #ced4da;border-radius:0.25rem}.custom-file-label::after{position:absolute;top:0;right:0;bottom:0;z-index:3;display:block;height:2.25rem;padding:0.375rem 0.75rem;line-height:1.5;color:#495057;content:"Browse";background-color:#e9ecef;border-left:1px solid #ced4da;border-radius:0 0.25rem 0.25rem 0}.custom-range{width:100%;padding-left:0;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-range:focus{outline:none}.custom-range:focus::-webkit-slider-thumb{-webkit-box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25)}.custom-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25)}.custom-range:focus::-ms-thumb{box-shadow:0 0 0 1px #fff,0 0 0 0.2rem rgba(47,164,231,0.25)}.custom-range::-moz-focus-outer{border:0}.custom-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-0.25rem;background-color:#2FA4E7;border:0;border-radius:1rem;-webkit-transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;-webkit-appearance:none;appearance:none}@media screen and (prefers-reduced-motion: reduce){.custom-range::-webkit-slider-thumb{-webkit-transition:none;transition:none}}.custom-range::-webkit-slider-thumb:active{background-color:#cfeaf9}.custom-range::-webkit-slider-runnable-track{width:100%;height:0.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#2FA4E7;border:0;border-radius:1rem;-webkit-transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;-moz-appearance:none;appearance:none}@media screen and (prefers-reduced-motion: reduce){.custom-range::-moz-range-thumb{-webkit-transition:none;transition:none}}.custom-range::-moz-range-thumb:active{background-color:#cfeaf9}.custom-range::-moz-range-track{width:100%;height:0.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-ms-thumb{width:1rem;height:1rem;margin-top:0;margin-right:0.2rem;margin-left:0.2rem;background-color:#2FA4E7;border:0;border-radius:1rem;-webkit-transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;appearance:none}@media screen and (prefers-reduced-motion: reduce){.custom-range::-ms-thumb{-webkit-transition:none;transition:none}}.custom-range::-ms-thumb:active{background-color:#cfeaf9}.custom-range::-ms-track{width:100%;height:0.5rem;color:transparent;cursor:pointer;background-color:transparent;border-color:transparent;border-width:0.5rem}.custom-range::-ms-fill-lower{background-color:#dee2e6;border-radius:1rem}.custom-range::-ms-fill-upper{margin-right:15px;background-color:#dee2e6;border-radius:1rem}.custom-control-label::before,.custom-file-label,.custom-select{-webkit-transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out}@media screen and (prefers-reduced-motion: reduce){.custom-control-label::before,.custom-file-label,.custom-select{-webkit-transition:none;transition:none}}.nav{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:0.5rem 1rem}.nav-link:hover,.nav-link:focus{text-decoration:none}.nav-link.disabled{color:#868e96}.nav-tabs{border-bottom:1px solid #dee2e6}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:0.25rem;border-top-right-radius:0.25rem}.nav-tabs .nav-link:hover,.nav-tabs .nav-link:focus{border-color:#e9ecef #e9ecef #dee2e6}.nav-tabs .nav-link.disabled{color:#868e96;background-color:transparent;border-color:transparent}.nav-tabs .nav-link.active,.nav-tabs .nav-item.show .nav-link{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:0.25rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#2FA4E7}.nav-fill .nav-item{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;text-align:center}.nav-justified .nav-item{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;text-align:center}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:0.5rem 1rem}.navbar>.container,.navbar>.container-fluid{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.navbar-brand{display:inline-block;padding-top:0.3125rem;padding-bottom:0.3125rem;margin-right:1rem;font-size:1.25rem;line-height:inherit;white-space:nowrap}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}.navbar-nav{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link{padding-right:0;padding-left:0}.navbar-nav .dropdown-menu{position:static;float:none}.navbar-text{display:inline-block;padding-top:0.5rem;padding-bottom:0.5rem}.navbar-collapse{-ms-flex-preferred-size:100%;flex-basis:100%;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.navbar-toggler{padding:0.25rem 0.75rem;font-size:1.25rem;line-height:1;background-color:transparent;border:1px solid transparent;border-radius:0.25rem}.navbar-toggler:hover,.navbar-toggler:focus{text-decoration:none}.navbar-toggler:not(:disabled):not(.disabled){cursor:pointer}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;content:"";background:no-repeat center center;background-size:100% 100%}@media (max-width: 575.98px){.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{padding-right:0;padding-left:0}}@media (min-width: 576px){.navbar-expand-sm{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-sm .navbar-nav{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .nav-link{padding-right:0.5rem;padding-left:0.5rem}.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-sm .navbar-collapse{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (max-width: 767.98px){.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{padding-right:0;padding-left:0}}@media (min-width: 768px){.navbar-expand-md{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-md .navbar-nav{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .nav-link{padding-right:0.5rem;padding-left:0.5rem}.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-md .navbar-collapse{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (max-width: 991.98px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{padding-right:0;padding-left:0}}@media (min-width: 992px){.navbar-expand-lg{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-lg .navbar-nav{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .nav-link{padding-right:0.5rem;padding-left:0.5rem}.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-lg .navbar-collapse{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (max-width: 1199.98px){.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{padding-right:0;padding-left:0}}@media (min-width: 1200px){.navbar-expand-xl{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-xl .navbar-nav{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .nav-link{padding-right:0.5rem;padding-left:0.5rem}.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-xl .navbar-collapse{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}.navbar-expand{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand>.container,.navbar-expand>.container-fluid{padding-right:0;padding-left:0}.navbar-expand .navbar-nav{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .nav-link{padding-right:0.5rem;padding-left:0.5rem}.navbar-expand>.container,.navbar-expand>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand .navbar-collapse{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-light .navbar-brand{color:rgba(0,0,0,0.9)}.navbar-light .navbar-brand:hover,.navbar-light .navbar-brand:focus{color:rgba(0,0,0,0.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,0.5)}.navbar-light .navbar-nav .nav-link:hover,.navbar-light .navbar-nav .nav-link:focus{color:rgba(0,0,0,0.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,0.3)}.navbar-light .navbar-nav .show>.nav-link,.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .nav-link.active{color:rgba(0,0,0,0.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,0.5);border-color:rgba(0,0,0,0.1)}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,0.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,0.9)}.navbar-light .navbar-text a:hover,.navbar-light .navbar-text a:focus{color:rgba(0,0,0,0.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:hover,.navbar-dark .navbar-brand:focus{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,0.8)}.navbar-dark .navbar-nav .nav-link:hover,.navbar-dark .navbar-nav .nav-link:focus{color:#fff}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,0.25)}.navbar-dark .navbar-nav .show>.nav-link,.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .nav-link.active{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,0.8);border-color:rgba(255,255,255,0.1)}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.8)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:rgba(255,255,255,0.8)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:hover,.navbar-dark .navbar-text a:focus{color:#fff}.card{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,0.125);border-radius:0.25rem}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:0.25rem;border-top-right-radius:0.25rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:0.25rem;border-bottom-left-radius:0.25rem}.card-body{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:0.75rem}.card-subtitle{margin-top:-0.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link:hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:0.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,0.03);border-bottom:1px solid rgba(0,0,0,0.125)}.card-header:first-child{border-radius:calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:0.75rem 1.25rem;background-color:rgba(0,0,0,0.03);border-top:1px solid rgba(0,0,0,0.125)}.card-footer:last-child{border-radius:0 0 calc(0.25rem - 1px) calc(0.25rem - 1px)}.card-header-tabs{margin-right:-0.625rem;margin-bottom:-0.75rem;margin-left:-0.625rem;border-bottom:0}.card-header-pills{margin-right:-0.625rem;margin-left:-0.625rem}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:1.25rem}.card-img{width:100%;border-radius:calc(0.25rem - 1px)}.card-img-top{width:100%;border-top-left-radius:calc(0.25rem - 1px);border-top-right-radius:calc(0.25rem - 1px)}.card-img-bottom{width:100%;border-bottom-right-radius:calc(0.25rem - 1px);border-bottom-left-radius:calc(0.25rem - 1px)}.card-deck{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.card-deck .card{margin-bottom:15px}@media (min-width: 576px){.card-deck{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap;margin-right:-15px;margin-left:-15px}.card-deck .card{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex:1 0 0%;flex:1 0 0%;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin-right:15px;margin-bottom:0;margin-left:15px}}.card-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.card-group>.card{margin-bottom:15px}@media (min-width: 576px){.card-group{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap}.card-group>.card{-webkit-box-flex:1;-ms-flex:1 0 0%;flex:1 0 0%;margin-bottom:0}.card-group>.card+.card{margin-left:0;border-left:0}.card-group>.card:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:first-child .card-img-top,.card-group>.card:first-child .card-header{border-top-right-radius:0}.card-group>.card:first-child .card-img-bottom,.card-group>.card:first-child .card-footer{border-bottom-right-radius:0}.card-group>.card:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:last-child .card-img-top,.card-group>.card:last-child .card-header{border-top-left-radius:0}.card-group>.card:last-child .card-img-bottom,.card-group>.card:last-child .card-footer{border-bottom-left-radius:0}.card-group>.card:only-child{border-radius:0.25rem}.card-group>.card:only-child .card-img-top,.card-group>.card:only-child .card-header{border-top-left-radius:0.25rem;border-top-right-radius:0.25rem}.card-group>.card:only-child .card-img-bottom,.card-group>.card:only-child .card-footer{border-bottom-right-radius:0.25rem;border-bottom-left-radius:0.25rem}.card-group>.card:not(:first-child):not(:last-child):not(:only-child){border-radius:0}.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-top,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-header,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-footer{border-radius:0}}.card-columns .card{margin-bottom:0.75rem}@media (min-width: 576px){.card-columns{-webkit-column-count:3;column-count:3;-webkit-column-gap:1.25rem;column-gap:1.25rem;orphans:1;widows:1}.card-columns .card{display:inline-block;width:100%}}.accordion .card:not(:first-of-type):not(:last-of-type){border-bottom:0;border-radius:0}.accordion .card:not(:first-of-type) .card-header:first-child{border-radius:0}.accordion .card:first-of-type{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.accordion .card:last-of-type{border-top-left-radius:0;border-top-right-radius:0}.breadcrumb{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:0.75rem 1rem;margin-bottom:1rem;list-style:none;background-color:#e9ecef;border-radius:0.25rem}.breadcrumb-item+.breadcrumb-item{padding-left:0.5rem}.breadcrumb-item+.breadcrumb-item::before{display:inline-block;padding-right:0.5rem;color:#868e96;content:"/"}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:underline}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:none}.breadcrumb-item.active{color:#868e96}.pagination{display:-webkit-box;display:-ms-flexbox;display:flex;padding-left:0;list-style:none;border-radius:0.25rem}.page-link{position:relative;display:block;padding:0.5rem 0.75rem;margin-left:-1px;line-height:1.25;color:#2FA4E7;background-color:#fff;border:1px solid #dee2e6}.page-link:hover{z-index:2;color:#157ab5;text-decoration:none;background-color:#e9ecef;border-color:#dee2e6}.page-link:focus{z-index:2;outline:0;-webkit-box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25);box-shadow:0 0 0 0.2rem rgba(47,164,231,0.25)}.page-link:not(:disabled):not(.disabled){cursor:pointer}.page-item:first-child .page-link{margin-left:0;border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.page-item:last-child .page-link{border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}.page-item.active .page-link{z-index:1;color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.page-item.disabled .page-link{color:#868e96;pointer-events:none;cursor:auto;background-color:#fff;border-color:#dee2e6}.pagination-lg .page-link{padding:0.75rem 1.5rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:0.3rem;border-bottom-left-radius:0.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:0.3rem;border-bottom-right-radius:0.3rem}.pagination-sm .page-link{padding:0.25rem 0.5rem;font-size:0.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:0.2rem;border-bottom-left-radius:0.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:0.2rem;border-bottom-right-radius:0.2rem}.badge{display:inline-block;padding:0.25em 0.4em;font-size:75%;font-weight:700;line-height:1;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:0.25rem}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.badge-pill{padding-right:0.6em;padding-left:0.6em;border-radius:10rem}.badge-primary{color:#fff;background-color:#2FA4E7}.badge-primary[href]:hover,.badge-primary[href]:focus{color:#fff;text-decoration:none;background-color:#178acc}.badge-secondary{color:#212529;background-color:#e9ecef}.badge-secondary[href]:hover,.badge-secondary[href]:focus{color:#212529;text-decoration:none;background-color:#cbd3da}.badge-success{color:#fff;background-color:#73A839}.badge-success[href]:hover,.badge-success[href]:focus{color:#fff;text-decoration:none;background-color:#59822c}.badge-info{color:#fff;background-color:#033C73}.badge-info[href]:hover,.badge-info[href]:focus{color:#fff;text-decoration:none;background-color:#022241}.badge-warning{color:#fff;background-color:#DD5600}.badge-warning[href]:hover,.badge-warning[href]:focus{color:#fff;text-decoration:none;background-color:#aa4200}.badge-danger{color:#fff;background-color:#C71C22}.badge-danger[href]:hover,.badge-danger[href]:focus{color:#fff;text-decoration:none;background-color:#9a161a}.badge-light{color:#212529;background-color:#f8f9fa}.badge-light[href]:hover,.badge-light[href]:focus{color:#212529;text-decoration:none;background-color:#dae0e5}.badge-dark{color:#fff;background-color:#343a40}.badge-dark[href]:hover,.badge-dark[href]:focus{color:#fff;text-decoration:none;background-color:#1d2124}.jumbotron{padding:2rem 1rem;margin-bottom:2rem;background-color:#e9ecef;border-radius:0.3rem}@media (min-width: 576px){.jumbotron{padding:4rem 2rem}}.jumbotron-fluid{padding-right:0;padding-left:0;border-radius:0}.alert{position:relative;padding:0.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:0.25rem}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible{padding-right:4rem}.alert-dismissible .close{position:absolute;top:0;right:0;padding:0.75rem 1.25rem;color:inherit}.alert-primary{color:#185578;background-color:#d5edfa;border-color:#c5e6f8}.alert-primary hr{border-top-color:#aedcf5}.alert-primary .alert-link{color:#10374e}.alert-secondary{color:#797b7c;background-color:#fbfbfc;border-color:#f9fafb}.alert-secondary hr{border-top-color:#eaedf1}.alert-secondary .alert-link{color:#606162}.alert-success{color:#3c571e;background-color:#e3eed7;border-color:#d8e7c8}.alert-success hr{border-top-color:#cbdfb6}.alert-success .alert-link{color:#223111}.alert-info{color:#021f3c;background-color:#cdd8e3;border-color:#b8c8d8}.alert-info hr{border-top-color:#a8bbcf}.alert-info .alert-link{color:#00060b}.alert-warning{color:#732d00;background-color:#f8ddcc;border-color:#f5d0b8}.alert-warning hr{border-top-color:#f2c1a2}.alert-warning .alert-link{color:#401900}.alert-danger{color:#670f12;background-color:#f4d2d3;border-color:#efbfc1}.alert-danger hr{border-top-color:#eaabad}.alert-danger .alert-link{color:#3a090a}.alert-light{color:#818182;background-color:#fefefe;border-color:#fdfdfe}.alert-light hr{border-top-color:#ececf6}.alert-light .alert-link{color:#686868}.alert-dark{color:#1b1e21;background-color:#d6d8d9;border-color:#c6c8ca}.alert-dark hr{border-top-color:#b9bbbe}.alert-dark .alert-link{color:#040505}@-webkit-keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}.progress{display:-webkit-box;display:-ms-flexbox;display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#2FA4E7;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}@media screen and (prefers-reduced-motion: reduce){.progress-bar{-webkit-transition:none;transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.media{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.media-body{-webkit-box-flex:1;-ms-flex:1;flex:1}.list-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:hover,.list-group-item-action:focus{color:#495057;text-decoration:none;background-color:#f8f9fa}.list-group-item-action:active{color:#495057;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:0.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,0.125)}.list-group-item:first-child{border-top-left-radius:0.25rem;border-top-right-radius:0.25rem}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:0.25rem;border-bottom-left-radius:0.25rem}.list-group-item:hover,.list-group-item:focus{z-index:1;text-decoration:none}.list-group-item.disabled,.list-group-item:disabled{color:#868e96;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#2FA4E7;border-color:#2FA4E7}.list-group-flush .list-group-item{border-right:0;border-left:0;border-radius:0}.list-group-flush:first-child .list-group-item:first-child{border-top:0}.list-group-flush:last-child .list-group-item:last-child{border-bottom:0}.list-group-item-primary{color:#185578;background-color:#c5e6f8}.list-group-item-primary.list-group-item-action:hover,.list-group-item-primary.list-group-item-action:focus{color:#185578;background-color:#aedcf5}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#185578;border-color:#185578}.list-group-item-secondary{color:#797b7c;background-color:#f9fafb}.list-group-item-secondary.list-group-item-action:hover,.list-group-item-secondary.list-group-item-action:focus{color:#797b7c;background-color:#eaedf1}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#797b7c;border-color:#797b7c}.list-group-item-success{color:#3c571e;background-color:#d8e7c8}.list-group-item-success.list-group-item-action:hover,.list-group-item-success.list-group-item-action:focus{color:#3c571e;background-color:#cbdfb6}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#3c571e;border-color:#3c571e}.list-group-item-info{color:#021f3c;background-color:#b8c8d8}.list-group-item-info.list-group-item-action:hover,.list-group-item-info.list-group-item-action:focus{color:#021f3c;background-color:#a8bbcf}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#021f3c;border-color:#021f3c}.list-group-item-warning{color:#732d00;background-color:#f5d0b8}.list-group-item-warning.list-group-item-action:hover,.list-group-item-warning.list-group-item-action:focus{color:#732d00;background-color:#f2c1a2}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#732d00;border-color:#732d00}.list-group-item-danger{color:#670f12;background-color:#efbfc1}.list-group-item-danger.list-group-item-action:hover,.list-group-item-danger.list-group-item-action:focus{color:#670f12;background-color:#eaabad}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#670f12;border-color:#670f12}.list-group-item-light{color:#818182;background-color:#fdfdfe}.list-group-item-light.list-group-item-action:hover,.list-group-item-light.list-group-item-action:focus{color:#818182;background-color:#ececf6}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#818182;border-color:#818182}.list-group-item-dark{color:#1b1e21;background-color:#c6c8ca}.list-group-item-dark.list-group-item-action:hover,.list-group-item-dark.list-group-item-action:focus{color:#1b1e21;background-color:#b9bbbe}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#1b1e21;border-color:#1b1e21}.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:not(:disabled):not(.disabled){cursor:pointer}.close:not(:disabled):not(.disabled):hover,.close:not(:disabled):not(.disabled):focus{color:#000;text-decoration:none;opacity:.75}button.close{padding:0;background-color:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;outline:0}.modal-dialog{position:relative;width:auto;margin:0.5rem;pointer-events:none}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform 0.3s ease-out;transition:-webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out;transition:transform 0.3s ease-out, -webkit-transform 0.3s ease-out;-webkit-transform:translate(0, -25%);transform:translate(0, -25%)}@media screen and (prefers-reduced-motion: reduce){.modal.fade .modal-dialog{-webkit-transition:none;transition:none}}.modal.show .modal-dialog{-webkit-transform:translate(0, 0);transform:translate(0, 0)}.modal-dialog-centered{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:calc(100% - (0.5rem * 2))}.modal-dialog-centered::before{display:block;height:calc(100vh - (0.5rem * 2));content:""}.modal-content{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,0.2);border-radius:0.3rem;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:0.5}.modal-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:1rem;border-bottom:1px solid #e9ecef;border-top-left-radius:0.3rem;border-top-right-radius:0.3rem}.modal-header .close{padding:1rem;margin:-1rem -1rem -1rem auto}.modal-title{margin-bottom:0;line-height:1.5}.modal-body{position:relative;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem}.modal-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;padding:1rem;border-top:1px solid #e9ecef}.modal-footer>:not(:first-child){margin-left:.25rem}.modal-footer>:not(:last-child){margin-right:.25rem}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width: 576px){.modal-dialog{max-width:500px;margin:1.75rem auto}.modal-dialog-centered{min-height:calc(100% - (1.75rem * 2))}.modal-dialog-centered::before{height:calc(100vh - (1.75rem * 2))}.modal-sm{max-width:300px}}@media (min-width: 992px){.modal-lg{max-width:800px}}.tooltip{position:absolute;z-index:1070;display:block;margin:0;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:0.875rem;word-wrap:break-word;opacity:0}.tooltip.show{opacity:0.9}.tooltip .arrow{position:absolute;display:block;width:0.8rem;height:0.4rem}.tooltip .arrow::before{position:absolute;content:"";border-color:transparent;border-style:solid}.bs-tooltip-top,.bs-tooltip-auto[x-placement^="top"]{padding:0.4rem 0}.bs-tooltip-top .arrow,.bs-tooltip-auto[x-placement^="top"] .arrow{bottom:0}.bs-tooltip-top .arrow::before,.bs-tooltip-auto[x-placement^="top"] .arrow::before{top:0;border-width:0.4rem 0.4rem 0;border-top-color:#000}.bs-tooltip-right,.bs-tooltip-auto[x-placement^="right"]{padding:0 0.4rem}.bs-tooltip-right .arrow,.bs-tooltip-auto[x-placement^="right"] .arrow{left:0;width:0.4rem;height:0.8rem}.bs-tooltip-right .arrow::before,.bs-tooltip-auto[x-placement^="right"] .arrow::before{right:0;border-width:0.4rem 0.4rem 0.4rem 0;border-right-color:#000}.bs-tooltip-bottom,.bs-tooltip-auto[x-placement^="bottom"]{padding:0.4rem 0}.bs-tooltip-bottom .arrow,.bs-tooltip-auto[x-placement^="bottom"] .arrow{top:0}.bs-tooltip-bottom .arrow::before,.bs-tooltip-auto[x-placement^="bottom"] .arrow::before{bottom:0;border-width:0 0.4rem 0.4rem;border-bottom-color:#000}.bs-tooltip-left,.bs-tooltip-auto[x-placement^="left"]{padding:0 0.4rem}.bs-tooltip-left .arrow,.bs-tooltip-auto[x-placement^="left"] .arrow{right:0;width:0.4rem;height:0.8rem}.bs-tooltip-left .arrow::before,.bs-tooltip-auto[x-placement^="left"] .arrow::before{left:0;border-width:0.4rem 0 0.4rem 0.4rem;border-left-color:#000}.tooltip-inner{max-width:200px;padding:0.25rem 0.5rem;color:#fff;text-align:center;background-color:#000;border-radius:0.25rem}.popover{position:absolute;top:0;left:0;z-index:1060;display:block;max-width:276px;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:0.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,0.2);border-radius:0.3rem}.popover .arrow{position:absolute;display:block;width:1rem;height:0.5rem;margin:0 0.3rem}.popover .arrow::before,.popover .arrow::after{position:absolute;display:block;content:"";border-color:transparent;border-style:solid}.bs-popover-top,.bs-popover-auto[x-placement^="top"]{margin-bottom:0.5rem}.bs-popover-top .arrow,.bs-popover-auto[x-placement^="top"] .arrow{bottom:calc((0.5rem + 1px) * -1)}.bs-popover-top .arrow::before,.bs-popover-auto[x-placement^="top"] .arrow::before,.bs-popover-top .arrow::after,.bs-popover-auto[x-placement^="top"] .arrow::after{border-width:0.5rem 0.5rem 0}.bs-popover-top .arrow::before,.bs-popover-auto[x-placement^="top"] .arrow::before{bottom:0;border-top-color:rgba(0,0,0,0.25)}.bs-popover-top .arrow::after,.bs-popover-auto[x-placement^="top"] .arrow::after{bottom:1px;border-top-color:#fff}.bs-popover-right,.bs-popover-auto[x-placement^="right"]{margin-left:0.5rem}.bs-popover-right .arrow,.bs-popover-auto[x-placement^="right"] .arrow{left:calc((0.5rem + 1px) * -1);width:0.5rem;height:1rem;margin:0.3rem 0}.bs-popover-right .arrow::before,.bs-popover-auto[x-placement^="right"] .arrow::before,.bs-popover-right .arrow::after,.bs-popover-auto[x-placement^="right"] .arrow::after{border-width:0.5rem 0.5rem 0.5rem 0}.bs-popover-right .arrow::before,.bs-popover-auto[x-placement^="right"] .arrow::before{left:0;border-right-color:rgba(0,0,0,0.25)}.bs-popover-right .arrow::after,.bs-popover-auto[x-placement^="right"] .arrow::after{left:1px;border-right-color:#fff}.bs-popover-bottom,.bs-popover-auto[x-placement^="bottom"]{margin-top:0.5rem}.bs-popover-bottom .arrow,.bs-popover-auto[x-placement^="bottom"] .arrow{top:calc((0.5rem + 1px) * -1)}.bs-popover-bottom .arrow::before,.bs-popover-auto[x-placement^="bottom"] .arrow::before,.bs-popover-bottom .arrow::after,.bs-popover-auto[x-placement^="bottom"] .arrow::after{border-width:0 0.5rem 0.5rem 0.5rem}.bs-popover-bottom .arrow::before,.bs-popover-auto[x-placement^="bottom"] .arrow::before{top:0;border-bottom-color:rgba(0,0,0,0.25)}.bs-popover-bottom .arrow::after,.bs-popover-auto[x-placement^="bottom"] .arrow::after{top:1px;border-bottom-color:#fff}.bs-popover-bottom .popover-header::before,.bs-popover-auto[x-placement^="bottom"] .popover-header::before{position:absolute;top:0;left:50%;display:block;width:1rem;margin-left:-0.5rem;content:"";border-bottom:1px solid #f7f7f7}.bs-popover-left,.bs-popover-auto[x-placement^="left"]{margin-right:0.5rem}.bs-popover-left .arrow,.bs-popover-auto[x-placement^="left"] .arrow{right:calc((0.5rem + 1px) * -1);width:0.5rem;height:1rem;margin:0.3rem 0}.bs-popover-left .arrow::before,.bs-popover-auto[x-placement^="left"] .arrow::before,.bs-popover-left .arrow::after,.bs-popover-auto[x-placement^="left"] .arrow::after{border-width:0.5rem 0 0.5rem 0.5rem}.bs-popover-left .arrow::before,.bs-popover-auto[x-placement^="left"] .arrow::before{right:0;border-left-color:rgba(0,0,0,0.25)}.bs-popover-left .arrow::after,.bs-popover-auto[x-placement^="left"] .arrow::after{right:1px;border-left-color:#fff}.popover-header{padding:0.5rem 0.75rem;margin-bottom:0;font-size:1rem;color:#2FA4E7;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(0.3rem - 1px);border-top-right-radius:calc(0.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:0.5rem 0.75rem;color:#495057}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-item{position:relative;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-item.active,.carousel-item-next,.carousel-item-prev{display:block;-webkit-transition:-webkit-transform 0.6s ease;transition:-webkit-transform 0.6s ease;transition:transform 0.6s ease;transition:transform 0.6s ease, -webkit-transform 0.6s ease}@media screen and (prefers-reduced-motion: reduce){.carousel-item.active,.carousel-item-next,.carousel-item-prev{-webkit-transition:none;transition:none}}.carousel-item-next,.carousel-item-prev{position:absolute;top:0}.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translateX(0);transform:translateX(0)}@supports (-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d){.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}.carousel-item-next,.active.carousel-item-right{-webkit-transform:translateX(100%);transform:translateX(100%)}@supports (-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d){.carousel-item-next,.active.carousel-item-right{-webkit-transform:translate3d(100%, 0, 0);transform:translate3d(100%, 0, 0)}}.carousel-item-prev,.active.carousel-item-left{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@supports (-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d){.carousel-item-prev,.active.carousel-item-left{-webkit-transform:translate3d(-100%, 0, 0);transform:translate3d(-100%, 0, 0)}}.carousel-fade .carousel-item{opacity:0;-webkit-transition-duration:.6s;transition-duration:.6s;-webkit-transition-property:opacity;transition-property:opacity}.carousel-fade .carousel-item.active,.carousel-fade .carousel-item-next.carousel-item-left,.carousel-fade .carousel-item-prev.carousel-item-right{opacity:1}.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{opacity:0}.carousel-fade .carousel-item-next,.carousel-fade .carousel-item-prev,.carousel-fade .carousel-item.active,.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-prev{-webkit-transform:translateX(0);transform:translateX(0)}@supports (-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d){.carousel-fade .carousel-item-next,.carousel-fade .carousel-item-prev,.carousel-fade .carousel-item.active,.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-prev{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}}.carousel-control-prev,.carousel-control-next{position:absolute;top:0;bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:15%;color:#fff;text-align:center;opacity:0.5}.carousel-control-prev:hover,.carousel-control-prev:focus,.carousel-control-next:hover,.carousel-control-next:focus{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-prev-icon,.carousel-control-next-icon{display:inline-block;width:20px;height:20px;background:transparent no-repeat center center;background-size:100% 100%}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{position:absolute;right:0;bottom:10px;left:0;z-index:15;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding-left:0;margin-right:15%;margin-left:15%;list-style:none}.carousel-indicators li{position:relative;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;width:30px;height:3px;margin-right:3px;margin-left:3px;text-indent:-999px;cursor:pointer;background-color:rgba(255,255,255,0.5)}.carousel-indicators li::before{position:absolute;top:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators li::after{position:absolute;bottom:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators .active{background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center}.align-baseline{vertical-align:baseline !important}.align-top{vertical-align:top !important}.align-middle{vertical-align:middle !important}.align-bottom{vertical-align:bottom !important}.align-text-bottom{vertical-align:text-bottom !important}.align-text-top{vertical-align:text-top !important}.bg-primary{background-color:#2FA4E7 !important}a.bg-primary:hover,a.bg-primary:focus,button.bg-primary:hover,button.bg-primary:focus{background-color:#178acc !important}.bg-secondary{background-color:#e9ecef !important}a.bg-secondary:hover,a.bg-secondary:focus,button.bg-secondary:hover,button.bg-secondary:focus{background-color:#cbd3da !important}.bg-success{background-color:#73A839 !important}a.bg-success:hover,a.bg-success:focus,button.bg-success:hover,button.bg-success:focus{background-color:#59822c !important}.bg-info{background-color:#033C73 !important}a.bg-info:hover,a.bg-info:focus,button.bg-info:hover,button.bg-info:focus{background-color:#022241 !important}.bg-warning{background-color:#DD5600 !important}a.bg-warning:hover,a.bg-warning:focus,button.bg-warning:hover,button.bg-warning:focus{background-color:#aa4200 !important}.bg-danger{background-color:#C71C22 !important}a.bg-danger:hover,a.bg-danger:focus,button.bg-danger:hover,button.bg-danger:focus{background-color:#9a161a !important}.bg-light{background-color:#f8f9fa !important}a.bg-light:hover,a.bg-light:focus,button.bg-light:hover,button.bg-light:focus{background-color:#dae0e5 !important}.bg-dark{background-color:#343a40 !important}a.bg-dark:hover,a.bg-dark:focus,button.bg-dark:hover,button.bg-dark:focus{background-color:#1d2124 !important}.bg-white{background-color:#fff !important}.bg-transparent{background-color:transparent !important}.border{border:1px solid #dee2e6 !important}.border-top{border-top:1px solid #dee2e6 !important}.border-right{border-right:1px solid #dee2e6 !important}.border-bottom{border-bottom:1px solid #dee2e6 !important}.border-left{border-left:1px solid #dee2e6 !important}.border-0{border:0 !important}.border-top-0{border-top:0 !important}.border-right-0{border-right:0 !important}.border-bottom-0{border-bottom:0 !important}.border-left-0{border-left:0 !important}.border-primary{border-color:#2FA4E7 !important}.border-secondary{border-color:#e9ecef !important}.border-success{border-color:#73A839 !important}.border-info{border-color:#033C73 !important}.border-warning{border-color:#DD5600 !important}.border-danger{border-color:#C71C22 !important}.border-light{border-color:#f8f9fa !important}.border-dark{border-color:#343a40 !important}.border-white{border-color:#fff !important}.rounded{border-radius:0.25rem !important}.rounded-top{border-top-left-radius:0.25rem !important;border-top-right-radius:0.25rem !important}.rounded-right{border-top-right-radius:0.25rem !important;border-bottom-right-radius:0.25rem !important}.rounded-bottom{border-bottom-right-radius:0.25rem !important;border-bottom-left-radius:0.25rem !important}.rounded-left{border-top-left-radius:0.25rem !important;border-bottom-left-radius:0.25rem !important}.rounded-circle{border-radius:50% !important}.rounded-0{border-radius:0 !important}.clearfix::after{display:block;clear:both;content:""}.d-none{display:none !important}.d-inline{display:inline !important}.d-inline-block{display:inline-block !important}.d-block{display:block !important}.d-table{display:table !important}.d-table-row{display:table-row !important}.d-table-cell{display:table-cell !important}.d-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}@media (min-width: 576px){.d-sm-none{display:none !important}.d-sm-inline{display:inline !important}.d-sm-inline-block{display:inline-block !important}.d-sm-block{display:block !important}.d-sm-table{display:table !important}.d-sm-table-row{display:table-row !important}.d-sm-table-cell{display:table-cell !important}.d-sm-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-sm-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}}@media (min-width: 768px){.d-md-none{display:none !important}.d-md-inline{display:inline !important}.d-md-inline-block{display:inline-block !important}.d-md-block{display:block !important}.d-md-table{display:table !important}.d-md-table-row{display:table-row !important}.d-md-table-cell{display:table-cell !important}.d-md-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-md-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}}@media (min-width: 992px){.d-lg-none{display:none !important}.d-lg-inline{display:inline !important}.d-lg-inline-block{display:inline-block !important}.d-lg-block{display:block !important}.d-lg-table{display:table !important}.d-lg-table-row{display:table-row !important}.d-lg-table-cell{display:table-cell !important}.d-lg-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-lg-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}}@media (min-width: 1200px){.d-xl-none{display:none !important}.d-xl-inline{display:inline !important}.d-xl-inline-block{display:inline-block !important}.d-xl-block{display:block !important}.d-xl-table{display:table !important}.d-xl-table-row{display:table-row !important}.d-xl-table-cell{display:table-cell !important}.d-xl-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-xl-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}}@media print{.d-print-none{display:none !important}.d-print-inline{display:inline !important}.d-print-inline-block{display:inline-block !important}.d-print-block{display:block !important}.d-print-table{display:table !important}.d-print-table-row{display:table-row !important}.d-print-table-cell{display:table-cell !important}.d-print-flex{display:-webkit-box !important;display:-ms-flexbox !important;display:flex !important}.d-print-inline-flex{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important}}.embed-responsive{position:relative;display:block;width:100%;padding:0;overflow:hidden}.embed-responsive::before{display:block;content:""}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-21by9::before{padding-top:42.8571428571%}.embed-responsive-16by9::before{padding-top:56.25%}.embed-responsive-4by3::before{padding-top:75%}.embed-responsive-1by1::before{padding-top:100%}.flex-row{-webkit-box-orient:horizontal !important;-webkit-box-direction:normal !important;-ms-flex-direction:row !important;flex-direction:row !important}.flex-column{-webkit-box-orient:vertical !important;-webkit-box-direction:normal !important;-ms-flex-direction:column !important;flex-direction:column !important}.flex-row-reverse{-webkit-box-orient:horizontal !important;-webkit-box-direction:reverse !important;-ms-flex-direction:row-reverse !important;flex-direction:row-reverse !important}.flex-column-reverse{-webkit-box-orient:vertical !important;-webkit-box-direction:reverse !important;-ms-flex-direction:column-reverse !important;flex-direction:column-reverse !important}.flex-wrap{-ms-flex-wrap:wrap !important;flex-wrap:wrap !important}.flex-nowrap{-ms-flex-wrap:nowrap !important;flex-wrap:nowrap !important}.flex-wrap-reverse{-ms-flex-wrap:wrap-reverse !important;flex-wrap:wrap-reverse !important}.flex-fill{-webkit-box-flex:1 !important;-ms-flex:1 1 auto !important;flex:1 1 auto !important}.flex-grow-0{-webkit-box-flex:0 !important;-ms-flex-positive:0 !important;flex-grow:0 !important}.flex-grow-1{-webkit-box-flex:1 !important;-ms-flex-positive:1 !important;flex-grow:1 !important}.flex-shrink-0{-ms-flex-negative:0 !important;flex-shrink:0 !important}.flex-shrink-1{-ms-flex-negative:1 !important;flex-shrink:1 !important}.justify-content-start{-webkit-box-pack:start !important;-ms-flex-pack:start !important;justify-content:flex-start !important}.justify-content-end{-webkit-box-pack:end !important;-ms-flex-pack:end !important;justify-content:flex-end !important}.justify-content-center{-webkit-box-pack:center !important;-ms-flex-pack:center !important;justify-content:center !important}.justify-content-between{-webkit-box-pack:justify !important;-ms-flex-pack:justify !important;justify-content:space-between !important}.justify-content-around{-ms-flex-pack:distribute !important;justify-content:space-around !important}.align-items-start{-webkit-box-align:start !important;-ms-flex-align:start !important;align-items:flex-start !important}.align-items-end{-webkit-box-align:end !important;-ms-flex-align:end !important;align-items:flex-end !important}.align-items-center{-webkit-box-align:center !important;-ms-flex-align:center !important;align-items:center !important}.align-items-baseline{-webkit-box-align:baseline !important;-ms-flex-align:baseline !important;align-items:baseline !important}.align-items-stretch{-webkit-box-align:stretch !important;-ms-flex-align:stretch !important;align-items:stretch !important}.align-content-start{-ms-flex-line-pack:start !important;align-content:flex-start !important}.align-content-end{-ms-flex-line-pack:end !important;align-content:flex-end !important}.align-content-center{-ms-flex-line-pack:center !important;align-content:center !important}.align-content-between{-ms-flex-line-pack:justify !important;align-content:space-between !important}.align-content-around{-ms-flex-line-pack:distribute !important;align-content:space-around !important}.align-content-stretch{-ms-flex-line-pack:stretch !important;align-content:stretch !important}.align-self-auto{-ms-flex-item-align:auto !important;align-self:auto !important}.align-self-start{-ms-flex-item-align:start !important;align-self:flex-start !important}.align-self-end{-ms-flex-item-align:end !important;align-self:flex-end !important}.align-self-center{-ms-flex-item-align:center !important;align-self:center !important}.align-self-baseline{-ms-flex-item-align:baseline !important;align-self:baseline !important}.align-self-stretch{-ms-flex-item-align:stretch !important;align-self:stretch !important}@media (min-width: 576px){.flex-sm-row{-webkit-box-orient:horizontal !important;-webkit-box-direction:normal !important;-ms-flex-direction:row !important;flex-direction:row !important}.flex-sm-column{-webkit-box-orient:vertical !important;-webkit-box-direction:normal !important;-ms-flex-direction:column !important;flex-direction:column !important}.flex-sm-row-reverse{-webkit-box-orient:horizontal !important;-webkit-box-direction:reverse !important;-ms-flex-direction:row-reverse !important;flex-direction:row-reverse !important}.flex-sm-column-reverse{-webkit-box-orient:vertical !important;-webkit-box-direction:reverse !important;-ms-flex-direction:column-reverse !important;flex-direction:column-reverse !important}.flex-sm-wrap{-ms-flex-wrap:wrap !important;flex-wrap:wrap !important}.flex-sm-nowrap{-ms-flex-wrap:nowrap !important;flex-wrap:nowrap !important}.flex-sm-wrap-reverse{-ms-flex-wrap:wrap-reverse !important;flex-wrap:wrap-reverse !important}.flex-sm-fill{-webkit-box-flex:1 !important;-ms-flex:1 1 auto !important;flex:1 1 auto !important}.flex-sm-grow-0{-webkit-box-flex:0 !important;-ms-flex-positive:0 !important;flex-grow:0 !important}.flex-sm-grow-1{-webkit-box-flex:1 !important;-ms-flex-positive:1 !important;flex-grow:1 !important}.flex-sm-shrink-0{-ms-flex-negative:0 !important;flex-shrink:0 !important}.flex-sm-shrink-1{-ms-flex-negative:1 !important;flex-shrink:1 !important}.justify-content-sm-start{-webkit-box-pack:start !important;-ms-flex-pack:start !important;justify-content:flex-start !important}.justify-content-sm-end{-webkit-box-pack:end !important;-ms-flex-pack:end !important;justify-content:flex-end !important}.justify-content-sm-center{-webkit-box-pack:center !important;-ms-flex-pack:center !important;justify-content:center !important}.justify-content-sm-between{-webkit-box-pack:justify !important;-ms-flex-pack:justify !important;justify-content:space-between !important}.justify-content-sm-around{-ms-flex-pack:distribute !important;justify-content:space-around !important}.align-items-sm-start{-webkit-box-align:start !important;-ms-flex-align:start !important;align-items:flex-start !important}.align-items-sm-end{-webkit-box-align:end !important;-ms-flex-align:end !important;align-items:flex-end !important}.align-items-sm-center{-webkit-box-align:center !important;-ms-flex-align:center !important;align-items:center !important}.align-items-sm-baseline{-webkit-box-align:baseline !important;-ms-flex-align:baseline !important;align-items:baseline !important}.align-items-sm-stretch{-webkit-box-align:stretch !important;-ms-flex-align:stretch !important;align-items:stretch !important}.align-content-sm-start{-ms-flex-line-pack:start !important;align-content:flex-start !important}.align-content-sm-end{-ms-flex-line-pack:end !important;align-content:flex-end !important}.align-content-sm-center{-ms-flex-line-pack:center !important;align-content:center !important}.align-content-sm-between{-ms-flex-line-pack:justify !important;align-content:space-between !important}.align-content-sm-around{-ms-flex-line-pack:distribute !important;align-content:space-around !important}.align-content-sm-stretch{-ms-flex-line-pack:stretch !important;align-content:stretch !important}.align-self-sm-auto{-ms-flex-item-align:auto !important;align-self:auto !important}.align-self-sm-start{-ms-flex-item-align:start !important;align-self:flex-start !important}.align-self-sm-end{-ms-flex-item-align:end !important;align-self:flex-end !important}.align-self-sm-center{-ms-flex-item-align:center !important;align-self:center !important}.align-self-sm-baseline{-ms-flex-item-align:baseline !important;align-self:baseline !important}.align-self-sm-stretch{-ms-flex-item-align:stretch !important;align-self:stretch !important}}@media (min-width: 768px){.flex-md-row{-webkit-box-orient:horizontal !important;-webkit-box-direction:normal !important;-ms-flex-direction:row !important;flex-direction:row !important}.flex-md-column{-webkit-box-orient:vertical !important;-webkit-box-direction:normal !important;-ms-flex-direction:column !important;flex-direction:column !important}.flex-md-row-reverse{-webkit-box-orient:horizontal !important;-webkit-box-direction:reverse !important;-ms-flex-direction:row-reverse !important;flex-direction:row-reverse !important}.flex-md-column-reverse{-webkit-box-orient:vertical !important;-webkit-box-direction:reverse !important;-ms-flex-direction:column-reverse !important;flex-direction:column-reverse !important}.flex-md-wrap{-ms-flex-wrap:wrap !important;flex-wrap:wrap !important}.flex-md-nowrap{-ms-flex-wrap:nowrap !important;flex-wrap:nowrap !important}.flex-md-wrap-reverse{-ms-flex-wrap:wrap-reverse !important;flex-wrap:wrap-reverse !important}.flex-md-fill{-webkit-box-flex:1 !important;-ms-flex:1 1 auto !important;flex:1 1 auto !important}.flex-md-grow-0{-webkit-box-flex:0 !important;-ms-flex-positive:0 !important;flex-grow:0 !important}.flex-md-grow-1{-webkit-box-flex:1 !important;-ms-flex-positive:1 !important;flex-grow:1 !important}.flex-md-shrink-0{-ms-flex-negative:0 !important;flex-shrink:0 !important}.flex-md-shrink-1{-ms-flex-negative:1 !important;flex-shrink:1 !important}.justify-content-md-start{-webkit-box-pack:start !important;-ms-flex-pack:start !important;justify-content:flex-start !important}.justify-content-md-end{-webkit-box-pack:end !important;-ms-flex-pack:end !important;justify-content:flex-end !important}.justify-content-md-center{-webkit-box-pack:center !important;-ms-flex-pack:center !important;justify-content:center !important}.justify-content-md-between{-webkit-box-pack:justify !important;-ms-flex-pack:justify !important;justify-content:space-between !important}.justify-content-md-around{-ms-flex-pack:distribute !important;justify-content:space-around !important}.align-items-md-start{-webkit-box-align:start !important;-ms-flex-align:start !important;align-items:flex-start !important}.align-items-md-end{-webkit-box-align:end !important;-ms-flex-align:end !important;align-items:flex-end !important}.align-items-md-center{-webkit-box-align:center !important;-ms-flex-align:center !important;align-items:center !important}.align-items-md-baseline{-webkit-box-align:baseline !important;-ms-flex-align:baseline !important;align-items:baseline !important}.align-items-md-stretch{-webkit-box-align:stretch !important;-ms-flex-align:stretch !important;align-items:stretch !important}.align-content-md-start{-ms-flex-line-pack:start !important;align-content:flex-start !important}.align-content-md-end{-ms-flex-line-pack:end !important;align-content:flex-end !important}.align-content-md-center{-ms-flex-line-pack:center !important;align-content:center !important}.align-content-md-between{-ms-flex-line-pack:justify !important;align-content:space-between !important}.align-content-md-around{-ms-flex-line-pack:distribute !important;align-content:space-around !important}.align-content-md-stretch{-ms-flex-line-pack:stretch !important;align-content:stretch !important}.align-self-md-auto{-ms-flex-item-align:auto !important;align-self:auto !important}.align-self-md-start{-ms-flex-item-align:start !important;align-self:flex-start !important}.align-self-md-end{-ms-flex-item-align:end !important;align-self:flex-end !important}.align-self-md-center{-ms-flex-item-align:center !important;align-self:center !important}.align-self-md-baseline{-ms-flex-item-align:baseline !important;align-self:baseline !important}.align-self-md-stretch{-ms-flex-item-align:stretch !important;align-self:stretch !important}}@media (min-width: 992px){.flex-lg-row{-webkit-box-orient:horizontal !important;-webkit-box-direction:normal !important;-ms-flex-direction:row !important;flex-direction:row !important}.flex-lg-column{-webkit-box-orient:vertical !important;-webkit-box-direction:normal !important;-ms-flex-direction:column !important;flex-direction:column !important}.flex-lg-row-reverse{-webkit-box-orient:horizontal !important;-webkit-box-direction:reverse !important;-ms-flex-direction:row-reverse !important;flex-direction:row-reverse !important}.flex-lg-column-reverse{-webkit-box-orient:vertical !important;-webkit-box-direction:reverse !important;-ms-flex-direction:column-reverse !important;flex-direction:column-reverse !important}.flex-lg-wrap{-ms-flex-wrap:wrap !important;flex-wrap:wrap !important}.flex-lg-nowrap{-ms-flex-wrap:nowrap !important;flex-wrap:nowrap !important}.flex-lg-wrap-reverse{-ms-flex-wrap:wrap-reverse !important;flex-wrap:wrap-reverse !important}.flex-lg-fill{-webkit-box-flex:1 !important;-ms-flex:1 1 auto !important;flex:1 1 auto !important}.flex-lg-grow-0{-webkit-box-flex:0 !important;-ms-flex-positive:0 !important;flex-grow:0 !important}.flex-lg-grow-1{-webkit-box-flex:1 !important;-ms-flex-positive:1 !important;flex-grow:1 !important}.flex-lg-shrink-0{-ms-flex-negative:0 !important;flex-shrink:0 !important}.flex-lg-shrink-1{-ms-flex-negative:1 !important;flex-shrink:1 !important}.justify-content-lg-start{-webkit-box-pack:start !important;-ms-flex-pack:start !important;justify-content:flex-start !important}.justify-content-lg-end{-webkit-box-pack:end !important;-ms-flex-pack:end !important;justify-content:flex-end !important}.justify-content-lg-center{-webkit-box-pack:center !important;-ms-flex-pack:center !important;justify-content:center !important}.justify-content-lg-between{-webkit-box-pack:justify !important;-ms-flex-pack:justify !important;justify-content:space-between !important}.justify-content-lg-around{-ms-flex-pack:distribute !important;justify-content:space-around !important}.align-items-lg-start{-webkit-box-align:start !important;-ms-flex-align:start !important;align-items:flex-start !important}.align-items-lg-end{-webkit-box-align:end !important;-ms-flex-align:end !important;align-items:flex-end !important}.align-items-lg-center{-webkit-box-align:center !important;-ms-flex-align:center !important;align-items:center !important}.align-items-lg-baseline{-webkit-box-align:baseline !important;-ms-flex-align:baseline !important;align-items:baseline !important}.align-items-lg-stretch{-webkit-box-align:stretch !important;-ms-flex-align:stretch !important;align-items:stretch !important}.align-content-lg-start{-ms-flex-line-pack:start !important;align-content:flex-start !important}.align-content-lg-end{-ms-flex-line-pack:end !important;align-content:flex-end !important}.align-content-lg-center{-ms-flex-line-pack:center !important;align-content:center !important}.align-content-lg-between{-ms-flex-line-pack:justify !important;align-content:space-between !important}.align-content-lg-around{-ms-flex-line-pack:distribute !important;align-content:space-around !important}.align-content-lg-stretch{-ms-flex-line-pack:stretch !important;align-content:stretch !important}.align-self-lg-auto{-ms-flex-item-align:auto !important;align-self:auto !important}.align-self-lg-start{-ms-flex-item-align:start !important;align-self:flex-start !important}.align-self-lg-end{-ms-flex-item-align:end !important;align-self:flex-end !important}.align-self-lg-center{-ms-flex-item-align:center !important;align-self:center !important}.align-self-lg-baseline{-ms-flex-item-align:baseline !important;align-self:baseline !important}.align-self-lg-stretch{-ms-flex-item-align:stretch !important;align-self:stretch !important}}@media (min-width: 1200px){.flex-xl-row{-webkit-box-orient:horizontal !important;-webkit-box-direction:normal !important;-ms-flex-direction:row !important;flex-direction:row !important}.flex-xl-column{-webkit-box-orient:vertical !important;-webkit-box-direction:normal !important;-ms-flex-direction:column !important;flex-direction:column !important}.flex-xl-row-reverse{-webkit-box-orient:horizontal !important;-webkit-box-direction:reverse !important;-ms-flex-direction:row-reverse !important;flex-direction:row-reverse !important}.flex-xl-column-reverse{-webkit-box-orient:vertical !important;-webkit-box-direction:reverse !important;-ms-flex-direction:column-reverse !important;flex-direction:column-reverse !important}.flex-xl-wrap{-ms-flex-wrap:wrap !important;flex-wrap:wrap !important}.flex-xl-nowrap{-ms-flex-wrap:nowrap !important;flex-wrap:nowrap !important}.flex-xl-wrap-reverse{-ms-flex-wrap:wrap-reverse !important;flex-wrap:wrap-reverse !important}.flex-xl-fill{-webkit-box-flex:1 !important;-ms-flex:1 1 auto !important;flex:1 1 auto !important}.flex-xl-grow-0{-webkit-box-flex:0 !important;-ms-flex-positive:0 !important;flex-grow:0 !important}.flex-xl-grow-1{-webkit-box-flex:1 !important;-ms-flex-positive:1 !important;flex-grow:1 !important}.flex-xl-shrink-0{-ms-flex-negative:0 !important;flex-shrink:0 !important}.flex-xl-shrink-1{-ms-flex-negative:1 !important;flex-shrink:1 !important}.justify-content-xl-start{-webkit-box-pack:start !important;-ms-flex-pack:start !important;justify-content:flex-start !important}.justify-content-xl-end{-webkit-box-pack:end !important;-ms-flex-pack:end !important;justify-content:flex-end !important}.justify-content-xl-center{-webkit-box-pack:center !important;-ms-flex-pack:center !important;justify-content:center !important}.justify-content-xl-between{-webkit-box-pack:justify !important;-ms-flex-pack:justify !important;justify-content:space-between !important}.justify-content-xl-around{-ms-flex-pack:distribute !important;justify-content:space-around !important}.align-items-xl-start{-webkit-box-align:start !important;-ms-flex-align:start !important;align-items:flex-start !important}.align-items-xl-end{-webkit-box-align:end !important;-ms-flex-align:end !important;align-items:flex-end !important}.align-items-xl-center{-webkit-box-align:center !important;-ms-flex-align:center !important;align-items:center !important}.align-items-xl-baseline{-webkit-box-align:baseline !important;-ms-flex-align:baseline !important;align-items:baseline !important}.align-items-xl-stretch{-webkit-box-align:stretch !important;-ms-flex-align:stretch !important;align-items:stretch !important}.align-content-xl-start{-ms-flex-line-pack:start !important;align-content:flex-start !important}.align-content-xl-end{-ms-flex-line-pack:end !important;align-content:flex-end !important}.align-content-xl-center{-ms-flex-line-pack:center !important;align-content:center !important}.align-content-xl-between{-ms-flex-line-pack:justify !important;align-content:space-between !important}.align-content-xl-around{-ms-flex-line-pack:distribute !important;align-content:space-around !important}.align-content-xl-stretch{-ms-flex-line-pack:stretch !important;align-content:stretch !important}.align-self-xl-auto{-ms-flex-item-align:auto !important;align-self:auto !important}.align-self-xl-start{-ms-flex-item-align:start !important;align-self:flex-start !important}.align-self-xl-end{-ms-flex-item-align:end !important;align-self:flex-end !important}.align-self-xl-center{-ms-flex-item-align:center !important;align-self:center !important}.align-self-xl-baseline{-ms-flex-item-align:baseline !important;align-self:baseline !important}.align-self-xl-stretch{-ms-flex-item-align:stretch !important;align-self:stretch !important}}.float-left{float:left !important}.float-right{float:right !important}.float-none{float:none !important}@media (min-width: 576px){.float-sm-left{float:left !important}.float-sm-right{float:right !important}.float-sm-none{float:none !important}}@media (min-width: 768px){.float-md-left{float:left !important}.float-md-right{float:right !important}.float-md-none{float:none !important}}@media (min-width: 992px){.float-lg-left{float:left !important}.float-lg-right{float:right !important}.float-lg-none{float:none !important}}@media (min-width: 1200px){.float-xl-left{float:left !important}.float-xl-right{float:right !important}.float-xl-none{float:none !important}}.position-static{position:static !important}.position-relative{position:relative !important}.position-absolute{position:absolute !important}.position-fixed{position:fixed !important}.position-sticky{position:-webkit-sticky !important;position:sticky !important}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}@supports (position: -webkit-sticky) or (position: sticky){.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal}.shadow-sm{-webkit-box-shadow:0 0.125rem 0.25rem rgba(0,0,0,0.075) !important;box-shadow:0 0.125rem 0.25rem rgba(0,0,0,0.075) !important}.shadow{-webkit-box-shadow:0 0.5rem 1rem rgba(0,0,0,0.15) !important;box-shadow:0 0.5rem 1rem rgba(0,0,0,0.15) !important}.shadow-lg{-webkit-box-shadow:0 1rem 3rem rgba(0,0,0,0.175) !important;box-shadow:0 1rem 3rem rgba(0,0,0,0.175) !important}.shadow-none{-webkit-box-shadow:none !important;box-shadow:none !important}.w-25{width:25% !important}.w-50{width:50% !important}.w-75{width:75% !important}.w-100{width:100% !important}.w-auto{width:auto !important}.h-25{height:25% !important}.h-50{height:50% !important}.h-75{height:75% !important}.h-100{height:100% !important}.h-auto{height:auto !important}.mw-100{max-width:100% !important}.mh-100{max-height:100% !important}.m-0{margin:0 !important}.mt-0,.my-0{margin-top:0 !important}.mr-0,.mx-0{margin-right:0 !important}.mb-0,.my-0{margin-bottom:0 !important}.ml-0,.mx-0{margin-left:0 !important}.m-1{margin:0.25rem !important}.mt-1,.my-1{margin-top:0.25rem !important}.mr-1,.mx-1{margin-right:0.25rem !important}.mb-1,.my-1{margin-bottom:0.25rem !important}.ml-1,.mx-1{margin-left:0.25rem !important}.m-2{margin:0.5rem !important}.mt-2,.my-2{margin-top:0.5rem !important}.mr-2,.mx-2{margin-right:0.5rem !important}.mb-2,.my-2{margin-bottom:0.5rem !important}.ml-2,.mx-2{margin-left:0.5rem !important}.m-3{margin:1rem !important}.mt-3,.my-3{margin-top:1rem !important}.mr-3,.mx-3{margin-right:1rem !important}.mb-3,.my-3{margin-bottom:1rem !important}.ml-3,.mx-3{margin-left:1rem !important}.m-4{margin:1.5rem !important}.mt-4,.my-4{margin-top:1.5rem !important}.mr-4,.mx-4{margin-right:1.5rem !important}.mb-4,.my-4{margin-bottom:1.5rem !important}.ml-4,.mx-4{margin-left:1.5rem !important}.m-5{margin:3rem !important}.mt-5,.my-5{margin-top:3rem !important}.mr-5,.mx-5{margin-right:3rem !important}.mb-5,.my-5{margin-bottom:3rem !important}.ml-5,.mx-5{margin-left:3rem !important}.p-0{padding:0 !important}.pt-0,.py-0{padding-top:0 !important}.pr-0,.px-0{padding-right:0 !important}.pb-0,.py-0{padding-bottom:0 !important}.pl-0,.px-0{padding-left:0 !important}.p-1{padding:0.25rem !important}.pt-1,.py-1{padding-top:0.25rem !important}.pr-1,.px-1{padding-right:0.25rem !important}.pb-1,.py-1{padding-bottom:0.25rem !important}.pl-1,.px-1{padding-left:0.25rem !important}.p-2{padding:0.5rem !important}.pt-2,.py-2{padding-top:0.5rem !important}.pr-2,.px-2{padding-right:0.5rem !important}.pb-2,.py-2{padding-bottom:0.5rem !important}.pl-2,.px-2{padding-left:0.5rem !important}.p-3{padding:1rem !important}.pt-3,.py-3{padding-top:1rem !important}.pr-3,.px-3{padding-right:1rem !important}.pb-3,.py-3{padding-bottom:1rem !important}.pl-3,.px-3{padding-left:1rem !important}.p-4{padding:1.5rem !important}.pt-4,.py-4{padding-top:1.5rem !important}.pr-4,.px-4{padding-right:1.5rem !important}.pb-4,.py-4{padding-bottom:1.5rem !important}.pl-4,.px-4{padding-left:1.5rem !important}.p-5{padding:3rem !important}.pt-5,.py-5{padding-top:3rem !important}.pr-5,.px-5{padding-right:3rem !important}.pb-5,.py-5{padding-bottom:3rem !important}.pl-5,.px-5{padding-left:3rem !important}.m-auto{margin:auto !important}.mt-auto,.my-auto{margin-top:auto !important}.mr-auto,.mx-auto{margin-right:auto !important}.mb-auto,.my-auto{margin-bottom:auto !important}.ml-auto,.mx-auto{margin-left:auto !important}@media (min-width: 576px){.m-sm-0{margin:0 !important}.mt-sm-0,.my-sm-0{margin-top:0 !important}.mr-sm-0,.mx-sm-0{margin-right:0 !important}.mb-sm-0,.my-sm-0{margin-bottom:0 !important}.ml-sm-0,.mx-sm-0{margin-left:0 !important}.m-sm-1{margin:0.25rem !important}.mt-sm-1,.my-sm-1{margin-top:0.25rem !important}.mr-sm-1,.mx-sm-1{margin-right:0.25rem !important}.mb-sm-1,.my-sm-1{margin-bottom:0.25rem !important}.ml-sm-1,.mx-sm-1{margin-left:0.25rem !important}.m-sm-2{margin:0.5rem !important}.mt-sm-2,.my-sm-2{margin-top:0.5rem !important}.mr-sm-2,.mx-sm-2{margin-right:0.5rem !important}.mb-sm-2,.my-sm-2{margin-bottom:0.5rem !important}.ml-sm-2,.mx-sm-2{margin-left:0.5rem !important}.m-sm-3{margin:1rem !important}.mt-sm-3,.my-sm-3{margin-top:1rem !important}.mr-sm-3,.mx-sm-3{margin-right:1rem !important}.mb-sm-3,.my-sm-3{margin-bottom:1rem !important}.ml-sm-3,.mx-sm-3{margin-left:1rem !important}.m-sm-4{margin:1.5rem !important}.mt-sm-4,.my-sm-4{margin-top:1.5rem !important}.mr-sm-4,.mx-sm-4{margin-right:1.5rem !important}.mb-sm-4,.my-sm-4{margin-bottom:1.5rem !important}.ml-sm-4,.mx-sm-4{margin-left:1.5rem !important}.m-sm-5{margin:3rem !important}.mt-sm-5,.my-sm-5{margin-top:3rem !important}.mr-sm-5,.mx-sm-5{margin-right:3rem !important}.mb-sm-5,.my-sm-5{margin-bottom:3rem !important}.ml-sm-5,.mx-sm-5{margin-left:3rem !important}.p-sm-0{padding:0 !important}.pt-sm-0,.py-sm-0{padding-top:0 !important}.pr-sm-0,.px-sm-0{padding-right:0 !important}.pb-sm-0,.py-sm-0{padding-bottom:0 !important}.pl-sm-0,.px-sm-0{padding-left:0 !important}.p-sm-1{padding:0.25rem !important}.pt-sm-1,.py-sm-1{padding-top:0.25rem !important}.pr-sm-1,.px-sm-1{padding-right:0.25rem !important}.pb-sm-1,.py-sm-1{padding-bottom:0.25rem !important}.pl-sm-1,.px-sm-1{padding-left:0.25rem !important}.p-sm-2{padding:0.5rem !important}.pt-sm-2,.py-sm-2{padding-top:0.5rem !important}.pr-sm-2,.px-sm-2{padding-right:0.5rem !important}.pb-sm-2,.py-sm-2{padding-bottom:0.5rem !important}.pl-sm-2,.px-sm-2{padding-left:0.5rem !important}.p-sm-3{padding:1rem !important}.pt-sm-3,.py-sm-3{padding-top:1rem !important}.pr-sm-3,.px-sm-3{padding-right:1rem !important}.pb-sm-3,.py-sm-3{padding-bottom:1rem !important}.pl-sm-3,.px-sm-3{padding-left:1rem !important}.p-sm-4{padding:1.5rem !important}.pt-sm-4,.py-sm-4{padding-top:1.5rem !important}.pr-sm-4,.px-sm-4{padding-right:1.5rem !important}.pb-sm-4,.py-sm-4{padding-bottom:1.5rem !important}.pl-sm-4,.px-sm-4{padding-left:1.5rem !important}.p-sm-5{padding:3rem !important}.pt-sm-5,.py-sm-5{padding-top:3rem !important}.pr-sm-5,.px-sm-5{padding-right:3rem !important}.pb-sm-5,.py-sm-5{padding-bottom:3rem !important}.pl-sm-5,.px-sm-5{padding-left:3rem !important}.m-sm-auto{margin:auto !important}.mt-sm-auto,.my-sm-auto{margin-top:auto !important}.mr-sm-auto,.mx-sm-auto{margin-right:auto !important}.mb-sm-auto,.my-sm-auto{margin-bottom:auto !important}.ml-sm-auto,.mx-sm-auto{margin-left:auto !important}}@media (min-width: 768px){.m-md-0{margin:0 !important}.mt-md-0,.my-md-0{margin-top:0 !important}.mr-md-0,.mx-md-0{margin-right:0 !important}.mb-md-0,.my-md-0{margin-bottom:0 !important}.ml-md-0,.mx-md-0{margin-left:0 !important}.m-md-1{margin:0.25rem !important}.mt-md-1,.my-md-1{margin-top:0.25rem !important}.mr-md-1,.mx-md-1{margin-right:0.25rem !important}.mb-md-1,.my-md-1{margin-bottom:0.25rem !important}.ml-md-1,.mx-md-1{margin-left:0.25rem !important}.m-md-2{margin:0.5rem !important}.mt-md-2,.my-md-2{margin-top:0.5rem !important}.mr-md-2,.mx-md-2{margin-right:0.5rem !important}.mb-md-2,.my-md-2{margin-bottom:0.5rem !important}.ml-md-2,.mx-md-2{margin-left:0.5rem !important}.m-md-3{margin:1rem !important}.mt-md-3,.my-md-3{margin-top:1rem !important}.mr-md-3,.mx-md-3{margin-right:1rem !important}.mb-md-3,.my-md-3{margin-bottom:1rem !important}.ml-md-3,.mx-md-3{margin-left:1rem !important}.m-md-4{margin:1.5rem !important}.mt-md-4,.my-md-4{margin-top:1.5rem !important}.mr-md-4,.mx-md-4{margin-right:1.5rem !important}.mb-md-4,.my-md-4{margin-bottom:1.5rem !important}.ml-md-4,.mx-md-4{margin-left:1.5rem !important}.m-md-5{margin:3rem !important}.mt-md-5,.my-md-5{margin-top:3rem !important}.mr-md-5,.mx-md-5{margin-right:3rem !important}.mb-md-5,.my-md-5{margin-bottom:3rem !important}.ml-md-5,.mx-md-5{margin-left:3rem !important}.p-md-0{padding:0 !important}.pt-md-0,.py-md-0{padding-top:0 !important}.pr-md-0,.px-md-0{padding-right:0 !important}.pb-md-0,.py-md-0{padding-bottom:0 !important}.pl-md-0,.px-md-0{padding-left:0 !important}.p-md-1{padding:0.25rem !important}.pt-md-1,.py-md-1{padding-top:0.25rem !important}.pr-md-1,.px-md-1{padding-right:0.25rem !important}.pb-md-1,.py-md-1{padding-bottom:0.25rem !important}.pl-md-1,.px-md-1{padding-left:0.25rem !important}.p-md-2{padding:0.5rem !important}.pt-md-2,.py-md-2{padding-top:0.5rem !important}.pr-md-2,.px-md-2{padding-right:0.5rem !important}.pb-md-2,.py-md-2{padding-bottom:0.5rem !important}.pl-md-2,.px-md-2{padding-left:0.5rem !important}.p-md-3{padding:1rem !important}.pt-md-3,.py-md-3{padding-top:1rem !important}.pr-md-3,.px-md-3{padding-right:1rem !important}.pb-md-3,.py-md-3{padding-bottom:1rem !important}.pl-md-3,.px-md-3{padding-left:1rem !important}.p-md-4{padding:1.5rem !important}.pt-md-4,.py-md-4{padding-top:1.5rem !important}.pr-md-4,.px-md-4{padding-right:1.5rem !important}.pb-md-4,.py-md-4{padding-bottom:1.5rem !important}.pl-md-4,.px-md-4{padding-left:1.5rem !important}.p-md-5{padding:3rem !important}.pt-md-5,.py-md-5{padding-top:3rem !important}.pr-md-5,.px-md-5{padding-right:3rem !important}.pb-md-5,.py-md-5{padding-bottom:3rem !important}.pl-md-5,.px-md-5{padding-left:3rem !important}.m-md-auto{margin:auto !important}.mt-md-auto,.my-md-auto{margin-top:auto !important}.mr-md-auto,.mx-md-auto{margin-right:auto !important}.mb-md-auto,.my-md-auto{margin-bottom:auto !important}.ml-md-auto,.mx-md-auto{margin-left:auto !important}}@media (min-width: 992px){.m-lg-0{margin:0 !important}.mt-lg-0,.my-lg-0{margin-top:0 !important}.mr-lg-0,.mx-lg-0{margin-right:0 !important}.mb-lg-0,.my-lg-0{margin-bottom:0 !important}.ml-lg-0,.mx-lg-0{margin-left:0 !important}.m-lg-1{margin:0.25rem !important}.mt-lg-1,.my-lg-1{margin-top:0.25rem !important}.mr-lg-1,.mx-lg-1{margin-right:0.25rem !important}.mb-lg-1,.my-lg-1{margin-bottom:0.25rem !important}.ml-lg-1,.mx-lg-1{margin-left:0.25rem !important}.m-lg-2{margin:0.5rem !important}.mt-lg-2,.my-lg-2{margin-top:0.5rem !important}.mr-lg-2,.mx-lg-2{margin-right:0.5rem !important}.mb-lg-2,.my-lg-2{margin-bottom:0.5rem !important}.ml-lg-2,.mx-lg-2{margin-left:0.5rem !important}.m-lg-3{margin:1rem !important}.mt-lg-3,.my-lg-3{margin-top:1rem !important}.mr-lg-3,.mx-lg-3{margin-right:1rem !important}.mb-lg-3,.my-lg-3{margin-bottom:1rem !important}.ml-lg-3,.mx-lg-3{margin-left:1rem !important}.m-lg-4{margin:1.5rem !important}.mt-lg-4,.my-lg-4{margin-top:1.5rem !important}.mr-lg-4,.mx-lg-4{margin-right:1.5rem !important}.mb-lg-4,.my-lg-4{margin-bottom:1.5rem !important}.ml-lg-4,.mx-lg-4{margin-left:1.5rem !important}.m-lg-5{margin:3rem !important}.mt-lg-5,.my-lg-5{margin-top:3rem !important}.mr-lg-5,.mx-lg-5{margin-right:3rem !important}.mb-lg-5,.my-lg-5{margin-bottom:3rem !important}.ml-lg-5,.mx-lg-5{margin-left:3rem !important}.p-lg-0{padding:0 !important}.pt-lg-0,.py-lg-0{padding-top:0 !important}.pr-lg-0,.px-lg-0{padding-right:0 !important}.pb-lg-0,.py-lg-0{padding-bottom:0 !important}.pl-lg-0,.px-lg-0{padding-left:0 !important}.p-lg-1{padding:0.25rem !important}.pt-lg-1,.py-lg-1{padding-top:0.25rem !important}.pr-lg-1,.px-lg-1{padding-right:0.25rem !important}.pb-lg-1,.py-lg-1{padding-bottom:0.25rem !important}.pl-lg-1,.px-lg-1{padding-left:0.25rem !important}.p-lg-2{padding:0.5rem !important}.pt-lg-2,.py-lg-2{padding-top:0.5rem !important}.pr-lg-2,.px-lg-2{padding-right:0.5rem !important}.pb-lg-2,.py-lg-2{padding-bottom:0.5rem !important}.pl-lg-2,.px-lg-2{padding-left:0.5rem !important}.p-lg-3{padding:1rem !important}.pt-lg-3,.py-lg-3{padding-top:1rem !important}.pr-lg-3,.px-lg-3{padding-right:1rem !important}.pb-lg-3,.py-lg-3{padding-bottom:1rem !important}.pl-lg-3,.px-lg-3{padding-left:1rem !important}.p-lg-4{padding:1.5rem !important}.pt-lg-4,.py-lg-4{padding-top:1.5rem !important}.pr-lg-4,.px-lg-4{padding-right:1.5rem !important}.pb-lg-4,.py-lg-4{padding-bottom:1.5rem !important}.pl-lg-4,.px-lg-4{padding-left:1.5rem !important}.p-lg-5{padding:3rem !important}.pt-lg-5,.py-lg-5{padding-top:3rem !important}.pr-lg-5,.px-lg-5{padding-right:3rem !important}.pb-lg-5,.py-lg-5{padding-bottom:3rem !important}.pl-lg-5,.px-lg-5{padding-left:3rem !important}.m-lg-auto{margin:auto !important}.mt-lg-auto,.my-lg-auto{margin-top:auto !important}.mr-lg-auto,.mx-lg-auto{margin-right:auto !important}.mb-lg-auto,.my-lg-auto{margin-bottom:auto !important}.ml-lg-auto,.mx-lg-auto{margin-left:auto !important}}@media (min-width: 1200px){.m-xl-0{margin:0 !important}.mt-xl-0,.my-xl-0{margin-top:0 !important}.mr-xl-0,.mx-xl-0{margin-right:0 !important}.mb-xl-0,.my-xl-0{margin-bottom:0 !important}.ml-xl-0,.mx-xl-0{margin-left:0 !important}.m-xl-1{margin:0.25rem !important}.mt-xl-1,.my-xl-1{margin-top:0.25rem !important}.mr-xl-1,.mx-xl-1{margin-right:0.25rem !important}.mb-xl-1,.my-xl-1{margin-bottom:0.25rem !important}.ml-xl-1,.mx-xl-1{margin-left:0.25rem !important}.m-xl-2{margin:0.5rem !important}.mt-xl-2,.my-xl-2{margin-top:0.5rem !important}.mr-xl-2,.mx-xl-2{margin-right:0.5rem !important}.mb-xl-2,.my-xl-2{margin-bottom:0.5rem !important}.ml-xl-2,.mx-xl-2{margin-left:0.5rem !important}.m-xl-3{margin:1rem !important}.mt-xl-3,.my-xl-3{margin-top:1rem !important}.mr-xl-3,.mx-xl-3{margin-right:1rem !important}.mb-xl-3,.my-xl-3{margin-bottom:1rem !important}.ml-xl-3,.mx-xl-3{margin-left:1rem !important}.m-xl-4{margin:1.5rem !important}.mt-xl-4,.my-xl-4{margin-top:1.5rem !important}.mr-xl-4,.mx-xl-4{margin-right:1.5rem !important}.mb-xl-4,.my-xl-4{margin-bottom:1.5rem !important}.ml-xl-4,.mx-xl-4{margin-left:1.5rem !important}.m-xl-5{margin:3rem !important}.mt-xl-5,.my-xl-5{margin-top:3rem !important}.mr-xl-5,.mx-xl-5{margin-right:3rem !important}.mb-xl-5,.my-xl-5{margin-bottom:3rem !important}.ml-xl-5,.mx-xl-5{margin-left:3rem !important}.p-xl-0{padding:0 !important}.pt-xl-0,.py-xl-0{padding-top:0 !important}.pr-xl-0,.px-xl-0{padding-right:0 !important}.pb-xl-0,.py-xl-0{padding-bottom:0 !important}.pl-xl-0,.px-xl-0{padding-left:0 !important}.p-xl-1{padding:0.25rem !important}.pt-xl-1,.py-xl-1{padding-top:0.25rem !important}.pr-xl-1,.px-xl-1{padding-right:0.25rem !important}.pb-xl-1,.py-xl-1{padding-bottom:0.25rem !important}.pl-xl-1,.px-xl-1{padding-left:0.25rem !important}.p-xl-2{padding:0.5rem !important}.pt-xl-2,.py-xl-2{padding-top:0.5rem !important}.pr-xl-2,.px-xl-2{padding-right:0.5rem !important}.pb-xl-2,.py-xl-2{padding-bottom:0.5rem !important}.pl-xl-2,.px-xl-2{padding-left:0.5rem !important}.p-xl-3{padding:1rem !important}.pt-xl-3,.py-xl-3{padding-top:1rem !important}.pr-xl-3,.px-xl-3{padding-right:1rem !important}.pb-xl-3,.py-xl-3{padding-bottom:1rem !important}.pl-xl-3,.px-xl-3{padding-left:1rem !important}.p-xl-4{padding:1.5rem !important}.pt-xl-4,.py-xl-4{padding-top:1.5rem !important}.pr-xl-4,.px-xl-4{padding-right:1.5rem !important}.pb-xl-4,.py-xl-4{padding-bottom:1.5rem !important}.pl-xl-4,.px-xl-4{padding-left:1.5rem !important}.p-xl-5{padding:3rem !important}.pt-xl-5,.py-xl-5{padding-top:3rem !important}.pr-xl-5,.px-xl-5{padding-right:3rem !important}.pb-xl-5,.py-xl-5{padding-bottom:3rem !important}.pl-xl-5,.px-xl-5{padding-left:3rem !important}.m-xl-auto{margin:auto !important}.mt-xl-auto,.my-xl-auto{margin-top:auto !important}.mr-xl-auto,.mx-xl-auto{margin-right:auto !important}.mb-xl-auto,.my-xl-auto{margin-bottom:auto !important}.ml-xl-auto,.mx-xl-auto{margin-left:auto !important}}.text-monospace{font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}.text-justify{text-align:justify !important}.text-nowrap{white-space:nowrap !important}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-left{text-align:left !important}.text-right{text-align:right !important}.text-center{text-align:center !important}@media (min-width: 576px){.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}.text-sm-center{text-align:center !important}}@media (min-width: 768px){.text-md-left{text-align:left !important}.text-md-right{text-align:right !important}.text-md-center{text-align:center !important}}@media (min-width: 992px){.text-lg-left{text-align:left !important}.text-lg-right{text-align:right !important}.text-lg-center{text-align:center !important}}@media (min-width: 1200px){.text-xl-left{text-align:left !important}.text-xl-right{text-align:right !important}.text-xl-center{text-align:center !important}}.text-lowercase{text-transform:lowercase !important}.text-uppercase{text-transform:uppercase !important}.text-capitalize{text-transform:capitalize !important}.font-weight-light{font-weight:300 !important}.font-weight-normal{font-weight:400 !important}.font-weight-bold{font-weight:700 !important}.font-italic{font-style:italic !important}.text-white{color:#fff !important}.text-primary{color:#2FA4E7 !important}a.text-primary:hover,a.text-primary:focus{color:#178acc !important}.text-secondary{color:#e9ecef !important}a.text-secondary:hover,a.text-secondary:focus{color:#cbd3da !important}.text-success{color:#73A839 !important}a.text-success:hover,a.text-success:focus{color:#59822c !important}.text-info{color:#033C73 !important}a.text-info:hover,a.text-info:focus{color:#022241 !important}.text-warning{color:#DD5600 !important}a.text-warning:hover,a.text-warning:focus{color:#aa4200 !important}.text-danger{color:#C71C22 !important}a.text-danger:hover,a.text-danger:focus{color:#9a161a !important}.text-light{color:#f8f9fa !important}a.text-light:hover,a.text-light:focus{color:#dae0e5 !important}.text-dark{color:#343a40 !important}a.text-dark:hover,a.text-dark:focus{color:#1d2124 !important}.text-body{color:#495057 !important}.text-muted{color:#868e96 !important}.text-black-50{color:rgba(0,0,0,0.5) !important}.text-white-50{color:rgba(255,255,255,0.5) !important}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.visible{visibility:visible !important}.invisible{visibility:hidden !important}@media print{*,*::before,*::after{text-shadow:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}a:not(.btn){text-decoration:underline}abbr[title]::after{content:" (" attr(title) ")"}pre{white-space:pre-wrap !important}pre,blockquote{border:1px solid #adb5bd;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}@page{size:a3}body{min-width:992px !important}.container{min-width:992px !important}.navbar{display:none}.badge{border:1px solid #000}.table{border-collapse:collapse !important}.table td,.table th{background-color:#fff !important}.table-bordered th,.table-bordered td{border:1px solid #dee2e6 !important}.table-dark{color:inherit}.table-dark th,.table-dark td,.table-dark thead th,.table-dark tbody+tbody{border-color:#dee2e6}.table .thead-dark th{color:inherit;border-color:#dee2e6}}.bg-primary{background-image:-webkit-gradient(linear, left top, left bottom, from(#54b4eb), color-stop(60%, #2FA4E7), to(#1d9ce5));background-image:linear-gradient(#54b4eb, #2FA4E7 60%, #1d9ce5);background-repeat:no-repeat}.bg-dark{background-image:-webkit-gradient(linear, left top, left bottom, from(#04519b), color-stop(60%, #033C73), to(#02325f));background-image:linear-gradient(#04519b, #033C73 60%, #02325f);background-repeat:no-repeat}.bg-light{background-image:-webkit-gradient(linear, left top, left bottom, from(white), color-stop(60%, #e9ecef), to(#e3e7eb));background-image:linear-gradient(white, #e9ecef 60%, #e3e7eb);background-repeat:no-repeat}.navbar-brand,.nav-link{text-shadow:0 1px 0 rgba(0,0,0,0.05)}.btn{text-shadow:0 1px 0 rgba(0,0,0,0.05)}.btn-primary{background-image:-webkit-gradient(linear, left top, left bottom, from(#54b4eb), color-stop(60%, #2FA4E7), to(#1d9ce5));background-image:linear-gradient(#54b4eb, #2FA4E7 60%, #1d9ce5);background-repeat:no-repeat}.btn-secondary{background-image:-webkit-gradient(linear, left top, left bottom, from(white), color-stop(60%, #e9ecef), to(#dde2e6));background-image:linear-gradient(white, #e9ecef 60%, #dde2e6);background-repeat:no-repeat;color:#495057}.btn-success{background-image:-webkit-gradient(linear, left top, left bottom, from(#88c149), color-stop(60%, #73A839), to(#699934));background-image:linear-gradient(#88c149, #73A839 60%, #699934);background-repeat:no-repeat}.btn-info{background-image:-webkit-gradient(linear, left top, left bottom, from(#04519b), color-stop(60%, #033C73), to(#02325f));background-image:linear-gradient(#04519b, #033C73 60%, #02325f);background-repeat:no-repeat}.btn-warning{background-image:-webkit-gradient(linear, left top, left bottom, from(#ff6707), color-stop(60%, #DD5600), to(#c94e00));background-image:linear-gradient(#ff6707, #DD5600 60%, #c94e00);background-repeat:no-repeat}.btn-danger{background-image:-webkit-gradient(linear, left top, left bottom, from(#e12b31), color-stop(60%, #C71C22), to(#b5191f));background-image:linear-gradient(#e12b31, #C71C22 60%, #b5191f);background-repeat:no-repeat}.btn-light{background-image:-webkit-gradient(linear, left top, left bottom, from(white), color-stop(60%, #f8f9fa), to(#eceff2));background-image:linear-gradient(white, #f8f9fa 60%, #eceff2);background-repeat:no-repeat}.btn-dark{background-image:-webkit-gradient(linear, left top, left bottom, from(#464e57), color-stop(60%, #343a40), to(#2b3035));background-image:linear-gradient(#464e57, #343a40 60%, #2b3035);background-repeat:no-repeat}.bg-primary h1,.bg-primary h2,.bg-primary h3,.bg-primary h4,.bg-primary h5,.bg-primary h6,.bg-success h1,.bg-success h2,.bg-success h3,.bg-success h4,.bg-success h5,.bg-success h6,.bg-info h1,.bg-info h2,.bg-info h3,.bg-info h4,.bg-info h5,.bg-info h6,.bg-warning h1,.bg-warning h2,.bg-warning h3,.bg-warning h4,.bg-warning h5,.bg-warning h6,.bg-danger h1,.bg-danger h2,.bg-danger h3,.bg-danger h4,.bg-danger h5,.bg-danger h6,.bg-dark h1,.bg-dark h2,.bg-dark h3,.bg-dark h4,.bg-dark h5,.bg-dark h6{color:#fff}.dropdown-menu .dropdown-header{color:#868e96} diff --git a/mkdocs/themes/mkdocs/css/font-awesome-4.5.0.css b/mkdocs/themes/mkdocs/css/font-awesome-4.5.0.css deleted file mode 100644 index d0603cb4b0..0000000000 --- a/mkdocs/themes/mkdocs/css/font-awesome-4.5.0.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.5.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"} diff --git a/mkdocs/themes/mkdocs/css/font-awesome.min.css b/mkdocs/themes/mkdocs/css/font-awesome.min.css new file mode 100644 index 0000000000..540440ce89 --- /dev/null +++ b/mkdocs/themes/mkdocs/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/mkdocs/themes/mkdocs/css/highlight.css b/mkdocs/themes/mkdocs/css/highlight.css deleted file mode 100644 index 0ae40a72f6..0000000000 --- a/mkdocs/themes/mkdocs/css/highlight.css +++ /dev/null @@ -1,124 +0,0 @@ -/* -This is the GitHub theme for highlight.js - -github.com style (c) Vasily Polovnyov - -*/ - -.hljs { - display: block; - overflow-x: auto; - color: #333; - -webkit-text-size-adjust: none; -} - -.hljs-comment, -.diff .hljs-header, -.hljs-javadoc { - color: #998; - font-style: italic; -} - -.hljs-keyword, -.css .rule .hljs-keyword, -.hljs-winutils, -.nginx .hljs-title, -.hljs-subst, -.hljs-request, -.hljs-status { - color: #333; - font-weight: bold; -} - -.hljs-number, -.hljs-hexcolor, -.ruby .hljs-constant { - color: #008080; -} - -.hljs-string, -.hljs-tag .hljs-value, -.hljs-phpdoc, -.hljs-dartdoc, -.tex .hljs-formula { - color: #d14; -} - -.hljs-title, -.hljs-id, -.scss .hljs-preprocessor { - color: #900; - font-weight: bold; -} - -.hljs-list .hljs-keyword, -.hljs-subst { - font-weight: normal; -} - -.hljs-class .hljs-title, -.hljs-type, -.vhdl .hljs-literal, -.tex .hljs-command { - color: #458; - font-weight: bold; -} - -.hljs-tag, -.hljs-tag .hljs-title, -.hljs-rule .hljs-property, -.django .hljs-tag .hljs-keyword { - color: #000080; - font-weight: normal; -} - -.hljs-attribute, -.hljs-variable, -.lisp .hljs-body, -.hljs-name { - color: #008080; -} - -.hljs-regexp { - color: #009926; -} - -.hljs-symbol, -.ruby .hljs-symbol .hljs-string, -.lisp .hljs-keyword, -.clojure .hljs-keyword, -.scheme .hljs-keyword, -.tex .hljs-special, -.hljs-prompt { - color: #990073; -} - -.hljs-built_in { - color: #0086b3; -} - -.hljs-preprocessor, -.hljs-pragma, -.hljs-pi, -.hljs-doctype, -.hljs-shebang, -.hljs-cdata { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - background: #fdd; -} - -.hljs-addition { - background: #dfd; -} - -.diff .hljs-change { - background: #0086b3; -} - -.hljs-chunk { - color: #aaa; -} diff --git a/mkdocs/themes/mkdocs/fonts/FontAwesome.otf b/mkdocs/themes/mkdocs/fonts/FontAwesome.otf index 3ed7f8b48a..401ec0f36e 100644 Binary files a/mkdocs/themes/mkdocs/fonts/FontAwesome.otf and b/mkdocs/themes/mkdocs/fonts/FontAwesome.otf differ diff --git a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.eot b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.eot index 9b6afaedc0..e9f60ca953 100644 Binary files a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.eot and b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.eot differ diff --git a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.svg b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.svg index d05688e9e2..855c845e53 100644 --- a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.svg +++ b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.svg @@ -1,655 +1,2671 @@ - - + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.ttf b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.ttf index 26dea7951a..35acda2fa1 100644 Binary files a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.ttf and b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.ttf differ diff --git a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff index dc35ce3c2c..400014a4b0 100644 Binary files a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff and b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff differ diff --git a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff2 b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff2 index 500e517253..4d13fc6040 100644 Binary files a/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff2 and b/mkdocs/themes/mkdocs/fonts/fontawesome-webfont.woff2 differ diff --git a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.eot b/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a4953ff..0000000000 Binary files a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.svg b/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb5490a2..0000000000 --- a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.ttf b/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc609a..0000000000 Binary files a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff b/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e612858f8..0000000000 Binary files a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff2 b/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b54c3..0000000000 Binary files a/mkdocs/themes/mkdocs/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/mkdocs/themes/mkdocs/js/base.js b/mkdocs/themes/mkdocs/js/base.js index 0001d7f58d..b0f4726bf1 100644 --- a/mkdocs/themes/mkdocs/js/base.js +++ b/mkdocs/themes/mkdocs/js/base.js @@ -1,51 +1,74 @@ -function getSearchTerm() -{ +function getSearchTerm() { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); - for (var i = 0; i < sURLVariables.length; i++) - { + for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); - if (sParameterName[0] == 'q') - { + if (sParameterName[0] == 'q') { return sParameterName[1]; } } } +function applyTopPadding() { + // Update various absolute positions to match where the main container + // starts. This is necessary for handling multi-line nav headers, since + // that pushes the main container down. + var offset = $('body > .container').offset(); + $('html').css('scroll-padding-top', offset.top + 'px'); + $('.bs-sidebar.affix').css('top', offset.top + 'px'); +} + $(document).ready(function() { + applyTopPadding(); + var search_term = getSearchTerm(), $search_modal = $('#mkdocs_search_modal'), $keyboard_modal = $('#mkdocs_keyboard_modal'); - if(search_term){ + if (search_term) { $search_modal.modal(); } - // make sure search input gets autofocus everytime modal opens. - $search_modal.on('shown.bs.modal', function () { + // make sure search input gets autofocus every time modal opens. + $search_modal.on('shown.bs.modal', function() { $search_modal.find('#mkdocs-search-query').focus(); }); + // Close search modal when result is selected + // The links get added later so listen to parent + $('#mkdocs-search-results').click(function(e) { + if ($(e.target).is('a')) { + $search_modal.modal('hide'); + } + }); + + // Populate keyboard modal with proper Keys + $keyboard_modal.find('.help.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.help]; + $keyboard_modal.find('.prev.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.previous]; + $keyboard_modal.find('.next.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.next]; + $keyboard_modal.find('.search.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.search]; + // Keyboard navigation document.addEventListener("keydown", function(e) { if ($(e.target).is(':input')) return true; var key = e.which || e.keyCode || window.event && window.event.keyCode; var page; switch (key) { - case 39: // right arrow - page = $('[role="navigation"] a:contains(Next):first').prop('href'); + case shortcuts.next: + page = $('.navbar a[rel="next"]:first').prop('href'); break; - case 37: // left arrow - page = $('[role="navigation"] a:contains(Previous):first').prop('href'); + case shortcuts.previous: + page = $('.navbar a[rel="prev"]:first').prop('href'); break; - case 83: // s + case shortcuts.search: e.preventDefault(); $keyboard_modal.modal('hide'); $search_modal.modal('show'); $search_modal.find('#mkdocs-search-query').focus(); break; - case 191: // ? + case shortcuts.help: + $search_modal.modal('hide'); $keyboard_modal.modal('show'); break; default: break; @@ -56,8 +79,6 @@ $(document).ready(function() { } }); - // Highlight.js - hljs.initHighlightingOnLoad(); $('table').addClass('table table-striped table-hover'); // Improve the scrollspy behaviour when users click on a TOC item. @@ -73,20 +94,190 @@ $(document).ready(function() { }, 50); }); + function showInnerDropdown(item) { + var popup = $(item).next('.dropdown-menu'); + popup.addClass('show'); + $(item).addClass('open'); + + // First, close any sibling dropdowns. + var container = $(item).parent().parent(); + container.find('> .dropdown-submenu > a').each(function(i, el) { + if (el !== item) { + hideInnerDropdown(el); + } + }); + + var popupMargin = 10; + var maxBottom = $(window).height() - popupMargin; + var bounds = item.getBoundingClientRect(); + + popup.css('left', bounds.right + 'px'); + if (bounds.top + popup.height() > maxBottom && + bounds.top > $(window).height() / 2) { + popup.css({ + 'top': (bounds.bottom - popup.height()) + 'px', + 'max-height': (bounds.bottom - popupMargin) + 'px', + }); + } else { + popup.css({ + 'top': bounds.top + 'px', + 'max-height': (maxBottom - bounds.top) + 'px', + }); + } + } + + function hideInnerDropdown(item) { + var popup = $(item).next('.dropdown-menu'); + popup.removeClass('show'); + $(item).removeClass('open'); + + popup.scrollTop(0); + popup.find('.dropdown-menu').scrollTop(0).removeClass('show'); + popup.find('.dropdown-submenu > a').removeClass('open'); + } + + $('.dropdown-submenu > a').on('click', function(e) { + if ($(this).next('.dropdown-menu').hasClass('show')) { + hideInnerDropdown(this); + } else { + showInnerDropdown(this); + } + + e.stopPropagation(); + e.preventDefault(); + }); + + $('.dropdown-menu').parent().on('hide.bs.dropdown', function(e) { + $(this).find('.dropdown-menu').scrollTop(0); + $(this).find('.dropdown-submenu > a').removeClass('open'); + $(this).find('.dropdown-menu .dropdown-menu').removeClass('show'); + }); }); +$(window).on('resize', applyTopPadding); $('body').scrollspy({ target: '.bs-sidebar', -}); - -/* Toggle the `clicky` class on the body when clicking links to let us - retrigger CSS animations. See ../css/base.css for more details. */ -$('a').click(function(e) { - $('body').toggleClass('clicky'); + offset: 100 }); /* Prevent disabled links from causing a page reload */ $("li.disabled a").click(function() { event.preventDefault(); }); + +// See https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes +// We only list common keys below. Obscure keys are omitted and their use is discouraged. +var keyCodes = { + 8: 'backspace', + 9: 'tab', + 13: 'enter', + 16: 'shift', + 17: 'ctrl', + 18: 'alt', + 19: 'pause/break', + 20: 'caps lock', + 27: 'escape', + 32: 'spacebar', + 33: 'page up', + 34: 'page down', + 35: 'end', + 36: 'home', + 37: '←', + 38: '↑', + 39: '→', + 40: '↓', + 45: 'insert', + 46: 'delete', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 91: 'Left Windows Key / Left ⌘', + 92: 'Right Windows Key', + 93: 'Windows Menu / Right ⌘', + 96: 'numpad 0', + 97: 'numpad 1', + 98: 'numpad 2', + 99: 'numpad 3', + 100: 'numpad 4', + 101: 'numpad 5', + 102: 'numpad 6', + 103: 'numpad 7', + 104: 'numpad 8', + 105: 'numpad 9', + 106: 'multiply', + 107: 'add', + 109: 'subtract', + 110: 'decimal point', + 111: 'divide', + 112: 'f1', + 113: 'f2', + 114: 'f3', + 115: 'f4', + 116: 'f5', + 117: 'f6', + 118: 'f7', + 119: 'f8', + 120: 'f9', + 121: 'f10', + 122: 'f11', + 123: 'f12', + 124: 'f13', + 125: 'f14', + 126: 'f15', + 127: 'f16', + 128: 'f17', + 129: 'f18', + 130: 'f19', + 131: 'f20', + 132: 'f21', + 133: 'f22', + 134: 'f23', + 135: 'f24', + 144: 'num lock', + 145: 'scroll lock', + 186: ';', + 187: '=', + 188: ',', + 189: '‐', + 190: '.', + 191: '?', + 192: '`', + 219: '[', + 220: '\', + 221: ']', + 222: ''', +}; diff --git a/mkdocs/themes/mkdocs/js/bootstrap-3.0.3.min.js b/mkdocs/themes/mkdocs/js/bootstrap-3.0.3.min.js deleted file mode 100644 index 1a6258efcb..0000000000 --- a/mkdocs/themes/mkdocs/js/bootstrap-3.0.3.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.0.3 (http://getbootstrap.com) - * Copyright 2013 Twitter, Inc. - * Licensed under http://www.apache.org/licenses/LICENSE-2.0 - */ - -if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); \ No newline at end of file diff --git a/mkdocs/themes/mkdocs/js/bootstrap.min.js b/mkdocs/themes/mkdocs/js/bootstrap.min.js new file mode 100644 index 0000000000..ca013b70fb --- /dev/null +++ b/mkdocs/themes/mkdocs/js/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v4.3.1 (https://getbootstrap.com/) + * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;nthis._items.length-1||t<0))if(this._isSliding)g(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Ee},je="show",He="out",Re={HIDE:"hide"+De,HIDDEN:"hidden"+De,SHOW:"show"+De,SHOWN:"shown"+De,INSERTED:"inserted"+De,CLICK:"click"+De,FOCUSIN:"focusin"+De,FOCUSOUT:"focusout"+De,MOUSEENTER:"mouseenter"+De,MOUSELEAVE:"mouseleave"+De},xe="fade",Fe="show",Ue=".tooltip-inner",We=".arrow",qe="hover",Me="focus",Ke="click",Qe="manual",Be=function(){function i(t,e){if("undefined"==typeof u)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=g(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(g(this.getTipElement()).hasClass(Fe))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),g.removeData(this.element,this.constructor.DATA_KEY),g(this.element).off(this.constructor.EVENT_KEY),g(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&g(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===g(this.element).css("display"))throw new Error("Please use show on visible elements");var t=g.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){g(this.element).trigger(t);var n=_.findShadowRoot(this.element),i=g.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=_.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&g(o).addClass(xe);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();g(o).data(this.constructor.DATA_KEY,this),g.contains(this.element.ownerDocument.documentElement,this.tip)||g(o).appendTo(l),g(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new u(this.element,o,{placement:a,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:We},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}}),g(o).addClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().on("mouseover",null,g.noop);var c=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,g(e.element).trigger(e.constructor.Event.SHOWN),t===He&&e._leave(null,e)};if(g(this.tip).hasClass(xe)){var h=_.getTransitionDurationFromElement(this.tip);g(this.tip).one(_.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=g.Event(this.constructor.Event.HIDE),o=function(){e._hoverState!==je&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),g(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(g(this.element).trigger(i),!i.isDefaultPrevented()){if(g(n).removeClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().off("mouseover",null,g.noop),this._activeTrigger[Ke]=!1,this._activeTrigger[Me]=!1,this._activeTrigger[qe]=!1,g(this.tip).hasClass(xe)){var r=_.getTransitionDurationFromElement(n);g(n).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){g(this.getTipElement()).addClass(Ae+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},t.setContent=function(){var t=this.getTipElement();this.setElementContent(g(t.querySelectorAll(Ue)),this.getTitle()),g(t).removeClass(xe+" "+Fe)},t.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=Se(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?g(e).parent().is(t)||t.empty().append(e):t.text(g(e).text())},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getOffset=function(){var e=this,t={};return"function"==typeof this.config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e.config.offset(t.offsets,e.element)||{}),t}:t.offset=this.config.offset,t},t._getContainer=function(){return!1===this.config.container?document.body:_.isElement(this.config.container)?g(this.config.container):g(document).find(this.config.container)},t._getAttachment=function(t){return Pe[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)g(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==Qe){var e=t===qe?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===qe?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;g(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}}),g(this.element).closest(".modal").on("hide.bs.modal",function(){i.element&&i.hide()}),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Me:qe]=!0),g(e.getTipElement()).hasClass(Fe)||e._hoverState===je?e._hoverState=je:(clearTimeout(e._timeout),e._hoverState=je,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===je&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Me:qe]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=He,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===He&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){var e=g(this.element).data();return Object.keys(e).forEach(function(t){-1!==Oe.indexOf(t)&&delete e[t]}),"number"==typeof(t=l({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),_.typeCheckConfig(be,t,this.constructor.DefaultType),t.sanitize&&(t.template=Se(t.template,t.whiteList,t.sanitizeFn)),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ne);null!==e&&e.length&&t.removeClass(e.join(""))},t._handlePopperPlacementChange=function(t){var e=t.instance;this.tip=e.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},t._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(g(t).removeClass(xe),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},i._jQueryInterface=function(n){return this.each(function(){var t=g(this).data(Ie),e="object"==typeof n&&n;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),g(this).data(Ie,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return Le}},{key:"NAME",get:function(){return be}},{key:"DATA_KEY",get:function(){return Ie}},{key:"Event",get:function(){return Re}},{key:"EVENT_KEY",get:function(){return De}},{key:"DefaultType",get:function(){return ke}}]),i}();g.fn[be]=Be._jQueryInterface,g.fn[be].Constructor=Be,g.fn[be].noConflict=function(){return g.fn[be]=we,Be._jQueryInterface};var Ve="popover",Ye="bs.popover",ze="."+Ye,Xe=g.fn[Ve],$e="bs-popover",Ge=new RegExp("(^|\\s)"+$e+"\\S+","g"),Je=l({},Be.Default,{placement:"right",trigger:"click",content:"",template:''}),Ze=l({},Be.DefaultType,{content:"(string|element|function)"}),tn="fade",en="show",nn=".popover-header",on=".popover-body",rn={HIDE:"hide"+ze,HIDDEN:"hidden"+ze,SHOW:"show"+ze,SHOWN:"shown"+ze,INSERTED:"inserted"+ze,CLICK:"click"+ze,FOCUSIN:"focusin"+ze,FOCUSOUT:"focusout"+ze,MOUSEENTER:"mouseenter"+ze,MOUSELEAVE:"mouseleave"+ze},sn=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var o=i.prototype;return o.isWithContent=function(){return this.getTitle()||this._getContent()},o.addAttachmentClass=function(t){g(this.getTipElement()).addClass($e+"-"+t)},o.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},o.setContent=function(){var t=g(this.getTipElement());this.setElementContent(t.find(nn),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(on),e),t.removeClass(tn+" "+en)},o._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},o._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ge);null!==e&&0=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t/gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){var n=(e.className+" "+(e.parentNode?e.parentNode.className:"")).split(/\s+/);return n=n.map(function(e){return e.replace(/^lang(uage)?-/,"")}),n.filter(function(e){return N(e)||/no(-?)highlight|plain|text/.test(e)})[0]}function i(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function o(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function u(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);f.reverse().forEach(o)}else"start"==g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(a.substr(s))}function c(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,o){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\b\w+\b/,!0),o&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&o.tE&&(a.tE+=(a.e?"|":"")+o.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(i(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,o);var l=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function s(e,t,a,i){function o(e,n){for(var t=0;t";return i+=e+'">',i+n+o}function d(){if(!L.k)return n(y);var e="",t=0;L.lR.lastIndex=0;for(var r=L.lR.exec(y);r;){e+=n(y.substr(t,r.index-t));var a=g(L,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=L.lR.lastIndex,r=L.lR.exec(y)}return e+n(y.substr(t))}function h(){if(L.sL&&!w[L.sL])return n(y);var e=L.sL?s(L.sL,y,!0,M[L.sL]):l(y);return L.r>0&&(B+=e.r),"continuous"==L.subLanguageMode&&(M[L.sL]=e.top),p(e.language,e.value,!1,!0)}function b(){return void 0!==L.sL?h():d()}function v(e,t){var r=e.cN?p(e.cN,"",!0):"";e.rB?(k+=r,y=""):e.eB?(k+=n(t)+r,y=""):(k+=r,y=t),L=Object.create(e,{parent:{value:L}})}function m(e,t){if(y+=e,void 0===t)return k+=b(),0;var r=o(t,L);if(r)return k+=b(),v(r,t),r.rB?0:t.length;var a=u(L,t);if(a){var i=L;i.rE||i.eE||(y+=t),k+=b();do L.cN&&(k+=""),B+=L.r,L=L.parent;while(L!=a.parent);return i.eE&&(k+=n(t)),y="",a.starts&&v(a.starts,""),i.rE?0:t.length}if(f(t,L))throw new Error('Illegal lexeme "'+t+'" for mode "'+(L.cN||"")+'"');return y+=t,t.length||1}var E=N(e);if(!E)throw new Error('Unknown language: "'+e+'"');c(E);var R,L=i||E,M={},k="";for(R=L;R!=E;R=R.parent)R.cN&&(k=p(R.cN,"",!0)+k);var y="",B=0;try{for(var C,j,I=0;;){if(L.t.lastIndex=I,C=L.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),R=L;R.parent;R=R.parent)R.cN&&(k+="");return{r:B,value:k,language:e,top:L}}catch(S){if(-1!=S.message.indexOf("Illegal"))return{r:0,value:n(t)};throw S}}function l(e,t){t=t||x.languages||Object.keys(w);var r={r:0,value:n(e)},a=r;return t.forEach(function(n){if(N(n)){var t=s(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}}),a.language&&(r.second_best=a),r}function f(e){return x.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,x.tabReplace)})),x.useBR&&(e=e.replace(/\n/g,"
")),e}function g(e,n,t){var r=n?E[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function p(e){var n=a(e);if(!/no(-?)highlight|plain|text/.test(n)){var t;x.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e;var r=t.textContent,i=n?s(n,r,!0):l(r),c=o(t);if(c.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=i.value,i.value=u(c,o(p),r)}i.value=f(i.value),e.innerHTML=i.value,e.className=g(e.className,n,i.language),e.result={language:i.language,re:i.r},i.second_best&&(e.second_best={language:i.second_best.language,re:i.second_best.r})}}function d(e){x=i(x,e)}function h(){if(!h.called){h.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function b(){addEventListener("DOMContentLoaded",h,!1),addEventListener("load",h,!1)}function v(n,t){var r=w[n]=t(e);r.aliases&&r.aliases.forEach(function(e){E[e]=n})}function m(){return Object.keys(w)}function N(e){return w[e]||w[E[e]]}var x={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},w={},E={};return e.highlight=s,e.highlightAuto=l,e.fixMarkup=f,e.highlightBlock=p,e.configure=d,e.initHighlighting=h,e.initHighlightingOnLoad=b,e.registerLanguage=v,e.listLanguages=m,e.getLanguage=N,e.inherit=i,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"(AV|CA|CF|CG|CI|MK|MP|NS|UI)\\w+"},i={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},o=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["m","mm","objc","obj-c"],k:i,l:o,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:o,c:[e.UTM]},{cN:"variable",b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>]/,c:[{cN:"operator",bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate savepoint release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,k:{keyword:"abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length character_length charindex charset check checksum checksum_agg choose close coalesce coercibility collate collation collationproperty column columns columns_updated commit compress concat concat_ws concurrent connect connection connection_id consistent constraint constraints continue contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime data database databases datalength date_add date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec engine engines eomonth errors escape escaped event eventdata events except exception exec execute exists exp explain export_set extended external extract fast fetch field fields find_in_set first first_value floor flush for force foreign format found found_rows from from_base64 from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner innodb input insert install instr intersect into is is_free_lock is_ipv4 is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names national natural nchar next no no_write_to_binlog not now nullif nvarchar oct octet_length of old_password on only open optimize option optionally or ord order outer outfile output pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges procedure procedure_analyze processlist profile profiles public publishingservername purge quarter query quick quote quotename radians rand read references regexp relative relaylog release release_lock rename repair repeat replace replicate reset restore restrict return returns reverse revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll sec_to_time second section select serializable server session session_user set sha sha1 sha2 share show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sql_variant_property sqlstate sqrt square start starting status std stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short validate_password_strength value values var var_pop var_samp variables variance varp version view warnings week weekday weekofyear weight_string when whenever where with work write xml xor year yearweek zon",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int integer interval number numeric real serial smallint varchar varying int8 serial8 text"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"pi",r:10,v:[{b:/^\s*('|")use strict('|")/},{b:/^\s*('|")use asm('|")/}]},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",b:"\\b(0[xXbBoO][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{bK:"import",e:"[;$]",k:"import from as",c:[e.ASM,e.QSM]},{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]}]}});hljs.registerLanguage("scss",function(e){{var t="[a-zA-Z-][a-zA-Z0-9_-]*",i={cN:"variable",b:"(\\$"+t+")\\b"},r={cN:"function",b:t+"\\(",rB:!0,eE:!0,e:"\\("},o={cN:"hexcolor",b:"#[0-9A-Fa-f]+"};({cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{cN:"value",eW:!0,eE:!0,c:[r,o,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"important",b:"!important"}]}})}return{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,r,{cN:"id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{cN:"pseudo",b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{cN:"pseudo",b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},i,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{cN:"value",b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{cN:"value",b:":",e:";",c:[r,i,o,e.CSSNM,e.QSM,e.ASM,{cN:"important",b:"!important"}]},{cN:"at_rule",b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[r,i,e.QSM,e.ASM,o,e.CSSNM,{cN:"preprocessor",b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});hljs.registerLanguage("mel",function(e){return{k:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",i:"",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(r)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:r.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{cN:"attribute",b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("tex",function(c){var e={cN:"command",b:"\\\\[a-zA-Zа-яА-я]+[\\*]?"},m={cN:"command",b:"\\\\[^a-zA-Zа-яА-я0-9]"},r={cN:"special",b:"[{}\\[\\]\\&#~]",r:0};return{c:[{b:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",rB:!0,c:[e,m,{cN:"number",b:" *=",e:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",eB:!0}],r:10},e,m,r,{cN:"formula",b:"\\$\\$",e:"\\$\\$",c:[e,m,r],r:0},{cN:"formula",b:"\\$",e:"\\$",c:[e,m,r],r:0},c.C("%","$",{r:0})]}});hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer",constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"",sL:"vbscript"}]}});hljs.registerLanguage("haskell",function(e){var c=[e.C("--","$"),e.C("{-","-}",{c:["self"]})],a={cN:"pragma",b:"{-#",e:"#-}"},i={cN:"preprocessor",b:"^#",e:"$"},n={cN:"type",b:"\\b[A-Z][\\w']*",r:0},t={cN:"container",b:"\\(",e:"\\)",i:'"',c:[a,i,{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},e.inherit(e.TM,{b:"[_a-z][\\w']*"})].concat(c)},l={cN:"container",b:"{",e:"}",c:t.c};return{aliases:["hs"],k:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",c:[{cN:"module",b:"\\bmodule\\b",e:"where",k:"module where",c:[t].concat(c),i:"\\W\\.|;"},{cN:"import",b:"\\bimport\\b",e:"$",k:"import|0 qualified as hiding",c:[t].concat(c),i:"\\W\\.|;"},{cN:"class",b:"^(\\s*)?(class|instance)\\b",e:"where",k:"class family instance where",c:[n,t].concat(c)},{cN:"typedef",b:"\\b(data|(new)?type)\\b",e:"$",k:"data family type newtype deriving",c:[a,n,t,l].concat(c)},{cN:"default",bK:"default",e:"$",c:[n,t].concat(c)},{cN:"infix",bK:"infix infixl infixr",e:"$",c:[e.CNM].concat(c)},{cN:"foreign",b:"\\bforeign\\b",e:"$",k:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",c:[n,e.QSM].concat(c)},{cN:"shebang",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},a,i,e.QSM,e.CNM,n,e.inherit(e.TM,{b:"^[_a-z][\\w']*"}),{b:"->|<-"}].concat(c)}});hljs.registerLanguage("scilab",function(e){var n=[e.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[e.BE,{b:"''"}]}];return{aliases:["sci"],k:{keyword:"abort break case clear catch continue do elseif else endfunction end for functionglobal if pause return resume select try then while%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp errorexec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isemptyisinfisnan isvector lasterror length load linspace list listfiles log10 log2 logmax min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand realround sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tantype typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function endfunction",e:"$",k:"function endfunction|10",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",r:0,c:n},e.C("//","$")].concat(n)}});hljs.registerLanguage("profile",function(e){return{c:[e.CNM,{cN:"built_in",b:"{",e:"}$",eB:!0,eE:!0,c:[e.ASM,e.QSM],r:0},{cN:"filename",b:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",e:":",eE:!0},{cN:"header",b:"(ncalls|tottime|cumtime)",e:"$",k:"ncalls tottime|10 cumtime|10 filename",r:10},{cN:"summary",b:"function calls",e:"$",c:[e.CNM],r:10},e.ASM,e.QSM,{cN:"function",b:"\\(",e:"\\)$",c:[e.UTM],r:0}]}});hljs.registerLanguage("thrift",function(e){var t="bool byte i16 i32 i64 double string binary";return{k:{keyword:"namespace const typedef struct enum service exception void oneway set list map required optional",built_in:t,literal:"true false"},c:[e.QSM,e.NM,e.CLCM,e.CBCM,{cN:"class",bK:"struct enum service exception",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{b:"\\b(set|list|map)\\s*<",e:">",k:t,c:["self"]}]}});hljs.registerLanguage("matlab",function(e){var a=[e.CNM,{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]}],s={r:0,c:[{cN:"operator",b:/'['\.]*/}]};return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"},{cN:"params",b:"\\[",e:"\\]"}]},{b:/[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,rB:!0,r:0,c:[{b:/[a-zA-Z_][a-zA-Z_0-9]*/,r:0},s.c[0]]},{cN:"matrix",b:"\\[",e:"\\]",c:a,r:0,starts:s},{cN:"cell",b:"\\{",e:/}/,c:a,r:0,starts:s},{b:/\)/,r:0,starts:s},e.C("^\\s*\\%\\{\\s*$","^\\s*\\%\\}\\s*$"),e.C("\\%","$")].concat(a)}});hljs.registerLanguage("vbscript",function(e){return{aliases:["vbs"],cI:!0,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C(/'/,/$/,{r:0}),e.CNM]}});hljs.registerLanguage("capnproto",function(t){return{aliases:["capnp"],k:{keyword:"struct enum interface union group import using const annotation extends in of on as with from fixed",built_in:"Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 Text Data AnyPointer AnyStruct Capability List",literal:"true false"},c:[t.QSM,t.NM,t.HCM,{cN:"shebang",b:/@0x[\w\d]{16};/,i:/\n/},{cN:"number",b:/@\d+\b/},{cN:"class",bK:"struct enum",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]},{cN:"class",bK:"interface",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]}]}});hljs.registerLanguage("xl",function(e){var t="ObjectLoader Animate MovieCredits Slides Filters Shading Materials LensFlare Mapping VLCAudioVideo StereoDecoder PointCloud NetworkAccess RemoteControl RegExp ChromaKey Snowfall NodeJS Speech Charts",o={keyword:"if then else do while until for loop import with is as where when by data constant",literal:"true false nil",type:"integer real text name boolean symbol infix prefix postfix block tree",built_in:"in mod rem and or xor not abs sign floor ceil sqrt sin cos tan asin acos atan exp expm1 log log2 log10 log1p pi at",module:t,id:"text_length text_range text_find text_replace contains page slide basic_slide title_slide title subtitle fade_in fade_out fade_at clear_color color line_color line_width texture_wrap texture_transform texture scale_?x scale_?y scale_?z? translate_?x translate_?y translate_?z? rotate_?x rotate_?y rotate_?z? rectangle circle ellipse sphere path line_to move_to quad_to curve_to theme background contents locally time mouse_?x mouse_?y mouse_buttons"},a={cN:"constant",b:"[A-Z][A-Z_0-9]+",r:0},r={cN:"variable",b:"([A-Z][a-z_0-9]+)+",r:0},i={cN:"id",b:"[a-z][a-z_0-9]+",r:0},l={cN:"string",b:'"',e:'"',i:"\\n"},n={cN:"string",b:"'",e:"'",i:"\\n"},s={cN:"string",b:"<<",e:">>"},c={cN:"number",b:"[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?",r:10},_={cN:"import",bK:"import",e:"$",k:{keyword:"import",module:t},r:0,c:[l]},d={cN:"function",b:"[a-z].*->"};return{aliases:["tao"],l:/[a-zA-Z][a-zA-Z0-9_?]*/,k:o,c:[e.CLCM,e.CBCM,l,n,s,d,_,a,r,i,c,e.NM]}});hljs.registerLanguage("scala",function(e){var t={cN:"annotation",b:"@[A-Za-z]+"},a={cN:"string",b:'u?r?"""',e:'"""',r:10},r={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"},c={cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},i={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,r:0},l={cN:"class",bK:"class object trait type",e:/[:={\[(\n;]/,c:[{cN:"keyword",bK:"extends with",r:10},i]},n={cN:"function",bK:"def val",e:/[:={\[(\n;]/,c:[i]};return{k:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},c:[e.CLCM,e.CBCM,a,e.QSM,r,c,n,l,e.CNM,t]}});hljs.registerLanguage("elixir",function(e){var n="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",r="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",b="and false then defined module in return redo retry end for true self when next until do begin unless nil break not case cond alias while ensure or include use alias fn quote",c={cN:"subst",b:"#\\{",e:"}",l:n,k:b},a={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]},i={cN:"function",bK:"def defp defmacro",e:/\B\b/,c:[e.inherit(e.TM,{b:n,endsParent:!0})]},s=e.inherit(i,{cN:"class",bK:"defmodule defrecord",e:/\bdo\b|$|;/}),l=[a,e.HCM,s,i,{cN:"constant",b:"(\\b[A-Z_]\\w*(.)?)+",r:0},{cN:"symbol",b:":",c:[a,{b:r}],r:0},{cN:"symbol",b:n+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"->"},{b:"("+e.RSR+")\\s*",c:[e.HCM,{cN:"regexp",i:"\\n",c:[e.BE,c],v:[{b:"/",e:"/[a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];return c.c=l,{l:n,k:b,c:l}});hljs.registerLanguage("sml",function(e){return{aliases:["ml"],k:{keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)"},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"tag",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*"},e.inherit(e.ASM,{cN:"char",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"tag",b:""},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("dockerfile",function(n){return{aliases:["docker"],cI:!0,k:{built_ins:"from maintainer cmd expose add copy entrypoint volume user workdir onbuild run env"},c:[n.HCM,{k:{built_in:"run cmd entrypoint volume add copy workdir onbuild"},b:/^ *(onbuild +)?(run|cmd|entrypoint|volume|add|copy|workdir) +/,starts:{e:/[^\\]\n/,sL:"bash",subLanguageMode:"continuous"}},{k:{built_in:"from maintainer expose env user onbuild"},b:/^ *(onbuild +)?(from|maintainer|expose|env|user|onbuild) +/,e:/[^\\]\n/,c:[n.ASM,n.QSM,n.NM,n.HCM]}]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"link_reference",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link_url",e:"$"}}]}]}});hljs.registerLanguage("haml",function(s){return{cI:!0,c:[{cN:"doctype",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},s.C("^\\s*(!=#|=#|-#|/).*$",!1,{r:0}),{b:"^\\s*(-|=|!=)(?!#)",starts:{e:"\\n",sL:"ruby"}},{cN:"tag",b:"^\\s*%",c:[{cN:"title",b:"\\w+"},{cN:"value",b:"[#\\.]\\w+"},{b:"{\\s*",e:"\\s*}",eE:!0,c:[{b:":\\w+\\s*=>",e:",\\s+",rB:!0,eW:!0,c:[{cN:"symbol",b:":\\w+"},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]}]},{b:"\\(\\s*",e:"\\s*\\)",eE:!0,c:[{b:"\\w+\\s*=",e:"\\s+",rB:!0,eW:!0,c:[{cN:"attribute",b:"\\w+",r:0},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]}]}]},{cN:"bullet",b:"^\\s*[=~]\\s*",r:0},{b:"#{",starts:{e:"}",sL:"ruby"}}]}});hljs.registerLanguage("fortran",function(e){var t={cN:"params",b:"\\(",e:"\\)"},n={constant:".False. .True.",type:"integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image"};return{cI:!0,aliases:["f90","f95"],k:n,c:[e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{cN:"string",r:0}),{cN:"function",bK:"subroutine function program",i:"[${=\\n]",c:[e.UTM,t]},e.C("!","$",{r:0}),{cN:"number",b:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",r:0}]}});hljs.registerLanguage("smali",function(r){var t=["add","and","cmp","cmpg","cmpl","const","div","double","float","goto","if","int","long","move","mul","neg","new","nop","not","or","rem","return","shl","shr","sput","sub","throw","ushr","xor"],n=["aget","aput","array","check","execute","fill","filled","goto/16","goto/32","iget","instance","invoke","iput","monitor","packed","sget","sparse"],s=["transient","constructor","abstract","final","synthetic","public","private","protected","static","bridge","system"];return{aliases:["smali"],c:[{cN:"string",b:'"',e:'"',r:0},r.C("#","$",{r:0}),{cN:"keyword",b:"\\s*\\.end\\s[a-zA-Z0-9]*",r:1},{cN:"keyword",b:"^[ ]*\\.[a-zA-Z]*",r:0},{cN:"keyword",b:"\\s:[a-zA-Z_0-9]*",r:0},{cN:"keyword",b:"\\s("+s.join("|")+")",r:1},{cN:"keyword",b:"\\[",r:0},{cN:"instruction",b:"\\s("+t.join("|")+")\\s",r:1},{cN:"instruction",b:"\\s("+t.join("|")+")((\\-|/)[a-zA-Z0-9]+)+\\s",r:10},{cN:"instruction",b:"\\s("+n.join("|")+")((\\-|/)[a-zA-Z0-9]+)*\\s",r:10},{cN:"class",b:"L[^(;:\n]*;",r:0},{cN:"function",b:'( |->)[^(\n ;"]*\\(',r:0},{cN:"function",b:"\\)",r:0},{cN:"variable",b:"[vp][0-9]+",r:0}]}});hljs.registerLanguage("julia",function(r){var e={keyword:"in abstract baremodule begin bitstype break catch ccall const continue do else elseif end export finally for function global if immutable import importall let local macro module quote return try type typealias using while",literal:"true false ANY ARGS CPU_CORES C_NULL DL_LOAD_PATH DevNull ENDIAN_BOM ENV I|0 Inf Inf16 Inf32 InsertionSort JULIA_HOME LOAD_PATH MS_ASYNC MS_INVALIDATE MS_SYNC MergeSort NaN NaN16 NaN32 OS_NAME QuickSort RTLD_DEEPBIND RTLD_FIRST RTLD_GLOBAL RTLD_LAZY RTLD_LOCAL RTLD_NODELETE RTLD_NOLOAD RTLD_NOW RoundDown RoundFromZero RoundNearest RoundToZero RoundUp STDERR STDIN STDOUT VERSION WORD_SIZE catalan cglobal e eu eulergamma golden im nothing pi γ π φ",built_in:"ASCIIString AbstractArray AbstractRNG AbstractSparseArray Any ArgumentError Array Associative Base64Pipe Bidiagonal BigFloat BigInt BitArray BitMatrix BitVector Bool BoundsError Box CFILE Cchar Cdouble Cfloat Char CharString Cint Clong Clonglong ClusterManager Cmd Coff_t Colon Complex Complex128 Complex32 Complex64 Condition Cptrdiff_t Cshort Csize_t Cssize_t Cuchar Cuint Culong Culonglong Cushort Cwchar_t DArray DataType DenseArray Diagonal Dict DimensionMismatch DirectIndexString Display DivideError DomainError EOFError EachLine Enumerate ErrorException Exception Expr Factorization FileMonitor FileOffset Filter Float16 Float32 Float64 FloatRange FloatingPoint Function GetfieldNode GotoNode Hermitian IO IOBuffer IOStream IPv4 IPv6 InexactError Int Int128 Int16 Int32 Int64 Int8 IntSet Integer InterruptException IntrinsicFunction KeyError LabelNode LambdaStaticData LineNumberNode LoadError LocalProcess MIME MathConst MemoryError MersenneTwister Method MethodError MethodTable Module NTuple NewvarNode Nothing Number ObjectIdDict OrdinalRange OverflowError ParseError PollingFileWatcher ProcessExitedException ProcessGroup Ptr QuoteNode Range Range1 Ranges Rational RawFD Real Regex RegexMatch RemoteRef RepString RevString RopeString RoundingMode Set SharedArray Signed SparseMatrixCSC StackOverflowError Stat StatStruct StepRange String SubArray SubString SymTridiagonal Symbol SymbolNode Symmetric SystemError Task TextDisplay Timer TmStruct TopNode Triangular Tridiagonal Type TypeConstructor TypeError TypeName TypeVar UTF16String UTF32String UTF8String UdpSocket Uint Uint128 Uint16 Uint32 Uint64 Uint8 UndefRefError UndefVarError UniformScaling UnionType UnitRange Unsigned Vararg VersionNumber WString WeakKeyDict WeakRef Woodbury Zip"},t="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",o={l:t,k:e},n={cN:"type-annotation",b:/::/},a={cN:"subtype",b:/<:/},i={cN:"number",b:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,r:0},l={cN:"char",b:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},c={cN:"subst",b:/\$\(/,e:/\)/,k:e},u={cN:"variable",b:"\\$"+t},d={cN:"string",c:[r.BE,c,u],v:[{b:/\w*"/,e:/"\w*/},{b:/\w*"""/,e:/"""\w*/}]},g={cN:"string",c:[r.BE,c,u],b:"`",e:"`"},s={cN:"macrocall",b:"@"+t},S={cN:"comment",v:[{b:"#=",e:"=#",r:10},{b:"#",e:"$"}]};return o.c=[i,l,n,a,d,g,s,S,r.HCM],c.c=o.c,o});hljs.registerLanguage("delphi",function(e){var r="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure",t=[e.CLCM,e.C(/\{/,/\}/,{r:0}),e.C(/\(\*/,/\*\)/,{r:10})],i={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},c={cN:"string",b:/(#\d+)+/},o={b:e.IR+"\\s*=\\s*class\\s*\\(",rB:!0,c:[e.TM]},n={cN:"function",bK:"function constructor destructor procedure",e:/[:;]/,k:"function constructor|10 destructor|10 procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:r,c:[i,c]}].concat(t)};return{cI:!0,k:r,i:/"|\$[G-Zg-z]|\/\*|<\/|\|/,c:[i,c,e.NM,o,n].concat(t)}});hljs.registerLanguage("brainfuck",function(r){var n={cN:"literal",b:"[\\+\\-]",r:0};return{aliases:["bf"],c:[r.C("[^\\[\\]\\.,\\+\\-<> \r\n]","[\\[\\]\\.,\\+\\-<> \r\n]",{rE:!0,r:0}),{cN:"title",b:"[\\[\\]]",r:0},{cN:"string",b:"[\\.,]",r:0},{b:/\+\+|\-\-/,rB:!0,c:[n]},n]}});hljs.registerLanguage("ini",function(e){return{cI:!0,i:/\S/,c:[e.C(";","$"),{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:!0,k:"on off true false yes no",c:[e.QSM,e.NM],r:0}]}]}});hljs.registerLanguage("json",function(e){var t={literal:"true false null"},i=[e.QSM,e.CNM],l={cN:"value",e:",",eW:!0,eE:!0,c:i,k:t},c={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:l}],i:"\\S"},n={b:"\\[",e:"\\]",c:[e.inherit(l,{cN:null})],i:"\\S"};return i.splice(i.length,0,c,n),{c:i,k:t,i:"\\S"}});hljs.registerLanguage("powershell",function(e){var t={b:"`[\\s\\S]",r:0},r={cN:"variable",v:[{b:/\$[\w\d][\w\d_:]*/}]},o={cN:"string",b:/"/,e:/"/,c:[t,r,{cN:"variable",b:/\$[A-z]/,e:/[^A-z]/}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["ps"],l:/-?[A-z\.\-]+/,cI:!0,k:{keyword:"if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",literal:"$null $true $false",built_in:"Add-Content Add-History Add-Member Add-PSSnapin Clear-Content Clear-Item Clear-Item Property Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ConvertTo-Html ConvertTo-SecureString Copy-Item Copy-ItemProperty Export-Alias Export-Clixml Export-Console Export-Csv ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item Join-Path Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug Set-Service Set-TraceSource Set-Variable Sort-Object Split-Path Start-Service Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where-Object Write-Debug Write-Error Write-Host Write-Output Write-Progress Write-Verbose Write-Warning",operator:"-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"},c:[e.HCM,e.NM,o,a,r]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("erb",function(e){return{sL:"xml",subLanguageMode:"continuous",c:[e.C("<%#","%>"),{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0}]}});hljs.registerLanguage("swift",function(e){var i={keyword:"class deinit enum extension func import init let protocol static struct subscript typealias var break case continue default do else fallthrough if in for return switch where while as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__ associativity didSet get infix inout left mutating none nonmutating operator override postfix precedence prefix right set unowned unowned safe unsafe weak willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue assert bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal false filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced join lexicographicalCompare map max maxElement min minElement nil numericCast partition posix print println quickSort reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith strideof strideofValue swap swift toString transcode true underestimateCount unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafePointers withVaList"},t={cN:"type",b:"\\b[A-Z][\\w']*",r:0},n=e.C("/\\*","\\*/",{c:["self"]}),r={cN:"subst",b:/\\\(/,e:"\\)",k:i,c:[]},s={cN:"number",b:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",r:0},o=e.inherit(e.QSM,{c:[r,e.BE]});return r.c=[s],{k:i,c:[o,e.CLCM,n,t,s,{cN:"func",bK:"func",e:"{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/,i:/\(/}),{cN:"generics",b://,i:/>/},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:i,c:["self",s,o,e.CBCM,{b:":"}],i:/["']/}],i:/\[|%/},{cN:"class",bK:"struct protocol class extension enum",k:i,e:"\\{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/})]},{cN:"preprocessor",b:"(@assignment|@class_protocol|@exported|@final|@lazy|@noreturn|@NSCopying|@NSManaged|@objc|@optional|@required|@auto_closure|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix)"}]}});hljs.registerLanguage("lisp",function(b){var e="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*",c="\\|[^]*?\\|",r="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?",a={cN:"shebang",b:"^#!",e:"$"},i={cN:"literal",b:"\\b(t{1}|nil)\\b"},l={cN:"number",v:[{b:r,r:0},{b:"#(b|B)[0-1]+(/[0-1]+)?"},{b:"#(o|O)[0-7]+(/[0-7]+)?"},{b:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{b:"#(c|C)\\("+r+" +"+r,e:"\\)"}]},t=b.inherit(b.QSM,{i:null}),d=b.C(";","$",{r:0}),n={cN:"variable",b:"\\*",e:"\\*"},u={cN:"keyword",b:"[:&]"+e},N={b:e,r:0},o={b:c},s={b:"\\(",e:"\\)",c:["self",i,t,l,N]},v={cN:"quoted",c:[l,t,n,u,s,N],v:[{b:"['`]\\(",e:"\\)"},{b:"\\(quote ",e:"\\)",k:"quote"},{b:"'"+c}]},f={cN:"quoted",v:[{b:"'"+e},{b:"#'"+e+"(::"+e+")*"}]},g={cN:"list",b:"\\(\\s*",e:"\\)"},q={eW:!0,r:0};return g.c=[{cN:"keyword",v:[{b:e},{b:c}]},q],q.c=[v,f,g,i,l,t,d,n,u,o,N],{i:/\S/,c:[l,a,i,t,d,v,f,g,N]}});hljs.registerLanguage("rsl",function(e){return{k:{keyword:"float color point normal vector matrix while for if do return else break extern continue",built_in:"abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp faceforward filterstep floor format fresnel incident length lightsource log match max min mod noise normalize ntransform opposite option phong pnoise pow printf ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan texture textureinfo trace transform vtransform xcomp ycomp zcomp"},i:" > >= ` abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"},n={cN:"shebang",b:"^#!",e:"$"},c={cN:"literal",b:"(#t|#f|#\\\\"+t+"|#\\\\.)"},l={cN:"number",v:[{b:r,r:0},{b:i,r:0},{b:"#b[0-1]+(/[0-1]+)?"},{b:"#o[0-7]+(/[0-7]+)?"},{b:"#x[0-9a-f]+(/[0-9a-f]+)?"}]},s=e.QSM,o=[e.C(";","$",{r:0}),e.C("#\\|","\\|#")],u={b:t,r:0},p={cN:"variable",b:"'"+t},d={eW:!0,r:0},g={cN:"list",v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}],c:[{cN:"keyword",b:t,l:t,k:a},d]};return d.c=[c,l,s,u,p,g].concat(o),{i:/\S/,c:[n,l,s,p,g].concat(o)}});hljs.registerLanguage("stata",function(e){return{aliases:["do","ado"],cI:!0,k:"if else in foreach for forv forva forval forvalu forvalue forvalues by bys bysort xi quietly qui capture about ac ac_7 acprplot acprplot_7 adjust ado adopath adoupdate alpha ameans an ano anov anova anova_estat anova_terms anovadef aorder ap app appe appen append arch arch_dr arch_estat arch_p archlm areg areg_p args arima arima_dr arima_estat arima_p as asmprobit asmprobit_estat asmprobit_lf asmprobit_mfx__dlg asmprobit_p ass asse asser assert avplot avplot_7 avplots avplots_7 bcskew0 bgodfrey binreg bip0_lf biplot bipp_lf bipr_lf bipr_p biprobit bitest bitesti bitowt blogit bmemsize boot bootsamp bootstrap bootstrap_8 boxco_l boxco_p boxcox boxcox_6 boxcox_p bprobit br break brier bro brow brows browse brr brrstat bs bs_7 bsampl_w bsample bsample_7 bsqreg bstat bstat_7 bstat_8 bstrap bstrap_7 ca ca_estat ca_p cabiplot camat canon canon_8 canon_8_p canon_estat canon_p cap caprojection capt captu captur capture cat cc cchart cchart_7 cci cd censobs_table centile cf char chdir checkdlgfiles checkestimationsample checkhlpfiles checksum chelp ci cii cl class classutil clear cli clis clist clo clog clog_lf clog_p clogi clogi_sw clogit clogit_lf clogit_p clogitp clogl_sw cloglog clonevar clslistarray cluster cluster_measures cluster_stop cluster_tree cluster_tree_8 clustermat cmdlog cnr cnre cnreg cnreg_p cnreg_sw cnsreg codebook collaps4 collapse colormult_nb colormult_nw compare compress conf confi confir confirm conren cons const constr constra constrai constrain constraint continue contract copy copyright copysource cor corc corr corr2data corr_anti corr_kmo corr_smc corre correl correla correlat correlate corrgram cou coun count cox cox_p cox_sw coxbase coxhaz coxvar cprplot cprplot_7 crc cret cretu cretur creturn cross cs cscript cscript_log csi ct ct_is ctset ctst_5 ctst_st cttost cumsp cumsp_7 cumul cusum cusum_7 cutil d datasig datasign datasigna datasignat datasignatu datasignatur datasignature datetof db dbeta de dec deco decod decode deff des desc descr descri describ describe destring dfbeta dfgls dfuller di di_g dir dirstats dis discard disp disp_res disp_s displ displa display distinct do doe doed doedi doedit dotplot dotplot_7 dprobit drawnorm drop ds ds_util dstdize duplicates durbina dwstat dydx e ed edi edit egen eivreg emdef en enc enco encod encode eq erase ereg ereg_lf ereg_p ereg_sw ereghet ereghet_glf ereghet_glf_sh ereghet_gp ereghet_ilf ereghet_ilf_sh ereghet_ip eret eretu eretur ereturn err erro error est est_cfexist est_cfname est_clickable est_expand est_hold est_table est_unhold est_unholdok estat estat_default estat_summ estat_vce_only esti estimates etodow etof etomdy ex exi exit expand expandcl fac fact facto factor factor_estat factor_p factor_pca_rotated factor_rotate factormat fcast fcast_compute fcast_graph fdades fdadesc fdadescr fdadescri fdadescrib fdadescribe fdasav fdasave fdause fh_st file open file read file close file filefilter fillin find_hlp_file findfile findit findit_7 fit fl fli flis flist for5_0 form forma format fpredict frac_154 frac_adj frac_chk frac_cox frac_ddp frac_dis frac_dv frac_in frac_mun frac_pp frac_pq frac_pv frac_wgt frac_xo fracgen fracplot fracplot_7 fracpoly fracpred fron_ex fron_hn fron_p fron_tn fron_tn2 frontier ftodate ftoe ftomdy ftowdate g gamhet_glf gamhet_gp gamhet_ilf gamhet_ip gamma gamma_d2 gamma_p gamma_sw gammahet gdi_hexagon gdi_spokes ge gen gene gener genera generat generate genrank genstd genvmean gettoken gl gladder gladder_7 glim_l01 glim_l02 glim_l03 glim_l04 glim_l05 glim_l06 glim_l07 glim_l08 glim_l09 glim_l10 glim_l11 glim_l12 glim_lf glim_mu glim_nw1 glim_nw2 glim_nw3 glim_p glim_v1 glim_v2 glim_v3 glim_v4 glim_v5 glim_v6 glim_v7 glm glm_6 glm_p glm_sw glmpred glo glob globa global glogit glogit_8 glogit_p gmeans gnbre_lf gnbreg gnbreg_5 gnbreg_p gomp_lf gompe_sw gomper_p gompertz gompertzhet gomphet_glf gomphet_glf_sh gomphet_gp gomphet_ilf gomphet_ilf_sh gomphet_ip gphdot gphpen gphprint gprefs gprobi_p gprobit gprobit_8 gr gr7 gr_copy gr_current gr_db gr_describe gr_dir gr_draw gr_draw_replay gr_drop gr_edit gr_editviewopts gr_example gr_example2 gr_export gr_print gr_qscheme gr_query gr_read gr_rename gr_replay gr_save gr_set gr_setscheme gr_table gr_undo gr_use graph graph7 grebar greigen greigen_7 greigen_8 grmeanby grmeanby_7 gs_fileinfo gs_filetype gs_graphinfo gs_stat gsort gwood h hadimvo hareg hausman haver he heck_d2 heckma_p heckman heckp_lf heckpr_p heckprob hel help hereg hetpr_lf hetpr_p hetprob hettest hexdump hilite hist hist_7 histogram hlogit hlu hmeans hotel hotelling hprobit hreg hsearch icd9 icd9_ff icd9p iis impute imtest inbase include inf infi infil infile infix inp inpu input ins insheet insp inspe inspec inspect integ inten intreg intreg_7 intreg_p intrg2_ll intrg_ll intrg_ll2 ipolate iqreg ir irf irf_create irfm iri is_svy is_svysum isid istdize ivprob_1_lf ivprob_lf ivprobit ivprobit_p ivreg ivreg_footnote ivtob_1_lf ivtob_lf ivtobit ivtobit_p jackknife jacknife jknife jknife_6 jknife_8 jkstat joinby kalarma1 kap kap_3 kapmeier kappa kapwgt kdensity kdensity_7 keep ksm ksmirnov ktau kwallis l la lab labe label labelbook ladder levels levelsof leverage lfit lfit_p li lincom line linktest lis list lloghet_glf lloghet_glf_sh lloghet_gp lloghet_ilf lloghet_ilf_sh lloghet_ip llogi_sw llogis_p llogist llogistic llogistichet lnorm_lf lnorm_sw lnorma_p lnormal lnormalhet lnormhet_glf lnormhet_glf_sh lnormhet_gp lnormhet_ilf lnormhet_ilf_sh lnormhet_ip lnskew0 loadingplot loc loca local log logi logis_lf logistic logistic_p logit logit_estat logit_p loglogs logrank loneway lookfor lookup lowess lowess_7 lpredict lrecomp lroc lroc_7 lrtest ls lsens lsens_7 lsens_x lstat ltable ltable_7 ltriang lv lvr2plot lvr2plot_7 m ma mac macr macro makecns man manova manova_estat manova_p manovatest mantel mark markin markout marksample mat mat_capp mat_order mat_put_rr mat_rapp mata mata_clear mata_describe mata_drop mata_matdescribe mata_matsave mata_matuse mata_memory mata_mlib mata_mosave mata_rename mata_which matalabel matcproc matlist matname matr matri matrix matrix_input__dlg matstrik mcc mcci md0_ md1_ md1debug_ md2_ md2debug_ mds mds_estat mds_p mdsconfig mdslong mdsmat mdsshepard mdytoe mdytof me_derd mean means median memory memsize meqparse mer merg merge mfp mfx mhelp mhodds minbound mixed_ll mixed_ll_reparm mkassert mkdir mkmat mkspline ml ml_5 ml_adjs ml_bhhhs ml_c_d ml_check ml_clear ml_cnt ml_debug ml_defd ml_e0 ml_e0_bfgs ml_e0_cycle ml_e0_dfp ml_e0i ml_e1 ml_e1_bfgs ml_e1_bhhh ml_e1_cycle ml_e1_dfp ml_e2 ml_e2_cycle ml_ebfg0 ml_ebfr0 ml_ebfr1 ml_ebh0q ml_ebhh0 ml_ebhr0 ml_ebr0i ml_ecr0i ml_edfp0 ml_edfr0 ml_edfr1 ml_edr0i ml_eds ml_eer0i ml_egr0i ml_elf ml_elf_bfgs ml_elf_bhhh ml_elf_cycle ml_elf_dfp ml_elfi ml_elfs ml_enr0i ml_enrr0 ml_erdu0 ml_erdu0_bfgs ml_erdu0_bhhh ml_erdu0_bhhhq ml_erdu0_cycle ml_erdu0_dfp ml_erdu0_nrbfgs ml_exde ml_footnote ml_geqnr ml_grad0 ml_graph ml_hbhhh ml_hd0 ml_hold ml_init ml_inv ml_log ml_max ml_mlout ml_mlout_8 ml_model ml_nb0 ml_opt ml_p ml_plot ml_query ml_rdgrd ml_repor ml_s_e ml_score ml_searc ml_technique ml_unhold mleval mlf_ mlmatbysum mlmatsum mlog mlogi mlogit mlogit_footnote mlogit_p mlopts mlsum mlvecsum mnl0_ mor more mov move mprobit mprobit_lf mprobit_p mrdu0_ mrdu1_ mvdecode mvencode mvreg mvreg_estat n nbreg nbreg_al nbreg_lf nbreg_p nbreg_sw nestreg net newey newey_7 newey_p news nl nl_7 nl_9 nl_9_p nl_p nl_p_7 nlcom nlcom_p nlexp2 nlexp2_7 nlexp2a nlexp2a_7 nlexp3 nlexp3_7 nlgom3 nlgom3_7 nlgom4 nlgom4_7 nlinit nllog3 nllog3_7 nllog4 nllog4_7 nlog_rd nlogit nlogit_p nlogitgen nlogittree nlpred no nobreak noi nois noisi noisil noisily note notes notes_dlg nptrend numlabel numlist odbc old_ver olo olog ologi ologi_sw ologit ologit_p ologitp on one onew onewa oneway op_colnm op_comp op_diff op_inv op_str opr opro oprob oprob_sw oprobi oprobi_p oprobit oprobitp opts_exclusive order orthog orthpoly ou out outf outfi outfil outfile outs outsh outshe outshee outsheet ovtest pac pac_7 palette parse parse_dissim pause pca pca_8 pca_display pca_estat pca_p pca_rotate pcamat pchart pchart_7 pchi pchi_7 pcorr pctile pentium pergram pergram_7 permute permute_8 personal peto_st pkcollapse pkcross pkequiv pkexamine pkexamine_7 pkshape pksumm pksumm_7 pl plo plot plugin pnorm pnorm_7 poisgof poiss_lf poiss_sw poisso_p poisson poisson_estat post postclose postfile postutil pperron pr prais prais_e prais_e2 prais_p predict predictnl preserve print pro prob probi probit probit_estat probit_p proc_time procoverlay procrustes procrustes_estat procrustes_p profiler prog progr progra program prop proportion prtest prtesti pwcorr pwd q\\s qby qbys qchi qchi_7 qladder qladder_7 qnorm qnorm_7 qqplot qqplot_7 qreg qreg_c qreg_p qreg_sw qu quadchk quantile quantile_7 que quer query range ranksum ratio rchart rchart_7 rcof recast reclink recode reg reg3 reg3_p regdw regr regre regre_p2 regres regres_p regress regress_estat regriv_p remap ren rena renam rename renpfix repeat replace report reshape restore ret retu retur return rm rmdir robvar roccomp roccomp_7 roccomp_8 rocf_lf rocfit rocfit_8 rocgold rocplot rocplot_7 roctab roctab_7 rolling rologit rologit_p rot rota rotat rotate rotatemat rreg rreg_p ru run runtest rvfplot rvfplot_7 rvpplot rvpplot_7 sa safesum sample sampsi sav save savedresults saveold sc sca scal scala scalar scatter scm_mine sco scob_lf scob_p scobi_sw scobit scor score scoreplot scoreplot_help scree screeplot screeplot_help sdtest sdtesti se search separate seperate serrbar serrbar_7 serset set set_defaults sfrancia sh she shel shell shewhart shewhart_7 signestimationsample signrank signtest simul simul_7 simulate simulate_8 sktest sleep slogit slogit_d2 slogit_p smooth snapspan so sor sort spearman spikeplot spikeplot_7 spikeplt spline_x split sqreg sqreg_p sret sretu sretur sreturn ssc st st_ct st_hc st_hcd st_hcd_sh st_is st_issys st_note st_promo st_set st_show st_smpl st_subid stack statsby statsby_8 stbase stci stci_7 stcox stcox_estat stcox_fr stcox_fr_ll stcox_p stcox_sw stcoxkm stcoxkm_7 stcstat stcurv stcurve stcurve_7 stdes stem stepwise stereg stfill stgen stir stjoin stmc stmh stphplot stphplot_7 stphtest stphtest_7 stptime strate strate_7 streg streg_sw streset sts sts_7 stset stsplit stsum sttocc sttoct stvary stweib su suest suest_8 sum summ summa summar summari summariz summarize sunflower sureg survcurv survsum svar svar_p svmat svy svy_disp svy_dreg svy_est svy_est_7 svy_estat svy_get svy_gnbreg_p svy_head svy_header svy_heckman_p svy_heckprob_p svy_intreg_p svy_ivreg_p svy_logistic_p svy_logit_p svy_mlogit_p svy_nbreg_p svy_ologit_p svy_oprobit_p svy_poisson_p svy_probit_p svy_regress_p svy_sub svy_sub_7 svy_x svy_x_7 svy_x_p svydes svydes_8 svygen svygnbreg svyheckman svyheckprob svyintreg svyintreg_7 svyintrg svyivreg svylc svylog_p svylogit svymarkout svymarkout_8 svymean svymlog svymlogit svynbreg svyolog svyologit svyoprob svyoprobit svyopts svypois svypois_7 svypoisson svyprobit svyprobt svyprop svyprop_7 svyratio svyreg svyreg_p svyregress svyset svyset_7 svyset_8 svytab svytab_7 svytest svytotal sw sw_8 swcnreg swcox swereg swilk swlogis swlogit swologit swoprbt swpois swprobit swqreg swtobit swweib symmetry symmi symplot symplot_7 syntax sysdescribe sysdir sysuse szroeter ta tab tab1 tab2 tab_or tabd tabdi tabdis tabdisp tabi table tabodds tabodds_7 tabstat tabu tabul tabula tabulat tabulate te tempfile tempname tempvar tes test testnl testparm teststd tetrachoric time_it timer tis tob tobi tobit tobit_p tobit_sw token tokeni tokeniz tokenize tostring total translate translator transmap treat_ll treatr_p treatreg trim trnb_cons trnb_mean trpoiss_d2 trunc_ll truncr_p truncreg tsappend tset tsfill tsline tsline_ex tsreport tsrevar tsrline tsset tssmooth tsunab ttest ttesti tut_chk tut_wait tutorial tw tware_st two twoway twoway__fpfit_serset twoway__function_gen twoway__histogram_gen twoway__ipoint_serset twoway__ipoints_serset twoway__kdensity_gen twoway__lfit_serset twoway__normgen_gen twoway__pci_serset twoway__qfit_serset twoway__scatteri_serset twoway__sunflower_gen twoway_ksm_serset ty typ type typeof u unab unabbrev unabcmd update us use uselabel var var_mkcompanion var_p varbasic varfcast vargranger varirf varirf_add varirf_cgraph varirf_create varirf_ctable varirf_describe varirf_dir varirf_drop varirf_erase varirf_graph varirf_ograph varirf_rename varirf_set varirf_table varlist varlmar varnorm varsoc varstable varstable_w varstable_w2 varwle vce vec vec_fevd vec_mkphi vec_p vec_p_w vecirf_create veclmar veclmar_w vecnorm vecnorm_w vecrank vecstable verinst vers versi versio version view viewsource vif vwls wdatetof webdescribe webseek webuse weib1_lf weib2_lf weib_lf weib_lf0 weibhet_glf weibhet_glf_sh weibhet_glfa weibhet_glfa_sh weibhet_gp weibhet_ilf weibhet_ilf_sh weibhet_ilfa weibhet_ilfa_sh weibhet_ip weibu_sw weibul_p weibull weibull_c weibull_s weibullhet wh whelp whi which whil while wilc_st wilcoxon win wind windo window winexec wntestb wntestb_7 wntestq xchart xchart_7 xcorr xcorr_7 xi xi_6 xmlsav xmlsave xmluse xpose xsh xshe xshel xshell xt_iis xt_tis xtab_p xtabond xtbin_p xtclog xtcloglog xtcloglog_8 xtcloglog_d2 xtcloglog_pa_p xtcloglog_re_p xtcnt_p xtcorr xtdata xtdes xtfront_p xtfrontier xtgee xtgee_elink xtgee_estat xtgee_makeivar xtgee_p xtgee_plink xtgls xtgls_p xthaus xthausman xtht_p xthtaylor xtile xtint_p xtintreg xtintreg_8 xtintreg_d2 xtintreg_p xtivp_1 xtivp_2 xtivreg xtline xtline_ex xtlogit xtlogit_8 xtlogit_d2 xtlogit_fe_p xtlogit_pa_p xtlogit_re_p xtmixed xtmixed_estat xtmixed_p xtnb_fe xtnb_lf xtnbreg xtnbreg_pa_p xtnbreg_refe_p xtpcse xtpcse_p xtpois xtpoisson xtpoisson_d2 xtpoisson_pa_p xtpoisson_refe_p xtpred xtprobit xtprobit_8 xtprobit_d2 xtprobit_re_p xtps_fe xtps_lf xtps_ren xtps_ren_8 xtrar_p xtrc xtrc_p xtrchh xtrefe_p xtreg xtreg_be xtreg_fe xtreg_ml xtreg_pa_p xtreg_re xtregar xtrere_p xtset xtsf_ll xtsf_llti xtsum xttab xttest0 xttobit xttobit_8 xttobit_p xttrans yx yxview__barlike_draw yxview_area_draw yxview_bar_draw yxview_dot_draw yxview_dropline_draw yxview_function_draw yxview_iarrow_draw yxview_ilabels_draw yxview_normal_draw yxview_pcarrow_draw yxview_pcbarrow_draw yxview_pccapsym_draw yxview_pcscatter_draw yxview_pcspike_draw yxview_rarea_draw yxview_rbar_draw yxview_rbarm_draw yxview_rcap_draw yxview_rcapsym_draw yxview_rconnected_draw yxview_rline_draw yxview_rscatter_draw yxview_rspike_draw yxview_spike_draw yxview_sunflower_draw zap_s zinb zinb_llf zinb_plf zip zip_llf zip_p zip_plf zt_ct_5 zt_hc_5 zt_hcd_5 zt_is_5 zt_iss_5 zt_sho_5 zt_smp_5 ztbase_5 ztcox_5 ztdes_5 ztereg_5 ztfill_5 ztgen_5 ztir_5 ztjoin_5 ztnb ztnb_p ztp ztp_p zts_5 ztset_5 ztspli_5 ztsum_5 zttoct_5 ztvary_5 ztweib_5",c:[{cN:"label",v:[{b:"\\$\\{?[a-zA-Z0-9_]+\\}?"},{b:"`[a-zA-Z0-9_]+'"}]},{cN:"string",v:[{b:'`"[^\r\n]*?"\''},{b:'"[^\r\n"]*"'}]},{cN:"literal",v:[{b:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\(|$)"}]},e.C("^[ ]*\\*.*$",!1),e.CLCM,e.CBCM]}});hljs.registerLanguage("asciidoc",function(e){return{aliases:["adoc"],c:[e.C("^/{4,}\\n","\\n/{4,}$",{r:10}),e.C("^//","$",{r:0}),{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"header",b:"^(={1,5}) .+?( \\1)?$",r:10},{cN:"header",b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$",r:10},{cN:"attribute",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"attribute",b:"^\\[.+?\\]$",r:0},{cN:"blockquote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"label",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"smartquote",v:[{b:"``.+?''"},{b:"`.+?'"}]},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{cN:"horizontal_rule",b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link_url",b:"\\w",e:"[^\\[]+",r:0},{cN:"link_label",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}});hljs.registerLanguage("php",function(e){var c={cN:"variable",b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},i={cN:"preprocessor",b:/<\?(php)?|\?>/},a={cN:"string",c:[e.BE,i],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},i]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[e.BE]},i,c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,a,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},a,n]}});hljs.registerLanguage("java",function(e){var a=e.UIR+"(<"+e.UIR+">)?",t="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",c="(\\b(0b[01_]+)|\\b0[xX][a-fA-F0-9_]+|(\\b[\\d_]+(\\.[\\d_]*)?|\\.[\\d_]+)([eE][-+]?\\d+)?)[lLfF]?",r={cN:"number",b:c,r:0};return{aliases:["jsp"],k:t,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return",r:0},{cN:"function",b:"("+a+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},r,{cN:"annotation",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("glsl",function(e){return{k:{keyword:"atomic_uint attribute bool break bvec2 bvec3 bvec4 case centroid coherent const continue default discard dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 do double dvec2 dvec3 dvec4 else flat float for highp if iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray in inout int invariant isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 layout lowp mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 mediump noperspective out patch precision readonly restrict return sample sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow smooth struct subroutine switch uimage1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint uniform usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D usamplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 varying vec2 vec3 vec4 void volatile while writeonly",built_in:"gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffsetgl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_PerVertex gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicCounter atomicCounterDecrement atomicCounterIncrement barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow gl_TextureMatrix gl_TextureMatrixInverse",literal:"true false"},i:'"',c:[e.CLCM,e.CBCM,e.CNM,{cN:"preprocessor",b:"#",e:"$"}]}});hljs.registerLanguage("lua",function(e){var t="\\[=*\\[",a="\\]=*\\]",r={b:t,e:a,c:["self"]},n=[e.C("--(?!"+t+")","$"),e.C("--"+t,a,{c:[r],r:10})];return{l:e.UIR,k:{keyword:"and break do else elseif end false for if in local nil not or repeat return then true until while",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},c:n.concat([{cN:"function",bK:"function",e:"\\)",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{cN:"params",b:"\\(",eW:!0,c:n}].concat(n)},e.CNM,e.ASM,e.QSM,{cN:"string",b:t,e:a,c:[r],r:5}])}});hljs.registerLanguage("protobuf",function(e){return{k:{keyword:"package import option optional required repeated group",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},c:[e.QSM,e.NM,e.CLCM,{cN:"class",bK:"message enum service",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{cN:"function",bK:"rpc",e:/;/,eE:!0,k:"rpc returns"},{cN:"constant",b:/^\s*[A-Z_]+/,e:/\s*=/,eE:!0}]}});hljs.registerLanguage("gcode",function(e){var N="[A-Z_][A-Z0-9_.]*",i="\\%",c={literal:"",built_in:"",keyword:"IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT EQ LT GT NE GE LE OR XOR"},r={cN:"preprocessor",b:"([O])([0-9]+)"},l=[e.CLCM,e.CBCM,e.C(/\(/,/\)/),e.inherit(e.CNM,{b:"([-+]?([0-9]*\\.?[0-9]+\\.?))|"+e.CNR}),e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"keyword",b:"([G])([0-9]+\\.?[0-9]?)"},{cN:"title",b:"([M])([0-9]+\\.?[0-9]?)"},{cN:"title",b:"(VC|VS|#)",e:"(\\d+)"},{cN:"title",b:"(VZOFX|VZOFY|VZOFZ)"},{cN:"built_in",b:"(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)",e:"([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])"},{cN:"label",v:[{b:"N",e:"\\d+",i:"\\W"}]}];return{aliases:["nc"],cI:!0,l:N,k:c,c:[{cN:"preprocessor",b:i},r].concat(l)}});hljs.registerLanguage("vim",function(e){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw d|0 delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu g|0 go gr grepa gu gv ha h|0 helpf helpg helpt hi hid his i|0 ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs n|0 new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf q|0 quita qa r|0 rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv s|0 sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync t|0 tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up v|0 ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"abs acos add and append argc argidx argv asin atan atan2 browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call ceil changenr char2nr cindent clearmatches col complete complete_add complete_check confirm copy cos cosh count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty escape eval eventhandler executable exists exp expand extend feedkeys filereadable filewritable filter finddir findfile float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function garbagecollect get getbufline getbufvar getchar getcharmod getcmdline getcmdpos getcmdtype getcwd getfontname getfperm getfsize getftime getftype getline getloclist getmatches getpid getpos getqflist getreg getregtype gettabvar gettabwinvar getwinposx getwinposy getwinvar glob globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputlist inputrestore inputsave inputsecret insert invert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime log log10 luaeval map maparg mapcheck match matchadd matcharg matchdelete matchend matchlist matchstr max min mkdir mode mzeval nextnonblank nr2char or pathshorten pow prevnonblank printf pumvisible py3eval pyeval range readfile reltime reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse round screenattr screenchar screencol screenrow search searchdecl searchpair searchpairpos searchpos server2client serverlist setbufvar setcmdpos setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar setwinvar sha256 shellescape shiftwidth simplify sin sinh sort soundfold spellbadword spellsuggest split sqrt str2float str2nr strchars strdisplaywidth strftime stridx string strlen strpart strridx strtrans strwidth submatch substitute synconcealed synID synIDattr synIDtrans synstack system tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname tolower toupper tr trunc type undofile undotree values virtcol visualmode wildmenumode winbufnr wincol winheight winline winnr winrestcmd winrestview winsaveview winwidth writefile xor"},i:/[{:]/,c:[e.NM,e.ASM,{cN:"string",b:/"((\\")|[^"\n])*("|\n)/},{cN:"variable",b:/[bwtglsav]:[\w\d_]*/},{cN:"function",bK:"function function!",e:"$",r:0,c:[e.TM,{cN:"params",b:"\\(",e:"\\)"}]}]}});hljs.registerLanguage("processing",function(e){return{k:{keyword:"BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject Object StringDict StringList Table TableRow XML false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",constant:"P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI",variable:"displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key keyCode pixels focused frameCount frameRate height width",title:"setup draw",built_in:"size createGraphics beginDraw createShape loadShape PShape arc ellipse line point quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour millis minute month second year background clear colorMode fill noFill noStroke stroke alpha blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM]}});hljs.registerLanguage("mizar",function(e){return{k:"environ vocabularies notations constructors definitions registrations theorems schemes requirements begin end definition registration cluster existence pred func defpred deffunc theorem proof let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from be being by means equals implies iff redefine define now not or attr is mode suppose per cases set thesis contradiction scheme reserve struct correctness compatibility coherence symmetry assymetry reflexivity irreflexivity connectedness uniqueness commutativity idempotence involutiveness projectivity",c:[e.C("::","$")]}});hljs.registerLanguage("vbnet",function(e){return{aliases:["vb"],cI:!0,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C("'","$",{rB:!0,c:[{cN:"xmlDocTag",b:"'''|",c:[e.PWM]},{cN:"xmlDocTag",b:"",c:[e.PWM]}]}),e.CNM,{cN:"preprocessor",b:"#",e:"$",k:"if else elseif end region externalsource"}]}});hljs.registerLanguage("q",function(e){var s={keyword:"do while select delete by update from",constant:"0b 1b",built_in:"neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum",typename:"`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid"};return{aliases:["k","kdb"],k:s,l:/\b(`?)[A-Za-z0-9_]+\b/,c:[e.CLCM,e.QSM,e.CNM]}});hljs.registerLanguage("livescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger case default function var with then unless until loop of by when and or is isnt not it that otherwise from to til fallthrough super case default function var void const let enum export import native __hasProp __extends __slice __bind __indexOf",literal:"true false null undefined yes no on off it that void",built_in:"npm require console print module global window document"},s="[A-Za-z$_](?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*",i=e.inherit(e.TM,{b:s}),n={cN:"subst",b:/#\{/,e:/}/,k:t},r={cN:"subst",b:/#[A-Za-z$_]/,e:/(?:\-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,k:t},c=[e.BNM,{cN:"number",b:"(\\b0[xX][a-fA-F0-9_]+)|(\\b\\d(\\d|_\\d)*(\\.(\\d(\\d|_\\d)*)?)?(_*[eE]([-+]\\d(_\\d|\\d)*)?)?[_a-z]*)",r:0,starts:{e:"(\\s*/)?",r:0}},{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n,r]},{b:/"/,e:/"/,c:[e.BE,n,r]},{b:/\\/,e:/(\s|$)/,eE:!0}]},{cN:"pi",v:[{b:"//",e:"//[gim]*",c:[n,e.HCM]},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{cN:"property",b:"@"+s},{b:"``",e:"``",eB:!0,eE:!0,sL:"javascript"}];n.c=c;var a={cN:"params",b:"\\(",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(c)}]};return{aliases:["ls"],k:t,i:/\/\*/,c:c.concat([e.C("\\/\\*","\\*\\/"),e.HCM,{cN:"function",c:[i,a],rB:!0,v:[{b:"("+s+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B\\->\\*?",e:"\\->\\*?"},{b:"("+s+"\\s*(?:=|:=)\\s*)?!?(\\(.*\\))?\\s*\\B[-~]{1,2}>\\*?",e:"[-~]{1,2}>\\*?"},{b:"("+s+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B!?[-~]{1,2}>\\*?",e:"!?[-~]{1,2}>\\*?"}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{cN:"attribute",b:s+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("haxe",function(e){var r="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";return{aliases:["hx"],k:{keyword:"break callback case cast catch class continue default do dynamic else enum extends extern for function here if implements import in inline interface never new override package private public return static super switch this throw trace try typedef untyped using var while",literal:"true false null"},c:[e.ASM,e.QSM,e.CLCM,e.CBCM,e.CNM,{cN:"class",bK:"class interface",e:"{",eE:!0,c:[{bK:"extends implements"},e.TM]},{cN:"preprocessor",b:"#",e:"$",k:"if else elseif end error"},{cN:"function",bK:"function",e:"[{;]",eE:!0,i:"\\S",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",c:[e.ASM,e.QSM,e.CLCM,e.CBCM]},{cN:"type",b:":",e:r,r:10}]}]}});hljs.registerLanguage("monkey",function(e){var n={cN:"number",r:0,v:[{b:"[$][a-fA-F0-9]+"},e.NM]};return{cI:!0,k:{keyword:"public private property continue exit extern new try catch eachin not abstract final select case default const local global field end if then else elseif endif while wend repeat until forever for to step next return module inline throw",built_in:"DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI",literal:"true false null and or shl shr mod"},c:[e.C("#rem","#end"),e.C("'","$",{r:0}),{cN:"function",bK:"function method",e:"[(=:]|$",i:/\n/,c:[e.UTM]},{cN:"class",bK:"class interface",e:"$",c:[{bK:"extends implements"},e.UTM]},{cN:"variable",b:"\\b(self|super)\\b"},{cN:"preprocessor",bK:"import",e:"$"},{cN:"preprocessor",b:"\\s*#",e:"$",k:"if else elseif endif end then"},{cN:"pi",b:"^\\s*strict\\b"},{bK:"alias",e:"=",c:[e.UTM]},e.QSM,n]}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,e.NM,s,a,t]}});hljs.registerLanguage("erlang",function(e){var r="[a-z'][a-zA-Z0-9_']*",c="("+r+":"+r+"|"+r+")",a={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor",literal:"false true"},n=e.C("%","$"),i={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},b={b:"fun\\s+"+r+"/\\d+"},d={b:c+"\\(",e:"\\)",rB:!0,r:0,c:[{cN:"function_name",b:c,r:0},{b:"\\(",e:"\\)",eW:!0,rE:!0,r:0}]},o={cN:"tuple",b:"{",e:"}",r:0},t={cN:"variable",b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0},l={cN:"variable",b:"[A-Z][a-zA-Z0-9_]*",r:0},f={b:"#"+e.UIR,r:0,rB:!0,c:[{cN:"record_name",b:"#"+e.UIR,r:0},{b:"{",e:"}",r:0}]},s={bK:"fun receive if try case",e:"end",k:a};s.c=[n,b,e.inherit(e.ASM,{cN:""}),s,d,e.QSM,i,o,t,l,f];var u=[n,b,s,d,e.QSM,i,o,t,l,f];d.c[1].c=u,o.c=u,f.c[1].c=u;var v={cN:"params",b:"\\(",e:"\\)",c:u};return{aliases:["erl"],k:a,i:"(",rB:!0,i:"\\(|#|//|/\\*|\\\\|:|;",c:[v,e.inherit(e.TM,{b:r})],starts:{e:";|\\.",k:a,c:u}},n,{cN:"pp",b:"^-",e:"\\.",r:0,eE:!0,rB:!0,l:"-"+e.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",c:[v]},i,e.QSM,f,t,l,o,{b:/\.$/}]}});hljs.registerLanguage("kotlin",function(e){var a="val var get set class trait object public open private protected final enum if else do while for when break continue throw try catch finally import package is as in return fun override default companion reified inline volatile transient native";return{k:{typename:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null",keyword:a},c:[e.CLCM,{cN:"javadoc",b:"/\\*\\*",e:"\\*//*",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CBCM,{cN:"type",b://,rB:!0,eE:!1,r:0},{cN:"function",bK:"fun",e:"[(]|$",rB:!0,eE:!0,k:a,i:/fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,i:/\([^\(,\s:]+,/,c:[{cN:"typename",b:/:\s*/,e:/\s*[=\)]/,eB:!0,rE:!0,r:0}]},e.CLCM,e.CBCM]},{cN:"class",bK:"class trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"typename",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0}]},{cN:"variable",bK:"var val",e:/\s*[=:$]/,eE:!0},e.QSM,{cN:"shebang",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.CNM]}});hljs.registerLanguage("stylus",function(t){var e={cN:"variable",b:"\\$"+t.IR},o={cN:"hexcolor",b:"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})",r:10},i=["charset","css","debug","extend","font-face","for","import","include","media","mixin","page","warn","while"],r=["after","before","first-letter","first-line","active","first-child","focus","hover","lang","link","visited"],n=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],a="[\\.\\s\\n\\[\\:,]",l=["align-content","align-items","align-self","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","auto","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","clip-path","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-ligatures","font-weight","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inherit","initial","justify-content","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","mask","max-height","max-width","min-height","min-width","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","pointer-events","position","quotes","resize","right","tab-size","table-layout","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"],d=["\\{","\\}","\\?","(\\bReturn\\b)","(\\bEnd\\b)","(\\bend\\b)",";","#\\s","\\*\\s","===\\s","\\|","%"];return{aliases:["styl"],cI:!1,i:"("+d.join("|")+")",k:"if else for in",c:[t.QSM,t.ASM,t.CLCM,t.CBCM,o,{b:"\\.[a-zA-Z][a-zA-Z0-9_-]*"+a,rB:!0,c:[{cN:"class",b:"\\.[a-zA-Z][a-zA-Z0-9_-]*"}]},{b:"\\#[a-zA-Z][a-zA-Z0-9_-]*"+a,rB:!0,c:[{cN:"id",b:"\\#[a-zA-Z][a-zA-Z0-9_-]*"}]},{b:"\\b("+n.join("|")+")"+a,rB:!0,c:[{cN:"tag",b:"\\b[a-zA-Z][a-zA-Z0-9_-]*"}]},{cN:"pseudo",b:"&?:?:\\b("+r.join("|")+")"+a},{cN:"at_rule",b:"@("+i.join("|")+")\\b"},e,t.CSSNM,t.NM,{cN:"function",b:"\\b[a-zA-Z][a-zA-Z0-9_-]*\\(.*\\)",i:"[\\n]",rB:!0,c:[{cN:"title",b:"\\b[a-zA-Z][a-zA-Z0-9_-]*"},{cN:"params",b:/\(/,e:/\)/,c:[o,e,t.ASM,t.CSSNM,t.NM,t.QSM]}]},{cN:"attribute",b:"\\b("+l.reverse().join("|")+")\\b"}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",a={cN:"function",b:c+"\\(",rB:!0,eE:!0,e:"\\("},r={cN:"rule",b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{cN:"value",eW:!0,eE:!0,c:[a,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]};return{cI:!0,i:/[=\/|']/,c:[e.CBCM,r,{cN:"id",b:/\#[A-Za-z0-9_-]+/},{cN:"class",b:/\.[A-Za-z0-9_-]+/,r:0},{cN:"attr_selector",b:/\[/,e:/\]/,i:"$"},{cN:"pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"']+/},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[a,e.ASM,e.QSM,e.CSSNM]}]},{cN:"tag",b:c,r:0},{cN:"rules",b:"{",e:"}",i:/\S/,r:0,c:[e.CBCM,r]}]}});hljs.registerLanguage("puppet",function(e){var s="augeas computer cron exec file filebucket host interface k5login macauthorization mailalias maillist mcx mount nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service firewall nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo nagios_servicegroup nagios_timeperiod notify package resources router schedule scheduled_task selboolean selmodule service ssh_authorized_key sshkey stage tidy user vlan yumrepo zfs zone zpool",r="alias audit before loglevel noop require subscribe tag owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check en_address ip_address realname command environment hour monute month monthday special target weekday creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey sslverify mounted",a={keyword:"and case class default define else elsif false if in import enherits node or true undef unless main settings $string "+s,literal:r,built_in:"architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version"},i=e.C("#","$"),o={cN:"string",c:[e.BE],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]},n=[o,i,{cN:"keyword",bK:"class",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"(::)?[A-Za-z_]\\w*(::\\w+)*"}),i,o]},{cN:"keyword",b:"([a-zA-Z_(::)]+ *\\{)",c:[o,i],r:0},{cN:"keyword",b:"(\\}|\\{)",r:0},{cN:"function",b:"[a-zA-Z_]+\\s*=>"},{cN:"constant",b:"(::)?(\\b[A-Z][a-z_]*(::)?)+",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0}];return{aliases:["pp"],k:a,c:n}});hljs.registerLanguage("nimrod",function(t){return{aliases:["nim"],k:{keyword:"addr and as asm bind block break|0 case|0 cast const|0 continue|0 converter discard distinct|10 div do elif else|0 end|0 enum|0 except export finally for from generic if|0 import|0 in include|0 interface is isnot|10 iterator|10 let|0 macro method|10 mixin mod nil not notin|10 object|0 of or out proc|10 ptr raise ref|10 return shl shr static template|10 try|0 tuple type|0 using|0 var|0 when while|0 with without xor yield",literal:"shared guarded stdin stdout stderr result|10 true false"},c:[{cN:"decorator",b:/{\./,e:/\.}/,r:10},{cN:"string",b:/[a-zA-Z]\w*"/,e:/"/,c:[{b:/""/}]},{cN:"string",b:/([a-zA-Z]\w*)?"""/,e:/"""/},t.QSM,{cN:"type",b:/\b[A-Z]\w+\b/,r:0},{cN:"type",b:/\b(int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|string|cstring|pointer|expr|stmt|void|auto|any|range|array|openarray|varargs|seq|set|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringarray|semistatic)\b/},{cN:"number",b:/\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/,r:0},{cN:"number",b:/\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/,r:0},{cN:"number",b:/\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/,r:0},{cN:"number",b:/\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/,r:0},t.HCM]}});hljs.registerLanguage("smalltalk",function(a){var r="[a-z][a-zA-Z0-9_]*",s={cN:"char",b:"\\$.{1}"},c={cN:"symbol",b:"#"+a.UIR};return{aliases:["st"],k:"self super nil true false thisContext",c:[a.C('"','"'),a.ASM,{cN:"class",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{cN:"method",b:r+":",r:0},a.CNM,c,s,{cN:"localvars",b:"\\|[ ]*"+r+"([ ]+"+r+")*[ ]*\\|",rB:!0,e:/\|/,i:/\S/,c:[{b:"(\\|[ ]*)?"+r}]},{cN:"array",b:"\\#\\(",e:"\\)",c:[a.ASM,s,a.CNM,c]}]}});hljs.registerLanguage("x86asm",function(s){return{cI:!0,l:"\\.?"+s.IR,k:{keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63",literal:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l",pseudo:"db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times",preprocessor:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public ",built_in:"bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__"},c:[s.C(";","$",{r:0}),{cN:"number",b:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b",r:0},{cN:"number",b:"\\$[0-9][0-9A-Fa-f]*",r:0},{cN:"number",b:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[HhXx]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b"},{cN:"number",b:"\\b(?:0[HhXx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b"},s.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"string",b:"`",e:"[^\\\\]`",r:0},{cN:"string",b:"\\.[A-Za-z0-9]+",r:0},{cN:"label",b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",r:0},{cN:"label",b:"^\\s*%%[A-Za-z0-9_$#@~.?]*:",r:0},{cN:"argument",b:"%[0-9]+",r:0},{cN:"built_in",b:"%!S+",r:0}]}});hljs.registerLanguage("roboconf",function(e){var n="[a-zA-Z-_][^\n{\r\n]+\\{";return{aliases:["graph","instances"],cI:!0,k:"import",c:[{cN:"facet",b:"^facet "+n,e:"}",k:"facet installer exports children extends",c:[e.HCM]},{cN:"instance-of",b:"^instance of "+n,e:"}",k:"name count channels instance-data instance-state instance of",c:[{cN:"keyword",b:"[a-zA-Z-_]+( | )*:"},e.HCM]},{cN:"component",b:"^"+n,e:"}",l:"\\(?[a-zA-Z]+\\)?",k:"installer exports children extends imports facets alias (optional)",c:[{cN:"string",b:"\\.[a-zA-Z-_]+",e:"\\s|,|;",eE:!0},e.HCM]},e.HCM]}});hljs.registerLanguage("ruby",function(e){var c="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",b={cN:"yardoctag",b:"@[A-Za-z]+"},a={cN:"value",b:"#<",e:">"},n=[e.C("#","$",{c:[b]}),e.C("^\\=begin","^\\=end",{c:[b],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},t={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},i={cN:"params",b:"\\(",e:"\\)",k:r},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(n)},{cN:"function",bK:"def",e:" |$|;",r:0,c:[e.inherit(e.TM,{b:c}),i].concat(n)},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[t,{b:c}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[a,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(n),r:0}].concat(n);s.c=d,i.c=d;var o="[>?]>",l="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",N=[{b:/^\s*=>/,cN:"status",starts:{e:"$",c:d}},{cN:"prompt",b:"^("+o+"|"+l+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,c:n.concat(N).concat(d)}});hljs.registerLanguage("typescript",function(e){return{aliases:["ts"],k:{keyword:"in if for while finally var new function|0 do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private get set super interface extendsstatic constructor implements enum export import declare type protected",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:0},e.ASM,e.QSM,e.CLCM,e.CBCM,e.CNM,{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/\[|%/,r:0},{cN:"constructor",bK:"constructor",e:/\{/,eE:!0,r:10},{cN:"module",bK:"module",e:/\{/,eE:!0},{cN:"interface",bK:"interface",e:/\{/,eE:!0},{b:/\$[(.]/},{b:"\\."+e.IR,r:0}]}});hljs.registerLanguage("handlebars",function(e){var a="each in with if else unless bindattr action collection debugger log outlet template unbound view yield";return{aliases:["hbs","html.hbs","html.handlebars"],cI:!0,sL:"xml",subLanguageMode:"continuous",c:[{cN:"expression",b:"{{",e:"}}",c:[{cN:"begin-block",b:"#[a-zA-Z- .]+",k:a},{cN:"string",b:'"',e:'"'},{cN:"end-block",b:"\\/[a-zA-Z- .]+",k:a},{cN:"variable",b:"[a-zA-Z-.]+",k:a}]}]}});hljs.registerLanguage("mercury",function(e){var i={keyword:"module use_module import_module include_module end_module initialise mutable initialize finalize finalise interface implementation pred mode func type inst solver any_pred any_func is semidet det nondet multi erroneous failure cc_nondet cc_multi typeclass instance where pragma promise external trace atomic or_else require_complete_switch require_det require_semidet require_multi require_nondet require_cc_multi require_cc_nondet require_erroneous require_failure",pragma:"inline no_inline type_spec source_file fact_table obsolete memo loop_check minimal_model terminates does_not_terminate check_termination promise_equivalent_clauses",preprocessor:"foreign_proc foreign_decl foreign_code foreign_type foreign_import_module foreign_export_enum foreign_export foreign_enum may_call_mercury will_not_call_mercury thread_safe not_thread_safe maybe_thread_safe promise_pure promise_semipure tabled_for_io local untrailed trailed attach_to_io_state can_pass_as_mercury_type stable will_not_throw_exception may_modify_trail will_not_modify_trail may_duplicate may_not_duplicate affects_liveness does_not_affect_liveness doesnt_affect_liveness no_sharing unknown_sharing sharing",built_in:"some all not if then else true fail false try catch catch_any semidet_true semidet_false semidet_fail impure_true impure semipure"},r={cN:"label",b:"XXX",e:"$",eW:!0,r:0},t=e.inherit(e.CLCM,{b:"%"}),_=e.inherit(e.CBCM,{r:0});t.c.push(r),_.c.push(r);var n={cN:"number",b:"0'.\\|0[box][0-9a-fA-F]*"},a=e.inherit(e.ASM,{r:0}),o=e.inherit(e.QSM,{r:0}),l={cN:"constant",b:"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]",r:0};o.c.push(l);var s={cN:"built_in",v:[{b:"<=>"},{b:"<=",r:0},{b:"=>",r:0},{b:"/\\\\"},{b:"\\\\/"}]},c={cN:"built_in",v:[{b:":-\\|-->"},{b:"=",r:0}]};return{aliases:["m","moo"],k:i,c:[s,c,t,_,n,e.NM,a,o,{b:/:-/}]}});hljs.registerLanguage("fix",function(u){return{c:[{b:/[^\u2401\u0001]+/,e:/[\u2401\u0001]/,eE:!0,rB:!0,rE:!1,c:[{b:/([^\u2401\u0001=]+)/,e:/=([^\u2401\u0001=]+)/,rE:!0,rB:!1,cN:"attribute"},{b:/=/,e:/([\u2401\u0001])/,eE:!0,eB:!0,cN:"string"}]}],cI:!0}});hljs.registerLanguage("clojure",function(e){var t={built_in:"def cond apply if-not if-let if not not= = < > <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"},r="a-zA-Z_\\-!.?+*=<>&#'",n="["+r+"]["+r+"0-9/;:]*",a="[-+]?\\d+(\\.\\d+)?",o={b:n,r:0},s={cN:"number",b:a,r:0},i=e.inherit(e.QSM,{i:null}),c=e.C(";","$",{r:0}),d={cN:"literal",b:/\b(true|false|nil)\b/},l={cN:"collection",b:"[\\[\\{]",e:"[\\]\\}]"},m={cN:"comment",b:"\\^"+n},p=e.C("\\^\\{","\\}"),u={cN:"attribute",b:"[:]"+n},f={cN:"list",b:"\\(",e:"\\)"},h={eW:!0,r:0},y={k:t,l:n,cN:"keyword",b:n,starts:h},b=[f,i,m,p,c,u,l,s,d,o];return f.c=[e.C("comment",""),y,h],h.c=b,l.c=b,{aliases:["clj"],i:/\S/,c:[f,i,m,p,c,u,l,s,d]}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={cN:"variable",v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=e.C("^(__END__|__DATA__)","\\n$",{r:5}),o=[e.BE,r,n],a=[n,e.HCM,i,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:o,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,i,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];return r.c=a,s.c=a,{aliases:["pl"],k:t,c:a}});hljs.registerLanguage("twig",function(e){var t={cN:"params",b:"\\(",e:"\\)"},a="attribute block constant cycle date dump include max min parent random range source template_from_string",r={cN:"function",bK:a,r:0,c:[t]},c={cN:"filter",b:/\|[A-Za-z_]+:?/,k:"abs batch capitalize convert_encoding date date_modify default escape first format join json_encode keys last length lower merge nl2br number_format raw replace reverse round slice sort split striptags title trim upper url_encode",c:[r]},n="autoescape block do embed extends filter flush for if import include macro sandbox set spaceless use verbatim";return n=n+" "+n.split(" ").map(function(e){return"end"+e}).join(" "),{aliases:["craftcms"],cI:!0,sL:"xml",subLanguageMode:"continuous",c:[e.C(/\{#/,/#}/),{cN:"template_tag",b:/\{%/,e:/%}/,k:n,c:[c,r]},{cN:"variable",b:/\{\{/,e:/}}/,c:[c,r]}]}});hljs.registerLanguage("livecodeserver",function(e){var r={cN:"variable",b:"\\b[gtps][A-Z]+[A-Za-z0-9_\\-]*\\b|\\$_[A-Z]+",r:0},t=[e.CBCM,e.HCM,e.C("--","$"),e.C("[^:]//","$")],a=e.inherit(e.TM,{v:[{b:"\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*"},{b:"\\b_[a-z0-9\\-]+"}]}),o=e.inherit(e.TM,{b:"\\b([A-Za-z0-9_\\-]+)\\b"});return{cI:!1,k:{keyword:"$_COOKIE $_FILES $_GET $_GET_BINARY $_GET_RAW $_POST $_POST_BINARY $_POST_RAW $_SESSION $_SERVER codepoint codepoints segment segments codeunit codeunits sentence sentences trueWord trueWords paragraph after byte bytes english the until http forever descending using line real8 with seventh for stdout finally element word words fourth before black ninth sixth characters chars stderr uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat end repeat URL in try into switch to words https token binfile each tenth as ticks tick system real4 by dateItems without char character ascending eighth whole dateTime numeric short first ftp integer abbreviated abbr abbrev private case while if",constant:"SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five quote empty one true return cr linefeed right backslash null seven tab three two RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK",operator:"div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within contains ends with begins the keys of keys",built_in:"put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg avgDev base64Decode base64Encode baseConvert binaryDecode binaryEncode byteOffset byteToNum cachedURL cachedURLs charToNum cipherNames codepointOffset codepointProperty codepointToNum codeunitOffset commandNames compound compress constantNames cos date dateFormat decompress directories diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames geometricMean global globals hasMemory harmonicMean hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge millisec millisecs millisecond milliseconds min monthNames nativeCharToNum normalizeText num number numToByte numToChar numToCodepoint numToNativeChar offset open openfiles openProcesses openProcessIDs openSockets paragraphOffset paramCount param params peerAddress pendingMessages platform popStdDev populationStandardDeviation populationVariance popVariance processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLCreateTreeFromFileWithNamespaces revXMLCreateTreeWithNamespaces revXMLDataFromXPathQuery revXMLEvaluateXPath revXMLFirstChild revXMLMatchingNode revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_Execute revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sampVariance sec secs seconds sentenceOffset sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound stdDev sum sysError systemVersion tan tempName textDecode textEncode tick ticks time to tokenOffset toLower toUpper transpose truewordOffset trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus uuid value variableNames variance version waitDepth weekdayNames wordOffset xsltApplyStylesheet xsltApplyStylesheetFromFile xsltLoadStylesheet xsltLoadStylesheetFromFile add breakpoint cancel clear local variable file word line folder directory URL close socket process combine constant convert create new alias folder directory decrypt delete variable word line folder directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime libURLSetStatusCallback load multiply socket prepare process post seek rel relative read from process rename replace require resetAll resolve revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split start stop subtract union unload wait write"},c:[r,{cN:"keyword",b:"\\bend\\sif\\b"},{cN:"function",bK:"function",e:"$",c:[r,o,e.ASM,e.QSM,e.BNM,e.CNM,a]},{cN:"function",bK:"end",e:"$",c:[o,a]},{cN:"command",bK:"command on",e:"$",c:[r,o,e.ASM,e.QSM,e.BNM,e.CNM,a]},{cN:"command",bK:"end",e:"$",c:[o,a]},{cN:"preprocessor",b:"<\\?rev|<\\?lc|<\\?livecode",r:10},{cN:"preprocessor",b:"<\\?"},{cN:"preprocessor",b:"\\?>"},e.ASM,e.QSM,e.BNM,e.CNM,a].concat(t),i:";$|^\\[|^="}});hljs.registerLanguage("step21",function(e){var r="[A-Z_][A-Z0-9_.]*",i="END-ISO-10303-21;",l={literal:"",built_in:"",keyword:"HEADER ENDSEC DATA"},s={cN:"preprocessor",b:"ISO-10303-21;",r:10},t=[e.CLCM,e.CBCM,e.C("/\\*\\*!","\\*/"),e.CNM,e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"string",b:"'",e:"'"},{cN:"label",v:[{b:"#",e:"\\d+",i:"\\W"}]}];return{aliases:["p21","step","stp"],cI:!0,l:r,k:l,c:[{cN:"preprocessor",b:i,r:10},s].concat(t)}});hljs.registerLanguage("cpp",function(t){var i={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary intmax_t uintmax_t int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t int_least8_t uint_least8_t int_least16_t uint_least16_t int_least32_t uint_least32_t int_least64_t uint_least64_t int_fast8_t uint_fast8_t int_fast16_t uint_fast16_t int_fast32_t uint_fast32_t int_fast64_t uint_fast64_t intptr_t uintptr_t atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong atomic_wchar_t atomic_char16_t atomic_char32_t atomic_intmax_t atomic_uintmax_t atomic_intptr_t atomic_uintptr_t atomic_size_t atomic_ptrdiff_t atomic_int_least8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_uint_least8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_int_fast8_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_uint_fast8_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c","cc","h","c++","h++","hpp"],k:i,i:""]',k:"include",i:"\\n"},t.CLCM]},{b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:i,c:["self"]},{b:t.IR+"::",k:i},{bK:"new throw return else",r:0},{cN:"function",b:"("+t.IR+"\\s+)+"+t.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:t.IR+"\\s*\\(",rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:i,r:0,c:[t.CBCM]},t.CLCM,t.CBCM]}]}});hljs.registerLanguage("vala",function(e){return{k:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object",literal:"false true null"},c:[{cN:"class",bK:"class interface delegate namespace",e:"{",eE:!0,i:"[^,:\\n\\s\\.]",c:[e.UTM]},e.CLCM,e.CBCM,{cN:"string",b:'"""',e:'"""',r:5},e.ASM,e.QSM,e.CNM,{cN:"preprocessor",b:"^#",e:"$",r:2},{cN:"constant",b:" [A-Z_]+ ",r:0}]}});hljs.registerLanguage("http",function(t){return{aliases:["https"],i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:!0}}]}});hljs.registerLanguage("avrasm",function(r){return{cI:!0,l:"\\.?"+r.IR,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",preprocessor:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},c:[r.CBCM,r.C(";","$",{r:0}),r.CNM,r.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},r.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"localvars",b:"@[0-9]+"}]}});hljs.registerLanguage("aspectj",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",i="get set args call";return{k:t,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"aspect",bK:"aspect",e:/[{;=]/,eE:!0,i:/[:;"\[\]]/,c:[{bK:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},e.UTM,{b:/\([^\)]*/,e:/[)]+/,k:t+" "+i,eE:!1}]},{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,r:0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"pointcut after before around throwing returning",e:/[)]/,eE:!1,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",rB:!0,c:[e.UTM]}]},{b:/[:]/,rB:!0,e:/[{;]/,r:0,eE:!1,k:t,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",k:t+" "+i},e.QSM]},{bK:"new throw",r:0},{cN:"function",b:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,rB:!0,e:/[{;=]/,k:t,eE:!0,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,r:0,k:t,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},e.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("rib",function(e){return{k:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",i:">>|\.\.\.) /},b={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},l={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},c={cN:"params",b:/\(/,e:/\)/,c:["self",r,l,b]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[r,l,b,e.HCM,{v:[{cN:"function",bK:"def",r:10},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,c]},{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("axapta",function(e){return{k:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"class",bK:"class interface",e:"{",eE:!0,i:":",c:[{bK:"extends implements"},e.UTM]}]}});hljs.registerLanguage("nix",function(e){var t={keyword:"rec with let in inherit assert if else then",constant:"true false or and null",built_in:"import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation"},i={cN:"subst",b:/\$\{/,e:/}/,k:t},r={cN:"variable",b:/[a-zA-Z0-9-_]+(\s*=)/},n={cN:"string",b:"''",e:"''",c:[i]},s={cN:"string",b:'"',e:'"',c:[i]},a=[e.NM,e.HCM,e.CBCM,n,s,r];return i.c=a,{aliases:["nixos"],k:t,c:a}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}});hljs.registerLanguage("parser3",function(r){var e=r.C("{","}",{c:["self"]});return{sL:"xml",r:0,c:[r.C("^#","$"),r.C("\\^rem{","}",{r:10,c:[e]}),{cN:"preprocessor",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},r.CNM]}});hljs.registerLanguage("django",function(e){var t={cN:"filter",b:/\|[A-Za-z]+:?/,k:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone",c:[{cN:"argument",b:/"/,e:/"/},{cN:"argument",b:/'/,e:/'/}]};return{aliases:["jinja"],cI:!0,sL:"xml",subLanguageMode:"continuous",c:[e.C(/\{%\s*comment\s*%}/,/\{%\s*endcomment\s*%}/),e.C(/\{#/,/#}/),{cN:"template_tag",b:/\{%/,e:/%}/,k:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor in ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup by as ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim",c:[t]},{cN:"variable",b:/\{\{/,e:/}}/,c:[t]}]}});hljs.registerLanguage("rust",function(e){var t=e.inherit(e.CBCM);return t.c.push("self"),{aliases:["rs"],k:{keyword:"alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self sizeof static struct super trait true type typeof unsafe unsized use virtual while yield int i8 i16 i32 i64 uint u8 u32 u64 float f32 f64 str char bool",built_in:"assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln!"},l:e.IR+"!?",i:""}]}});hljs.registerLanguage("vhdl",function(e){var t="\\d(_|\\d)*",r="[eE][-+]?"+t,n=t+"(\\."+t+")?("+r+")?",o="\\w+",i=t+"#"+o+"(\\."+o+")?#("+r+")?",a="\\b("+i+"|"+n+")";return{cI:!0,k:{keyword:"abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",typename:"boolean bit character severity_level integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector std_logic std_logic_vector unsigned signed boolean_vector integer_vector real_vector time_vector"},i:"{",c:[e.CBCM,e.C("--","$"),e.QSM,{cN:"number",b:a,r:0},{cN:"literal",b:"'(U|X|0|1|Z|W|L|H|-)'",c:[e.BE]},{cN:"attribute",b:"'[A-Za-z](_?[A-Za-z0-9])*",c:[e.BE]}]}});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)"},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"tag",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*"},e.inherit(e.ASM,{cN:"char",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("cmake",function(e){return{aliases:["cmake.in"],cI:!0,k:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or",operator:"equal less greater strless strgreater strequal matches"},c:[{cN:"envvar",b:"\\${",e:"}"},e.HCM,e.QSM,e.NM]}});hljs.registerLanguage("1c",function(c){var e="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*",r="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт",t="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон",i={cN:"dquote",b:'""'},n={cN:"string",b:'"',e:'"|$',c:[i]},a={cN:"string",b:"\\|",e:'"|$',c:[i]};return{cI:!0,l:e,k:{keyword:r,built_in:t},c:[c.CLCM,c.NM,n,a,{cN:"function",b:"(процедура|функция)",e:"$",l:e,k:"процедура функция",c:[c.inherit(c.TM,{b:e}),{cN:"tail",eW:!0,c:[{cN:"params",b:"\\(",e:"\\)",l:e,k:"знач",c:[n,a]},{cN:"export",b:"экспорт",eW:!0,l:e,k:"экспорт",c:[c.CLCM]}]},c.CLCM]},{cN:"preprocessor",b:"#",e:"$"},{cN:"date",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}});hljs.registerLanguage("tcl",function(e){return{aliases:["tk"],k:"after append apply array auto_execok auto_import auto_load auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock close concat continue dde dict encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent filename flush for foreach format gets glob global history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename return safe scan seek set socket source split string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update uplevel upvar variable vwait while",c:[e.C(";[ \\t]*#","$"),e.C("^[ \\t]*#","$"),{bK:"proc",e:"[\\{]",eE:!0,c:[{cN:"symbol",b:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",e:"[ \\t\\n\\r]",eW:!0,eE:!0}]},{cN:"variable",eE:!0,v:[{b:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\(([a-zA-Z0-9_])*\\)",e:"[^a-zA-Z0-9_\\}\\$]"},{b:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",e:"(\\))?[^a-zA-Z0-9_\\}\\$]"}]},{cN:"string",c:[e.BE],v:[e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},{cN:"number",v:[e.BNM,e.CNM]}]}});hljs.registerLanguage("groovy",function(e){return{k:{typename:"byte short char int long boolean float double void",literal:"true false null",keyword:"def as in assert trait super this abstract static volatile transient public private protected synchronized final class interface enum if else for while switch case break default continue throw throws try catch finally implements extends new import package return instanceof"},c:[e.CLCM,{cN:"javadoc",b:"/\\*\\*",e:"\\*//*",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CBCM,{cN:"string",b:'"""',e:'"""'},{cN:"string",b:"'''",e:"'''"},{cN:"string",b:"\\$/",e:"/\\$",r:10},e.ASM,{cN:"regexp",b:/~?\/[^\/\n]+\//,c:[e.BE]},e.QSM,{cN:"shebang",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.BNM,{cN:"class",bK:"class interface trait enum",e:"{",i:":",c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"annotation",b:"@[A-Za-z]+"},{cN:"string",b:/[^\?]{0}[A-Za-z0-9_$]+ *:/},{b:/\?/,e:/\:/},{cN:"label",b:"^\\s*[A-Za-z0-9_$]+:",r:0}]}});hljs.registerLanguage("erlang-repl",function(r){return{k:{special_functions:"spawn spawn_link self",reserved:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"prompt",b:"^[0-9]+> ",r:10},r.C("%","$"),{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},r.ASM,r.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"title",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("mathematica",function(e){return{aliases:["mma"],l:"(\\$|\\b)"+e.IR+"\\b",k:"AbelianGroup Abort AbortKernels AbortProtect Above Abs Absolute AbsoluteCorrelation AbsoluteCorrelationFunction AbsoluteCurrentValue AbsoluteDashing AbsoluteFileName AbsoluteOptions AbsolutePointSize AbsoluteThickness AbsoluteTime AbsoluteTiming AccountingForm Accumulate Accuracy AccuracyGoal ActionDelay ActionMenu ActionMenuBox ActionMenuBoxOptions Active ActiveItem ActiveStyle AcyclicGraphQ AddOnHelpPath AddTo AdjacencyGraph AdjacencyList AdjacencyMatrix AdjustmentBox AdjustmentBoxOptions AdjustTimeSeriesForecast AffineTransform After AiryAi AiryAiPrime AiryAiZero AiryBi AiryBiPrime AiryBiZero AlgebraicIntegerQ AlgebraicNumber AlgebraicNumberDenominator AlgebraicNumberNorm AlgebraicNumberPolynomial AlgebraicNumberTrace AlgebraicRules AlgebraicRulesData Algebraics AlgebraicUnitQ Alignment AlignmentMarker AlignmentPoint All AllowedDimensions AllowGroupClose AllowInlineCells AllowKernelInitialization AllowReverseGroupClose AllowScriptLevelChange AlphaChannel AlternatingGroup AlternativeHypothesis Alternatives AmbientLight Analytic AnchoredSearch And AndersonDarlingTest AngerJ AngleBracket AngularGauge Animate AnimationCycleOffset AnimationCycleRepetitions AnimationDirection AnimationDisplayTime AnimationRate AnimationRepetitions AnimationRunning Animator AnimatorBox AnimatorBoxOptions AnimatorElements Annotation Annuity AnnuityDue Antialiasing Antisymmetric Apart ApartSquareFree Appearance AppearanceElements AppellF1 Append AppendTo Apply ArcCos ArcCosh ArcCot ArcCoth ArcCsc ArcCsch ArcSec ArcSech ArcSin ArcSinDistribution ArcSinh ArcTan ArcTanh Arg ArgMax ArgMin ArgumentCountQ ARIMAProcess ArithmeticGeometricMean ARMAProcess ARProcess Array ArrayComponents ArrayDepth ArrayFlatten ArrayPad ArrayPlot ArrayQ ArrayReshape ArrayRules Arrays Arrow Arrow3DBox ArrowBox Arrowheads AspectRatio AspectRatioFixed Assert Assuming Assumptions AstronomicalData Asynchronous AsynchronousTaskObject AsynchronousTasks AtomQ Attributes AugmentedSymmetricPolynomial AutoAction AutoDelete AutoEvaluateEvents AutoGeneratedPackage AutoIndent AutoIndentSpacings AutoItalicWords AutoloadPath AutoMatch Automatic AutomaticImageSize AutoMultiplicationSymbol AutoNumberFormatting AutoOpenNotebooks AutoOpenPalettes AutorunSequencing AutoScaling AutoScroll AutoSpacing AutoStyleOptions AutoStyleWords Axes AxesEdge AxesLabel AxesOrigin AxesStyle Axis BabyMonsterGroupB Back Background BackgroundTasksSettings Backslash Backsubstitution Backward Band BandpassFilter BandstopFilter BarabasiAlbertGraphDistribution BarChart BarChart3D BarLegend BarlowProschanImportance BarnesG BarOrigin BarSpacing BartlettHannWindow BartlettWindow BaseForm Baseline BaselinePosition BaseStyle BatesDistribution BattleLemarieWavelet Because BeckmannDistribution Beep Before Begin BeginDialogPacket BeginFrontEndInteractionPacket BeginPackage BellB BellY Below BenfordDistribution BeniniDistribution BenktanderGibratDistribution BenktanderWeibullDistribution BernoulliB BernoulliDistribution BernoulliGraphDistribution BernoulliProcess BernsteinBasis BesselFilterModel BesselI BesselJ BesselJZero BesselK BesselY BesselYZero Beta BetaBinomialDistribution BetaDistribution BetaNegativeBinomialDistribution BetaPrimeDistribution BetaRegularized BetweennessCentrality BezierCurve BezierCurve3DBox BezierCurve3DBoxOptions BezierCurveBox BezierCurveBoxOptions BezierFunction BilateralFilter Binarize BinaryFormat BinaryImageQ BinaryRead BinaryReadList BinaryWrite BinCounts BinLists Binomial BinomialDistribution BinomialProcess BinormalDistribution BiorthogonalSplineWavelet BipartiteGraphQ BirnbaumImportance BirnbaumSaundersDistribution BitAnd BitClear BitGet BitLength BitNot BitOr BitSet BitShiftLeft BitShiftRight BitXor Black BlackmanHarrisWindow BlackmanNuttallWindow BlackmanWindow Blank BlankForm BlankNullSequence BlankSequence Blend Block BlockRandom BlomqvistBeta BlomqvistBetaTest Blue Blur BodePlot BohmanWindow Bold Bookmarks Boole BooleanConsecutiveFunction BooleanConvert BooleanCountingFunction BooleanFunction BooleanGraph BooleanMaxterms BooleanMinimize BooleanMinterms Booleans BooleanTable BooleanVariables BorderDimensions BorelTannerDistribution Bottom BottomHatTransform BoundaryStyle Bounds Box BoxBaselineShift BoxData BoxDimensions Boxed Boxes BoxForm BoxFormFormatTypes BoxFrame BoxID BoxMargins BoxMatrix BoxRatios BoxRotation BoxRotationPoint BoxStyle BoxWhiskerChart Bra BracketingBar BraKet BrayCurtisDistance BreadthFirstScan Break Brown BrownForsytheTest BrownianBridgeProcess BrowserCategory BSplineBasis BSplineCurve BSplineCurve3DBox BSplineCurveBox BSplineCurveBoxOptions BSplineFunction BSplineSurface BSplineSurface3DBox BubbleChart BubbleChart3D BubbleScale BubbleSizes BulletGauge BusinessDayQ ButterflyGraph ButterworthFilterModel Button ButtonBar ButtonBox ButtonBoxOptions ButtonCell ButtonContents ButtonData ButtonEvaluator ButtonExpandable ButtonFrame ButtonFunction ButtonMargins ButtonMinHeight ButtonNote ButtonNotebook ButtonSource ButtonStyle ButtonStyleMenuListing Byte ByteCount ByteOrdering C CachedValue CacheGraphics CalendarData CalendarType CallPacket CanberraDistance Cancel CancelButton CandlestickChart Cap CapForm CapitalDifferentialD CardinalBSplineBasis CarmichaelLambda Cases Cashflow Casoratian Catalan CatalanNumber Catch CauchyDistribution CauchyWindow CayleyGraph CDF CDFDeploy CDFInformation CDFWavelet Ceiling Cell CellAutoOverwrite CellBaseline CellBoundingBox CellBracketOptions CellChangeTimes CellContents CellContext CellDingbat CellDynamicExpression CellEditDuplicate CellElementsBoundingBox CellElementSpacings CellEpilog CellEvaluationDuplicate CellEvaluationFunction CellEventActions CellFrame CellFrameColor CellFrameLabelMargins CellFrameLabels CellFrameMargins CellGroup CellGroupData CellGrouping CellGroupingRules CellHorizontalScrolling CellID CellLabel CellLabelAutoDelete CellLabelMargins CellLabelPositioning CellMargins CellObject CellOpen CellPrint CellProlog Cells CellSize CellStyle CellTags CellularAutomaton CensoredDistribution Censoring Center CenterDot CentralMoment CentralMomentGeneratingFunction CForm ChampernowneNumber ChanVeseBinarize Character CharacterEncoding CharacterEncodingsPath CharacteristicFunction CharacteristicPolynomial CharacterRange Characters ChartBaseStyle ChartElementData ChartElementDataFunction ChartElementFunction ChartElements ChartLabels ChartLayout ChartLegends ChartStyle Chebyshev1FilterModel Chebyshev2FilterModel ChebyshevDistance ChebyshevT ChebyshevU Check CheckAbort CheckAll Checkbox CheckboxBar CheckboxBox CheckboxBoxOptions ChemicalData ChessboardDistance ChiDistribution ChineseRemainder ChiSquareDistribution ChoiceButtons ChoiceDialog CholeskyDecomposition Chop Circle CircleBox CircleDot CircleMinus CirclePlus CircleTimes CirculantGraph CityData Clear ClearAll ClearAttributes ClearSystemCache ClebschGordan ClickPane Clip ClipboardNotebook ClipFill ClippingStyle ClipPlanes ClipRange Clock ClockGauge ClockwiseContourIntegral Close Closed CloseKernels ClosenessCentrality Closing ClosingAutoSave ClosingEvent ClusteringComponents CMYKColor Coarse Coefficient CoefficientArrays CoefficientDomain CoefficientList CoefficientRules CoifletWavelet Collect Colon ColonForm ColorCombine ColorConvert ColorData ColorDataFunction ColorFunction ColorFunctionScaling Colorize ColorNegate ColorOutput ColorProfileData ColorQuantize ColorReplace ColorRules ColorSelectorSettings ColorSeparate ColorSetter ColorSetterBox ColorSetterBoxOptions ColorSlider ColorSpace Column ColumnAlignments ColumnBackgrounds ColumnForm ColumnLines ColumnsEqual ColumnSpacings ColumnWidths CommonDefaultFormatTypes Commonest CommonestFilter CommonUnits CommunityBoundaryStyle CommunityGraphPlot CommunityLabels CommunityRegionStyle CompatibleUnitQ CompilationOptions CompilationTarget Compile Compiled CompiledFunction Complement CompleteGraph CompleteGraphQ CompleteKaryTree CompletionsListPacket Complex Complexes ComplexExpand ComplexInfinity ComplexityFunction ComponentMeasurements ComponentwiseContextMenu Compose ComposeList ComposeSeries Composition CompoundExpression CompoundPoissonDistribution CompoundPoissonProcess CompoundRenewalProcess Compress CompressedData Condition ConditionalExpression Conditioned Cone ConeBox ConfidenceLevel ConfidenceRange ConfidenceTransform ConfigurationPath Congruent Conjugate ConjugateTranspose Conjunction Connect ConnectedComponents ConnectedGraphQ ConnesWindow ConoverTest ConsoleMessage ConsoleMessagePacket ConsolePrint Constant ConstantArray Constants ConstrainedMax ConstrainedMin ContentPadding ContentsBoundingBox ContentSelectable ContentSize Context ContextMenu Contexts ContextToFilename ContextToFileName Continuation Continue ContinuedFraction ContinuedFractionK ContinuousAction ContinuousMarkovProcess ContinuousTimeModelQ ContinuousWaveletData ContinuousWaveletTransform ContourDetect ContourGraphics ContourIntegral ContourLabels ContourLines ContourPlot ContourPlot3D Contours ContourShading ContourSmoothing ContourStyle ContraharmonicMean Control ControlActive ControlAlignment ControllabilityGramian ControllabilityMatrix ControllableDecomposition ControllableModelQ ControllerDuration ControllerInformation ControllerInformationData ControllerLinking ControllerManipulate ControllerMethod ControllerPath ControllerState ControlPlacement ControlsRendering ControlType Convergents ConversionOptions ConversionRules ConvertToBitmapPacket ConvertToPostScript ConvertToPostScriptPacket Convolve ConwayGroupCo1 ConwayGroupCo2 ConwayGroupCo3 CoordinateChartData CoordinatesToolOptions CoordinateTransform CoordinateTransformData CoprimeQ Coproduct CopulaDistribution Copyable CopyDirectory CopyFile CopyTag CopyToClipboard CornerFilter CornerNeighbors Correlation CorrelationDistance CorrelationFunction CorrelationTest Cos Cosh CoshIntegral CosineDistance CosineWindow CosIntegral Cot Coth Count CounterAssignments CounterBox CounterBoxOptions CounterClockwiseContourIntegral CounterEvaluator CounterFunction CounterIncrements CounterStyle CounterStyleMenuListing CountRoots CountryData Covariance CovarianceEstimatorFunction CovarianceFunction CoxianDistribution CoxIngersollRossProcess CoxModel CoxModelFit CramerVonMisesTest CreateArchive CreateDialog CreateDirectory CreateDocument CreateIntermediateDirectories CreatePalette CreatePalettePacket CreateScheduledTask CreateTemporary CreateWindow CriticalityFailureImportance CriticalitySuccessImportance CriticalSection Cross CrossingDetect CrossMatrix Csc Csch CubeRoot Cubics Cuboid CuboidBox Cumulant CumulantGeneratingFunction Cup CupCap Curl CurlyDoubleQuote CurlyQuote CurrentImage CurrentlySpeakingPacket CurrentValue CurvatureFlowFilter CurveClosed Cyan CycleGraph CycleIndexPolynomial Cycles CyclicGroup Cyclotomic Cylinder CylinderBox CylindricalDecomposition D DagumDistribution DamerauLevenshteinDistance DampingFactor Darker Dashed Dashing DataCompression DataDistribution DataRange DataReversed Date DateDelimiters DateDifference DateFunction DateList DateListLogPlot DateListPlot DatePattern DatePlus DateRange DateString DateTicksFormat DaubechiesWavelet DavisDistribution DawsonF DayCount DayCountConvention DayMatchQ DayName DayPlus DayRange DayRound DeBruijnGraph Debug DebugTag Decimal DeclareKnownSymbols DeclarePackage Decompose Decrement DedekindEta Default DefaultAxesStyle DefaultBaseStyle DefaultBoxStyle DefaultButton DefaultColor DefaultControlPlacement DefaultDuplicateCellStyle DefaultDuration DefaultElement DefaultFaceGridsStyle DefaultFieldHintStyle DefaultFont DefaultFontProperties DefaultFormatType DefaultFormatTypeForStyle DefaultFrameStyle DefaultFrameTicksStyle DefaultGridLinesStyle DefaultInlineFormatType DefaultInputFormatType DefaultLabelStyle DefaultMenuStyle DefaultNaturalLanguage DefaultNewCellStyle DefaultNewInlineCellStyle DefaultNotebook DefaultOptions DefaultOutputFormatType DefaultStyle DefaultStyleDefinitions DefaultTextFormatType DefaultTextInlineFormatType DefaultTicksStyle DefaultTooltipStyle DefaultValues Defer DefineExternal DefineInputStreamMethod DefineOutputStreamMethod Definition Degree DegreeCentrality DegreeGraphDistribution DegreeLexicographic DegreeReverseLexicographic Deinitialization Del Deletable Delete DeleteBorderComponents DeleteCases DeleteContents DeleteDirectory DeleteDuplicates DeleteFile DeleteSmallComponents DeleteWithContents DeletionWarning Delimiter DelimiterFlashTime DelimiterMatching Delimiters Denominator DensityGraphics DensityHistogram DensityPlot DependentVariables Deploy Deployed Depth DepthFirstScan Derivative DerivativeFilter DescriptorStateSpace DesignMatrix Det DGaussianWavelet DiacriticalPositioning Diagonal DiagonalMatrix Dialog DialogIndent DialogInput DialogLevel DialogNotebook DialogProlog DialogReturn DialogSymbols Diamond DiamondMatrix DiceDissimilarity DictionaryLookup DifferenceDelta DifferenceOrder DifferenceRoot DifferenceRootReduce Differences DifferentialD DifferentialRoot DifferentialRootReduce DifferentiatorFilter DigitBlock DigitBlockMinimum DigitCharacter DigitCount DigitQ DihedralGroup Dilation Dimensions DiracComb DiracDelta DirectedEdge DirectedEdges DirectedGraph DirectedGraphQ DirectedInfinity Direction Directive Directory DirectoryName DirectoryQ DirectoryStack DirichletCharacter DirichletConvolve DirichletDistribution DirichletL DirichletTransform DirichletWindow DisableConsolePrintPacket DiscreteChirpZTransform DiscreteConvolve DiscreteDelta DiscreteHadamardTransform DiscreteIndicator DiscreteLQEstimatorGains DiscreteLQRegulatorGains DiscreteLyapunovSolve DiscreteMarkovProcess DiscretePlot DiscretePlot3D DiscreteRatio DiscreteRiccatiSolve DiscreteShift DiscreteTimeModelQ DiscreteUniformDistribution DiscreteVariables DiscreteWaveletData DiscreteWaveletPacketTransform DiscreteWaveletTransform Discriminant Disjunction Disk DiskBox DiskMatrix Dispatch DispersionEstimatorFunction Display DisplayAllSteps DisplayEndPacket DisplayFlushImagePacket DisplayForm DisplayFunction DisplayPacket DisplayRules DisplaySetSizePacket DisplayString DisplayTemporary DisplayWith DisplayWithRef DisplayWithVariable DistanceFunction DistanceTransform Distribute Distributed DistributedContexts DistributeDefinitions DistributionChart DistributionDomain DistributionFitTest DistributionParameterAssumptions DistributionParameterQ Dithering Div Divergence Divide DivideBy Dividers Divisible Divisors DivisorSigma DivisorSum DMSList DMSString Do DockedCells DocumentNotebook DominantColors DOSTextFormat Dot DotDashed DotEqual Dotted DoubleBracketingBar DoubleContourIntegral DoubleDownArrow DoubleLeftArrow DoubleLeftRightArrow DoubleLeftTee DoubleLongLeftArrow DoubleLongLeftRightArrow DoubleLongRightArrow DoubleRightArrow DoubleRightTee DoubleUpArrow DoubleUpDownArrow DoubleVerticalBar DoublyInfinite Down DownArrow DownArrowBar DownArrowUpArrow DownLeftRightVector DownLeftTeeVector DownLeftVector DownLeftVectorBar DownRightTeeVector DownRightVector DownRightVectorBar Downsample DownTee DownTeeArrow DownValues DragAndDrop DrawEdges DrawFrontFaces DrawHighlighted Drop DSolve Dt DualLinearProgramming DualSystemsModel DumpGet DumpSave DuplicateFreeQ Dynamic DynamicBox DynamicBoxOptions DynamicEvaluationTimeout DynamicLocation DynamicModule DynamicModuleBox DynamicModuleBoxOptions DynamicModuleParent DynamicModuleValues DynamicName DynamicNamespace DynamicReference DynamicSetting DynamicUpdating DynamicWrapper DynamicWrapperBox DynamicWrapperBoxOptions E EccentricityCentrality EdgeAdd EdgeBetweennessCentrality EdgeCapacity EdgeCapForm EdgeColor EdgeConnectivity EdgeCost EdgeCount EdgeCoverQ EdgeDashing EdgeDelete EdgeDetect EdgeForm EdgeIndex EdgeJoinForm EdgeLabeling EdgeLabels EdgeLabelStyle EdgeList EdgeOpacity EdgeQ EdgeRenderingFunction EdgeRules EdgeShapeFunction EdgeStyle EdgeThickness EdgeWeight Editable EditButtonSettings EditCellTagsSettings EditDistance EffectiveInterest Eigensystem Eigenvalues EigenvectorCentrality Eigenvectors Element ElementData Eliminate EliminationOrder EllipticE EllipticExp EllipticExpPrime EllipticF EllipticFilterModel EllipticK EllipticLog EllipticNomeQ EllipticPi EllipticReducedHalfPeriods EllipticTheta EllipticThetaPrime EmitSound EmphasizeSyntaxErrors EmpiricalDistribution Empty EmptyGraphQ EnableConsolePrintPacket Enabled Encode End EndAdd EndDialogPacket EndFrontEndInteractionPacket EndOfFile EndOfLine EndOfString EndPackage EngineeringForm Enter EnterExpressionPacket EnterTextPacket Entropy EntropyFilter Environment Epilog Equal EqualColumns EqualRows EqualTilde EquatedTo Equilibrium EquirippleFilterKernel Equivalent Erf Erfc Erfi ErlangB ErlangC ErlangDistribution Erosion ErrorBox ErrorBoxOptions ErrorNorm ErrorPacket ErrorsDialogSettings EstimatedDistribution EstimatedProcess EstimatorGains EstimatorRegulator EuclideanDistance EulerE EulerGamma EulerianGraphQ EulerPhi Evaluatable Evaluate Evaluated EvaluatePacket EvaluationCell EvaluationCompletionAction EvaluationElements EvaluationMode EvaluationMonitor EvaluationNotebook EvaluationObject EvaluationOrder Evaluator EvaluatorNames EvenQ EventData EventEvaluator EventHandler EventHandlerTag EventLabels ExactBlackmanWindow ExactNumberQ ExactRootIsolation ExampleData Except ExcludedForms ExcludePods Exclusions ExclusionsStyle Exists Exit ExitDialog Exp Expand ExpandAll ExpandDenominator ExpandFileName ExpandNumerator Expectation ExpectationE ExpectedValue ExpGammaDistribution ExpIntegralE ExpIntegralEi Exponent ExponentFunction ExponentialDistribution ExponentialFamily ExponentialGeneratingFunction ExponentialMovingAverage ExponentialPowerDistribution ExponentPosition ExponentStep Export ExportAutoReplacements ExportPacket ExportString Expression ExpressionCell ExpressionPacket ExpToTrig ExtendedGCD Extension ExtentElementFunction ExtentMarkers ExtentSize ExternalCall ExternalDataCharacterEncoding Extract ExtractArchive ExtremeValueDistribution FaceForm FaceGrids FaceGridsStyle Factor FactorComplete Factorial Factorial2 FactorialMoment FactorialMomentGeneratingFunction FactorialPower FactorInteger FactorList FactorSquareFree FactorSquareFreeList FactorTerms FactorTermsList Fail FailureDistribution False FARIMAProcess FEDisableConsolePrintPacket FeedbackSector FeedbackSectorStyle FeedbackType FEEnableConsolePrintPacket Fibonacci FieldHint FieldHintStyle FieldMasked FieldSize File FileBaseName FileByteCount FileDate FileExistsQ FileExtension FileFormat FileHash FileInformation FileName FileNameDepth FileNameDialogSettings FileNameDrop FileNameJoin FileNames FileNameSetter FileNameSplit FileNameTake FilePrint FileType FilledCurve FilledCurveBox Filling FillingStyle FillingTransform FilterRules FinancialBond FinancialData FinancialDerivative FinancialIndicator Find FindArgMax FindArgMin FindClique FindClusters FindCurvePath FindDistributionParameters FindDivisions FindEdgeCover FindEdgeCut FindEulerianCycle FindFaces FindFile FindFit FindGeneratingFunction FindGeoLocation FindGeometricTransform FindGraphCommunities FindGraphIsomorphism FindGraphPartition FindHamiltonianCycle FindIndependentEdgeSet FindIndependentVertexSet FindInstance FindIntegerNullVector FindKClan FindKClique FindKClub FindKPlex FindLibrary FindLinearRecurrence FindList FindMaximum FindMaximumFlow FindMaxValue FindMinimum FindMinimumCostFlow FindMinimumCut FindMinValue FindPermutation FindPostmanTour FindProcessParameters FindRoot FindSequenceFunction FindSettings FindShortestPath FindShortestTour FindThreshold FindVertexCover FindVertexCut Fine FinishDynamic FiniteAbelianGroupCount FiniteGroupCount FiniteGroupData First FirstPassageTimeDistribution FischerGroupFi22 FischerGroupFi23 FischerGroupFi24Prime FisherHypergeometricDistribution FisherRatioTest FisherZDistribution Fit FitAll FittedModel FixedPoint FixedPointList FlashSelection Flat Flatten FlattenAt FlatTopWindow FlipView Floor FlushPrintOutputPacket Fold FoldList Font FontColor FontFamily FontForm FontName FontOpacity FontPostScriptName FontProperties FontReencoding FontSize FontSlant FontSubstitutions FontTracking FontVariations FontWeight For ForAll Format FormatRules FormatType FormatTypeAutoConvert FormatValues FormBox FormBoxOptions FortranForm Forward ForwardBackward Fourier FourierCoefficient FourierCosCoefficient FourierCosSeries FourierCosTransform FourierDCT FourierDCTFilter FourierDCTMatrix FourierDST FourierDSTMatrix FourierMatrix FourierParameters FourierSequenceTransform FourierSeries FourierSinCoefficient FourierSinSeries FourierSinTransform FourierTransform FourierTrigSeries FractionalBrownianMotionProcess FractionalPart FractionBox FractionBoxOptions FractionLine Frame FrameBox FrameBoxOptions Framed FrameInset FrameLabel Frameless FrameMargins FrameStyle FrameTicks FrameTicksStyle FRatioDistribution FrechetDistribution FreeQ FrequencySamplingFilterKernel FresnelC FresnelS Friday FrobeniusNumber FrobeniusSolve FromCharacterCode FromCoefficientRules FromContinuedFraction FromDate FromDigits FromDMS Front FrontEndDynamicExpression FrontEndEventActions FrontEndExecute FrontEndObject FrontEndResource FrontEndResourceString FrontEndStackSize FrontEndToken FrontEndTokenExecute FrontEndValueCache FrontEndVersion FrontFaceColor FrontFaceOpacity Full FullAxes FullDefinition FullForm FullGraphics FullOptions FullSimplify Function FunctionExpand FunctionInterpolation FunctionSpace FussellVeselyImportance GaborFilter GaborMatrix GaborWavelet GainMargins GainPhaseMargins Gamma GammaDistribution GammaRegularized GapPenalty Gather GatherBy GaugeFaceElementFunction GaugeFaceStyle GaugeFrameElementFunction GaugeFrameSize GaugeFrameStyle GaugeLabels GaugeMarkers GaugeStyle GaussianFilter GaussianIntegers GaussianMatrix GaussianWindow GCD GegenbauerC General GeneralizedLinearModelFit GenerateConditions GeneratedCell GeneratedParameters GeneratingFunction Generic GenericCylindricalDecomposition GenomeData GenomeLookup GeodesicClosing GeodesicDilation GeodesicErosion GeodesicOpening GeoDestination GeodesyData GeoDirection GeoDistance GeoGridPosition GeometricBrownianMotionProcess GeometricDistribution GeometricMean GeometricMeanFilter GeometricTransformation GeometricTransformation3DBox GeometricTransformation3DBoxOptions GeometricTransformationBox GeometricTransformationBoxOptions GeoPosition GeoPositionENU GeoPositionXYZ GeoProjectionData GestureHandler GestureHandlerTag Get GetBoundingBoxSizePacket GetContext GetEnvironment GetFileName GetFrontEndOptionsDataPacket GetLinebreakInformationPacket GetMenusPacket GetPageBreakInformationPacket Glaisher GlobalClusteringCoefficient GlobalPreferences GlobalSession Glow GoldenRatio GompertzMakehamDistribution GoodmanKruskalGamma GoodmanKruskalGammaTest Goto Grad Gradient GradientFilter GradientOrientationFilter Graph GraphAssortativity GraphCenter GraphComplement GraphData GraphDensity GraphDiameter GraphDifference GraphDisjointUnion GraphDistance GraphDistanceMatrix GraphElementData GraphEmbedding GraphHighlight GraphHighlightStyle GraphHub Graphics Graphics3D Graphics3DBox Graphics3DBoxOptions GraphicsArray GraphicsBaseline GraphicsBox GraphicsBoxOptions GraphicsColor GraphicsColumn GraphicsComplex GraphicsComplex3DBox GraphicsComplex3DBoxOptions GraphicsComplexBox GraphicsComplexBoxOptions GraphicsContents GraphicsData GraphicsGrid GraphicsGridBox GraphicsGroup GraphicsGroup3DBox GraphicsGroup3DBoxOptions GraphicsGroupBox GraphicsGroupBoxOptions GraphicsGrouping GraphicsHighlightColor GraphicsRow GraphicsSpacing GraphicsStyle GraphIntersection GraphLayout GraphLinkEfficiency GraphPeriphery GraphPlot GraphPlot3D GraphPower GraphPropertyDistribution GraphQ GraphRadius GraphReciprocity GraphRoot GraphStyle GraphUnion Gray GrayLevel GreatCircleDistance Greater GreaterEqual GreaterEqualLess GreaterFullEqual GreaterGreater GreaterLess GreaterSlantEqual GreaterTilde Green Grid GridBaseline GridBox GridBoxAlignment GridBoxBackground GridBoxDividers GridBoxFrame GridBoxItemSize GridBoxItemStyle GridBoxOptions GridBoxSpacings GridCreationSettings GridDefaultElement GridElementStyleOptions GridFrame GridFrameMargins GridGraph GridLines GridLinesStyle GroebnerBasis GroupActionBase GroupCentralizer GroupElementFromWord GroupElementPosition GroupElementQ GroupElements GroupElementToWord GroupGenerators GroupMultiplicationTable GroupOrbits GroupOrder GroupPageBreakWithin GroupSetwiseStabilizer GroupStabilizer GroupStabilizerChain Gudermannian GumbelDistribution HaarWavelet HadamardMatrix HalfNormalDistribution HamiltonianGraphQ HammingDistance HammingWindow HankelH1 HankelH2 HankelMatrix HannPoissonWindow HannWindow HaradaNortonGroupHN HararyGraph HarmonicMean HarmonicMeanFilter HarmonicNumber Hash HashTable Haversine HazardFunction Head HeadCompose Heads HeavisideLambda HeavisidePi HeavisideTheta HeldGroupHe HeldPart HelpBrowserLookup HelpBrowserNotebook HelpBrowserSettings HermiteDecomposition HermiteH HermitianMatrixQ HessenbergDecomposition Hessian HexadecimalCharacter Hexahedron HexahedronBox HexahedronBoxOptions HiddenSurface HighlightGraph HighlightImage HighpassFilter HigmanSimsGroupHS HilbertFilter HilbertMatrix Histogram Histogram3D HistogramDistribution HistogramList HistogramTransform HistogramTransformInterpolation HitMissTransform HITSCentrality HodgeDual HoeffdingD HoeffdingDTest Hold HoldAll HoldAllComplete HoldComplete HoldFirst HoldForm HoldPattern HoldRest HolidayCalendar HomeDirectory HomePage Horizontal HorizontalForm HorizontalGauge HorizontalScrollPosition HornerForm HotellingTSquareDistribution HoytDistribution HTMLSave Hue HumpDownHump HumpEqual HurwitzLerchPhi HurwitzZeta HyperbolicDistribution HypercubeGraph HyperexponentialDistribution Hyperfactorial Hypergeometric0F1 Hypergeometric0F1Regularized Hypergeometric1F1 Hypergeometric1F1Regularized Hypergeometric2F1 Hypergeometric2F1Regularized HypergeometricDistribution HypergeometricPFQ HypergeometricPFQRegularized HypergeometricU Hyperlink HyperlinkCreationSettings Hyphenation HyphenationOptions HypoexponentialDistribution HypothesisTestData I Identity IdentityMatrix If IgnoreCase Im Image Image3D Image3DSlices ImageAccumulate ImageAdd ImageAdjust ImageAlign ImageApply ImageAspectRatio ImageAssemble ImageCache ImageCacheValid ImageCapture ImageChannels ImageClip ImageColorSpace ImageCompose ImageConvolve ImageCooccurrence ImageCorners ImageCorrelate ImageCorrespondingPoints ImageCrop ImageData ImageDataPacket ImageDeconvolve ImageDemosaic ImageDifference ImageDimensions ImageDistance ImageEffect ImageFeatureTrack ImageFileApply ImageFileFilter ImageFileScan ImageFilter ImageForestingComponents ImageForwardTransformation ImageHistogram ImageKeypoints ImageLevels ImageLines ImageMargins ImageMarkers ImageMeasurements ImageMultiply ImageOffset ImagePad ImagePadding ImagePartition ImagePeriodogram ImagePerspectiveTransformation ImageQ ImageRangeCache ImageReflect ImageRegion ImageResize ImageResolution ImageRotate ImageRotated ImageScaled ImageScan ImageSize ImageSizeAction ImageSizeCache ImageSizeMultipliers ImageSizeRaw ImageSubtract ImageTake ImageTransformation ImageTrim ImageType ImageValue ImageValuePositions Implies Import ImportAutoReplacements ImportString ImprovementImportance In IncidenceGraph IncidenceList IncidenceMatrix IncludeConstantBasis IncludeFileExtension IncludePods IncludeSingularTerm Increment Indent IndentingNewlineSpacings IndentMaxFraction IndependenceTest IndependentEdgeSetQ IndependentUnit IndependentVertexSetQ Indeterminate IndexCreationOptions Indexed IndexGraph IndexTag Inequality InexactNumberQ InexactNumbers Infinity Infix Information Inherited InheritScope Initialization InitializationCell InitializationCellEvaluation InitializationCellWarning InlineCounterAssignments InlineCounterIncrements InlineRules Inner Inpaint Input InputAliases InputAssumptions InputAutoReplacements InputField InputFieldBox InputFieldBoxOptions InputForm InputGrouping InputNamePacket InputNotebook InputPacket InputSettings InputStream InputString InputStringPacket InputToBoxFormPacket Insert InsertionPointObject InsertResults Inset Inset3DBox Inset3DBoxOptions InsetBox InsetBoxOptions Install InstallService InString Integer IntegerDigits IntegerExponent IntegerLength IntegerPart IntegerPartitions IntegerQ Integers IntegerString Integral Integrate Interactive InteractiveTradingChart Interlaced Interleaving InternallyBalancedDecomposition InterpolatingFunction InterpolatingPolynomial Interpolation InterpolationOrder InterpolationPoints InterpolationPrecision Interpretation InterpretationBox InterpretationBoxOptions InterpretationFunction InterpretTemplate InterquartileRange Interrupt InterruptSettings Intersection Interval IntervalIntersection IntervalMemberQ IntervalUnion Inverse InverseBetaRegularized InverseCDF InverseChiSquareDistribution InverseContinuousWaveletTransform InverseDistanceTransform InverseEllipticNomeQ InverseErf InverseErfc InverseFourier InverseFourierCosTransform InverseFourierSequenceTransform InverseFourierSinTransform InverseFourierTransform InverseFunction InverseFunctions InverseGammaDistribution InverseGammaRegularized InverseGaussianDistribution InverseGudermannian InverseHaversine InverseJacobiCD InverseJacobiCN InverseJacobiCS InverseJacobiDC InverseJacobiDN InverseJacobiDS InverseJacobiNC InverseJacobiND InverseJacobiNS InverseJacobiSC InverseJacobiSD InverseJacobiSN InverseLaplaceTransform InversePermutation InverseRadon InverseSeries InverseSurvivalFunction InverseWaveletTransform InverseWeierstrassP InverseZTransform Invisible InvisibleApplication InvisibleTimes IrreduciblePolynomialQ IsolatingInterval IsomorphicGraphQ IsotopeData Italic Item ItemBox ItemBoxOptions ItemSize ItemStyle ItoProcess JaccardDissimilarity JacobiAmplitude Jacobian JacobiCD JacobiCN JacobiCS JacobiDC JacobiDN JacobiDS JacobiNC JacobiND JacobiNS JacobiP JacobiSC JacobiSD JacobiSN JacobiSymbol JacobiZeta JankoGroupJ1 JankoGroupJ2 JankoGroupJ3 JankoGroupJ4 JarqueBeraALMTest JohnsonDistribution Join Joined JoinedCurve JoinedCurveBox JoinForm JordanDecomposition JordanModelDecomposition K KagiChart KaiserBesselWindow KaiserWindow KalmanEstimator KalmanFilter KarhunenLoeveDecomposition KaryTree KatzCentrality KCoreComponents KDistribution KelvinBei KelvinBer KelvinKei KelvinKer KendallTau KendallTauTest KernelExecute KernelMixtureDistribution KernelObject Kernels Ket Khinchin KirchhoffGraph KirchhoffMatrix KleinInvariantJ KnightTourGraph KnotData KnownUnitQ KolmogorovSmirnovTest KroneckerDelta KroneckerModelDecomposition KroneckerProduct KroneckerSymbol KuiperTest KumaraswamyDistribution Kurtosis KuwaharaFilter Label Labeled LabeledSlider LabelingFunction LabelStyle LaguerreL LambdaComponents LambertW LanczosWindow LandauDistribution Language LanguageCategory LaplaceDistribution LaplaceTransform Laplacian LaplacianFilter LaplacianGaussianFilter Large Larger Last Latitude LatitudeLongitude LatticeData LatticeReduce Launch LaunchKernels LayeredGraphPlot LayerSizeFunction LayoutInformation LCM LeafCount LeapYearQ LeastSquares LeastSquaresFilterKernel Left LeftArrow LeftArrowBar LeftArrowRightArrow LeftDownTeeVector LeftDownVector LeftDownVectorBar LeftRightArrow LeftRightVector LeftTee LeftTeeArrow LeftTeeVector LeftTriangle LeftTriangleBar LeftTriangleEqual LeftUpDownVector LeftUpTeeVector LeftUpVector LeftUpVectorBar LeftVector LeftVectorBar LegendAppearance Legended LegendFunction LegendLabel LegendLayout LegendMargins LegendMarkers LegendMarkerSize LegendreP LegendreQ LegendreType Length LengthWhile LerchPhi Less LessEqual LessEqualGreater LessFullEqual LessGreater LessLess LessSlantEqual LessTilde LetterCharacter LetterQ Level LeveneTest LeviCivitaTensor LevyDistribution Lexicographic LibraryFunction LibraryFunctionError LibraryFunctionInformation LibraryFunctionLoad LibraryFunctionUnload LibraryLoad LibraryUnload LicenseID LiftingFilterData LiftingWaveletTransform LightBlue LightBrown LightCyan Lighter LightGray LightGreen Lighting LightingAngle LightMagenta LightOrange LightPink LightPurple LightRed LightSources LightYellow Likelihood Limit LimitsPositioning LimitsPositioningTokens LindleyDistribution Line Line3DBox LinearFilter LinearFractionalTransform LinearModelFit LinearOffsetFunction LinearProgramming LinearRecurrence LinearSolve LinearSolveFunction LineBox LineBreak LinebreakAdjustments LineBreakChart LineBreakWithin LineColor LineForm LineGraph LineIndent LineIndentMaxFraction LineIntegralConvolutionPlot LineIntegralConvolutionScale LineLegend LineOpacity LineSpacing LineWrapParts LinkActivate LinkClose LinkConnect LinkConnectedQ LinkCreate LinkError LinkFlush LinkFunction LinkHost LinkInterrupt LinkLaunch LinkMode LinkObject LinkOpen LinkOptions LinkPatterns LinkProtocol LinkRead LinkReadHeld LinkReadyQ Links LinkWrite LinkWriteHeld LiouvilleLambda List Listable ListAnimate ListContourPlot ListContourPlot3D ListConvolve ListCorrelate ListCurvePathPlot ListDeconvolve ListDensityPlot Listen ListFourierSequenceTransform ListInterpolation ListLineIntegralConvolutionPlot ListLinePlot ListLogLinearPlot ListLogLogPlot ListLogPlot ListPicker ListPickerBox ListPickerBoxBackground ListPickerBoxOptions ListPlay ListPlot ListPlot3D ListPointPlot3D ListPolarPlot ListQ ListStreamDensityPlot ListStreamPlot ListSurfacePlot3D ListVectorDensityPlot ListVectorPlot ListVectorPlot3D ListZTransform Literal LiteralSearch LocalClusteringCoefficient LocalizeVariables LocationEquivalenceTest LocationTest Locator LocatorAutoCreate LocatorBox LocatorBoxOptions LocatorCentering LocatorPane LocatorPaneBox LocatorPaneBoxOptions LocatorRegion Locked Log Log10 Log2 LogBarnesG LogGamma LogGammaDistribution LogicalExpand LogIntegral LogisticDistribution LogitModelFit LogLikelihood LogLinearPlot LogLogisticDistribution LogLogPlot LogMultinormalDistribution LogNormalDistribution LogPlot LogRankTest LogSeriesDistribution LongEqual Longest LongestAscendingSequence LongestCommonSequence LongestCommonSequencePositions LongestCommonSubsequence LongestCommonSubsequencePositions LongestMatch LongForm Longitude LongLeftArrow LongLeftRightArrow LongRightArrow Loopback LoopFreeGraphQ LowerCaseQ LowerLeftArrow LowerRightArrow LowerTriangularize LowpassFilter LQEstimatorGains LQGRegulator LQOutputRegulatorGains LQRegulatorGains LUBackSubstitution LucasL LuccioSamiComponents LUDecomposition LyapunovSolve LyonsGroupLy MachineID MachineName MachineNumberQ MachinePrecision MacintoshSystemPageSetup Magenta Magnification Magnify MainSolve MaintainDynamicCaches Majority MakeBoxes MakeExpression MakeRules MangoldtLambda ManhattanDistance Manipulate Manipulator MannWhitneyTest MantissaExponent Manual Map MapAll MapAt MapIndexed MAProcess MapThread MarcumQ MardiaCombinedTest MardiaKurtosisTest MardiaSkewnessTest MarginalDistribution MarkovProcessProperties Masking MatchingDissimilarity MatchLocalNameQ MatchLocalNames MatchQ Material MathematicaNotation MathieuC MathieuCharacteristicA MathieuCharacteristicB MathieuCharacteristicExponent MathieuCPrime MathieuGroupM11 MathieuGroupM12 MathieuGroupM22 MathieuGroupM23 MathieuGroupM24 MathieuS MathieuSPrime MathMLForm MathMLText Matrices MatrixExp MatrixForm MatrixFunction MatrixLog MatrixPlot MatrixPower MatrixQ MatrixRank Max MaxBend MaxDetect MaxExtraBandwidths MaxExtraConditions MaxFeatures MaxFilter Maximize MaxIterations MaxMemoryUsed MaxMixtureKernels MaxPlotPoints MaxPoints MaxRecursion MaxStableDistribution MaxStepFraction MaxSteps MaxStepSize MaxValue MaxwellDistribution McLaughlinGroupMcL Mean MeanClusteringCoefficient MeanDegreeConnectivity MeanDeviation MeanFilter MeanGraphDistance MeanNeighborDegree MeanShift MeanShiftFilter Median MedianDeviation MedianFilter Medium MeijerG MeixnerDistribution MemberQ MemoryConstrained MemoryInUse Menu MenuAppearance MenuCommandKey MenuEvaluator MenuItem MenuPacket MenuSortingValue MenuStyle MenuView MergeDifferences Mesh MeshFunctions MeshRange MeshShading MeshStyle Message MessageDialog MessageList MessageName MessageOptions MessagePacket Messages MessagesNotebook MetaCharacters MetaInformation Method MethodOptions MexicanHatWavelet MeyerWavelet Min MinDetect MinFilter MinimalPolynomial MinimalStateSpaceModel Minimize Minors MinRecursion MinSize MinStableDistribution Minus MinusPlus MinValue Missing MissingDataMethod MittagLefflerE MixedRadix MixedRadixQuantity MixtureDistribution Mod Modal Mode Modular ModularLambda Module Modulus MoebiusMu Moment Momentary MomentConvert MomentEvaluate MomentGeneratingFunction Monday Monitor MonomialList MonomialOrder MonsterGroupM MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform Most MouseAnnotation MouseAppearance MouseAppearanceTag MouseButtons Mouseover MousePointerNote MousePosition MovingAverage MovingMedian MoyalDistribution MultiedgeStyle MultilaunchWarning MultiLetterItalics MultiLetterStyle MultilineFunction Multinomial MultinomialDistribution MultinormalDistribution MultiplicativeOrder Multiplicity Multiselection MultivariateHypergeometricDistribution MultivariatePoissonDistribution MultivariateTDistribution N NakagamiDistribution NameQ Names NamespaceBox Nand NArgMax NArgMin NBernoulliB NCache NDSolve NDSolveValue Nearest NearestFunction NeedCurrentFrontEndPackagePacket NeedCurrentFrontEndSymbolsPacket NeedlemanWunschSimilarity Needs Negative NegativeBinomialDistribution NegativeMultinomialDistribution NeighborhoodGraph Nest NestedGreaterGreater NestedLessLess NestedScriptRules NestList NestWhile NestWhileList NevilleThetaC NevilleThetaD NevilleThetaN NevilleThetaS NewPrimitiveStyle NExpectation Next NextPrime NHoldAll NHoldFirst NHoldRest NicholsGridLines NicholsPlot NIntegrate NMaximize NMaxValue NMinimize NMinValue NominalVariables NonAssociative NoncentralBetaDistribution NoncentralChiSquareDistribution NoncentralFRatioDistribution NoncentralStudentTDistribution NonCommutativeMultiply NonConstants None NonlinearModelFit NonlocalMeansFilter NonNegative NonPositive Nor NorlundB Norm Normal NormalDistribution NormalGrouping Normalize NormalizedSquaredEuclideanDistance NormalsFunction NormFunction Not NotCongruent NotCupCap NotDoubleVerticalBar Notebook NotebookApply NotebookAutoSave NotebookClose NotebookConvertSettings NotebookCreate NotebookCreateReturnObject NotebookDefault NotebookDelete NotebookDirectory NotebookDynamicExpression NotebookEvaluate NotebookEventActions NotebookFileName NotebookFind NotebookFindReturnObject NotebookGet NotebookGetLayoutInformationPacket NotebookGetMisspellingsPacket NotebookInformation NotebookInterfaceObject NotebookLocate NotebookObject NotebookOpen NotebookOpenReturnObject NotebookPath NotebookPrint NotebookPut NotebookPutReturnObject NotebookRead NotebookResetGeneratedCells Notebooks NotebookSave NotebookSaveAs NotebookSelection NotebookSetupLayoutInformationPacket NotebooksMenu NotebookWrite NotElement NotEqualTilde NotExists NotGreater NotGreaterEqual NotGreaterFullEqual NotGreaterGreater NotGreaterLess NotGreaterSlantEqual NotGreaterTilde NotHumpDownHump NotHumpEqual NotLeftTriangle NotLeftTriangleBar NotLeftTriangleEqual NotLess NotLessEqual NotLessFullEqual NotLessGreater NotLessLess NotLessSlantEqual NotLessTilde NotNestedGreaterGreater NotNestedLessLess NotPrecedes NotPrecedesEqual NotPrecedesSlantEqual NotPrecedesTilde NotReverseElement NotRightTriangle NotRightTriangleBar NotRightTriangleEqual NotSquareSubset NotSquareSubsetEqual NotSquareSuperset NotSquareSupersetEqual NotSubset NotSubsetEqual NotSucceeds NotSucceedsEqual NotSucceedsSlantEqual NotSucceedsTilde NotSuperset NotSupersetEqual NotTilde NotTildeEqual NotTildeFullEqual NotTildeTilde NotVerticalBar NProbability NProduct NProductFactors NRoots NSolve NSum NSumTerms Null NullRecords NullSpace NullWords Number NumberFieldClassNumber NumberFieldDiscriminant NumberFieldFundamentalUnits NumberFieldIntegralBasis NumberFieldNormRepresentatives NumberFieldRegulator NumberFieldRootsOfUnity NumberFieldSignature NumberForm NumberFormat NumberMarks NumberMultiplier NumberPadding NumberPoint NumberQ NumberSeparator NumberSigns NumberString Numerator NumericFunction NumericQ NuttallWindow NValues NyquistGridLines NyquistPlot O ObservabilityGramian ObservabilityMatrix ObservableDecomposition ObservableModelQ OddQ Off Offset OLEData On ONanGroupON OneIdentity Opacity Open OpenAppend Opener OpenerBox OpenerBoxOptions OpenerView OpenFunctionInspectorPacket Opening OpenRead OpenSpecialOptions OpenTemporary OpenWrite Operate OperatingSystem OptimumFlowData Optional OptionInspectorSettings OptionQ Options OptionsPacket OptionsPattern OptionValue OptionValueBox OptionValueBoxOptions Or Orange Order OrderDistribution OrderedQ Ordering Orderless OrnsteinUhlenbeckProcess Orthogonalize Out Outer OutputAutoOverwrite OutputControllabilityMatrix OutputControllableModelQ OutputForm OutputFormData OutputGrouping OutputMathEditExpression OutputNamePacket OutputResponse OutputSizeLimit OutputStream Over OverBar OverDot Overflow OverHat Overlaps Overlay OverlayBox OverlayBoxOptions Overscript OverscriptBox OverscriptBoxOptions OverTilde OverVector OwenT OwnValues PackingMethod PaddedForm Padding PadeApproximant PadLeft PadRight PageBreakAbove PageBreakBelow PageBreakWithin PageFooterLines PageFooters PageHeaderLines PageHeaders PageHeight PageRankCentrality PageWidth PairedBarChart PairedHistogram PairedSmoothHistogram PairedTTest PairedZTest PaletteNotebook PalettePath Pane PaneBox PaneBoxOptions Panel PanelBox PanelBoxOptions Paneled PaneSelector PaneSelectorBox PaneSelectorBoxOptions PaperWidth ParabolicCylinderD ParagraphIndent ParagraphSpacing ParallelArray ParallelCombine ParallelDo ParallelEvaluate Parallelization Parallelize ParallelMap ParallelNeeds ParallelProduct ParallelSubmit ParallelSum ParallelTable ParallelTry Parameter ParameterEstimator ParameterMixtureDistribution ParameterVariables ParametricFunction ParametricNDSolve ParametricNDSolveValue ParametricPlot ParametricPlot3D ParentConnect ParentDirectory ParentForm Parenthesize ParentList ParetoDistribution Part PartialCorrelationFunction PartialD ParticleData Partition PartitionsP PartitionsQ ParzenWindow PascalDistribution PassEventsDown PassEventsUp Paste PasteBoxFormInlineCells PasteButton Path PathGraph PathGraphQ Pattern PatternSequence PatternTest PauliMatrix PaulWavelet Pause PausedTime PDF PearsonChiSquareTest PearsonCorrelationTest PearsonDistribution PerformanceGoal PeriodicInterpolation Periodogram PeriodogramArray PermutationCycles PermutationCyclesQ PermutationGroup PermutationLength PermutationList PermutationListQ PermutationMax PermutationMin PermutationOrder PermutationPower PermutationProduct PermutationReplace Permutations PermutationSupport Permute PeronaMalikFilter Perpendicular PERTDistribution PetersenGraph PhaseMargins Pi Pick PIDData PIDDerivativeFilter PIDFeedforward PIDTune Piecewise PiecewiseExpand PieChart PieChart3D PillaiTrace PillaiTraceTest Pink Pivoting PixelConstrained PixelValue PixelValuePositions Placed Placeholder PlaceholderReplace Plain PlanarGraphQ Play PlayRange Plot Plot3D Plot3Matrix PlotDivision PlotJoined PlotLabel PlotLayout PlotLegends PlotMarkers PlotPoints PlotRange PlotRangeClipping PlotRangePadding PlotRegion PlotStyle Plus PlusMinus Pochhammer PodStates PodWidth Point Point3DBox PointBox PointFigureChart PointForm PointLegend PointSize PoissonConsulDistribution PoissonDistribution PoissonProcess PoissonWindow PolarAxes PolarAxesOrigin PolarGridLines PolarPlot PolarTicks PoleZeroMarkers PolyaAeppliDistribution PolyGamma Polygon Polygon3DBox Polygon3DBoxOptions PolygonBox PolygonBoxOptions PolygonHoleScale PolygonIntersections PolygonScale PolyhedronData PolyLog PolynomialExtendedGCD PolynomialForm PolynomialGCD PolynomialLCM PolynomialMod PolynomialQ PolynomialQuotient PolynomialQuotientRemainder PolynomialReduce PolynomialRemainder Polynomials PopupMenu PopupMenuBox PopupMenuBoxOptions PopupView PopupWindow Position Positive PositiveDefiniteMatrixQ PossibleZeroQ Postfix PostScript Power PowerDistribution PowerExpand PowerMod PowerModList PowerSpectralDensity PowersRepresentations PowerSymmetricPolynomial Precedence PrecedenceForm Precedes PrecedesEqual PrecedesSlantEqual PrecedesTilde Precision PrecisionGoal PreDecrement PredictionRoot PreemptProtect PreferencesPath Prefix PreIncrement Prepend PrependTo PreserveImageOptions Previous PriceGraphDistribution PrimaryPlaceholder Prime PrimeNu PrimeOmega PrimePi PrimePowerQ PrimeQ Primes PrimeZetaP PrimitiveRoot PrincipalComponents PrincipalValue Print PrintAction PrintForm PrintingCopies PrintingOptions PrintingPageRange PrintingStartingPageNumber PrintingStyleEnvironment PrintPrecision PrintTemporary Prism PrismBox PrismBoxOptions PrivateCellOptions PrivateEvaluationOptions PrivateFontOptions PrivateFrontEndOptions PrivateNotebookOptions PrivatePaths Probability ProbabilityDistribution ProbabilityPlot ProbabilityPr ProbabilityScalePlot ProbitModelFit ProcessEstimator ProcessParameterAssumptions ProcessParameterQ ProcessStateDomain ProcessTimeDomain Product ProductDistribution ProductLog ProgressIndicator ProgressIndicatorBox ProgressIndicatorBoxOptions Projection Prolog PromptForm Properties Property PropertyList PropertyValue Proportion Proportional Protect Protected ProteinData Pruning PseudoInverse Purple Put PutAppend Pyramid PyramidBox PyramidBoxOptions QBinomial QFactorial QGamma QHypergeometricPFQ QPochhammer QPolyGamma QRDecomposition QuadraticIrrationalQ Quantile QuantilePlot Quantity QuantityForm QuantityMagnitude QuantityQ QuantityUnit Quartics QuartileDeviation Quartiles QuartileSkewness QueueingNetworkProcess QueueingProcess QueueProperties Quiet Quit Quotient QuotientRemainder RadialityCentrality RadicalBox RadicalBoxOptions RadioButton RadioButtonBar RadioButtonBox RadioButtonBoxOptions Radon RamanujanTau RamanujanTauL RamanujanTauTheta RamanujanTauZ Random RandomChoice RandomComplex RandomFunction RandomGraph RandomImage RandomInteger RandomPermutation RandomPrime RandomReal RandomSample RandomSeed RandomVariate RandomWalkProcess Range RangeFilter RangeSpecification RankedMax RankedMin Raster Raster3D Raster3DBox Raster3DBoxOptions RasterArray RasterBox RasterBoxOptions Rasterize RasterSize Rational RationalFunctions Rationalize Rationals Ratios Raw RawArray RawBoxes RawData RawMedium RayleighDistribution Re Read ReadList ReadProtected Real RealBlockDiagonalForm RealDigits RealExponent Reals Reap Record RecordLists RecordSeparators Rectangle RectangleBox RectangleBoxOptions RectangleChart RectangleChart3D RecurrenceFilter RecurrenceTable RecurringDigitsForm Red Reduce RefBox ReferenceLineStyle ReferenceMarkers ReferenceMarkerStyle Refine ReflectionMatrix ReflectionTransform Refresh RefreshRate RegionBinarize RegionFunction RegionPlot RegionPlot3D RegularExpression Regularization Reinstall Release ReleaseHold ReliabilityDistribution ReliefImage ReliefPlot Remove RemoveAlphaChannel RemoveAsynchronousTask Removed RemoveInputStreamMethod RemoveOutputStreamMethod RemoveProperty RemoveScheduledTask RenameDirectory RenameFile RenderAll RenderingOptions RenewalProcess RenkoChart Repeated RepeatedNull RepeatedString Replace ReplaceAll ReplaceHeldPart ReplaceImageValue ReplaceList ReplacePart ReplacePixelValue ReplaceRepeated Resampling Rescale RescalingTransform ResetDirectory ResetMenusPacket ResetScheduledTask Residue Resolve Rest Resultant ResumePacket Return ReturnExpressionPacket ReturnInputFormPacket ReturnPacket ReturnTextPacket Reverse ReverseBiorthogonalSplineWavelet ReverseElement ReverseEquilibrium ReverseGraph ReverseUpEquilibrium RevolutionAxis RevolutionPlot3D RGBColor RiccatiSolve RiceDistribution RidgeFilter RiemannR RiemannSiegelTheta RiemannSiegelZ Riffle Right RightArrow RightArrowBar RightArrowLeftArrow RightCosetRepresentative RightDownTeeVector RightDownVector RightDownVectorBar RightTee RightTeeArrow RightTeeVector RightTriangle RightTriangleBar RightTriangleEqual RightUpDownVector RightUpTeeVector RightUpVector RightUpVectorBar RightVector RightVectorBar RiskAchievementImportance RiskReductionImportance RogersTanimotoDissimilarity Root RootApproximant RootIntervals RootLocusPlot RootMeanSquare RootOfUnityQ RootReduce Roots RootSum Rotate RotateLabel RotateLeft RotateRight RotationAction RotationBox RotationBoxOptions RotationMatrix RotationTransform Round RoundImplies RoundingRadius Row RowAlignments RowBackgrounds RowBox RowHeights RowLines RowMinHeight RowReduce RowsEqual RowSpacings RSolve RudvalisGroupRu Rule RuleCondition RuleDelayed RuleForm RulerUnits Run RunScheduledTask RunThrough RuntimeAttributes RuntimeOptions RussellRaoDissimilarity SameQ SameTest SampleDepth SampledSoundFunction SampledSoundList SampleRate SamplingPeriod SARIMAProcess SARMAProcess SatisfiabilityCount SatisfiabilityInstances SatisfiableQ Saturday Save Saveable SaveAutoDelete SaveDefinitions SawtoothWave Scale Scaled ScaleDivisions ScaledMousePosition ScaleOrigin ScalePadding ScaleRanges ScaleRangeStyle ScalingFunctions ScalingMatrix ScalingTransform Scan ScheduledTaskActiveQ ScheduledTaskData ScheduledTaskObject ScheduledTasks SchurDecomposition ScientificForm ScreenRectangle ScreenStyleEnvironment ScriptBaselineShifts ScriptLevel ScriptMinSize ScriptRules ScriptSizeMultipliers Scrollbars ScrollingOptions ScrollPosition Sec Sech SechDistribution SectionGrouping SectorChart SectorChart3D SectorOrigin SectorSpacing SeedRandom Select Selectable SelectComponents SelectedCells SelectedNotebook Selection SelectionAnimate SelectionCell SelectionCellCreateCell SelectionCellDefaultStyle SelectionCellParentStyle SelectionCreateCell SelectionDebuggerTag SelectionDuplicateCell SelectionEvaluate SelectionEvaluateCreateCell SelectionMove SelectionPlaceholder SelectionSetStyle SelectWithContents SelfLoops SelfLoopStyle SemialgebraicComponentInstances SendMail Sequence SequenceAlignment SequenceForm SequenceHold SequenceLimit Series SeriesCoefficient SeriesData SessionTime Set SetAccuracy SetAlphaChannel SetAttributes Setbacks SetBoxFormNamesPacket SetDelayed SetDirectory SetEnvironment SetEvaluationNotebook SetFileDate SetFileLoadingContext SetNotebookStatusLine SetOptions SetOptionsPacket SetPrecision SetProperty SetSelectedNotebook SetSharedFunction SetSharedVariable SetSpeechParametersPacket SetStreamPosition SetSystemOptions Setter SetterBar SetterBox SetterBoxOptions Setting SetValue Shading Shallow ShannonWavelet ShapiroWilkTest Share Sharpen ShearingMatrix ShearingTransform ShenCastanMatrix Short ShortDownArrow Shortest ShortestMatch ShortestPathFunction ShortLeftArrow ShortRightArrow ShortUpArrow Show ShowAutoStyles ShowCellBracket ShowCellLabel ShowCellTags ShowClosedCellArea ShowContents ShowControls ShowCursorTracker ShowGroupOpenCloseIcon ShowGroupOpener ShowInvisibleCharacters ShowPageBreaks ShowPredictiveInterface ShowSelection ShowShortBoxForm ShowSpecialCharacters ShowStringCharacters ShowSyntaxStyles ShrinkingDelay ShrinkWrapBoundingBox SiegelTheta SiegelTukeyTest Sign Signature SignedRankTest SignificanceLevel SignPadding SignTest SimilarityRules SimpleGraph SimpleGraphQ Simplify Sin Sinc SinghMaddalaDistribution SingleEvaluation SingleLetterItalics SingleLetterStyle SingularValueDecomposition SingularValueList SingularValuePlot SingularValues Sinh SinhIntegral SinIntegral SixJSymbol Skeleton SkeletonTransform SkellamDistribution Skewness SkewNormalDistribution Skip SliceDistribution Slider Slider2D Slider2DBox Slider2DBoxOptions SliderBox SliderBoxOptions SlideView Slot SlotSequence Small SmallCircle Smaller SmithDelayCompensator SmithWatermanSimilarity SmoothDensityHistogram SmoothHistogram SmoothHistogram3D SmoothKernelDistribution SocialMediaData Socket SokalSneathDissimilarity Solve SolveAlways SolveDelayed Sort SortBy Sound SoundAndGraphics SoundNote SoundVolume Sow Space SpaceForm Spacer Spacings Span SpanAdjustments SpanCharacterRounding SpanFromAbove SpanFromBoth SpanFromLeft SpanLineThickness SpanMaxSize SpanMinSize SpanningCharacters SpanSymmetric SparseArray SpatialGraphDistribution Speak SpeakTextPacket SpearmanRankTest SpearmanRho Spectrogram SpectrogramArray Specularity SpellingCorrection SpellingDictionaries SpellingDictionariesPath SpellingOptions SpellingSuggestionsPacket Sphere SphereBox SphericalBesselJ SphericalBesselY SphericalHankelH1 SphericalHankelH2 SphericalHarmonicY SphericalPlot3D SphericalRegion SpheroidalEigenvalue SpheroidalJoiningFactor SpheroidalPS SpheroidalPSPrime SpheroidalQS SpheroidalQSPrime SpheroidalRadialFactor SpheroidalS1 SpheroidalS1Prime SpheroidalS2 SpheroidalS2Prime Splice SplicedDistribution SplineClosed SplineDegree SplineKnots SplineWeights Split SplitBy SpokenString Sqrt SqrtBox SqrtBoxOptions Square SquaredEuclideanDistance SquareFreeQ SquareIntersection SquaresR SquareSubset SquareSubsetEqual SquareSuperset SquareSupersetEqual SquareUnion SquareWave StabilityMargins StabilityMarginsStyle StableDistribution Stack StackBegin StackComplete StackInhibit StandardDeviation StandardDeviationFilter StandardForm Standardize StandbyDistribution Star StarGraph StartAsynchronousTask StartingStepSize StartOfLine StartOfString StartScheduledTask StartupSound StateDimensions StateFeedbackGains StateOutputEstimator StateResponse StateSpaceModel StateSpaceRealization StateSpaceTransform StationaryDistribution StationaryWaveletPacketTransform StationaryWaveletTransform StatusArea StatusCentrality StepMonitor StieltjesGamma StirlingS1 StirlingS2 StopAsynchronousTask StopScheduledTask StrataVariables StratonovichProcess StreamColorFunction StreamColorFunctionScaling StreamDensityPlot StreamPlot StreamPoints StreamPosition Streams StreamScale StreamStyle String StringBreak StringByteCount StringCases StringCount StringDrop StringExpression StringForm StringFormat StringFreeQ StringInsert StringJoin StringLength StringMatchQ StringPosition StringQ StringReplace StringReplaceList StringReplacePart StringReverse StringRotateLeft StringRotateRight StringSkeleton StringSplit StringTake StringToStream StringTrim StripBoxes StripOnInput StripWrapperBoxes StrokeForm StructuralImportance StructuredArray StructuredSelection StruveH StruveL Stub StudentTDistribution Style StyleBox StyleBoxAutoDelete StyleBoxOptions StyleData StyleDefinitions StyleForm StyleKeyMapping StyleMenuListing StyleNameDialogSettings StyleNames StylePrint StyleSheetPath Subfactorial Subgraph SubMinus SubPlus SubresultantPolynomialRemainders SubresultantPolynomials Subresultants Subscript SubscriptBox SubscriptBoxOptions Subscripted Subset SubsetEqual Subsets SubStar Subsuperscript SubsuperscriptBox SubsuperscriptBoxOptions Subtract SubtractFrom SubValues Succeeds SucceedsEqual SucceedsSlantEqual SucceedsTilde SuchThat Sum SumConvergence Sunday SuperDagger SuperMinus SuperPlus Superscript SuperscriptBox SuperscriptBoxOptions Superset SupersetEqual SuperStar Surd SurdForm SurfaceColor SurfaceGraphics SurvivalDistribution SurvivalFunction SurvivalModel SurvivalModelFit SuspendPacket SuzukiDistribution SuzukiGroupSuz SwatchLegend Switch Symbol SymbolName SymletWavelet Symmetric SymmetricGroup SymmetricMatrixQ SymmetricPolynomial SymmetricReduction Symmetrize SymmetrizedArray SymmetrizedArrayRules SymmetrizedDependentComponents SymmetrizedIndependentComponents SymmetrizedReplacePart SynchronousInitialization SynchronousUpdating Syntax SyntaxForm SyntaxInformation SyntaxLength SyntaxPacket SyntaxQ SystemDialogInput SystemException SystemHelpPath SystemInformation SystemInformationData SystemOpen SystemOptions SystemsModelDelay SystemsModelDelayApproximate SystemsModelDelete SystemsModelDimensions SystemsModelExtract SystemsModelFeedbackConnect SystemsModelLabels SystemsModelOrder SystemsModelParallelConnect SystemsModelSeriesConnect SystemsModelStateFeedbackConnect SystemStub Tab TabFilling Table TableAlignments TableDepth TableDirections TableForm TableHeadings TableSpacing TableView TableViewBox TabSpacings TabView TabViewBox TabViewBoxOptions TagBox TagBoxNote TagBoxOptions TaggingRules TagSet TagSetDelayed TagStyle TagUnset Take TakeWhile Tally Tan Tanh TargetFunctions TargetUnits TautologyQ TelegraphProcess TemplateBox TemplateBoxOptions TemplateSlotSequence TemporalData Temporary TemporaryVariable TensorContract TensorDimensions TensorExpand TensorProduct TensorQ TensorRank TensorReduce TensorSymmetry TensorTranspose TensorWedge Tetrahedron TetrahedronBox TetrahedronBoxOptions TeXForm TeXSave Text Text3DBox Text3DBoxOptions TextAlignment TextBand TextBoundingBox TextBox TextCell TextClipboardType TextData TextForm TextJustification TextLine TextPacket TextParagraph TextRecognize TextRendering TextStyle Texture TextureCoordinateFunction TextureCoordinateScaling Therefore ThermometerGauge Thick Thickness Thin Thinning ThisLink ThompsonGroupTh Thread ThreeJSymbol Threshold Through Throw Thumbnail Thursday Ticks TicksStyle Tilde TildeEqual TildeFullEqual TildeTilde TimeConstrained TimeConstraint Times TimesBy TimeSeriesForecast TimeSeriesInvertibility TimeUsed TimeValue TimeZone Timing Tiny TitleGrouping TitsGroupT ToBoxes ToCharacterCode ToColor ToContinuousTimeModel ToDate ToDiscreteTimeModel ToeplitzMatrix ToExpression ToFileName Together Toggle ToggleFalse Toggler TogglerBar TogglerBox TogglerBoxOptions ToHeldExpression ToInvertibleTimeSeries TokenWords Tolerance ToLowerCase ToNumberField TooBig Tooltip TooltipBox TooltipBoxOptions TooltipDelay TooltipStyle Top TopHatTransform TopologicalSort ToRadicals ToRules ToString Total TotalHeight TotalVariationFilter TotalWidth TouchscreenAutoZoom TouchscreenControlPlacement ToUpperCase Tr Trace TraceAbove TraceAction TraceBackward TraceDepth TraceDialog TraceForward TraceInternal TraceLevel TraceOff TraceOn TraceOriginal TracePrint TraceScan TrackedSymbols TradingChart TraditionalForm TraditionalFunctionNotation TraditionalNotation TraditionalOrder TransferFunctionCancel TransferFunctionExpand TransferFunctionFactor TransferFunctionModel TransferFunctionPoles TransferFunctionTransform TransferFunctionZeros TransformationFunction TransformationFunctions TransformationMatrix TransformedDistribution TransformedField Translate TranslationTransform TransparentColor Transpose TreeForm TreeGraph TreeGraphQ TreePlot TrendStyle TriangleWave TriangularDistribution Trig TrigExpand TrigFactor TrigFactorList Trigger TrigReduce TrigToExp TrimmedMean True TrueQ TruncatedDistribution TsallisQExponentialDistribution TsallisQGaussianDistribution TTest Tube TubeBezierCurveBox TubeBezierCurveBoxOptions TubeBox TubeBSplineCurveBox TubeBSplineCurveBoxOptions Tuesday TukeyLambdaDistribution TukeyWindow Tuples TuranGraph TuringMachine Transparent UnateQ Uncompress Undefined UnderBar Underflow Underlined Underoverscript UnderoverscriptBox UnderoverscriptBoxOptions Underscript UnderscriptBox UnderscriptBoxOptions UndirectedEdge UndirectedGraph UndirectedGraphQ UndocumentedTestFEParserPacket UndocumentedTestGetSelectionPacket Unequal Unevaluated UniformDistribution UniformGraphDistribution UniformSumDistribution Uninstall Union UnionPlus Unique UnitBox UnitConvert UnitDimensions Unitize UnitRootTest UnitSimplify UnitStep UnitTriangle UnitVector Unprotect UnsameQ UnsavedVariables Unset UnsetShared UntrackedVariables Up UpArrow UpArrowBar UpArrowDownArrow Update UpdateDynamicObjects UpdateDynamicObjectsSynchronous UpdateInterval UpDownArrow UpEquilibrium UpperCaseQ UpperLeftArrow UpperRightArrow UpperTriangularize Upsample UpSet UpSetDelayed UpTee UpTeeArrow UpValues URL URLFetch URLFetchAsynchronous URLSave URLSaveAsynchronous UseGraphicsRange Using UsingFrontEnd V2Get ValidationLength Value ValueBox ValueBoxOptions ValueForm ValueQ ValuesData Variables Variance VarianceEquivalenceTest VarianceEstimatorFunction VarianceGammaDistribution VarianceTest VectorAngle VectorColorFunction VectorColorFunctionScaling VectorDensityPlot VectorGlyphData VectorPlot VectorPlot3D VectorPoints VectorQ Vectors VectorScale VectorStyle Vee Verbatim Verbose VerboseConvertToPostScriptPacket VerifyConvergence VerifySolutions VerifyTestAssumptions Version VersionNumber VertexAdd VertexCapacity VertexColors VertexComponent VertexConnectivity VertexCoordinateRules VertexCoordinates VertexCorrelationSimilarity VertexCosineSimilarity VertexCount VertexCoverQ VertexDataCoordinates VertexDegree VertexDelete VertexDiceSimilarity VertexEccentricity VertexInComponent VertexInDegree VertexIndex VertexJaccardSimilarity VertexLabeling VertexLabels VertexLabelStyle VertexList VertexNormals VertexOutComponent VertexOutDegree VertexQ VertexRenderingFunction VertexReplace VertexShape VertexShapeFunction VertexSize VertexStyle VertexTextureCoordinates VertexWeight Vertical VerticalBar VerticalForm VerticalGauge VerticalSeparator VerticalSlider VerticalTilde ViewAngle ViewCenter ViewMatrix ViewPoint ViewPointSelectorSettings ViewPort ViewRange ViewVector ViewVertical VirtualGroupData Visible VisibleCell VoigtDistribution VonMisesDistribution WaitAll WaitAsynchronousTask WaitNext WaitUntil WakebyDistribution WalleniusHypergeometricDistribution WaringYuleDistribution WatershedComponents WatsonUSquareTest WattsStrogatzGraphDistribution WaveletBestBasis WaveletFilterCoefficients WaveletImagePlot WaveletListPlot WaveletMapIndexed WaveletMatrixPlot WaveletPhi WaveletPsi WaveletScale WaveletScalogram WaveletThreshold WeaklyConnectedComponents WeaklyConnectedGraphQ WeakStationarity WeatherData WeberE Wedge Wednesday WeibullDistribution WeierstrassHalfPeriods WeierstrassInvariants WeierstrassP WeierstrassPPrime WeierstrassSigma WeierstrassZeta WeightedAdjacencyGraph WeightedAdjacencyMatrix WeightedData WeightedGraphQ Weights WelchWindow WheelGraph WhenEvent Which While White Whitespace WhitespaceCharacter WhittakerM WhittakerW WienerFilter WienerProcess WignerD WignerSemicircleDistribution WilksW WilksWTest WindowClickSelect WindowElements WindowFloating WindowFrame WindowFrameElements WindowMargins WindowMovable WindowOpacity WindowSelected WindowSize WindowStatusArea WindowTitle WindowToolbars WindowWidth With WolframAlpha WolframAlphaDate WolframAlphaQuantity WolframAlphaResult Word WordBoundary WordCharacter WordData WordSearch WordSeparators WorkingPrecision Write WriteString Wronskian XMLElement XMLObject Xnor Xor Yellow YuleDissimilarity ZernikeR ZeroSymmetric ZeroTest ZeroWidthTimes Zeta ZetaZero ZipfDistribution ZTest ZTransform $Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered $AddOnsDirectory $AssertFunction $Assumptions $AsynchronousTask $BaseDirectory $BatchInput $BatchOutput $BoxForms $ByteOrdering $Canceled $CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget $ConditionHold $ConfiguredKernels $Context $ContextPath $ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat $DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath $Display $DisplayFunction $DistributedContexts $DynamicEvaluation $Echo $Epilog $ExportFormats $Failed $FinancialDataSource $FormatType $FrontEnd $FrontEndSession $GeoLocation $HistoryLength $HomeDirectory $HTTPCookies $IgnoreEOF $ImagingDevices $ImportFormats $InitialDirectory $Input $InputFileName $InputStreamMethods $Inspector $InstallationDate $InstallationDirectory $InterfaceEnvironment $IterationLimit $KernelCount $KernelID $Language $LaunchDirectory $LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses $LicenseServer $LicenseSubprocesses $LicenseType $Line $Linked $LinkSupported $LoadedFiles $MachineAddresses $MachineDomain $MachineDomains $MachineEpsilon $MachineID $MachineName $MachinePrecision $MachineType $MaxExtraPrecision $MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber $MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups $MessageList $MessagePrePrint $Messages $MinMachineNumber $MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber $NetworkLicense $NewMessage $NewSymbol $Notebooks $NumberMarks $Off $OperatingSystem $Output $OutputForms $OutputSizeLimit $OutputStreamMethods $Packages $ParentLink $ParentProcessID $PasswordFile $PatchLevelID $Path $PathnameSeparator $PerformanceGoal $PipeSupported $Post $Pre $PreferencesDirectory $PrePrint $PreRead $PrintForms $PrintLiteral $ProcessID $ProcessorCount $ProcessorType $ProductInformation $ProgramName $RandomState $RecursionLimit $ReleaseNumber $RootDirectory $ScheduledTask $ScriptCommandLine $SessionID $SetParentLink $SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction $SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System $SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory $TemporaryPrefix $TextStyle $TimedOut $TimeUnit $TimeZone $TopDirectory $TraceOff $TraceOn $TracePattern $TracePostAction $TracePreAction $Urgent $UserAddOnsDirectory $UserBaseDirectory $UserDocumentsDirectory $UserName $Version $VersionNumber", -c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{cN:"list",b:/\{/,e:/\}/,i:/:/}]}});hljs.registerLanguage("fsharp",function(e){var t={b:"<",e:">",c:[e.inherit(e.TM,{b:/'[a-zA-Z0-9_]+/})]};return{aliases:["fs"],k:"yield! return! let! do!abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",c:[{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},e.C("\\(\\*","\\*\\)"),{cN:"class",bK:"type",e:"\\(|=|$",eE:!0,c:[e.UTM,t]},{cN:"annotation",b:"\\[<",e:">\\]",r:10},{cN:"attribute",b:"\\B('[A-Za-z])\\b",c:[e.BE]},e.CLCM,e.inherit(e.QSM,{i:null}),e.CNM]}});hljs.registerLanguage("verilog",function(e){return{aliases:["v"],cI:!0,k:{keyword:"always and assign begin buf bufif0 bufif1 case casex casez cmos deassign default defparam disable edge else end endcase endfunction endmodule endprimitive endspecify endtable endtask event for force forever fork function if ifnone initial inout input join macromodule module nand negedge nmos nor not notif0 notif1 or output parameter pmos posedge primitive pulldown pullup rcmos release repeat rnmos rpmos rtran rtranif0 rtranif1 specify specparam table task timescale tran tranif0 tranif1 wait while xnor xor",typename:"highz0 highz1 integer large medium pull0 pull1 real realtime reg scalared signed small strong0 strong1 supply0 supply0 supply1 supply1 time tri tri0 tri1 triand trior trireg vectored wand weak0 weak1 wire wor"},c:[e.CBCM,e.CLCM,e.QSM,{cN:"number",b:"\\b(\\d+'(b|h|o|d|B|H|O|D))?[0-9xzXZ]+",c:[e.BE],r:0},{cN:"typename",b:"\\.\\w+",r:0},{cN:"value",b:"#\\((?!parameter).+\\)"},{cN:"keyword",b:"\\+|-|\\*|/|%|<|>|=|#|`|\\!|&|\\||@|:|\\^|~|\\{|\\}",r:0}]}});hljs.registerLanguage("dos",function(e){var r=e.C(/@?rem\b/,/$/,{r:10}),t={cN:"label",b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",r:0};return{aliases:["bat","cmd"],cI:!0,k:{flow:"if else goto for in do call exit not exist errorlevel defined",operator:"equ neq lss leq gtr geq",keyword:"shift cd dir echo setlocal endlocal set pause copy",stream:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux",winutils:"ping net ipconfig taskkill xcopy ren del",built_in:"append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color comp compact convert date dir diskcomp diskcopy doskey erase fs find findstr format ftype graftabl help keyb label md mkdir mode more move path pause print popd pushd promt rd recover rem rename replace restore rmdir shiftsort start subst time title tree type ver verify vol"},c:[{cN:"envvar",b:/%%[^ ]|%[^ ]+?%|![^ ]+?!/},{cN:"function",b:t.b,e:"goto:eof",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),r]},{cN:"number",b:"\\b\\d+",r:0},r]}});hljs.registerLanguage("gherkin",function(e){return{aliases:["feature"],k:"Feature Background Ability Business Need Scenario Scenarios Scenario Outline Scenario Template Examples Given And Then But When",c:[{cN:"keyword",b:"\\*"},e.C("@[^@\r\n ]+","$"),{cN:"string",b:"\\|",e:"\\$"},{cN:"variable",b:"<",e:">"},e.HCM,{cN:"string",b:'"""',e:'"""'},e.QSM]}});hljs.registerLanguage("xml",function(t){var e="[A-Za-z0-9\\._:-]+",s={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"},c={eW:!0,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},t.C("",{r:10}),{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[c],starts:{e:"",rE:!0,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[c],starts:{e:"",rE:!0,sL:""}},s,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},c]}]}});hljs.registerLanguage("autohotkey",function(e){var r={cN:"escape",b:"`[\\s\\S]"},c=e.C(";","$",{r:0}),n=[{cN:"built_in",b:"A_[a-zA-Z0-9]+"},{cN:"built_in",bK:"ComSpec Clipboard ClipboardAll ErrorLevel"}];return{cI:!0,k:{keyword:"Break Continue Else Gosub If Loop Return While",literal:"A true false NOT AND OR"},c:n.concat([r,e.inherit(e.QSM,{c:[r]}),c,{cN:"number",b:e.NR,r:0},{cN:"var_expand",b:"%",e:"%",i:"\\n",c:[r]},{cN:"label",c:[r],v:[{b:'^[^\\n";]+::(?!=)'},{b:'^[^\\n";]+:(?!=)',r:0}]},{b:",\\s*,",r:10}])}});hljs.registerLanguage("r",function(e){var r="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[e.HCM,{b:r,l:r,k:{keyword:"function if in break next repeat else for return switch while try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[e.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}});hljs.registerLanguage("cs",function(e){var r="abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",t=e.IR+"(<"+e.IR+">)?";return{aliases:["csharp"],k:r,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"xmlDocTag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class namespace interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("nsis",function(e){var t={cN:"symbol",b:"\\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)"},n={cN:"constant",b:"\\$+{[a-zA-Z0-9_]+}"},i={cN:"variable",b:"\\$+[a-zA-Z0-9_]+",i:"\\(\\){}"},r={cN:"constant",b:"\\$+\\([a-zA-Z0-9_]+\\)"},o={cN:"params",b:"(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)"},l={cN:"constant",b:"\\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)"};return{cI:!1,k:{keyword:"Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PageExEnd Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetPluginUnload SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption SubSectionEnd Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle",literal:"admin all auto both colored current false force hide highest lastused leave listonly none normal notset off on open print show silent silentlog smooth textonly true user "},c:[e.HCM,e.CBCM,{cN:"string",b:'"',e:'"',i:"\\n",c:[{cN:"symbol",b:"\\$(\\\\(n|r|t)|\\$)"},t,n,i,r]},e.C(";","$",{r:0}),{cN:"function",bK:"Function PageEx Section SectionGroup SubSection",e:"$"},l,n,i,r,o,e.NM,{cN:"literal",b:e.IR+"::"+e.IR}]}});hljs.registerLanguage("less",function(e){var r="[\\w-]+",t="("+r+"|@{"+r+"})",a=[],c=[],n=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},i=function(e,r,t){return{cN:e,b:r,r:t}},s=function(r,t,a){return e.inherit({cN:r,b:t+"\\(",e:"\\(",rB:!0,eE:!0,r:0},a)},b={b:"\\(",e:"\\)",c:c,r:0};c.push(e.CLCM,e.CBCM,n("'"),n('"'),e.CSSNM,i("hexcolor","#[0-9A-Fa-f]+\\b"),s("function","(url|data-uri)",{starts:{cN:"string",e:"[\\)\\n]",eE:!0}}),s("function",r),b,i("variable","@@?"+r,10),i("variable","@{"+r+"}"),i("built_in","~?`[^`]*?`"),{cN:"attribute",b:r+"\\s*:",e:":",rB:!0,eE:!0});var o=c.concat({b:"{",e:"}",c:a}),u={bK:"when",eW:!0,c:[{bK:"and not"}].concat(c)},C={cN:"attribute",b:t,e:":",eE:!0,c:[e.CLCM,e.CBCM],i:/\S/,starts:{e:"[;}]",rE:!0,c:c,i:"[<=$]"}},l={cN:"at_rule",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:c,r:0}},d={cN:"variable",v:[{b:"@"+r+"\\s*:",r:15},{b:"@"+r}],starts:{e:"[;}]",rE:!0,c:o}},p={v:[{b:"[\\.#:&\\[]",e:"[;{}]"},{b:t+"[^;]*{",e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",c:[e.CLCM,e.CBCM,u,i("keyword","all\\b"),i("variable","@{"+r+"}"),i("tag",t+"%?",0),i("id","#"+t),i("class","\\."+t,0),i("keyword","&",0),s("pseudo",":not"),s("keyword",":extend"),i("pseudo","::?"+t),{cN:"attr_selector",b:"\\[",e:"\\]"},{b:"\\(",e:"\\)",c:o},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,l,d,p,C),{cI:!0,i:"[=>'/<($\"]",c:a}});hljs.registerLanguage("pf",function(t){var o={cN:"variable",b:/\$[\w\d#@][\w\d_]*/},e={cN:"variable",b://};return{aliases:["pf.conf"],l:/[a-z0-9_<>-]+/,k:{built_in:"block match pass load anchor|5 antispoof|10 set table",keyword:"in out log quick on rdomain inet inet6 proto from port os to routeallow-opts divert-packet divert-reply divert-to flags group icmp-typeicmp6-type label once probability recieved-on rtable prio queuetos tag tagged user keep fragment for os dropaf-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robinsource-hash static-portdup-to reply-to route-toparent bandwidth default min max qlimitblock-policy debug fingerprints hostid limit loginterface optimizationreassemble ruleset-optimization basic none profile skip state-defaultsstate-policy timeoutconst counters persistno modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppysource-track global rule max-src-nodes max-src-states max-src-connmax-src-conn-rate overload flushscrub|5 max-mss min-ttl no-df|10 random-id",literal:"all any no-route self urpf-failed egress|5 unknown"},c:[t.HCM,t.NM,t.QSM,o,e]}});hljs.registerLanguage("lasso",function(e){var r="[a-zA-Z_][a-zA-Z0-9_.]*",a="<\\?(lasso(script)?|=)",t="\\]|\\?>",s={literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null boolean bytes keyword list locale queue set stack staticarray local var variable global data self inherited",keyword:"error_code error_msg error_pop error_push error_reset cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},n=e.C("",{r:0}),o={cN:"preprocessor",b:"\\[noprocess\\]",starts:{cN:"markup",e:"\\[/noprocess\\]",rE:!0,c:[n]}},i={cN:"preprocessor",b:"\\[/noprocess|"+a},l={cN:"variable",b:"'"+r+"'"},c=[e.CLCM,{cN:"javadoc",b:"/\\*\\*!",e:"\\*/",c:[e.PWM]},e.CBCM,e.inherit(e.CNM,{b:e.CNR+"|(-?infinity|nan)\\b"}),e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"string",b:"`",e:"`"},{cN:"variable",v:[{b:"[#$]"+r},{b:"#",e:"\\d+",i:"\\W"}]},{cN:"tag",b:"::\\s*",e:r,i:"\\W"},{cN:"attribute",v:[{b:"-"+e.UIR,r:0},{b:"(\\.\\.\\.)"}]},{cN:"subst",v:[{b:"->\\s*",c:[l]},{b:":=|/(?!\\w)=?|[-+*%=<>&|!?\\\\]+",r:0}]},{cN:"built_in",b:"\\.\\.?\\s*",r:0,c:[l]},{cN:"class",bK:"define",rE:!0,e:"\\(|=>",c:[e.inherit(e.TM,{b:e.UIR+"(=(?!>))?"})]}];return{aliases:["ls","lassoscript"],cI:!0,l:r+"|&[lg]t;",k:s,c:[{cN:"preprocessor",b:t,r:0,starts:{cN:"markup",e:"\\[|"+a,rE:!0,r:0,c:[n]}},o,i,{cN:"preprocessor",b:"\\[no_square_brackets",starts:{e:"\\[/no_square_brackets\\]",l:r+"|&[lg]t;",k:s,c:[{cN:"preprocessor",b:t,r:0,starts:{cN:"markup",e:"\\[noprocess\\]|"+a,rE:!0,c:[n]}},o,i].concat(c)}},{cN:"preprocessor",b:"\\[",r:0},{cN:"shebang",b:"^#!.+lasso9\\b",r:10}].concat(c)}});hljs.registerLanguage("prolog",function(c){var r={cN:"atom",b:/[a-z][A-Za-z0-9_]*/,r:0},b={cN:"name",v:[{b:/[A-Z][a-zA-Z0-9_]*/},{b:/_[A-Za-z0-9_]*/}],r:0},a={b:/\(/,e:/\)/,r:0},e={b:/\[/,e:/\]/},n={cN:"comment",b:/%/,e:/$/,c:[c.PWM]},t={cN:"string",b:/`/,e:/`/,c:[c.BE]},g={cN:"string",b:/0\'(\\\'|.)/},N={cN:"string",b:/0\'\\s/},o={b:/:-/},s=[r,b,a,o,e,n,c.CBCM,c.QSM,c.ASM,t,g,N,c.CNM];return a.c=s,e.c=s,{c:s.concat([{b:/\.$/}])}});hljs.registerLanguage("oxygene",function(e){var r="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained",t=e.C("{","}",{r:0}),a=e.C("\\(\\*","\\*\\)",{r:10}),n={cN:"string",b:"'",e:"'",c:[{b:"''"}]},o={cN:"string",b:"(#\\d+)+"},i={cN:"function",bK:"function constructor destructor procedure method",e:"[:;]",k:"function constructor|10 destructor|10 procedure|10 method|10",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",k:r,c:[n,o]},t,a]};return{cI:!0,k:r,i:'("|\\$[G-Zg-z]|\\/\\*||->)',c:[t,a,e.CLCM,n,o,e.NM,i,{cN:"class",b:"=\\bclass\\b",e:"end;",k:r,c:[n,o,t,a,e.CLCM,i]}]}});hljs.registerLanguage("applescript",function(e){var t=e.inherit(e.QSM,{i:""}),r={cN:"params",b:"\\(",e:"\\)",c:["self",e.CNM,t]},o=e.C("--","$"),n=e.C("\\(\\*","\\*\\)",{c:["self",o]}),a=[o,n,e.HCM];return{aliases:["osascript"],k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the|0 then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[t,e.CNM,{cN:"type",b:"\\bPOSIX file\\b"},{cN:"command",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"constant",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{cN:"property",b:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{cN:"function_start",bK:"on",i:"[${=;\\n]",c:[e.UTM,r]}].concat(a),i:"//|->|=>"}});hljs.registerLanguage("makefile",function(e){var a={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[a]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,a]}]}});hljs.registerLanguage("dust",function(e){var a="if eq ne lt lte gt gte select default math sep";return{aliases:["dst"],cI:!0,sL:"xml",subLanguageMode:"continuous",c:[{cN:"expression",b:"{",e:"}",r:0,c:[{cN:"begin-block",b:"#[a-zA-Z- .]+",k:a},{cN:"string",b:'"',e:'"'},{cN:"end-block",b:"\\/[a-zA-Z- .]+",k:a},{cN:"variable",b:"[a-zA-Z-.]+",k:a,r:0}]}]}});hljs.registerLanguage("clojure-repl",function(e){return{c:[{cN:"prompt",b:/^([\w.-]+|\s*#_)=>/,starts:{e:/$/,sL:"clojure",subLanguageMode:"continuous"}}]}});hljs.registerLanguage("dart",function(e){var t={cN:"subst",b:"\\$\\{",e:"}",k:"true false null this is new super"},r={cN:"string",v:[{b:"r'''",e:"'''"},{b:'r"""',e:'"""'},{b:"r'",e:"'",i:"\\n"},{b:'r"',e:'"',i:"\\n"},{b:"'''",e:"'''",c:[e.BE,t]},{b:'"""',e:'"""',c:[e.BE,t]},{b:"'",e:"'",i:"\\n",c:[e.BE,t]},{b:'"',e:'"',i:"\\n",c:[e.BE,t]}]};t.c=[e.CNM,r];var n={keyword:"assert break case catch class const continue default do else enum extends false final finally for if in is new null rethrow return super switch this throw true try var void while with",literal:"abstract as dynamic export external factory get implements import library operator part set static typedef",built_in:"print Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set Stopwatch String StringBuffer StringSink Symbol Type Uri bool double int num document window querySelector querySelectorAll Element ElementList"};return{k:n,c:[r,{cN:"dartdoc",b:"/\\*\\*",e:"\\*/",sL:"markdown",subLanguageMode:"continuous"},{cN:"dartdoc",b:"///",e:"$",sL:"markdown",subLanguageMode:"continuous"},e.CLCM,e.CBCM,{cN:"class",bK:"class interface",e:"{",eE:!0,c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"annotation",b:"@[A-Za-z]+"},{b:"=>"}]}}); \ No newline at end of file diff --git a/mkdocs/themes/mkdocs/keyboard-modal.html b/mkdocs/themes/mkdocs/keyboard-modal.html index f903ddf8a6..2bda3f3f4c 100644 --- a/mkdocs/themes/mkdocs/keyboard-modal.html +++ b/mkdocs/themes/mkdocs/keyboard-modal.html @@ -1,34 +1,34 @@ -"),n("table.docutils.footnote").wrap("
"),n("table.docutils.citation").wrap("
"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var i=n(this);expand=n(''),expand.on("click",function(n){return e.toggleCurrent(i),n.stopPropagation(),!1}),i.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}i.length>0&&($(".wy-menu-vertical .current").removeClass("current"),i.addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l1").parent().addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l2").addClass("current"),i.closest("li.toctree-l3").addClass("current"),i.closest("li.toctree-l4").addClass("current"))}catch(o){console.log("Error expanding nav for anchor",o)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,i=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],i=0;i\n" +"Language: es\n" +"Language-Team: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "Página no encontrada" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "Documentos" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "Editar en %(repo_name)s" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "Siguiente" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "Anterior" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "" +"Construído con %(mkdocs_link)s usando %(sphinx_link)s provisto " +"por%(rtd_link)s." + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "Resultados de búsqueda" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "Buscar en la documentación" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "Escriba el término de búsqueda aquí" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "No se encontraron resultados" + +#: mkdocs/themes/readthedocs/search.html:13 +#, fuzzy +msgid "Searching..." +msgstr "Buscando..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "Buscar documentos" + diff --git a/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..b3409374e2 --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/fr/LC_MESSAGES/messages.po @@ -0,0 +1,78 @@ +# French translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-02-23 23:56+0100\n" +"Last-Translator: Alexys Jacob @ultrabug\n" +"Language: fr\n" +"Language-Team: fr \n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "Page non trouvée" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "Documents" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "Editer dans %(repo_name)s" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "Suivant" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "Précédent" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "" +"Générée avec %(mkdocs_link)s avec un %(sphinx_link)s fourni par " +"%(rtd_link)s." + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "Résultats de la recherche" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "Rechercher dans la documentation" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "Tapez vos mots clés ici" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "Aucun résultat trouvé" + +#: mkdocs/themes/readthedocs/search.html:13 +msgid "Searching..." +msgstr "Recherche en cours..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "Rechercher des documents" + diff --git a/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..e526548edf --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/ja/LC_MESSAGES/messages.po @@ -0,0 +1,76 @@ +# Japanese translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-07-31 12:07+0900\n" +"Last-Translator: Goto Hayato \n" +"Language: ja\n" +"Language-Team: ja \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "ページが見つかりません" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "ドキュメント" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "%(repo_name)s で編集" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "次へ" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "前へ" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "%(rtd_link)s 提供の %(sphinx_link)s を使って %(mkdocs_link)s でビルドされました。" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "検索結果" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "ドキュメントを検索" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "検索語句を入力してください" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "結果がありません" + +#: mkdocs/themes/readthedocs/search.html:13 +msgid "Searching..." +msgstr "検索しています..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "ドキュメントを検索" + diff --git a/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..69e819d030 --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/pt_BR/LC_MESSAGES/messages.po @@ -0,0 +1,77 @@ +# Portuguese (Brazil) translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-09-07 12:06+0200\n" +"Last-Translator: Nicole Buitoni \n" +"Language: pt_BR\n" +"Language-Team: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "Página não encontrada" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "Editar em %(repo_name)s" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "Seguinte" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "Anterior" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "Digite o termo a ser buscado aqui" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "Não foram encontrados resultados" + +#: mkdocs/themes/readthedocs/search.html:13 +#, fuzzy +msgid "Searching..." +msgstr "Buscando..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "" + diff --git a/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po b/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po new file mode 100644 index 0000000000..6d6d8dd6fb --- /dev/null +++ b/mkdocs/themes/readthedocs/locales/zh_CN/LC_MESSAGES/messages.po @@ -0,0 +1,76 @@ +# Chinese (Simplified, China) translations for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: 2021-07-14 06:01+0800\n" +"Last-Translator: xingkong0113 \n" +"Language: zh_CN\n" +"Language-Team: zh_Hans_CN \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "找不到页面" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "文档" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "在%(repo_name)s上编辑" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "下一张" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "上一张" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "" +"Built with %(mkdocs_link)s using a %(sphinx_link)s provided by " +"%(rtd_link)s." +msgstr "用%(mkdocs_link)s构建,使用%(rtd_link)s提供的%(sphinx_link)s。" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "搜索结果" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "搜索文档" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "在此输入需要搜索的内容" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "没有搜到结果" + +#: mkdocs/themes/readthedocs/search.html:13 +msgid "Searching..." +msgstr "搜索中..." + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "搜索文档" + diff --git a/mkdocs/themes/readthedocs/messages.pot b/mkdocs/themes/readthedocs/messages.pot new file mode 100644 index 0000000000..cd40768c32 --- /dev/null +++ b/mkdocs/themes/readthedocs/messages.pot @@ -0,0 +1,72 @@ +# Translations template for MkDocs. +# Copyright (C) 2021 MkDocs +# This file is distributed under the same license as the MkDocs project. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: MkDocs 1.2\n" +"Report-Msgid-Bugs-To: https://github.com/mkdocs/mkdocs/issues\n" +"POT-Creation-Date: 2021-04-08 22:46+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <@nickname or @email>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.0\n" + +#: mkdocs/themes/readthedocs/404.html:7 +msgid "Page not found" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:3 +msgid "Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:24 +#, python-format +msgid "Edit on %(repo_name)s" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:33 +#: mkdocs/themes/readthedocs/footer.html:7 +#: mkdocs/themes/readthedocs/versions.html:14 +msgid "Next" +msgstr "" + +#: mkdocs/themes/readthedocs/breadcrumbs.html:36 +#: mkdocs/themes/readthedocs/footer.html:10 +#: mkdocs/themes/readthedocs/versions.html:11 +msgid "Previous" +msgstr "" + +#: mkdocs/themes/readthedocs/footer.html:25 +#, python-format +msgid "Built with %(mkdocs_link)s using a %(sphinx_link)s provided by %(rtd_link)s." +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:5 +msgid "Search Results" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +msgid "Search the Docs" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:9 +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Type search term here" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:12 +msgid "No results found" +msgstr "" + +#: mkdocs/themes/readthedocs/search.html:13 +msgid "Searching..." +msgstr "" + +#: mkdocs/themes/readthedocs/searchbox.html:3 +msgid "Search docs" +msgstr "" + diff --git a/mkdocs/themes/readthedocs/mkdocs_theme.yml b/mkdocs/themes/readthedocs/mkdocs_theme.yml index 6a0d292eb2..4a39fc2d4f 100644 --- a/mkdocs/themes/readthedocs/mkdocs_theme.yml +++ b/mkdocs/themes/readthedocs/mkdocs_theme.yml @@ -3,5 +3,20 @@ static_templates: - 404.html +locale: en + include_search_page: true search_index_only: false + +highlightjs: true +hljs_languages: [] + +analytics: + gtag: null + +include_homepage_in_sidebar: true +prev_next_buttons_location: bottom +navigation_depth: 4 +titles_only: false +sticky_navigation: true +collapse_navigation: true diff --git a/mkdocs/themes/readthedocs/nav.html b/mkdocs/themes/readthedocs/nav.html index 6b6d7d8041..f66815a813 100644 --- a/mkdocs/themes/readthedocs/nav.html +++ b/mkdocs/themes/readthedocs/nav.html @@ -1,22 +1,22 @@ -{%- if nav_item.url %} - {{ nav_item.title }} -{%- else %} - {{ nav_item.title }} -{%- endif %} - -{%- if nav_item == page or nav_item.children %} - {%- endif %} +{%- set navlevel = navlevel - 1 %} diff --git a/mkdocs/themes/readthedocs/search.html b/mkdocs/themes/readthedocs/search.html index 19a7093eeb..705fcbeec8 100644 --- a/mkdocs/themes/readthedocs/search.html +++ b/mkdocs/themes/readthedocs/search.html @@ -1,16 +1,16 @@ -{% extends "base.html" %} +{% extends "main.html" %} {% block content %} -

Search Results

+

{% trans %}Search Results{% endtrans %}

-
- Searching... +
+ {% trans %}Searching...{% endtrans %}
{% endblock %} diff --git a/mkdocs/themes/readthedocs/searchbox.html b/mkdocs/themes/readthedocs/searchbox.html index 177fcb391f..cb7c4977d2 100644 --- a/mkdocs/themes/readthedocs/searchbox.html +++ b/mkdocs/themes/readthedocs/searchbox.html @@ -1,5 +1,5 @@
- +
diff --git a/mkdocs/themes/readthedocs/toc.html b/mkdocs/themes/readthedocs/toc.html index cecfbe4ff5..b00416c709 100644 --- a/mkdocs/themes/readthedocs/toc.html +++ b/mkdocs/themes/readthedocs/toc.html @@ -1,10 +1,12 @@ -{% for toc_item in page.toc %} - - {% if toc_item.children %} + +{%- for toc_item in toc_item.children %} + +{%- endfor %} diff --git a/mkdocs/themes/readthedocs/versions.html b/mkdocs/themes/readthedocs/versions.html index 8a0ecef74b..7596727c86 100644 --- a/mkdocs/themes/readthedocs/versions.html +++ b/mkdocs/themes/readthedocs/versions.html @@ -1,15 +1,23 @@ -
- - {% if config.repo_name == 'GitHub' %} - GitHub - {% elif config.repo_name == 'Bitbucket' %} - BitBucket - {% endif %} - {% if page.previous_page %} - « Previous - {% endif %} - {% if page.next_page %} - Next » - {% endif %} - +
+ + {% if config.repo_name == 'GitHub' %} + + GitHub + + {% elif config.repo_name == 'Bitbucket' %} + + BitBucket + + {% elif config.repo_name == 'GitLab' %} + + GitLab + + {% endif %} + {% if page.previous_page %} + « {% trans %}Previous{% endtrans %} + {% endif %} + {% if page.next_page %} + {% trans %}Next{% endtrans %} » + {% endif %} +
diff --git a/mkdocs/toc.py b/mkdocs/toc.py deleted file mode 100644 index e101efe2f8..0000000000 --- a/mkdocs/toc.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" -Deals with generating the per-page table of contents. - -For the sake of simplicity we use an existing markdown extension to generate -an HTML table of contents, and then parse that into the underlying data. - -The steps we take to generate a table of contents are: - -* Pre-process the markdown, injecting a [TOC] marker. -* Generate HTML from markdown. -* Post-process the HTML, spliting the content and the table of contents. -* Parse table of contents HTML into the underlying data structure. -""" - -from __future__ import unicode_literals - -try: # pragma: no cover - from html.parser import HTMLParser # noqa -except ImportError: # pragma: no cover - from HTMLParser import HTMLParser # noqa - - -class TableOfContents(object): - """ - Represents the table of contents for a given page. - """ - def __init__(self, html): - self.items = _parse_html_table_of_contents(html) - - def __iter__(self): - return iter(self.items) - - def __len__(self): - return len(self.items) - - def __str__(self): - return ''.join([str(item) for item in self]) - - -class AnchorLink(object): - """ - A single entry in the table of contents. - """ - def __init__(self, title, url): - self.title, self.url = title, url - self.children = [] - - def __str__(self): - return self.indent_print() - - def indent_print(self, depth=0): - indent = ' ' * depth - ret = '%s%s - %s\n' % (indent, self.title, self.url) - for item in self.children: - ret += item.indent_print(depth + 1) - return ret - - -class TOCParser(HTMLParser): - - def __init__(self): - HTMLParser.__init__(self) - self.links = [] - - self.in_anchor = False - self.attrs = None - self.title = '' - - # Prior to Python3.4 no convert_charrefs keyword existed. - # However, in Python3.5 the default was changed to True. - # We need the False behavior in all versions but can only - # set it if it exists. - if hasattr(self, 'convert_charrefs'): - self.convert_charrefs = False - - def handle_starttag(self, tag, attrs): - - if not self.in_anchor: - if tag == 'a': - self.in_anchor = True - self.attrs = dict(attrs) - - def handle_endtag(self, tag): - if tag == 'a': - self.in_anchor = False - - def handle_data(self, data): - - if self.in_anchor: - self.title += data - - def handle_charref(self, ref): - self.handle_entityref("#" + ref) - - def handle_entityref(self, ref): - self.handle_data("&%s;" % ref) - - -def _parse_html_table_of_contents(html): - """ - Given a table of contents string that has been automatically generated by - the markdown library, parse it into a tree of AnchorLink instances. - - Returns a list of all the parent AnchorLink instances. - """ - lines = html.splitlines()[2:-2] - parents = [] - ret = [] - for line in lines: - parser = TOCParser() - parser.feed(line) - if parser.title: - try: - href = parser.attrs['href'] - except KeyError: - continue - title = parser.title - nav = AnchorLink(title, href) - # Add the item to its parent if required. If it is a topmost - # item then instead append it to our return value. - if parents: - parents[-1].children.append(nav) - else: - ret.append(nav) - # If this item has children, store it as the current parent - if line.endswith('
    '): - parents.append(nav) - elif line.startswith('
'): - if parents: - parents.pop() - - # For the table of contents, always mark the first element as active - if ret: - ret[0].active = True - - return ret diff --git a/mkdocs/utils/__init__.py b/mkdocs/utils/__init__.py index a252beba8b..4a7b6e8ad3 100644 --- a/mkdocs/utils/__init__.py +++ b/mkdocs/utils/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Standalone file utils. @@ -7,55 +5,37 @@ and structure of the site and pages in the site. """ -from __future__ import unicode_literals import logging import os -import pkg_resources import shutil import re -import sys import yaml import fnmatch +import posixpath +import functools +import importlib_metadata +from collections import defaultdict +from datetime import datetime, timezone +from urllib.parse import urlsplit +from yaml_env_tag import construct_env_tag +from mergedeep import merge from mkdocs import exceptions -try: # pragma: no cover - from urllib.parse import urlparse, urlunparse, urljoin # noqa - from urllib.request import pathname2url # noqa - from collections import UserDict # noqa -except ImportError: # pragma: no cover - from urlparse import urlparse, urlunparse, urljoin # noqa - from urllib import pathname2url # noqa - from UserDict import UserDict # noqa - - -PY3 = sys.version_info[0] == 3 - -if PY3: # pragma: no cover - string_types = str, # noqa - text_type = str # noqa -else: # pragma: no cover - string_types = basestring, # noqa - text_type = unicode # noqa - log = logging.getLogger(__name__) +markdown_extensions = [ + '.markdown', + '.mdown', + '.mkdn', + '.mkd', + '.md' +] -def yaml_load(source, loader=yaml.Loader): - """ - Wrap PyYaml's loader so we can extend it to suit our needs. - - Load all strings as unicode. - http://stackoverflow.com/a/2967461/3609487 - """ - def construct_yaml_str(self, node): - """ - Override the default string handling function to always return - unicode objects. - """ - return self.construct_scalar(node) +def get_yaml_loader(loader=yaml.Loader): + """ Wrap PyYaml's loader so we can extend it to suit our needs. """ class Loader(loader): """ @@ -63,22 +43,28 @@ class Loader(loader): global loader unaltered. """ - # Attach our unicode constructor to our custom loader ensuring all strings - # will be unicode on translation. - Loader.add_constructor('tag:yaml.org,2002:str', construct_yaml_str) + # Attach Environment Variable constructor. + # See https://github.com/waylan/pyyaml-env-tag + Loader.add_constructor('!ENV', construct_env_tag) + + return Loader + - try: - return yaml.load(source, Loader) - finally: - # TODO: Remove this when external calls are properly cleaning up file - # objects. Some mkdocs internal calls, sometimes in test lib, will - # load configs with a file object but never close it. On some - # systems, if a delete action is performed on that file without Python - # closing that object, there will be an access error. This will - # process the file and close it as there should be no more use for the - # file once we process the yaml content. - if hasattr(source, 'close'): - source.close() +def yaml_load(source, loader=None): + """ Return dict of source YAML file using loader, recursively deep merging inherited parent. """ + Loader = loader or get_yaml_loader() + result = yaml.load(source, Loader=Loader) + if result is not None and 'INHERIT' in result: + relpath = result.pop('INHERIT') + abspath = os.path.normpath(os.path.join(os.path.dirname(source.name), relpath)) + if not os.path.exists(abspath): + raise exceptions.ConfigurationError( + f"Inherited config file '{relpath}' does not exist at '{abspath}'.") + log.debug(f"Loading inherited configuration file: {abspath}") + with open(abspath, 'rb') as fd: + parent = yaml_load(fd, Loader) + result = merge(parent, result) + return result def modified_time(file_path): @@ -92,6 +78,44 @@ def modified_time(file_path): return 0.0 +def get_build_timestamp(): + """ + Returns the number of seconds since the epoch. + + Support SOURCE_DATE_EPOCH environment variable for reproducible builds. + See https://reproducible-builds.org/specs/source-date-epoch/ + """ + source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH') + if source_date_epoch is None: + return int(datetime.now(timezone.utc).timestamp()) + + return int(source_date_epoch) + + +def get_build_datetime(): + """ + Returns an aware datetime object. + + Support SOURCE_DATE_EPOCH environment variable for reproducible builds. + See https://reproducible-builds.org/specs/source-date-epoch/ + """ + source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH') + if source_date_epoch is None: + return datetime.now(timezone.utc) + + return datetime.fromtimestamp(int(source_date_epoch), timezone.utc) + + +def get_build_date(): + """ + Returns the displayable date string. + + Support SOURCE_DATE_EPOCH environment variable for reproducible builds. + See https://reproducible-builds.org/specs/source-date-epoch/ + """ + return get_build_datetime().strftime('%Y-%m-%d') + + def reduce_list(data_set): """ Reduce duplicate items in a list and preserve order """ seen = set() @@ -106,8 +130,7 @@ def copy_file(source_path, output_path): The output_path may be a directory. """ output_dir = os.path.dirname(output_path) - if not os.path.exists(output_dir): - os.makedirs(output_dir) + os.makedirs(output_dir, exist_ok=True) if os.path.isdir(output_path): output_path = os.path.join(output_path, os.path.basename(source_path)) shutil.copyfile(source_path, output_path) @@ -118,8 +141,7 @@ def write_file(content, output_path): Write content to output_path, making sure any parent directories exist. """ output_dir = os.path.dirname(output_path) - if not os.path.exists(output_dir): - os.makedirs(output_dir) + os.makedirs(output_dir, exist_ok=True) with open(output_path, 'wb') as f: f.write(content) @@ -145,40 +167,6 @@ def clean_directory(directory): os.unlink(path) -def copy_media_files(from_dir, to_dir, exclude=None, dirty=False): - """ - Recursively copy all files except markdown and exclude[ed] files into another directory. - - `exclude` accepts a list of Unix shell-style wildcards (`['*.py', '*.pyc']`). - Note that `exclude` only operates on file names, not directories. - """ - for (source_dir, dirnames, filenames) in os.walk(from_dir, followlinks=True): - relative_path = os.path.relpath(source_dir, from_dir) - output_dir = os.path.normpath(os.path.join(to_dir, relative_path)) - - # Filter file names using Unix pattern matching - # Always filter file names starting with a '.' - exclude_patterns = ['.*'] - exclude_patterns.extend(exclude or []) - for pattern in exclude_patterns: - filenames = [f for f in filenames if not fnmatch.fnmatch(f, pattern)] - - # Filter the dirnames that start with a '.' and update the list in - # place to prevent us walking these. - dirnames[:] = [d for d in dirnames if not d.startswith('.')] - - for filename in filenames: - if not is_markdown_file(filename): - source_path = os.path.join(source_dir, filename) - output_path = os.path.join(output_dir, filename) - - # Do not copy when using --dirty if the file has not been modified - if dirty and (modified_time(source_path) < modified_time(output_path)): - continue - - copy_file(source_path, output_path) - - def get_html_path(path): """ Map a source file path to an output html path. @@ -211,45 +199,13 @@ def get_url_path(path, use_directory_urls=True): return url -def is_homepage(path): - return os.path.splitext(path)[0] == 'index' - - def is_markdown_file(path): """ Return True if the given file path is a Markdown file. - http://superuser.com/questions/249436/file-extension-for-markdown-files - """ - ext = os.path.splitext(path)[1].lower() - return ext in [ - '.markdown', - '.mdown', - '.mkdn', - '.mkd', - '.md', - ] - - -def is_css_file(path): + https://superuser.com/questions/249436/file-extension-for-markdown-files """ - Return True if the given file path is a CSS file. - """ - ext = os.path.splitext(path)[1].lower() - return ext in [ - '.css', - ] - - -def is_javascript_file(path): - """ - Return True if the given file path is a Javascript file. - """ - ext = os.path.splitext(path)[1].lower() - return ext in [ - '.js', - '.javascript' - ] + return any(fnmatch.fnmatch(path.lower(), f'*{x}') for x in markdown_extensions) def is_html_file(path): @@ -285,85 +241,73 @@ def is_error_template(path): return bool(_ERROR_TEMPLATE_RE.match(path)) -def create_media_urls(nav, path_list): - """ - Return a list of URLs that have been processed correctly for inclusion in - a page. - """ - final_urls = [] - - for path in path_list: - # Allow links to fully qualified URL's - parsed = urlparse(path) - if parsed.netloc: - final_urls.append(path) - continue - # We must be looking at a local path. - url = path_to_url(path) - relative_url = '%s/%s' % (nav.url_context.make_relative('/').rstrip('/'), url) - final_urls.append(relative_url) - - return final_urls +@functools.lru_cache(maxsize=None) +def _norm_parts(path): + if not path.startswith('/'): + path = '/' + path + path = posixpath.normpath(path)[1:] + return path.split('/') if path else [] -def create_relative_media_url(nav, url): +def get_relative_url(url, other): """ - For a current page, create a relative url based on the given URL. - - On index.md (which becomes /index.html): - image.png -> ./image.png - /image.png -> ./image.png + Return given url relative to other. - On sub/page.md (which becomes /sub/page/index.html): - image.png -> ../image.png - /image.png -> ../../image.png + Both are operated as slash-separated paths, similarly to the 'path' part of a URL. + The last component of `other` is skipped if it contains a dot (considered a file). + Actual URLs (with schemas etc.) aren't supported. The leading slash is ignored. + Paths are normalized ('..' works as parent directory), but going higher than the + root has no effect ('foo/../../bar' ends up just as 'bar'). + """ + # Remove filename from other url if it has one. + dirname, _, basename = other.rpartition('/') + if '.' in basename: + other = dirname - On sub/index.md (which becomes /sub/index.html): - image.png -> ./image.png - /image.png -> ./image.png + other_parts = _norm_parts(other) + dest_parts = _norm_parts(url) + common = 0 + for a, b in zip(other_parts, dest_parts): + if a != b: + break + common += 1 - """ + rel_parts = ['..'] * (len(other_parts) - common) + dest_parts[common:] + relurl = '/'.join(rel_parts) or '.' + return relurl + '/' if url.endswith('/') else relurl - # Allow links to fully qualified URL's - parsed = urlparse(url) - if parsed.netloc: - return url - # If the URL we are looking at starts with a /, then it should be - # considered as absolute and will be 'relative' to the root. - if url.startswith('/'): - base = '/' - url = url[1:] - else: - base = nav.url_context.base_path +def normalize_url(path, page=None, base=''): + """ Return a URL relative to the given page or using the base. """ + path, is_abs = _get_norm_url(path) + if is_abs: + return path + if page is not None: + return get_relative_url(path, page.url) + return posixpath.join(base, path) - relative_base = nav.url_context.make_relative(base) - if relative_base == "." and url.startswith("./"): - relative_url = url - else: - relative_url = '%s/%s' % (relative_base, url) - # TODO: Fix this, this is a hack. Relative urls are not being calculated - # correctly for images in the same directory as the markdown. I think this - # is due to us moving it into a directory with index.html, but I'm not sure - # win32 platform uses backslash "\". eg. "\level1\level2" - notindex = re.match(r'.*(?:\\|/)index.md$', nav.file_context.current_file) is None +@functools.lru_cache(maxsize=None) +def _get_norm_url(path): + path = path_to_url(path or '.') + # Allow links to be fully qualified URLs + parsed = urlsplit(path) + if parsed.scheme or parsed.netloc or path.startswith(('/', '#')): + return path, True + return path, False - if notindex and nav.url_context.base_path != '/' and relative_url.startswith("./"): - relative_url = ".%s" % relative_url - return relative_url +def create_media_urls(path_list, page=None, base=''): + """ + Return a list of URLs relative to the given page or using the base. + """ + return [normalize_url(path, page, base) for path in path_list] def path_to_url(path): """Convert a system path to a URL.""" - if os.path.sep == '/': - return path - - if sys.version_info < (3, 0): - path = path.encode('utf8') - return pathname2url(path) + return '/'.join(path.split('\\')) def get_theme_dir(name): @@ -374,23 +318,24 @@ def get_theme_dir(name): def get_themes(): - """ Return a dict of all installed themes as (name, entry point) pairs. """ + """ Return a dict of all installed themes as {name: EntryPoint}. """ themes = {} - builtins = pkg_resources.get_entry_map(dist='mkdocs', group='mkdocs.themes') + eps = set(importlib_metadata.entry_points(group='mkdocs.themes')) + builtins = {ep.name for ep in eps if ep.dist.name == 'mkdocs'} - for theme in pkg_resources.iter_entry_points(group='mkdocs.themes'): + for theme in eps: - if theme.name in builtins and theme.dist.key != 'mkdocs': + if theme.name in builtins and theme.dist.name != 'mkdocs': raise exceptions.ConfigurationError( - "The theme {0} is a builtin theme but {1} provides a theme " - "with the same name".format(theme.name, theme.dist.key)) - + f"The theme '{theme.name}' is a builtin theme but the package '{theme.dist.name}' " + "attempts to provide a theme with the same name." + ) elif theme.name in themes: - multiple_packages = [themes[theme.name].dist.key, theme.dist.key] - log.warning("The theme %s is provided by the Python packages " - "'%s'. The one in %s will be used.", - theme.name, ','.join(multiple_packages), theme.dist.key) + log.warning( + f"A theme named '{theme.name}' is provided by the Python packages '{theme.dist.name}' " + f"and '{themes[theme.name].dist.name}'. The one in '{theme.dist.name}' will be used." + ) themes[theme.name] = theme @@ -403,19 +348,8 @@ def get_theme_names(): return get_themes().keys() -def filename_to_title(filename): - - title = os.path.splitext(filename)[0] - title = title.replace('-', ' ').replace('_', ' ') - # Capitalize if the filename was all lowercase, otherwise leave it as-is. - if title.lower() == title: - title = title.capitalize() - - return title - - def dirname_to_title(dirname): - + """ Return a page tile obtained from a directory name. """ title = dirname title = title.replace('-', ' ').replace('_', ' ') # Capitalize if the dirname was all lowercase, otherwise leave it as-is. @@ -426,22 +360,22 @@ def dirname_to_title(dirname): def get_markdown_title(markdown_src): - """ - Get the title of a Markdown document. The title in this case is considered - to be a H1 that occurs before any other content in the document. - The procedure is then to iterate through the lines, stopping at the first - non-whitespace content. If it is a title, return that, otherwise return - None. - """ + """ + Get the title of a Markdown document. The title in this case is considered + to be a H1 that occurs before any other content in the document. + The procedure is then to iterate through the lines, stopping at the first + non-whitespace content. If it is a title, return that, otherwise return + None. + """ - lines = markdown_src.replace('\r\n', '\n').replace('\r', '\n').split('\n') - while lines: - line = lines.pop(0).strip() - if not line.strip(): - continue - if not line.startswith('# '): - return - return line.lstrip('# ') + lines = markdown_src.replace('\r\n', '\n').replace('\r', '\n').split('\n') + while lines: + line = lines.pop(0).strip() + if not line.strip(): + continue + if not line.startswith('# '): + return + return line.lstrip('# ') def find_or_create_node(branch, key): @@ -488,3 +422,27 @@ def nest_paths(paths): branch.append(path) return nested + + +class CountHandler(logging.NullHandler): + """ Counts all logged messages >= level. """ + + def __init__(self, **kwargs): + self.counts = defaultdict(int) + super().__init__(**kwargs) + + def handle(self, record): + rv = self.filter(record) + if rv: + # Use levelno for keys so they can be sorted later + self.counts[record.levelno] += 1 + return rv + + def get_counts(self): + return [(logging.getLevelName(k), v) for k, v in sorted(self.counts.items(), reverse=True)] + + +# For backward compatibility as some plugins import it. +# It is no longer necessary as all messages on the +# `mkdocs` logger get counted automatically. +warning_filter = logging.Filter() diff --git a/mkdocs/utils/babel_stub.py b/mkdocs/utils/babel_stub.py new file mode 100644 index 0000000000..7f355a78ca --- /dev/null +++ b/mkdocs/utils/babel_stub.py @@ -0,0 +1,27 @@ +from typing import NamedTuple +from string import ascii_letters + + +class UnknownLocaleError(Exception): + pass + + +class Locale(NamedTuple): + language: str + territory: str = '' + + def __str__(self): + if self.territory: + return f'{self.language}_{self.territory}' + return self.language + + @classmethod + def parse(cls, identifier, sep): + if not isinstance(identifier, str): + raise TypeError(f"Unexpected value for identifier: '{identifier}'") + locale = cls(*identifier.split(sep, 1)) + if not all(x in ascii_letters for x in locale.language): + raise ValueError(f"expected only letters, got '{locale.language}'") + if len(locale.language) != 2: + raise UnknownLocaleError(f"unknown locale '{locale.language}'") + return locale diff --git a/mkdocs/utils/filters.py b/mkdocs/utils/filters.py index 4a26c8d1c7..e7fb163e4f 100644 --- a/mkdocs/utils/filters.py +++ b/mkdocs/utils/filters.py @@ -1,6 +1,16 @@ import json + import jinja2 +import markupsafe + +from mkdocs.utils import normalize_url def tojson(obj, **kwargs): - return jinja2.Markup(json.dumps(obj, **kwargs)) + return markupsafe.Markup(json.dumps(obj, **kwargs)) + + +@jinja2.contextfilter +def url_filter(context, value): + """ A Template filter to normalize URLs. """ + return normalize_url(value, page=context['page'], base=context['base_url']) diff --git a/mkdocs/utils/ghp_import.py b/mkdocs/utils/ghp_import.py deleted file mode 100644 index 62ef8c5cb6..0000000000 --- a/mkdocs/utils/ghp_import.py +++ /dev/null @@ -1,180 +0,0 @@ -#! /usr/bin/env python -# -# This file is part of the ghp-import package released under -# the Tumbolia Public License. - -# Tumbolia Public License - -# Copyright 2013, Paul Davis - -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice and this -# notice are preserved. - -# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -# 0. opan saurce LOL - -from __future__ import unicode_literals - -import errno -import logging -import os -import subprocess as sp -import sys -import time -import unicodedata - -log = logging.getLogger(__name__) - - -if sys.version_info[0] == 3: - def enc(text): - if isinstance(text, bytes): - return text - return text.encode() - - def dec(text): - if isinstance(text, bytes): - return text.decode('utf-8') - return text - - def write(pipe, data): - try: - pipe.stdin.write(data) - except IOError as e: - if e.errno != errno.EPIPE: - raise -else: - def enc(text): - if isinstance(text, unicode): - return text.encode('utf-8') - return text - - def dec(text): - if isinstance(text, unicode): - return text - return text.decode('utf-8') - - def write(pipe, data): - pipe.stdin.write(data) - - -def normalize_path(path): - # Fix unicode pathnames on OS X - # See: http://stackoverflow.com/a/5582439/44289 - if sys.platform == "darwin": - return unicodedata.normalize("NFKC", dec(path)) - return path - - -def try_rebase(remote, branch): - cmd = ['git', 'rev-list', '--max-count=1', '%s/%s' % (remote, branch)] - p = sp.Popen(cmd, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) - (rev, _) = p.communicate() - if p.wait() != 0: - return True - cmd = ['git', 'update-ref', 'refs/heads/%s' % branch, dec(rev.strip())] - if sp.call(cmd) != 0: - return False - return True - - -def get_config(key): - p = sp.Popen(['git', 'config', key], stdin=sp.PIPE, stdout=sp.PIPE) - (value, _) = p.communicate() - return value.decode('utf-8').strip() - - -def get_prev_commit(branch): - cmd = ['git', 'rev-list', '--max-count=1', branch, '--'] - p = sp.Popen(cmd, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) - (rev, _) = p.communicate() - if p.wait() != 0: - return None - return rev.decode('utf-8').strip() - - -def mk_when(timestamp=None): - if timestamp is None: - timestamp = int(time.time()) - currtz = "%+05d" % (-1 * time.timezone / 36) # / 3600 * 100 - return "%s %s" % (timestamp, currtz) - - -def start_commit(pipe, branch, message): - uname = dec(get_config("user.name")) - email = dec(get_config("user.email")) - write(pipe, enc('commit refs/heads/%s\n' % branch)) - write(pipe, enc('committer %s <%s> %s\n' % (uname, email, mk_when()))) - write(pipe, enc('data %d\n%s\n' % (len(message), message))) - head = get_prev_commit(branch) - if head: - write(pipe, enc('from %s\n' % head)) - write(pipe, enc('deleteall\n')) - - -def add_file(pipe, srcpath, tgtpath): - with open(srcpath, "rb") as handle: - if os.access(srcpath, os.X_OK): - write(pipe, enc('M 100755 inline %s\n' % tgtpath)) - else: - write(pipe, enc('M 100644 inline %s\n' % tgtpath)) - data = handle.read() - write(pipe, enc('data %d\n' % len(data))) - write(pipe, enc(data)) - write(pipe, enc('\n')) - - -def add_nojekyll(pipe): - write(pipe, enc('M 100644 inline .nojekyll\n')) - write(pipe, enc('data 0\n')) - write(pipe, enc('\n')) - - -def gitpath(fname): - norm = os.path.normpath(fname) - return "/".join(norm.split(os.path.sep)) - - -def run_import(srcdir, branch, message, nojekyll): - cmd = ['git', 'fast-import', '--date-format=raw', '--quiet'] - kwargs = {"stdin": sp.PIPE} - if sys.version_info >= (3, 2, 0): - kwargs["universal_newlines"] = False - pipe = sp.Popen(cmd, **kwargs) - start_commit(pipe, branch, message) - for path, _, fnames in os.walk(srcdir): - for fn in fnames: - fpath = os.path.join(path, fn) - fpath = normalize_path(fpath) - gpath = gitpath(os.path.relpath(fpath, start=srcdir)) - add_file(pipe, fpath, gpath) - if nojekyll: - add_nojekyll(pipe) - write(pipe, enc('\n')) - pipe.stdin.close() - if pipe.wait() != 0: - sys.stdout.write(enc("Failed to process commit.\n")) - - -def ghp_import(directory, message, remote='origin', branch='gh-pages', force=False): - - if not try_rebase(remote, branch): - log.error("Failed to rebase %s branch.", branch) - - nojekyll = True - - run_import(directory, branch, message, nojekyll) - - cmd = ['git', 'push', remote, branch] - - if force: - cmd.insert(2, '--force') - - proc = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE) - - out, err = proc.communicate() - result = proc.wait() == 0 - - return result, dec(err) diff --git a/mkdocs/utils/meta.py b/mkdocs/utils/meta.py index b976d9af38..c503dac800 100644 --- a/mkdocs/utils/meta.py +++ b/mkdocs/utils/meta.py @@ -35,142 +35,65 @@ import re - - -##################################################################### -# Transformer Collection # -##################################################################### - -class TransformerCollection(object): - """ - A collecton of transformers. - - A transformer is a callable that accepts a single argument (the value to be transformed) - and returns a transformed value. - """ - - def __init__(self, items=None, default=None): - """ - Create a transformer collection. - - `items`: A dictionary which points to a transformer for each key (optional). - - `default`: The default transformer (optional). If no default is provided, - then the values of unknown keys are returned unaltered. - """ - - self._registery = items or {} - self.default = default or (lambda v: v) - - def register(self, key=None): - """ - Decorator which registers a transformer for the given key. - - If no key is provided, a "default" transformer is registered. - """ - - def wrap(fn): - if key: - self._registery[key] = fn - else: - self.default = fn - return fn - return wrap - - def transform(self, key, value): - """ - Calls the transformer for the given key and returns the transformed value. - """ - - if key in self._registery: - return self._registery[key](value) - return self.default(value) - - def transform_dict(self, data): - """ - Calls the transformer for each item in a dictionary and returns a new dictionary. - """ - - newdata = {} - for k, v in data.items(): - newdata[k] = self.transform(k, v) - return newdata - - -# The global default transformer collection. -tc = TransformerCollection() - - -def transformer(key=None): - """ - Decorator which registers a transformer for the given key. - - If no key is provided, a "default" transformer is registered. - """ - - def wrap(fn): - tc.register(key)(fn) - return fn - return wrap - +import yaml +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: # pragma: no cover + from yaml import SafeLoader ##################################################################### # Data Parser # ##################################################################### - -BEGIN_RE = re.compile(r'^-{3}(\s.*)?') +YAML_RE = re.compile(r'^-{3}[ \t]*\n(.*?\n)(?:\.{3}|-{3})[ \t]*\n', re.UNICODE | re.DOTALL) META_RE = re.compile(r'^[ ]{0,3}(?P[A-Za-z0-9_-]+):\s*(?P.*)') META_MORE_RE = re.compile(r'^([ ]{4}|\t)(\s*)(?P.*)') -END_RE = re.compile(r'^(-{3}|\.{3})(\s.*)?') -def get_raw_data(doc): +def get_data(doc): """ - Extract raw meta-data from a text document. + Extract meta-data from a text document. Returns a tuple of document and a data dict. """ + data = {} - lines = doc.replace('\r\n', '\n').replace('\r', '\n').split('\n') + # First try YAML + m = YAML_RE.match(doc) + if m: + try: + data = yaml.load(m.group(1), SafeLoader) + if isinstance(data, dict): + doc = doc[m.end():].lstrip('\n') + else: + data = {} + except Exception: + pass + return doc, data - if lines and BEGIN_RE.match(lines[0]): - lines.pop(0) + # No YAML deliminators. Try MultiMarkdown style + lines = doc.replace('\r\n', '\n').replace('\r', '\n').split('\n') - data = {} key = None while lines: line = lines.pop(0) - if line.strip() == '' or END_RE.match(line): - break # blank line or end deliminator - done + if line.strip() == '': + break # blank line - done m1 = META_RE.match(line) if m1: key = m1.group('key').lower().strip() value = m1.group('value').strip() - try: - data[key].append(value) - except KeyError: - data[key] = [value] + if key in data: + data[key] += f' {value}' + else: + data[key] = value else: m2 = META_MORE_RE.match(line) if m2 and key: # Add another line to existing key - data[key].append(m2.group('value').strip()) + data[key] += ' {}'.format(m2.group('value').strip()) else: lines.insert(0, line) break # no meta data - done return '\n'.join(lines).lstrip('\n'), data - - -def get_data(doc, transformers=tc): - """ - Extract meta-data from a text document. - - `transformers`: A TransformerCollection used to transform data values. - - Returns a tuple of document and a (transformed) data dict. - """ - - doc, rawdata = get_raw_data(doc) - return doc, transformers.transform_dict(rawdata) diff --git a/readthedocs.yml b/readthedocs.yml new file mode 100644 index 0000000000..ae64ca7f56 --- /dev/null +++ b/readthedocs.yml @@ -0,0 +1,7 @@ +build: + image: latest + +python: + setup_py_install: true + +requirements_file: requirements/project.txt diff --git a/requirements/packaging.txt b/requirements/packaging.txt index 76d275df38..acd60daba1 100644 --- a/requirements/packaging.txt +++ b/requirements/packaging.txt @@ -4,3 +4,5 @@ wheel==0.24.0 # Twine for secured PyPI uploads. twine==1.5.0 +# Babel for messages.po localization compilation +babel==2.9.0 diff --git a/requirements/project-min.txt b/requirements/project-min.txt index 6b0262e0d1..20a9327df0 100644 --- a/requirements/project-min.txt +++ b/requirements/project-min.txt @@ -1,6 +1,15 @@ +babel==2.9.0 click==3.3 -Jinja2==2.7.1 -livereload==2.5.1 -Markdown==2.5 -PyYAML==3.10 -tornado==4.1 +Jinja2==2.10.1 +MarkupSafe==0.23 +Markdown==3.2.1 +PyYAML==5.1 +watchdog==2.0.0 +mdx_gh_links==0.2 +ghp-import==1.0 +pyyaml_env_tag==0.1 +mkdocs-redirects==1.0.1 +importlib_metadata==3.10.0 +packaging==20.5 +mergedeep==1.3.4 +colorama==0.4; platform_system == 'Windows' diff --git a/requirements/project.txt b/requirements/project.txt index bc2ab3c5c6..c8fd11335c 100644 --- a/requirements/project.txt +++ b/requirements/project.txt @@ -1,6 +1,15 @@ -click>=3.3 -Jinja2>=2.7.1 -livereload>=2.5.1 -Markdown>=2.5 -PyYAML>=3.10 -tornado>=4.1 +babel>=2.9.0 +click>=7.0 +Jinja2>=2.10.3 +MarkupSafe>=0.23 +Markdown>=3.2.1 +PyYAML>=5.2 +watchdog>=2.0.0 +mdx_gh_links>=0.2 +ghp-import>=1.0 +pyyaml_env_tag>=0.1 +mkdocs-redirects>=1.0.1 +importlib_metadata>=3.10 +packaging>=20.5 +mergedeep>=1.3.4 +colorama>=0.4; platform_system == 'Windows' diff --git a/requirements/test.txt b/requirements/test.txt index d9425c034f..9c4e8691db 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,2 @@ coverage flake8 -nose -mock diff --git a/setup.cfg b/setup.cfg index 5e4090017a..1e6ff98121 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,21 @@ -[wheel] -universal = 1 +[metadata] +license_file = LICENSE + +[compile_catalog] +statistics = True +domain = messages + +[extract_messages] +copyright_holder = MkDocs +domain = messages +msgid_bugs_address = "https://github.com/mkdocs/mkdocs/issues" +project = MkDocs +no_wrap = True + +[init_catalog] +domain = messages + +[update_catalog] +ignore_obsolete = True +update_header_comment = True +domain = messages diff --git a/setup.py b/setup.py index f50951e667..b9834e5151 100755 --- a/setup.py +++ b/setup.py @@ -1,19 +1,14 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- -from __future__ import print_function from setuptools import setup import re import os import sys +from mkdocs.commands.setup import babel_cmdclass -long_description = ( - "MkDocs is a fast, simple and downright gorgeous static site generator " - "that's geared towards building project documentation. Documentation " - "source files are written in Markdown, and configured with a single YAML " - "configuration file." -) +with open('README.md') as f: + long_description = f.read() def get_version(package): @@ -36,6 +31,12 @@ def get_packages(package): if os.system("pip freeze | grep twine"): print("twine not installed.\nUse `pip install twine`.\nExiting.") sys.exit() + if os.system("pip freeze | grep Babel"): + print("babel not installed.\nUse `pip install babel`.\nExiting.") + sys.exit() + for locale in os.listdir("mkdocs/themes/mkdocs/locales"): + os.system(f"python setup.py compile_catalog -t mkdocs -l {locale}") + os.system(f"python setup.py compile_catalog -t readthedocs -l {locale}") os.system("python setup.py sdist bdist_wheel") os.system("twine upload dist/*") print("You probably want to also tag the version now:") @@ -47,22 +48,29 @@ def get_packages(package): setup( name="mkdocs", version=get_version("mkdocs"), - url='http://www.mkdocs.org', + url='https://www.mkdocs.org', license='BSD', description='Project documentation with Markdown.', long_description=long_description, + long_description_content_type='text/markdown', author='Tom Christie', author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) packages=get_packages("mkdocs"), include_package_data=True, install_requires=[ 'click>=3.3', - 'Jinja2>=2.7.1', - 'livereload>=2.5.1', - 'Markdown>=2.3.1', + 'Jinja2>=2.10.1', + 'Markdown>=3.2.1', 'PyYAML>=3.10', - 'tornado>=4.1', + 'watchdog>=2.0', + 'ghp-import>=1.0', + 'pyyaml_env_tag>=0.1', + 'importlib_metadata>=3.10', + 'packaging>=20.5', + 'mergedeep>=1.3.4' ], + extras_require={"i18n": ['babel>=2.9.0']}, + python_requires='>=3.6', entry_points={ 'console_scripts': [ 'mkdocs = mkdocs.__main__:cli', @@ -72,7 +80,7 @@ def get_packages(package): 'readthedocs = mkdocs.themes.readthedocs', ], 'mkdocs.plugins': [ - 'search = mkdocs.contrib.legacy_search:SearchPlugin', + 'search = mkdocs.contrib.search:SearchPlugin', ], }, classifiers=[ @@ -83,19 +91,19 @@ def get_packages(package): 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3 :: Only', "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", 'Topic :: Documentation', 'Topic :: Text Processing', ], zip_safe=False, + cmdclass=babel_cmdclass, ) # (*) Please direct queries to the discussion group: diff --git a/tox.ini b/tox.ini index 3f0dea3229..ad890b636a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,33 +1,45 @@ [tox] envlist = - py{27,33,34,35,36}-{unittests,integration,min-req}, - flake8, markdown-lint, linkchecker, jshint, csslint + py{36,37,38,39,py3}-{unittests,min-req,integration,integration-no-babel}, + flake8, markdown-lint, linkchecker, jshint, csslint, nobabel, codespell [testenv] passenv = LANG deps= - py{27,33,34,35,36,py,py3}-{unittests,integration}: -rrequirements/project.txt - py{27,33,34,35,36,py,py3}-min-req: -rrequirements/project-min.txt - py{27,33,34,35,36,py,py3}-{unittests,min-req}: -rrequirements/test.txt + py{36,37,38,39,py3}-{unittests,integration}: -rrequirements/project.txt + py{36,37,38,39,py3}-min-req: -rrequirements/project-min.txt + py{36,37,38,39,py3}-{unittests,min-req}: -rrequirements/test.txt commands= {envpython} --version - py{27,33,34,35,36,py,py3}-{unittests,min-req}: {envbindir}/nosetests --with-coverage --cover-package mkdocs mkdocs - py{27,33,34,35,36,py,py3}-integration: {envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds + py{36,37,38,39,py3}-{unittests,min-req}: {envbindir}/coverage run --source=mkdocs --omit 'mkdocs/tests/*' -m unittest discover -p '*tests.py' mkdocs + py{36,37,38,39,py3}-unittests: {envbindir}/coverage xml + py{36,37,38,39,py3}-unittests: {envbindir}/coverage report --show-missing + py{36,37,38,39,py3}-integration: {envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds [testenv:flake8] -basepython = python2.7 deps=-rrequirements/test.txt -commands={envbindir}/flake8 mkdocs --max-line-length=119 --exclude=mkdocs/compat.py +commands={envbindir}/flake8 mkdocs --max-line-length=119 [testenv:markdown-lint] -whitelist_externals = mdl +whitelist_externals= + node + markdownlint passenv = * -commands=mdl --style mdl_ruleset.rb README.md CONTRIBUTING.md docs/ +commands= + node --version + markdownlint --version + markdownlint README.md CONTRIBUTING.md docs/ --ignore docs/CNAME + +[testenv:codespell] +deps=codespell +commands= + {envbindir}/codespell mkdocs docs *.* -S .tox -S LC_MESSAGES -S '*.min.js' -S 'lunr*.js' -S fontawesome-webfont.svg -S tinyseg.js [testenv:linkchecker] basepython = python2.7 passenv=* deps= + mdx_gh_links requests<=2.9.0 LinkChecker commands= @@ -43,3 +55,10 @@ commands=jshint mkdocs/ whitelist_externals = csslint passenv=* commands=csslint mkdocs/ + +[testenv:py{36,37,38,39,py3}-integration-no-babel] +passenv = LANG +deps=-rrequirements/project.txt +commands= + pip uninstall -y babel + {envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds