├── .checkignore ├── .coveragerc ├── .git-blame-ignore-revs ├── .github └── workflows │ ├── pypi-publish.yml │ └── tests.yml ├── .gitignore ├── .lgtm ├── AUTHORS.rst ├── CHANGES.rst ├── CONTRIBUTING.rst ├── LICENSE ├── MAINTAINERS ├── MANIFEST.in ├── README.rst ├── RELEASE-NOTES.rst ├── docs ├── Makefile ├── _templates │ └── sidebarintro.html ├── conf.py ├── index.rst └── requirements.txt ├── flask_breadcrumbs └── __init__.py ├── pyproject.toml ├── requirements-devel.txt ├── run-tests.sh ├── setup.cfg ├── setup.py ├── tests └── test_core.py └── tox.ini /.checkignore: -------------------------------------------------------------------------------- 1 | setup.py 2 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = flask_breadcrumbs 3 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | c30354ce5899bd6b78741e0caaef040caf128ded 2 | -------------------------------------------------------------------------------- /.github/workflows/pypi-publish.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Invenio. 4 | # Copyright (C) 2020 CERN. 5 | # 6 | # Invenio is free software; you can redistribute it and/or modify it 7 | # under the terms of the MIT License; see LICENSE file for more details 8 | 9 | name: Publish 10 | 11 | on: 12 | push: 13 | tags: 14 | - v* 15 | 16 | jobs: 17 | Publish: 18 | runs-on: ubuntu-20.04 19 | 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v2 23 | 24 | - name: Set up Python 25 | uses: actions/setup-python@v2 26 | with: 27 | python-version: 3.8 28 | 29 | - name: Install dependencies 30 | run: | 31 | python -m pip install --upgrade pip 32 | pip install setuptools wheel babel 33 | 34 | - name: Build package 35 | run: python setup.py compile_catalog sdist bdist_wheel 36 | 37 | - name: Publish on PyPI 38 | uses: pypa/gh-action-pypi-publish@v1.3.1 39 | with: 40 | user: __token__ 41 | # The token is provided by the inveniosoftware organization 42 | password: ${{ secrets.pypi_token }} 43 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Invenio. 4 | # Copyright (C) 2020 CERN. 5 | # Copyright (C) 2022 Graz University of Technology. 6 | # 7 | # Invenio is free software; you can redistribute it and/or modify it 8 | # under the terms of the MIT License; see LICENSE file for more details. 9 | 10 | name: CI 11 | 12 | on: 13 | push: 14 | branches: master 15 | pull_request: 16 | branches: master 17 | schedule: 18 | # * is a special character in YAML so you have to quote this string 19 | - cron: '0 3 * * 6' 20 | workflow_dispatch: 21 | inputs: 22 | reason: 23 | description: 'Reason' 24 | required: false 25 | default: 'Manual trigger' 26 | 27 | jobs: 28 | Tests: 29 | runs-on: ubuntu-20.04 30 | strategy: 31 | matrix: 32 | python-version: [3.7, 3.8, 3.9] 33 | requirements-level: [pypi] 34 | 35 | env: 36 | EXTRAS: tests 37 | steps: 38 | - name: Checkout 39 | uses: actions/checkout@v2 40 | 41 | - name: Set up Python ${{ matrix.python-version }} 42 | uses: actions/setup-python@v2 43 | with: 44 | python-version: ${{ matrix.python-version }} 45 | 46 | - name: Generate dependencies 47 | run: | 48 | pip install wheel requirements-builder 49 | requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt 50 | 51 | - name: Cache pip 52 | uses: actions/cache@v2 53 | with: 54 | path: ~/.cache/pip 55 | key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }} 56 | 57 | - name: Install dependencies 58 | run: | 59 | pip install -r .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt 60 | pip install .[$EXTRAS] 61 | pip freeze 62 | 63 | - name: Run tests 64 | run: | 65 | ./run-tests.sh 66 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # Idea software family 6 | .idea/ 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *,cover 48 | 49 | # Translations 50 | *.mo 51 | 52 | # Django stuff: 53 | *.log 54 | 55 | # Sphinx documentation 56 | docs/_build/ 57 | 58 | # PyBuilder 59 | target/ 60 | 61 | # Vim swapfiles 62 | .*.sw? 63 | -------------------------------------------------------------------------------- /.lgtm: -------------------------------------------------------------------------------- 1 | approvals = 1 2 | pattern = "(?i)LGTM" 3 | self_approval_off = false 4 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | Flask-Breadcrumbs is developed for use in 5 | `Invenio `_ digital library software. 6 | 7 | Contact us at `info@inveniosoftware.org `_ 8 | 9 | * Krzysztof Lis 10 | * Jiri Kuncar 11 | * Tibor Simko 12 | * Pierre Lucas 13 | * Joshua Arnott 14 | * Florian Merges 15 | * Nicholas Rutherford 16 | * Tianhui Michael Li <> 17 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | Here you can see the full list of changes between each Flask-Breadcrumbs 5 | release. 6 | 7 | Version 0.5.1 (released 2020-05-06) 8 | 9 | - Deprecated Python versions lower than 3.6.0. Now supporting 3.6.0 and 3.7.0 10 | - Stop using example app 11 | 12 | Version 0.5.0 (released 2020-03-10) 13 | 14 | - Removes support for Python 2.7 15 | - Updates Flask dependency 16 | 17 | Version 0.4.0 (released 2016-07-01) 18 | 19 | - Removes support for Python 2.6. 20 | - Adds an advanced example using MethodViews and Blueprints. (#23) 21 | - Amends deprecated import of Flask extensions via `flask.ext`. (#29) 22 | 23 | Version 0.3.0 (released 2015-03-16) 24 | 25 | - Improved factory pattern support. (#19) 26 | - Added example of using a dynamic list constructor with variables. 27 | (#16 #17) 28 | - Allows usage of ordered breadcrumbs as menu. (#15) 29 | 30 | Version 0.2.0 (released 2014-11-05) 31 | 32 | - The Flask-Breadcrumbs extension is now released under more 33 | permissive Revised BSD License. (#11) 34 | - Documentation improvements. (#13) 35 | - Extension initialization improvements. (#12) 36 | - Support for Python 3.4. (#5) 37 | 38 | Version 0.1.0 (released 2014-07-24) 39 | 40 | - Initial public release 41 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | Bug reports, feature requests, and other contributions are welcome. 5 | If you find a demonstrable problem that is caused by the code of this 6 | library, please: 7 | 8 | 1. Search for `already reported problems 9 | `_. 10 | 2. Check if the issue has been fixed or is still reproducible on the 11 | latest `master` branch. 12 | 3. Create an issue with **a test case**. 13 | 14 | If you create a feature branch, you can run the tests to ensure everything is 15 | operating correctly: 16 | 17 | .. code-block:: console 18 | 19 | $ ./run-tests.sh 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Flask-Breadcrumbs is free software; you can redistribute it and/or 2 | modify it under the terms of the Revised BSD License quoted below. 3 | 4 | Copyright (C) 2014, 2016 CERN. 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are 10 | met: 11 | 12 | * Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | * Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the distribution. 18 | 19 | * Neither the name of the copyright holder nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 30 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 33 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 34 | DAMAGE. 35 | 36 | In applying this license, CERN does not waive the privileges and 37 | immunities granted to it by virtue of its status as an 38 | Intergovernmental Organization or submit itself to any jurisdiction. 39 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | Jiri Kuncar (@jirikuncar) 2 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014, 2016 CERN. 5 | # 6 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 7 | # modify it under the terms of the Revised BSD License; see LICENSE 8 | # file for more details. 9 | 10 | include .checkignore .coveragerc run-tests.sh pytest.ini tox.ini 11 | include .lgtm MAINTAINERS 12 | include LICENSE *.rst *.txt 13 | include docs/*.rst docs/*.py docs/Makefile docs/requirements.txt 14 | recursive-include docs/_templates *.html 15 | recursive-include docs/_themes *.py *.css *.css_t *.conf *.html LICENSE README 16 | recursive-include tests *.py 17 | recursive-include .github/workflows *.yml 18 | include .git-blame-ignore-revs 19 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | Flask-Breadcrumbs 3 | =================== 4 | 5 | .. image:: https://github.com/inveniosoftware/flask-breadcrumbs/workflows/CI/badge.svg 6 | :target: https://github.com/inveniosoftware/flask-breadcrumbs/actions 7 | .. image:: https://coveralls.io/repos/inveniosoftware/flask-breadcrumbs/badge.png?branch=master 8 | :target: https://coveralls.io/r/inveniosoftware/flask-breadcrumbs 9 | .. image:: https://pypip.in/v/Flask-Breadcrumbs/badge.png 10 | :target: https://pypi.python.org/pypi/Flask-Breadcrumbs/ 11 | .. image:: https://pypip.in/d/Flask-Breadcrumbs/badge.png 12 | :target: https://pypi.python.org/pypi/Flask-Breadcrumbs/ 13 | 14 | About 15 | ===== 16 | Flask-Breadcrumbs is a Flask extension that adds support for 17 | generating site breadcrumb navigation. 18 | 19 | Installation 20 | ============ 21 | Flask-Breadcrumbs is on PyPI so all you need is: :: 22 | 23 | pip install Flask-Breadcrumbs 24 | 25 | Documentation 26 | ============= 27 | Documentation is readable at http://flask-breadcrumbs.readthedocs.io/ or 28 | can be build using Sphinx: :: 29 | 30 | git submodule init 31 | git submodule update 32 | pip install Sphinx 33 | python setup.py build_sphinx 34 | 35 | Testing 36 | ======= 37 | Running the test suite is as simple as: :: 38 | 39 | python setup.py test 40 | 41 | or, to also show code coverage: :: 42 | 43 | ./run-tests.sh 44 | -------------------------------------------------------------------------------- /RELEASE-NOTES.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Flask-Breadcrumbs v0.4.0 3 | ========================== 4 | 5 | Flask-Breadcrumbs v0.4.0 was released on July 1, 2016. 6 | 7 | About 8 | ----- 9 | 10 | Flask-Breadcrumbs is a Flask extension that adds support for 11 | generating site breadcrumb navigation. 12 | 13 | Incompatible changes 14 | -------------------- 15 | 16 | - Removes support for Python 2.6. 17 | 18 | Improved features 19 | ----------------- 20 | 21 | - Adds an advanced example using MethodViews and Blueprints. (#23) 22 | 23 | Bug fixes 24 | --------- 25 | 26 | - Amends deprecated import of Flask extensions via `flask.ext`. (#29) 27 | 28 | Installation 29 | ------------ 30 | 31 | $ pip install flask-breadcrumbs==0.4.0 32 | 33 | Documentation 34 | ------------- 35 | 36 | https://flask-breadcrumbs.readthedocs.io/en/v0.4.0 37 | 38 | Homepage 39 | -------- 40 | 41 | https://github.com/inveniosoftware/flask-breadcrumbs 42 | 43 | Good luck and thanks for choosing Flask-Breadcrumbs. 44 | 45 | | Invenio Development Team 46 | | Email: info@inveniosoftware.org 47 | | IRC: #invenio on irc.freenode.net 48 | | Twitter: https://twitter.com/inveniosoftware 49 | | GitHub: https://github.com/inveniosoftware 50 | | URL: http://inveniosoftware.org 51 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014 CERN. 5 | # 6 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 7 | # modify it under the terms of the Revised BSD License; see LICENSE 8 | # file for more details. 9 | 10 | # You can set these variables from the command line. 11 | SPHINXOPTS = 12 | SPHINXBUILD = sphinx-build 13 | PAPER = 14 | BUILDDIR = _build 15 | 16 | # User-friendly check for sphinx-build 17 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 18 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 19 | endif 20 | 21 | # Internal variables. 22 | PAPEROPT_a4 = -D latex_paper_size=a4 23 | PAPEROPT_letter = -D latex_paper_size=letter 24 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 25 | # the i18n builder cannot share the environment and doctrees with the others 26 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 27 | 28 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 29 | 30 | help: 31 | @echo "Please use \`make ' where is one of" 32 | @echo " html to make standalone HTML files" 33 | @echo " dirhtml to make HTML files named index.html in directories" 34 | @echo " singlehtml to make a single large HTML file" 35 | @echo " pickle to make pickle files" 36 | @echo " json to make JSON files" 37 | @echo " htmlhelp to make HTML files and a HTML help project" 38 | @echo " qthelp to make HTML files and a qthelp project" 39 | @echo " devhelp to make HTML files and a Devhelp project" 40 | @echo " epub to make an epub" 41 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 42 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 43 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 44 | @echo " text to make text files" 45 | @echo " man to make manual pages" 46 | @echo " texinfo to make Texinfo files" 47 | @echo " info to make Texinfo files and run them through makeinfo" 48 | @echo " gettext to make PO message catalogs" 49 | @echo " changes to make an overview of all changed/added/deprecated items" 50 | @echo " xml to make Docutils-native XML files" 51 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 52 | @echo " linkcheck to check all external links for integrity" 53 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 54 | 55 | clean: 56 | rm -rf $(BUILDDIR)/* 57 | 58 | html: 59 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 60 | @echo 61 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 62 | 63 | dirhtml: 64 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 65 | @echo 66 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 67 | 68 | singlehtml: 69 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 70 | @echo 71 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 72 | 73 | pickle: 74 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 75 | @echo 76 | @echo "Build finished; now you can process the pickle files." 77 | 78 | json: 79 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 80 | @echo 81 | @echo "Build finished; now you can process the JSON files." 82 | 83 | htmlhelp: 84 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 85 | @echo 86 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 87 | ".hhp project file in $(BUILDDIR)/htmlhelp." 88 | 89 | qthelp: 90 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 91 | @echo 92 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 93 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 94 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask-Breadcrumbs.qhcp" 95 | @echo "To view the help file:" 96 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask-Breadcrumbs.qhc" 97 | 98 | devhelp: 99 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 100 | @echo 101 | @echo "Build finished." 102 | @echo "To view the help file:" 103 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Flask-Breadcrumbs" 104 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Flask-Breadcrumbs" 105 | @echo "# devhelp" 106 | 107 | epub: 108 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 109 | @echo 110 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 111 | 112 | latex: 113 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 114 | @echo 115 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 116 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 117 | "(use \`make latexpdf' here to do that automatically)." 118 | 119 | latexpdf: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through pdflatex..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | latexpdfja: 126 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 127 | @echo "Running LaTeX files through platex and dvipdfmx..." 128 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 129 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 130 | 131 | text: 132 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 133 | @echo 134 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 135 | 136 | man: 137 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 138 | @echo 139 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 140 | 141 | texinfo: 142 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 143 | @echo 144 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 145 | @echo "Run \`make' in that directory to run these through makeinfo" \ 146 | "(use \`make info' here to do that automatically)." 147 | 148 | info: 149 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 150 | @echo "Running Texinfo files through makeinfo..." 151 | make -C $(BUILDDIR)/texinfo info 152 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 153 | 154 | gettext: 155 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 156 | @echo 157 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 158 | 159 | changes: 160 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 161 | @echo 162 | @echo "The overview file is in $(BUILDDIR)/changes." 163 | 164 | linkcheck: 165 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 166 | @echo 167 | @echo "Link check complete; look for any errors in the above output " \ 168 | "or in $(BUILDDIR)/linkcheck/output.txt." 169 | 170 | doctest: 171 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 172 | @echo "Testing of doctests in the sources finished, look at the " \ 173 | "results in $(BUILDDIR)/doctest/output.txt." 174 | 175 | xml: 176 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 177 | @echo 178 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 179 | 180 | pseudoxml: 181 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 182 | @echo 183 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 184 | -------------------------------------------------------------------------------- /docs/_templates/sidebarintro.html: -------------------------------------------------------------------------------- 1 |

About

2 |

3 | Flask-Breadcrumbs is an extension for Flask that adds support for quickly. 4 |

5 |

Useful Links

6 | 12 | 13 | Fork me on GitHub 15 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (C) 2022 Graz University of Technology. 3 | # 4 | # Copyright (C) 2022 Graz University of Technology. 5 | # Flask-Breadcrumbs documentation build configuration file, created by 6 | # Copyright (C) 2022 Graz University of Technology. 7 | # sphinx-quickstart on Fri Jul 31 13:10:12 2015. 8 | # Copyright (C) 2022 Graz University of Technology. 9 | # 10 | # Copyright (C) 2022 Graz University of Technology. 11 | # This file is execfile()d with the current directory set to its 12 | # Copyright (C) 2022 Graz University of Technology. 13 | # containing dir. 14 | # Copyright (C) 2022 Graz University of Technology. 15 | # 16 | # Copyright (C) 2022 Graz University of Technology. 17 | # Note that not all possible configuration values are present in this 18 | # Copyright (C) 2022 Graz University of Technology. 19 | # autogenerated file. 20 | # Copyright (C) 2022 Graz University of Technology. 21 | # 22 | # Copyright (C) 2022 Graz University of Technology. 23 | # All configuration values have a default; values that are commented out 24 | # Copyright (C) 2022 Graz University of Technology. 25 | # serve to show the default. 26 | # Copyright (C) 2022 Graz University of Technology. 27 | 28 | # Copyright (C) 2022 Graz University of Technology. 29 | import re 30 | # Copyright (C) 2022 Graz University of Technology. 31 | import shlex 32 | # Copyright (C) 2022 Graz University of Technology. 33 | import sys 34 | # Copyright (C) 2022 Graz University of Technology. 35 | 36 | # Copyright (C) 2022 Graz University of Technology. 37 | from flask_breadcrumbs import __version__ 38 | # Copyright (C) 2022 Graz University of Technology. 39 | 40 | # Copyright (C) 2022 Graz University of Technology. 41 | # If extensions (or modules to document with autodoc) are in another directory, 42 | # Copyright (C) 2022 Graz University of Technology. 43 | # add these directories to sys.path here. If the directory is relative to the 44 | # Copyright (C) 2022 Graz University of Technology. 45 | # documentation root, use os.path.abspath to make it absolute, like shown here. 46 | # Copyright (C) 2022 Graz University of Technology. 47 | # sys.path.insert(0, os.path.abspath('.')) 48 | # Copyright (C) 2022 Graz University of Technology. 49 | 50 | # Copyright (C) 2022 Graz University of Technology. 51 | # -- General configuration ------------------------------------------------ 52 | # Copyright (C) 2022 Graz University of Technology. 53 | 54 | # Copyright (C) 2022 Graz University of Technology. 55 | # If your documentation needs a minimal Sphinx version, state it here. 56 | # Copyright (C) 2022 Graz University of Technology. 57 | # needs_sphinx = '1.0' 58 | # Copyright (C) 2022 Graz University of Technology. 59 | 60 | # Copyright (C) 2022 Graz University of Technology. 61 | # Add any Sphinx extension module names here, as strings. They can be 62 | # Copyright (C) 2022 Graz University of Technology. 63 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 64 | # Copyright (C) 2022 Graz University of Technology. 65 | # ones. 66 | # Copyright (C) 2022 Graz University of Technology. 67 | extensions = [ 68 | # Copyright (C) 2022 Graz University of Technology. 69 | "sphinx.ext.autodoc", 70 | # Copyright (C) 2022 Graz University of Technology. 71 | "sphinx.ext.coverage", 72 | # Copyright (C) 2022 Graz University of Technology. 73 | "sphinx.ext.doctest", 74 | # Copyright (C) 2022 Graz University of Technology. 75 | "sphinx.ext.intersphinx", 76 | # Copyright (C) 2022 Graz University of Technology. 77 | "sphinx.ext.viewcode", 78 | # Copyright (C) 2022 Graz University of Technology. 79 | ] 80 | # Copyright (C) 2022 Graz University of Technology. 81 | 82 | # Copyright (C) 2022 Graz University of Technology. 83 | # Add any paths that contain templates here, relative to this directory. 84 | # Copyright (C) 2022 Graz University of Technology. 85 | # templates_path = ['_templates'] 86 | # Copyright (C) 2022 Graz University of Technology. 87 | 88 | # Copyright (C) 2022 Graz University of Technology. 89 | # The suffix(es) of source filenames. 90 | # Copyright (C) 2022 Graz University of Technology. 91 | # You can specify multiple suffix as a list of string: 92 | # Copyright (C) 2022 Graz University of Technology. 93 | # source_suffix = ['.rst', '.md'] 94 | # Copyright (C) 2022 Graz University of Technology. 95 | source_suffix = ".rst" 96 | # Copyright (C) 2022 Graz University of Technology. 97 | 98 | # Copyright (C) 2022 Graz University of Technology. 99 | # The encoding of source files. 100 | # Copyright (C) 2022 Graz University of Technology. 101 | # source_encoding = 'utf-8-sig' 102 | # Copyright (C) 2022 Graz University of Technology. 103 | 104 | # Copyright (C) 2022 Graz University of Technology. 105 | # The master toctree document. 106 | # Copyright (C) 2022 Graz University of Technology. 107 | master_doc = "index" 108 | # Copyright (C) 2022 Graz University of Technology. 109 | 110 | # Copyright (C) 2022 Graz University of Technology. 111 | # General information about the project. 112 | # Copyright (C) 2022 Graz University of Technology. 113 | project = "Flask-Breadcrumbs" 114 | # Copyright (C) 2022 Graz University of Technology. 115 | copyright = "2014, 2015, 2016, CERN" 116 | # Copyright (C) 2022 Graz University of Technology. 117 | author = "Invenio Software" 118 | # Copyright (C) 2022 Graz University of Technology. 119 | 120 | # Copyright (C) 2022 Graz University of Technology. 121 | # The version info for the project you're documenting, acts as replacement for 122 | # Copyright (C) 2022 Graz University of Technology. 123 | # |version| and |release|, also used in various other places throughout the 124 | # Copyright (C) 2022 Graz University of Technology. 125 | # built documents. 126 | # Copyright (C) 2022 Graz University of Technology. 127 | # 128 | # Copyright (C) 2022 Graz University of Technology. 129 | # The short X.Y version. 130 | # Copyright (C) 2022 Graz University of Technology. 131 | # The full version, including alpha/beta/rc tags. 132 | # Copyright (C) 2022 Graz University of Technology. 133 | release = __version__ 134 | # Copyright (C) 2022 Graz University of Technology. 135 | 136 | # Copyright (C) 2022 Graz University of Technology. 137 | # The language for content autogenerated by Sphinx. Refer to documentation 138 | # Copyright (C) 2022 Graz University of Technology. 139 | # for a list of supported languages. 140 | # Copyright (C) 2022 Graz University of Technology. 141 | # 142 | # Copyright (C) 2022 Graz University of Technology. 143 | # This is also used if you do content translation via gettext catalogs. 144 | # Copyright (C) 2022 Graz University of Technology. 145 | # Usually you set "language" from the command line for these cases. 146 | # Copyright (C) 2022 Graz University of Technology. 147 | language = "en" 148 | # Copyright (C) 2022 Graz University of Technology. 149 | 150 | # Copyright (C) 2022 Graz University of Technology. 151 | # There are two options for replacing |today|: either, you set today to some 152 | # Copyright (C) 2022 Graz University of Technology. 153 | # non-false value, then it is used: 154 | # Copyright (C) 2022 Graz University of Technology. 155 | # today = '' 156 | # Copyright (C) 2022 Graz University of Technology. 157 | # Else, today_fmt is used as the format for a strftime call. 158 | # Copyright (C) 2022 Graz University of Technology. 159 | # today_fmt = '%B %d, %Y' 160 | # Copyright (C) 2022 Graz University of Technology. 161 | 162 | # Copyright (C) 2022 Graz University of Technology. 163 | # List of patterns, relative to source directory, that match files and 164 | # Copyright (C) 2022 Graz University of Technology. 165 | # directories to ignore when looking for source files. 166 | # Copyright (C) 2022 Graz University of Technology. 167 | exclude_patterns = ["_build"] 168 | # Copyright (C) 2022 Graz University of Technology. 169 | 170 | # Copyright (C) 2022 Graz University of Technology. 171 | # The reST default role (used for this markup: `text`) to use for all 172 | # Copyright (C) 2022 Graz University of Technology. 173 | # documents. 174 | # Copyright (C) 2022 Graz University of Technology. 175 | # default_role = None 176 | # Copyright (C) 2022 Graz University of Technology. 177 | 178 | # Copyright (C) 2022 Graz University of Technology. 179 | # If true, '()' will be appended to :func: etc. cross-reference text. 180 | # Copyright (C) 2022 Graz University of Technology. 181 | # add_function_parentheses = True 182 | # Copyright (C) 2022 Graz University of Technology. 183 | 184 | # Copyright (C) 2022 Graz University of Technology. 185 | # If true, the current module name will be prepended to all description 186 | # Copyright (C) 2022 Graz University of Technology. 187 | # unit titles (such as .. function::). 188 | # Copyright (C) 2022 Graz University of Technology. 189 | # add_module_names = True 190 | # Copyright (C) 2022 Graz University of Technology. 191 | 192 | # Copyright (C) 2022 Graz University of Technology. 193 | # If true, sectionauthor and moduleauthor directives will be shown in the 194 | # Copyright (C) 2022 Graz University of Technology. 195 | # output. They are ignored by default. 196 | # Copyright (C) 2022 Graz University of Technology. 197 | # show_authors = False 198 | # Copyright (C) 2022 Graz University of Technology. 199 | 200 | # Copyright (C) 2022 Graz University of Technology. 201 | # The name of the Pygments (syntax highlighting) style to use. 202 | # Copyright (C) 2022 Graz University of Technology. 203 | pygments_style = "sphinx" 204 | # Copyright (C) 2022 Graz University of Technology. 205 | 206 | # Copyright (C) 2022 Graz University of Technology. 207 | # A list of ignored prefixes for module index sorting. 208 | # Copyright (C) 2022 Graz University of Technology. 209 | # modindex_common_prefix = [] 210 | # Copyright (C) 2022 Graz University of Technology. 211 | 212 | # Copyright (C) 2022 Graz University of Technology. 213 | # If true, keep warnings as "system message" paragraphs in the built documents. 214 | # Copyright (C) 2022 Graz University of Technology. 215 | # keep_warnings = False 216 | # Copyright (C) 2022 Graz University of Technology. 217 | 218 | # Copyright (C) 2022 Graz University of Technology. 219 | # If true, `todo` and `todoList` produce output, else they produce nothing. 220 | # Copyright (C) 2022 Graz University of Technology. 221 | todo_include_todos = False 222 | # Copyright (C) 2022 Graz University of Technology. 223 | 224 | # Copyright (C) 2022 Graz University of Technology. 225 | 226 | # Copyright (C) 2022 Graz University of Technology. 227 | # -- Options for HTML output ---------------------------------------------- 228 | # Copyright (C) 2022 Graz University of Technology. 229 | 230 | # Copyright (C) 2022 Graz University of Technology. 231 | # The theme to use for HTML and HTML Help pages. See the documentation for 232 | # Copyright (C) 2022 Graz University of Technology. 233 | # a list of builtin themes. 234 | # Copyright (C) 2022 Graz University of Technology. 235 | html_theme = "alabaster" 236 | # Copyright (C) 2022 Graz University of Technology. 237 | 238 | # Copyright (C) 2022 Graz University of Technology. 239 | # Theme options are theme-specific and customize the look and feel of a theme 240 | # Copyright (C) 2022 Graz University of Technology. 241 | # further. For a list of options available for each theme, see the 242 | # Copyright (C) 2022 Graz University of Technology. 243 | # documentation. 244 | # Copyright (C) 2022 Graz University of Technology. 245 | html_theme_options = { 246 | # Copyright (C) 2022 Graz University of Technology. 247 | "description": "Flask-Breadcrumbs adds support for generating site breadcrumb navigation.", 248 | # Copyright (C) 2022 Graz University of Technology. 249 | "github_user": "inveniosoftware", 250 | # Copyright (C) 2022 Graz University of Technology. 251 | "github_repo": "flask-breadcrumbs", 252 | # Copyright (C) 2022 Graz University of Technology. 253 | "github_button": False, 254 | # Copyright (C) 2022 Graz University of Technology. 255 | "github_banner": True, 256 | # Copyright (C) 2022 Graz University of Technology. 257 | "show_powered_by": False, 258 | # Copyright (C) 2022 Graz University of Technology. 259 | "extra_nav_links": { 260 | # Copyright (C) 2022 Graz University of Technology. 261 | "Flask-CLI@GitHub": "http://github.com/inveniosoftware/flask-breadcrumbs/", 262 | # Copyright (C) 2022 Graz University of Technology. 263 | "Flask-CLI@PyPI": "http://pypi.python.org/pypi/Flask-Breadcrumbs/", 264 | # Copyright (C) 2022 Graz University of Technology. 265 | }, 266 | # Copyright (C) 2022 Graz University of Technology. 267 | } 268 | # Copyright (C) 2022 Graz University of Technology. 269 | 270 | # Copyright (C) 2022 Graz University of Technology. 271 | # Add any paths that contain custom themes here, relative to this directory. 272 | # Copyright (C) 2022 Graz University of Technology. 273 | # html_theme_path = [] 274 | # Copyright (C) 2022 Graz University of Technology. 275 | 276 | # Copyright (C) 2022 Graz University of Technology. 277 | # The name for this set of Sphinx documents. If None, it defaults to 278 | # Copyright (C) 2022 Graz University of Technology. 279 | # " v documentation". 280 | # Copyright (C) 2022 Graz University of Technology. 281 | # html_title = None 282 | # Copyright (C) 2022 Graz University of Technology. 283 | 284 | # Copyright (C) 2022 Graz University of Technology. 285 | # A shorter title for the navigation bar. Default is the same as html_title. 286 | # Copyright (C) 2022 Graz University of Technology. 287 | # html_short_title = None 288 | # Copyright (C) 2022 Graz University of Technology. 289 | 290 | # Copyright (C) 2022 Graz University of Technology. 291 | # The name of an image file (relative to this directory) to place at the top 292 | # Copyright (C) 2022 Graz University of Technology. 293 | # of the sidebar. 294 | # Copyright (C) 2022 Graz University of Technology. 295 | # html_logo = None 296 | # Copyright (C) 2022 Graz University of Technology. 297 | 298 | # Copyright (C) 2022 Graz University of Technology. 299 | # The name of an image file (within the static path) to use as favicon of the 300 | # Copyright (C) 2022 Graz University of Technology. 301 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 302 | # Copyright (C) 2022 Graz University of Technology. 303 | # pixels large. 304 | # Copyright (C) 2022 Graz University of Technology. 305 | # html_favicon = None 306 | # Copyright (C) 2022 Graz University of Technology. 307 | 308 | # Copyright (C) 2022 Graz University of Technology. 309 | # Add any paths that contain custom static files (such as style sheets) here, 310 | # Copyright (C) 2022 Graz University of Technology. 311 | # relative to this directory. They are copied after the builtin static files, 312 | # Copyright (C) 2022 Graz University of Technology. 313 | # so a file named "default.css" will overwrite the builtin "default.css". 314 | # Copyright (C) 2022 Graz University of Technology. 315 | # html_static_path = ['_static'] 316 | # Copyright (C) 2022 Graz University of Technology. 317 | 318 | # Copyright (C) 2022 Graz University of Technology. 319 | # Add any extra paths that contain custom files (such as robots.txt or 320 | # Copyright (C) 2022 Graz University of Technology. 321 | # .htaccess) here, relative to this directory. These files are copied 322 | # Copyright (C) 2022 Graz University of Technology. 323 | # directly to the root of the documentation. 324 | # Copyright (C) 2022 Graz University of Technology. 325 | # html_extra_path = [] 326 | # Copyright (C) 2022 Graz University of Technology. 327 | 328 | # Copyright (C) 2022 Graz University of Technology. 329 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 330 | # Copyright (C) 2022 Graz University of Technology. 331 | # using the given strftime format. 332 | # Copyright (C) 2022 Graz University of Technology. 333 | # html_last_updated_fmt = '%b %d, %Y' 334 | # Copyright (C) 2022 Graz University of Technology. 335 | 336 | # Copyright (C) 2022 Graz University of Technology. 337 | # If true, SmartyPants will be used to convert quotes and dashes to 338 | # Copyright (C) 2022 Graz University of Technology. 339 | # typographically correct entities. 340 | # Copyright (C) 2022 Graz University of Technology. 341 | # html_use_smartypants = True 342 | # Copyright (C) 2022 Graz University of Technology. 343 | 344 | # Copyright (C) 2022 Graz University of Technology. 345 | # Custom sidebar templates, maps document names to template names. 346 | # Copyright (C) 2022 Graz University of Technology. 347 | # html_sidebars = {} 348 | # Copyright (C) 2022 Graz University of Technology. 349 | 350 | # Copyright (C) 2022 Graz University of Technology. 351 | # Additional templates that should be rendered to pages, maps page names to 352 | # Copyright (C) 2022 Graz University of Technology. 353 | # template names. 354 | # Copyright (C) 2022 Graz University of Technology. 355 | # html_additional_pages = {} 356 | # Copyright (C) 2022 Graz University of Technology. 357 | 358 | # Copyright (C) 2022 Graz University of Technology. 359 | # If false, no module index is generated. 360 | # Copyright (C) 2022 Graz University of Technology. 361 | # html_domain_indices = True 362 | # Copyright (C) 2022 Graz University of Technology. 363 | 364 | # Copyright (C) 2022 Graz University of Technology. 365 | # If false, no index is generated. 366 | # Copyright (C) 2022 Graz University of Technology. 367 | # html_use_index = True 368 | # Copyright (C) 2022 Graz University of Technology. 369 | 370 | # Copyright (C) 2022 Graz University of Technology. 371 | # If true, the index is split into individual pages for each letter. 372 | # Copyright (C) 2022 Graz University of Technology. 373 | # html_split_index = False 374 | # Copyright (C) 2022 Graz University of Technology. 375 | 376 | # Copyright (C) 2022 Graz University of Technology. 377 | # If true, links to the reST sources are added to the pages. 378 | # Copyright (C) 2022 Graz University of Technology. 379 | # html_show_sourcelink = True 380 | # Copyright (C) 2022 Graz University of Technology. 381 | 382 | # Copyright (C) 2022 Graz University of Technology. 383 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 384 | # Copyright (C) 2022 Graz University of Technology. 385 | # html_show_sphinx = True 386 | # Copyright (C) 2022 Graz University of Technology. 387 | 388 | # Copyright (C) 2022 Graz University of Technology. 389 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 390 | # Copyright (C) 2022 Graz University of Technology. 391 | # html_show_copyright = True 392 | # Copyright (C) 2022 Graz University of Technology. 393 | 394 | # Copyright (C) 2022 Graz University of Technology. 395 | # If true, an OpenSearch description file will be output, and all pages will 396 | # Copyright (C) 2022 Graz University of Technology. 397 | # contain a tag referring to it. The value of this option must be the 398 | # Copyright (C) 2022 Graz University of Technology. 399 | # base URL from which the finished HTML is served. 400 | # Copyright (C) 2022 Graz University of Technology. 401 | # html_use_opensearch = '' 402 | # Copyright (C) 2022 Graz University of Technology. 403 | 404 | # Copyright (C) 2022 Graz University of Technology. 405 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 406 | # Copyright (C) 2022 Graz University of Technology. 407 | # html_file_suffix = None 408 | # Copyright (C) 2022 Graz University of Technology. 409 | 410 | # Copyright (C) 2022 Graz University of Technology. 411 | # Language to be used for generating the HTML full-text search index. 412 | # Copyright (C) 2022 Graz University of Technology. 413 | # Sphinx supports the following languages: 414 | # Copyright (C) 2022 Graz University of Technology. 415 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 416 | # Copyright (C) 2022 Graz University of Technology. 417 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' 418 | # Copyright (C) 2022 Graz University of Technology. 419 | # html_search_language = 'en' 420 | # Copyright (C) 2022 Graz University of Technology. 421 | 422 | # Copyright (C) 2022 Graz University of Technology. 423 | # A dictionary with options for the search language support, empty by default. 424 | # Copyright (C) 2022 Graz University of Technology. 425 | # Now only 'ja' uses this config value 426 | # Copyright (C) 2022 Graz University of Technology. 427 | # html_search_options = {'type': 'default'} 428 | # Copyright (C) 2022 Graz University of Technology. 429 | 430 | # Copyright (C) 2022 Graz University of Technology. 431 | # The name of a javascript file (relative to the configuration directory) that 432 | # Copyright (C) 2022 Graz University of Technology. 433 | # implements a search results scorer. If empty, the default will be used. 434 | # Copyright (C) 2022 Graz University of Technology. 435 | # html_search_scorer = 'scorer.js' 436 | # Copyright (C) 2022 Graz University of Technology. 437 | 438 | # Copyright (C) 2022 Graz University of Technology. 439 | # Output file base name for HTML help builder. 440 | # Copyright (C) 2022 Graz University of Technology. 441 | htmlhelp_basename = "Flask-Breadcrumbsdoc" 442 | # Copyright (C) 2022 Graz University of Technology. 443 | 444 | # Copyright (C) 2022 Graz University of Technology. 445 | # -- Options for LaTeX output --------------------------------------------- 446 | # Copyright (C) 2022 Graz University of Technology. 447 | 448 | # Copyright (C) 2022 Graz University of Technology. 449 | latex_elements = { 450 | # Copyright (C) 2022 Graz University of Technology. 451 | # The paper size ('letterpaper' or 'a4paper'). 452 | # Copyright (C) 2022 Graz University of Technology. 453 | #'papersize': 'letterpaper', 454 | # Copyright (C) 2022 Graz University of Technology. 455 | # The font size ('10pt', '11pt' or '12pt'). 456 | # Copyright (C) 2022 Graz University of Technology. 457 | #'pointsize': '10pt', 458 | # Copyright (C) 2022 Graz University of Technology. 459 | # Additional stuff for the LaTeX preamble. 460 | # Copyright (C) 2022 Graz University of Technology. 461 | #'preamble': '', 462 | # Copyright (C) 2022 Graz University of Technology. 463 | # Latex figure (float) alignment 464 | # Copyright (C) 2022 Graz University of Technology. 465 | #'figure_align': 'htbp', 466 | # Copyright (C) 2022 Graz University of Technology. 467 | } 468 | # Copyright (C) 2022 Graz University of Technology. 469 | 470 | # Copyright (C) 2022 Graz University of Technology. 471 | # Grouping the document tree into LaTeX files. List of tuples 472 | # Copyright (C) 2022 Graz University of Technology. 473 | # (source start file, target name, title, 474 | # Copyright (C) 2022 Graz University of Technology. 475 | # author, documentclass [howto, manual, or own class]). 476 | # Copyright (C) 2022 Graz University of Technology. 477 | latex_documents = [ 478 | # Copyright (C) 2022 Graz University of Technology. 479 | ( 480 | # Copyright (C) 2022 Graz University of Technology. 481 | master_doc, 482 | # Copyright (C) 2022 Graz University of Technology. 483 | "Flask-Breadcrumbs.tex", 484 | # Copyright (C) 2022 Graz University of Technology. 485 | "Flask-Breadcrumbs Documentation", 486 | # Copyright (C) 2022 Graz University of Technology. 487 | "Invenio Software", 488 | # Copyright (C) 2022 Graz University of Technology. 489 | "manual", 490 | # Copyright (C) 2022 Graz University of Technology. 491 | ), 492 | # Copyright (C) 2022 Graz University of Technology. 493 | ] 494 | # Copyright (C) 2022 Graz University of Technology. 495 | 496 | # Copyright (C) 2022 Graz University of Technology. 497 | # The name of an image file (relative to this directory) to place at the top of 498 | # Copyright (C) 2022 Graz University of Technology. 499 | # the title page. 500 | # Copyright (C) 2022 Graz University of Technology. 501 | # latex_logo = None 502 | # Copyright (C) 2022 Graz University of Technology. 503 | 504 | # Copyright (C) 2022 Graz University of Technology. 505 | # For "manual" documents, if this is true, then toplevel headings are parts, 506 | # Copyright (C) 2022 Graz University of Technology. 507 | # not chapters. 508 | # Copyright (C) 2022 Graz University of Technology. 509 | # latex_use_parts = False 510 | # Copyright (C) 2022 Graz University of Technology. 511 | 512 | # Copyright (C) 2022 Graz University of Technology. 513 | # If true, show page references after internal links. 514 | # Copyright (C) 2022 Graz University of Technology. 515 | # latex_show_pagerefs = False 516 | # Copyright (C) 2022 Graz University of Technology. 517 | 518 | # Copyright (C) 2022 Graz University of Technology. 519 | # If true, show URL addresses after external links. 520 | # Copyright (C) 2022 Graz University of Technology. 521 | # latex_show_urls = False 522 | # Copyright (C) 2022 Graz University of Technology. 523 | 524 | # Copyright (C) 2022 Graz University of Technology. 525 | # Documents to append as an appendix to all manuals. 526 | # Copyright (C) 2022 Graz University of Technology. 527 | # latex_appendices = [] 528 | # Copyright (C) 2022 Graz University of Technology. 529 | 530 | # Copyright (C) 2022 Graz University of Technology. 531 | # If false, no module index is generated. 532 | # Copyright (C) 2022 Graz University of Technology. 533 | # latex_domain_indices = True 534 | # Copyright (C) 2022 Graz University of Technology. 535 | 536 | # Copyright (C) 2022 Graz University of Technology. 537 | 538 | # Copyright (C) 2022 Graz University of Technology. 539 | # -- Options for manual page output --------------------------------------- 540 | # Copyright (C) 2022 Graz University of Technology. 541 | 542 | # Copyright (C) 2022 Graz University of Technology. 543 | # One entry per manual page. List of tuples 544 | # Copyright (C) 2022 Graz University of Technology. 545 | # (source start file, name, description, authors, manual section). 546 | # Copyright (C) 2022 Graz University of Technology. 547 | man_pages = [ 548 | # Copyright (C) 2022 Graz University of Technology. 549 | (master_doc, "flask-breadcrumbs", "Flask-Breadcrumbs Documentation", [author], 1) 550 | # Copyright (C) 2022 Graz University of Technology. 551 | ] 552 | # Copyright (C) 2022 Graz University of Technology. 553 | 554 | # Copyright (C) 2022 Graz University of Technology. 555 | # If true, show URL addresses after external links. 556 | # Copyright (C) 2022 Graz University of Technology. 557 | # man_show_urls = False 558 | # Copyright (C) 2022 Graz University of Technology. 559 | 560 | # Copyright (C) 2022 Graz University of Technology. 561 | 562 | # Copyright (C) 2022 Graz University of Technology. 563 | # -- Options for Texinfo output ------------------------------------------- 564 | # Copyright (C) 2022 Graz University of Technology. 565 | 566 | # Copyright (C) 2022 Graz University of Technology. 567 | # Grouping the document tree into Texinfo files. List of tuples 568 | # Copyright (C) 2022 Graz University of Technology. 569 | # (source start file, target name, title, author, 570 | # Copyright (C) 2022 Graz University of Technology. 571 | # dir menu entry, description, category) 572 | # Copyright (C) 2022 Graz University of Technology. 573 | texinfo_documents = [ 574 | # Copyright (C) 2022 Graz University of Technology. 575 | ( 576 | # Copyright (C) 2022 Graz University of Technology. 577 | master_doc, 578 | # Copyright (C) 2022 Graz University of Technology. 579 | "Flask-Breadcrumbs", 580 | # Copyright (C) 2022 Graz University of Technology. 581 | "Flask-Breadcrumbs Documentation", 582 | # Copyright (C) 2022 Graz University of Technology. 583 | author, 584 | # Copyright (C) 2022 Graz University of Technology. 585 | "Flask-Breadcrumbs", 586 | # Copyright (C) 2022 Graz University of Technology. 587 | "One line description of project.", 588 | # Copyright (C) 2022 Graz University of Technology. 589 | "Miscellaneous", 590 | # Copyright (C) 2022 Graz University of Technology. 591 | ), 592 | # Copyright (C) 2022 Graz University of Technology. 593 | ] 594 | # Copyright (C) 2022 Graz University of Technology. 595 | 596 | # Copyright (C) 2022 Graz University of Technology. 597 | # Documents to append as an appendix to all manuals. 598 | # Copyright (C) 2022 Graz University of Technology. 599 | # texinfo_appendices = [] 600 | # Copyright (C) 2022 Graz University of Technology. 601 | 602 | # Copyright (C) 2022 Graz University of Technology. 603 | # If false, no module index is generated. 604 | # Copyright (C) 2022 Graz University of Technology. 605 | # texinfo_domain_indices = True 606 | # Copyright (C) 2022 Graz University of Technology. 607 | 608 | # Copyright (C) 2022 Graz University of Technology. 609 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 610 | # Copyright (C) 2022 Graz University of Technology. 611 | # texinfo_show_urls = 'footnote' 612 | # Copyright (C) 2022 Graz University of Technology. 613 | 614 | # Copyright (C) 2022 Graz University of Technology. 615 | # If true, do not generate a @detailmenu in the "Top" node's menu. 616 | # Copyright (C) 2022 Graz University of Technology. 617 | # texinfo_no_detailmenu = False 618 | # Copyright (C) 2022 Graz University of Technology. 619 | 620 | # Copyright (C) 2022 Graz University of Technology. 621 | # -- Options for Intersphinx mapping ------------------------------------------ 622 | # Copyright (C) 2022 Graz University of Technology. 623 | 624 | # Copyright (C) 2022 Graz University of Technology. 625 | # See 626 | # Copyright (C) 2022 Graz University of Technology. 627 | intersphinx_mapping = { 628 | # Copyright (C) 2022 Graz University of Technology. 629 | "python": ("https://docs.python.org/3/", None), 630 | # Copyright (C) 2022 Graz University of Technology. 631 | "werkzeug": ("https://werkzeug.palletsprojects.com/en/1.0.x/", None), 632 | # Copyright (C) 2022 Graz University of Technology. 633 | "flask": ("https://flask.palletsprojects.com/en/1.1.x/", None), 634 | # Copyright (C) 2022 Graz University of Technology. 635 | } 636 | # Copyright (C) 2022 Graz University of Technology. 637 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | Flask-Breadcrumbs 3 | =================== 4 | .. currentmodule:: flask_breadcrumbs 5 | 6 | .. raw:: html 7 | 8 |

9 | 10 | github-ci badge 12 | 13 | 14 | coveralls.io badge 16 | 17 |

18 | 19 | 20 | Flask-Breadcrumbs is a Flask extension that adds support for generating 21 | site breadcrumb navigation. 22 | 23 | Contents 24 | -------- 25 | 26 | .. contents:: 27 | :local: 28 | :depth: 1 29 | :backlinks: none 30 | 31 | 32 | .. _installation: 33 | 34 | Installation 35 | ============ 36 | 37 | Flask-Breadcrumbs is on PyPI so all you need is: 38 | 39 | .. code-block:: console 40 | 41 | $ pip install Flask-Breadcrumbs 42 | 43 | The development version can be downloaded from `its page at GitHub 44 | `_. 45 | 46 | .. code-block:: console 47 | 48 | $ git clone https://github.com/inveniosoftware/flask-breadcrumbs.git 49 | $ cd flask-breadcrumbs 50 | $ python setup.py develop 51 | $ ./run-tests.sh 52 | 53 | Requirements 54 | ^^^^^^^^^^^^ 55 | 56 | Flask-Breadcrumbs has the following dependencies: 57 | 58 | * `Flask-Menu `_ 59 | * `Flask `_ 60 | * `six `_ 61 | 62 | Flask-Breadcrumbs requires Python version 2.6, 2.7 or 3.3+. 63 | 64 | 65 | .. _usage: 66 | 67 | Usage 68 | ===== 69 | 70 | This guide assumes that you have successfully installed ``Flask-Breadcrumbs`` 71 | package already. If not, please follow the :ref:`installation` 72 | instructions first. 73 | 74 | Simple Example 75 | ^^^^^^^^^^^^^^ 76 | 77 | Here is a simple Flask-Breadcrumbs usage example: 78 | 79 | .. code-block:: python 80 | 81 | from flask import Flask 82 | from flask_breadcrumbs import Breadcrumbs, register_breadcrumb 83 | 84 | app = Flask(__name__) 85 | 86 | # Initialize Flask-Breadcrumbs 87 | Breadcrumbs(app=app) 88 | 89 | @app.route('/') 90 | @register_breadcrumb(app, '.', 'Home') 91 | def index(): 92 | pass 93 | 94 | if __name__ == '__main__': 95 | app.run(debug=True) 96 | 97 | 98 | Save this as app.py and run it using your Python interpreter. 99 | 100 | .. code-block:: console 101 | 102 | $ python app.py 103 | * Running on http://127.0.0.1:5000/ 104 | 105 | .. _templating: 106 | 107 | Templating 108 | ^^^^^^^^^^ 109 | 110 | By default, a proxy object to `current_breadcrumbs` is added to your Jinja2 111 | context as `breadcrumbs` to help you with creating navigation bar. 112 | For example: 113 | 114 | .. code-block:: jinja 115 | 116 |
117 | {%- for breadcrumb in breadcrumbs -%} 118 | {{ breadcrumb.text }} 119 | {{ '/' if not loop.last }} 120 | {%- endfor -%} 121 |
122 | 123 | .. _variables: 124 | 125 | Variable rules 126 | ^^^^^^^^^^^^^^ 127 | 128 | For routes with a variable part, a dynamic list constructor can be used to 129 | create a more meaningful breadcrumb. In the example below, the User's primary 130 | key is used to create a breadcrumb displaying their name. 131 | 132 | .. code-block:: python 133 | 134 | from flask import request, render_template 135 | 136 | def view_user_dlc(*args, **kwargs): 137 | user_id = request.view_args['user_id'] 138 | user = User.query.get(user_id) 139 | return [{'text': user.name, 'url': user.url}] 140 | 141 | @app.route('/users/') 142 | @breadcrumbs.register_breadcrumb(app, '.user.id', '', 143 | dynamic_list_constructor=view_user_dlc) 144 | def view_user(user_id): 145 | user = User.query.get(user_id) 146 | return render_template('user.html', user=user) 147 | 148 | .. _blueprints: 149 | 150 | Blueprint Support 151 | ^^^^^^^^^^^^^^^^^ 152 | 153 | The most import part of a modular Flask application is Blueprint. You 154 | can create one for your application somewhere in your code and decorate 155 | your view function, like this: 156 | 157 | .. code-block:: python 158 | 159 | from flask import Blueprint 160 | from flask_breadcrumbs import register_breadcrumb 161 | 162 | account = Blueprint('account', __name__, url_prefix='/account') 163 | 164 | @account.route('/') 165 | @register_breadcrumb(account, '.', 'Your account') 166 | def index(): 167 | pass 168 | 169 | Combining Multiple Blueprints 170 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 171 | 172 | Sometimes you want to combine multiple blueprints and organise the 173 | navigation to certain hierarchy. This can be achieved by using the 174 | function :func:`~flask_breadcrumbs.default_breadcrumb_root`. 175 | 176 | .. code-block:: python 177 | 178 | from flask import Blueprint 179 | from flask_breadcrumbs import default_breadcrumb_root, register_breadcrumb 180 | 181 | social = Blueprint('social', __name__, url_prefix='/social') 182 | default_breadcrumb_root(social, '.account') 183 | 184 | @social.route('/list') 185 | @register_breadcrumb(social, '.list', 'Social networks') 186 | def list(): 187 | pass 188 | 189 | As a result of this, your `current_breadcrumbs` object with contain list 190 | with 3 items during processing request for `/social/list`. 191 | 192 | .. code-block:: python 193 | 194 | from example import app 195 | from flask_breadcrumbs import current_breadcrumbs 196 | import account 197 | import social 198 | app.register_blueprint(account.bp_account) 199 | app.register_blueprint(social.bp_social) 200 | with app.test_client() as c: 201 | c.get('/social/list') 202 | assert map(lambda x: x.url, 203 | list(current_breadcrumbs)) == [ 204 | '/', '/account/', '/social/list'] 205 | 206 | Advanced Examples 207 | ================= 208 | 209 | Use with MethodViews and Blueprints 210 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 211 | No routes are used in this example. Take note of the odd syntax for explicitly 212 | calling the decorator. 213 | 214 | .. code-block:: python 215 | 216 | from flask import Flask, render_template, Blueprint 217 | from flask_breadcrumbs import Breadcrumbs, register_breadcrumb 218 | from flask.views import MethodView 219 | 220 | app = Flask(__name__) 221 | Breadcrumbs(app=app) 222 | bp = Blueprint('bp', __name__,) 223 | 224 | 225 | class LevelOneView(MethodView): 226 | def get(self): 227 | return render_template('template.html') 228 | 229 | 230 | class LevelTwoView(MethodView): 231 | def get(self): 232 | return render_template('template.html') 233 | 234 | # Define the view by calling the decorator on its own, 235 | # followed by the view inside parenthesis 236 | level_one_view = register_breadcrumb(bp, 'breadcrumbs.', 'Level One')( 237 | LevelOneView.as_view('first') 238 | ) 239 | bp.add_url_rule('/one', view_func=level_one_view) # Add the rule to the blueprint 240 | 241 | level_two_view = breadcrumbs.register_breadcrumb(bp, 'breadcrumbs.two', 'Level Two')( 242 | LevelOneView.as_view('second') 243 | ) 244 | bp.add_url_rule('/two', view_func=level_two_view) 245 | 246 | app.register_blueprint(bp) 247 | 248 | 249 | .. code-block:: jinja 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 |

Example

258 |
259 | {%- for breadcrumb in breadcrumbs -%} 260 | {{ breadcrumb.text }} 261 | {{ '/' if not loop.last }} 262 | {%- endfor -%} 263 |
264 | 265 | 266 | 267 | .. _api: 268 | 269 | API 270 | === 271 | 272 | If you are looking for information on a specific function, class or 273 | method, this part of the documentation is for you. 274 | 275 | Flask extension 276 | ^^^^^^^^^^^^^^^ 277 | 278 | .. module:: flask_breadcrumbs 279 | 280 | .. autoclass:: Breadcrumbs 281 | :members: 282 | 283 | Decorators 284 | ^^^^^^^^^^ 285 | 286 | .. autofunction:: register_breadcrumb 287 | 288 | .. autofunction:: default_breadcrumb_root 289 | 290 | Proxies 291 | ^^^^^^^ 292 | 293 | .. data:: current_breadcrumbs 294 | 295 | List of breadcrumbs for current request. 296 | 297 | .. data:: breadcrumbs_root_path 298 | 299 | Name of breadcrumbs root path. 300 | 301 | 302 | .. include:: ../CHANGES.rst 303 | 304 | .. include:: ../CONTRIBUTING.rst 305 | 306 | License 307 | ======= 308 | 309 | .. include:: ../LICENSE 310 | 311 | .. include:: ../AUTHORS.rst 312 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | -e .[docs,tests] 2 | -------------------------------------------------------------------------------- /flask_breadcrumbs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014, 2015, 2016 CERN. 5 | # 6 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 7 | # modify it under the terms of the Revised BSD License; see LICENSE 8 | # file for more details. 9 | 10 | """Provide support for generating site breadcrumb navigation. 11 | 12 | Depends on `flask_menu` extension. 13 | """ 14 | 15 | from flask import Blueprint, current_app, request 16 | 17 | # pylint: disable=F0401,E0611 18 | from flask_menu import Menu, current_menu, register_menu 19 | 20 | # pylint: enable=F0401,E0611 21 | from werkzeug.local import LocalProxy 22 | 23 | 24 | def default_breadcrumb_root(app, path): 25 | """Register default breadcrumb path for all endpoints in this blueprint. 26 | 27 | :param app: The :class:`~flask.Flask` or :class:`flask.Blueprint` object. 28 | :type app: :class:`flask.Flask` or :class:`flask.Blueprint` 29 | :param path: Path in the menu hierarchy. 30 | It should start with '.' to be relative to breadcrumbs root. 31 | """ 32 | if path.startswith("."): 33 | # Path relative to breadcrumb root 34 | bl_path = LocalProxy(lambda: (breadcrumb_root_path + path).strip(".")) 35 | else: 36 | bl_path = path 37 | 38 | app.__breadcrumb__ = bl_path 39 | 40 | 41 | class Breadcrumbs(Menu, object): 42 | """Breadcrumb organizer for a :class:`~flask.Flask` application.""" 43 | 44 | def __init__(self, app=None, init_menu=True): 45 | """Initialize Breadcrumb extension. 46 | 47 | :param app: The :class:`flask.Flask` object to configure. 48 | :type app: :class:`flask.Flask` 49 | :param init_menu: If Flask-Menu should be initialized. 50 | :type init_menu: bool 51 | """ 52 | self.init_menu = init_menu 53 | if app is not None: 54 | self.init_app(app) 55 | 56 | def init_app(self, app, *args, **kwargs): 57 | """Configure an application. This registers a `context_processor`. 58 | 59 | :param app: The :class:`flask.Flask` object to configure. 60 | :type app: :class:`flask.Flask` 61 | """ 62 | app.config.setdefault("BREADCRUMBS_ROOT", "breadcrumbs") 63 | app.context_processor(Breadcrumbs.breadcrumbs_context_processor) 64 | 65 | self.app = app 66 | # Follow the Flask guidelines on usage of app.extensions 67 | if not hasattr(app, "extensions"): # pragma: no cover 68 | app.extensions = {} 69 | if "menu" not in app.extensions: 70 | if self.init_menu: 71 | super(Breadcrumbs, self).init_app(app) 72 | else: 73 | raise RuntimeError("Flask-Breadcrumbs is not initialized.") 74 | 75 | @staticmethod 76 | def current_path(): 77 | """Determine current location in menu hierarchy. 78 | 79 | Backend function for current_path proxy. 80 | """ 81 | # str(...) because __breadcrumb__ can hold a LocalProxy 82 | if hasattr(current_function, "__breadcrumb__"): 83 | return str(getattr(current_function, "__breadcrumb__", "")) 84 | 85 | return Breadcrumbs.get_path( 86 | current_blueprint._get_current_object() 87 | ) # pylint: disable=W0212 88 | 89 | @staticmethod 90 | def breadcrumbs(): 91 | """Backend function for breadcrumbs proxy. 92 | 93 | :return: A list of breadcrumbs. 94 | """ 95 | # Construct breadcrumbs using their dynamic lists 96 | breadcrumb_list = [] 97 | 98 | for entry in current_menu.list_path(breadcrumb_root_path, current_path) or []: 99 | breadcrumb_list += entry.dynamic_list 100 | 101 | return breadcrumb_list 102 | 103 | @staticmethod 104 | def breadcrumbs_context_processor(): 105 | """Add variable ``breadcrumbs`` to template context. 106 | 107 | It contains the list of menu entries to render as breadcrumbs. 108 | """ 109 | return dict(breadcrumbs=current_breadcrumbs) 110 | 111 | @staticmethod 112 | def get_path(app): 113 | """Return path to root of application's or bluerpint's branch.""" 114 | return str( 115 | getattr( 116 | app, 117 | "__breadcrumb__", 118 | breadcrumb_root_path 119 | + ("." + app.name if isinstance(app, Blueprint) else ""), 120 | ) 121 | ) 122 | 123 | 124 | def register_breadcrumb( 125 | app, 126 | path, 127 | text, 128 | order=0, 129 | endpoint_arguments_constructor=None, 130 | dynamic_list_constructor=None, 131 | ): 132 | """Decorate endpoints that should be displayed as a breadcrumb. 133 | 134 | :param app: Application or Blueprint which owns the function. 135 | :param path: Path to this item in menu hierarchy 136 | ('breadcrumbs.' is automatically added). 137 | :param text: Text displayed as link. 138 | :param order: Index of item among other items in the same menu. 139 | :param endpoint_arguments_constructor: Function returning dict of 140 | arguments passed to url_for when creating the link. 141 | :param dynamic_list_constructor: Function returning a list of 142 | breadcrumbs to be displayed by this item. Every object should 143 | have 'text' and 'url' properties/dict elements. 144 | """ 145 | # Resolve blueprint-relative paths 146 | if path.startswith("."): 147 | 148 | def _evaluate_path(): 149 | """Lazy path evaluation.""" 150 | bl_path = Breadcrumbs.get_path(app) 151 | return (bl_path + path).strip(".") 152 | 153 | func_path = LocalProxy(_evaluate_path) 154 | 155 | else: 156 | func_path = path 157 | 158 | # Get standard menu decorator 159 | menu_decorator = register_menu( 160 | app, 161 | func_path, 162 | text, 163 | order, 164 | endpoint_arguments_constructor=endpoint_arguments_constructor, 165 | dynamic_list_constructor=dynamic_list_constructor, 166 | ) 167 | 168 | def breadcrumb_decorator(func): 169 | """Apply standard menu decorator and assign breadcrumb.""" 170 | func.__breadcrumb__ = func_path 171 | 172 | return menu_decorator(func) 173 | 174 | return breadcrumb_decorator 175 | 176 | 177 | def _lookup_current_function(): 178 | """Return current view function for request endpoint.""" 179 | return current_app.view_functions.get(request.endpoint) 180 | 181 | 182 | def _lookup_current_blueprint(): 183 | """Return current :class:`~flask.Blueprint` instance. 184 | 185 | Alternatively return :class:`~flask.Flask` application object when no 186 | blueprint is activated during request. 187 | """ 188 | return current_app.blueprints.get( 189 | request.blueprint, current_app._get_current_object() 190 | ) # pylint: disable=W0212 191 | 192 | 193 | def _lookup_breadcrumb_root_path(): 194 | """Backend function for breadcrumb_root_path proxy.""" 195 | return current_app.config.get("BREADCRUMBS_ROOT") 196 | 197 | 198 | # Proxies 199 | # pylint: disable-msg=C0103 200 | 201 | 202 | #: A proxy for the current function. 203 | current_function = LocalProxy(_lookup_current_function) 204 | 205 | #: A proxy for the current blueprint or application object. 206 | current_blueprint = LocalProxy(_lookup_current_blueprint) 207 | 208 | #: A proxy for breadcrumbs root element path. 209 | breadcrumb_root_path = LocalProxy(_lookup_breadcrumb_root_path) 210 | 211 | #: A proxy for detecting current breadcrumb path. 212 | current_path = LocalProxy(Breadcrumbs.current_path) 213 | 214 | #: A proxy for current breadcrumbs list. 215 | current_breadcrumbs = LocalProxy(Breadcrumbs.breadcrumbs) 216 | # pylint: enable-msg=C0103 217 | 218 | __version__ = "0.5.1" 219 | 220 | __all__ = "Breadcrumbs" 221 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "babel>2.8"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | -------------------------------------------------------------------------------- /requirements-devel.txt: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 7 | # modify it under the terms of the Revised BSD License; see LICENSE 8 | # file for more details. 9 | 10 | -e git+https://github.com/pallets/flask.git#egg=Flask 11 | -------------------------------------------------------------------------------- /run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # This file is part of Invenio. 5 | # Copyright (C) 2013-2020 CERN. 6 | # Copyright (C) 2022 Graz University of Technology. 7 | # 8 | # Flask-Breadcrumbs is free software; you can redistribute it and/or modify 9 | # it under the terms of the Revised BSD License; see LICENSE file for 10 | # more details. 11 | 12 | # Quit on errors 13 | set -o errexit 14 | 15 | # Quit on unbound symbols 16 | set -o nounset 17 | 18 | python -m check_manifest 19 | python -m sphinx.cmd.build -qnNW docs docs/_build/html 20 | python -m pytest 21 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014, 2016 CERN. 5 | # Copyright (C) 2022 Graz University of Technology. 6 | # 7 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 8 | # modify it under the terms of the Revised BSD License; see LICENSE 9 | # file for more details. 10 | 11 | [metadata] 12 | name = flask-breadcrumbs 13 | version = attr: flask_breadcrumbs.__version__ 14 | description = "Flask-Breadcrumbs adds support for generating site breadcrumb navigation." 15 | long_description = file: README.rst, CHANGES.rst 16 | keywords = invenio metadata 17 | license = BSD 18 | author = CERN 19 | author_email = info@inveniosoftware.org 20 | platforms = any 21 | url = https://github.com/inveniosoftware/flask-breadcrumbs/ 22 | classifiers = 23 | Development Status :: 5 - Production/Stable 24 | 25 | [options] 26 | include_package_data = True 27 | packages = find: 28 | python_requires = >=3.7 29 | zip_safe = False 30 | install_requires = 31 | Flask>=1.0.4 32 | six>=1.12.0 33 | Flask-Menu>=0.2 34 | 35 | [options.extras_require] 36 | tests = 37 | pytest-black>=0.3.0,<0.3.10 38 | mock>=1.0.0 39 | pytest-invenio>=1.4.0 40 | sphinx>=4.5 41 | # Kept for backwards compatibility 42 | docs = 43 | 44 | [build_sphinx] 45 | source-dir = docs/ 46 | build-dir = docs/_build 47 | all_files = 1 48 | 49 | [bdist_wheel] 50 | universal = 1 51 | 52 | [isort] 53 | profile=black 54 | 55 | [check-manifest] 56 | ignore = 57 | *-requirements.txt 58 | 59 | [tool:pytest] 60 | addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=flask_breadcrumbs --cov-report=term-missing 61 | testpaths = tests flask_breadcrumbs 62 | filterwarnings = ignore::pytest.PytestDeprecationWarning 63 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014, 2016 CERN. 5 | # Copyright (C) 2022 Graz University of Technology. 6 | # 7 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 8 | # modify it under the terms of the Revised BSD License; see LICENSE 9 | # file for more details. 10 | 11 | """Flask-Breadcrumbs adds support for generating site breadcrumb navigation.""" 12 | 13 | from setuptools import setup 14 | 15 | setup() 16 | -------------------------------------------------------------------------------- /tests/test_core.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of Flask-Breadcrumbs 4 | # Copyright (C) 2013, 2014, 2015, 2016 CERN. 5 | # 6 | # Flask-Breadcrumbs is free software; you can redistribute it and/or 7 | # modify it under the terms of the Revised BSD License; see LICENSE 8 | # file for more details. 9 | 10 | import sys 11 | from unittest import TestCase 12 | 13 | from flask import Blueprint, Flask, render_template_string 14 | 15 | from flask_breadcrumbs import ( 16 | Breadcrumbs, 17 | current_breadcrumbs, 18 | current_path, 19 | default_breadcrumb_root, 20 | register_breadcrumb, 21 | ) 22 | 23 | breadcrumbs_tpl = """ 24 | {%- for breadcrumb in breadcrumbs -%} 25 | {{ breadcrumb.text}},{{ breadcrumb.url}}; 26 | {%- endfor -%} 27 | """ 28 | 29 | 30 | class FlaskTestCase(TestCase): 31 | """ 32 | Mix-in class for creating the Flask application 33 | """ 34 | 35 | def setUp(self): 36 | app = Flask(__name__) 37 | app.config["DEBUG"] = True 38 | app.config["TESTING"] = True 39 | app.logger.disabled = True 40 | self.app = app 41 | 42 | def tearDown(self): 43 | self.app = None 44 | 45 | 46 | class TestBreadcrumbs(FlaskTestCase): 47 | def setUp(self): 48 | """Prepares breadcrumbs tree. 49 | 50 | Example:: 51 | test 52 | |-- level2 53 | | |-- level3 54 | | |-- level3B 55 | 56 | foo (*blueprint*) 57 | |-- bar 58 | 59 | """ 60 | 61 | if sys.version_info == (3, 4, 0, "final", 0) or sys.version_info == ( 62 | 3, 63 | 4, 64 | 1, 65 | "final", 66 | 0, 67 | ): 68 | from unittest import SkipTest 69 | 70 | raise SkipTest("Python 3.4.[01] detected") 71 | 72 | super(TestBreadcrumbs, self).setUp() 73 | self.breadcrumbs = Breadcrumbs(self.app, init_menu=True) 74 | 75 | @self.app.route("/test") 76 | @register_breadcrumb(self.app, ".", "Test") 77 | def test(): 78 | return "test" 79 | 80 | @self.app.route("/level2") 81 | @register_breadcrumb(self.app, ".level2", "Level 2") 82 | def level2(): 83 | return "level2" 84 | 85 | @self.app.route("/level3") 86 | @register_breadcrumb(self.app, ".level2.level3", "Level 3") 87 | def level3(): 88 | return "level3" 89 | 90 | @self.app.route("/level3B") 91 | @register_breadcrumb(self.app, "breadcrumbs.level2.level3B", "Level 3B") 92 | def level3B(): 93 | return render_template_string(breadcrumbs_tpl) 94 | 95 | @self.app.route("/missing") 96 | def missing(): 97 | return "missing" 98 | 99 | self.foo = Blueprint("foo", "foo", url_prefix="/foo") 100 | 101 | @self.foo.route("/") 102 | @register_breadcrumb(self.foo, ".bar", "Bar") 103 | def bar(): 104 | return "bar" 105 | 106 | @self.foo.route("/baz") 107 | @register_breadcrumb(self.foo, ".baz", "Baz") 108 | def baz(): 109 | return render_template_string(breadcrumbs_tpl) 110 | 111 | @self.foo.route("/missing") 112 | def missing2(): 113 | return "missing2" 114 | 115 | self.app.register_blueprint(self.foo) 116 | 117 | def tearDown(self): 118 | del self.app 119 | del self.foo 120 | del self.breadcrumbs 121 | 122 | def test_simple_app(self): 123 | Breadcrumbs(self.app, init_menu=True) 124 | with self.app.test_client() as c: 125 | c.get("/test") 126 | self.assertEqual(current_path, "breadcrumbs") 127 | self.assertEqual(current_breadcrumbs[-1].url, "/test") 128 | 129 | def test_default_breadcrumb_root(self): 130 | with self.app.test_client() as c: 131 | c.get("/foo/") 132 | self.assertEqual(current_path, "breadcrumbs.foo.bar") 133 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/") 134 | 135 | with self.app.test_client() as c: 136 | c.get("/foo/baz") 137 | self.assertEqual(current_path, "breadcrumbs.foo.baz") 138 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/baz") 139 | 140 | def test_set_default_breadcrumb_root_different_from_blueprint_name(self): 141 | default_breadcrumb_root(self.foo, ".fooo") 142 | 143 | with self.app.test_client() as c: 144 | c.get("/foo/") 145 | self.assertEqual(current_path, "breadcrumbs.fooo.bar") 146 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/") 147 | 148 | with self.app.test_client() as c: 149 | c.get("/foo/baz") 150 | self.assertEqual(current_path, "breadcrumbs.fooo.baz") 151 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/baz") 152 | 153 | def test_set_default_breadcrumb_root_as_dot(self): 154 | default_breadcrumb_root(self.foo, ".") 155 | 156 | with self.app.test_client() as c: 157 | c.get("/foo/") 158 | self.assertEqual(current_path, "breadcrumbs.bar") 159 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/") 160 | 161 | with self.app.test_client() as c: 162 | c.get("/foo/baz") 163 | self.assertEqual(current_path, "breadcrumbs.baz") 164 | self.assertEqual(current_breadcrumbs[-1].url, "/foo/baz") 165 | 166 | def test_missing_breadcrumbs_detection(self): 167 | with self.app.test_client() as c: 168 | c.get("/missing") 169 | self.assertEqual(current_path, "breadcrumbs") 170 | self.assertEqual(current_breadcrumbs[-1].url, "/test") 171 | 172 | with self.app.test_client() as c: 173 | c.get("/foo/missing") 174 | self.assertEqual(current_path, "breadcrumbs.foo") 175 | self.assertEqual(current_breadcrumbs[-1].url, "#") 176 | 177 | def test_template_context(self): 178 | default_breadcrumb_root(self.foo, "breadcrumbs") 179 | 180 | with self.app.test_client() as c: 181 | response = c.get("/level3B") 182 | self.assertEqual( 183 | response.data.decode("utf8"), 184 | "Test,/test;Level 2,/level2;Level 3B,/level3B;", 185 | ) 186 | 187 | with self.app.test_client() as c: 188 | response = c.get("/foo/baz") 189 | self.assertEqual(response.data.decode("utf8"), "Test,/test;Baz,/foo/baz;") 190 | 191 | 192 | class MenuIntegrationTestCase(FlaskTestCase): 193 | def test_without_menu(self): 194 | # it must raise an exception because it is not registered. 195 | self.assertRaises(RuntimeError, Breadcrumbs, self.app, False) 196 | 197 | def test_init_menu(self): 198 | Breadcrumbs(self.app) 199 | assert "menu" in self.app.extensions 200 | 201 | def test_create_menu_first(self): 202 | from flask_menu import Menu 203 | 204 | menu = Menu(self.app) 205 | entry = self.app.extensions["menu"] 206 | # it must reuse existing menu extension. 207 | Breadcrumbs(self.app, init_menu=False) 208 | assert entry == self.app.extensions["menu"] 209 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # This file is part of Flask-Breadcrumbs 2 | # Copyright (C) 2014 CERN. 3 | # 4 | # Flask-Breadcrumbs is free software; you can redistribute it and/or modify 5 | # it under the terms of the Revised BSD License; see LICENSE file for 6 | # more details. 7 | 8 | [tox] 9 | envlist = py26, py27, py33, py34 10 | 11 | [testenv] 12 | deps = pytest 13 | pytest-cov 14 | pytest-pep8 15 | commands = {envpython} setup.py test 16 | --------------------------------------------------------------------------------