Flask-FlatPages-0.6/0000755000175000001440000000000012466075304017045 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/setup.cfg0000644000175000001440000000030712466075304020666 0ustar playpauseandstopusers00000000000000[build_sphinx] source-dir = docs build-dir = docs/_build [upload_sphinx] upload-dir = docs/_build/html [pytest] python_files = *test*.py [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 Flask-FlatPages-0.6/setup.py0000644000175000001440000000322112466024224020550 0ustar playpauseandstopusers00000000000000import os import re import sys from setuptools import setup DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) README = open(rel('README.rst')).read() INIT_PY = open(rel('flask_flatpages', '__init__.py')).read() VERSION = re.search("__version__ = '([^']+)'", INIT_PY).group(1) setup( name='Flask-FlatPages', version=VERSION, url='https://github.com/SimonSapin/Flask-FlatPages', license='BSD', author='Simon Sapin', author_email='simon.sapin@exyr.org', description='Provides flat static pages to a Flask application', long_description=README, packages=[ 'flask_flatpages' ], zip_safe=False, platforms='any', install_requires=[ 'Flask>=0.8', 'PyYAML>=3.10', 'Markdown>=2.3.1' ], tests_require=['Pygments>=1.6'], extras_require={ 'tests': ['Pygments>=1.6'], }, classifiers=[ 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: Implementation :: PyPy', ] ) Flask-FlatPages-0.6/Flask_FlatPages.egg-info/0000755000175000001440000000000012466075304023525 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/Flask_FlatPages.egg-info/requires.txt0000644000175000001440000000007712466075303026130 0ustar playpauseandstopusers00000000000000Flask>=0.8 PyYAML>=3.10 Markdown>=2.3.1 [tests] Pygments>=1.6 Flask-FlatPages-0.6/Flask_FlatPages.egg-info/SOURCES.txt0000644000175000001440000000152512466075304025414 0ustar playpauseandstopusers00000000000000LICENSE MANIFEST.in README.rst setup.cfg setup.py Flask_FlatPages.egg-info/PKG-INFO Flask_FlatPages.egg-info/SOURCES.txt Flask_FlatPages.egg-info/dependency_links.txt Flask_FlatPages.egg-info/not-zip-safe Flask_FlatPages.egg-info/requires.txt Flask_FlatPages.egg-info/top_level.txt docs/Makefile docs/conf.py docs/index.rst docs/_themes/.git docs/_themes/.gitignore docs/_themes/LICENSE docs/_themes/README docs/_themes/flask_theme_support.py docs/_themes/flask/layout.html docs/_themes/flask/relations.html docs/_themes/flask/theme.conf docs/_themes/flask/static/flasky.css_t docs/_themes/flask_small/layout.html docs/_themes/flask_small/theme.conf docs/_themes/flask_small/static/flasky.css_t flask_flatpages/__init__.py flask_flatpages/compat.py flask_flatpages/flatpages.py flask_flatpages/imports.py flask_flatpages/page.py flask_flatpages/utils.pyFlask-FlatPages-0.6/Flask_FlatPages.egg-info/PKG-INFO0000644000175000001440000000376612466075303024635 0ustar playpauseandstopusers00000000000000Metadata-Version: 1.1 Name: Flask-FlatPages Version: 0.6 Summary: Provides flat static pages to a Flask application Home-page: https://github.com/SimonSapin/Flask-FlatPages Author: Simon Sapin Author-email: simon.sapin@exyr.org License: BSD Description: =============== Flask-FlatPages =============== .. image:: https://secure.travis-ci.org/SimonSapin/Flask-FlatPages.png?branch=master :target: https://travis-ci.org/SimonSapin/Flask-FlatPages .. image:: https://pypip.in/v/Flask-FlatPages/badge.png :target: https://pypi.python.org/pypi/Flask-FlatPages Provides flat static pages to a Flask_ application, based on text files as opposed to a relational database. * Works on Python 2.6, 2.7 and 3.3+ * BSD licensed * Latest documentation `on Read the Docs`_ * Source, issues and pull requests `on Github`_ * Releases `on PyPI`_ * Install with ``pip install Flask-FlatPages`` .. _Flask: http://flask.pocoo.org/ .. _on Read the Docs: http://flask-flatpages.readthedocs.org/ .. _on Github: https://github.com/SimonSapin/Flask-FlatPages/ .. _on PyPI: http://pypi.python.org/pypi/Flask-FlatPages Platform: any Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: PyPy Flask-FlatPages-0.6/Flask_FlatPages.egg-info/dependency_links.txt0000644000175000001440000000000112466075303027572 0ustar playpauseandstopusers00000000000000 Flask-FlatPages-0.6/Flask_FlatPages.egg-info/not-zip-safe0000644000175000001440000000000112273474355025760 0ustar playpauseandstopusers00000000000000 Flask-FlatPages-0.6/Flask_FlatPages.egg-info/top_level.txt0000644000175000001440000000002012466075303026246 0ustar playpauseandstopusers00000000000000flask_flatpages Flask-FlatPages-0.6/MANIFEST.in0000644000175000001440000000035312261237225020577 0ustar playpauseandstopusers00000000000000include LICENSE recursive-include docs * recursive-exclude docs *.pyc recursive-exclude docs *.pyo prune docs/_build prune docs/_themes/.git recursive-include flask_flatpages/pages * recursive-include flask_flatpages/pages_shift_jis * Flask-FlatPages-0.6/docs/0000755000175000001440000000000012466075304017775 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/conf.py0000644000175000001440000001671312466074324021305 0ustar playpauseandstopusers00000000000000# -*- coding: utf-8 -*- # # Flask-FlatPages documentation build configuration file, created by # sphinx-quickstart on Fri Dec 24 15:20:25 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os, re # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) sys.path.append(os.path.abspath('..')) sys.path.append(os.path.abspath('_themes')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] # Intersphinx Mapping intersphinx_mapping = {'flask': ('http://flask.pocoo.org/docs/', None)} # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Flask-FlatPages' copyright = u'2010-2015, Simon Sapin. 2013-2015, Igor Davydenko' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The full version, including alpha/beta/rc tags. #release = '0.1dev' release = re.search("__version__ = '([^']+)'", open(os.path.join( os.path.dirname(__file__), '..', 'flask_flatpages', '__init__.py')) .read()).group(1) # The short X.Y version. #version = '0.1' version = re.split('[a-zA-Z]', release)[0] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. #pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'flask_small' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} html_theme_options = { 'index_logo': None, 'github_fork': 'SimonSapin/Flask-FlatPages' } # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ['_themes'] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'Flask-FlatPagesdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Flask-FlatPages.tex', u'Flask-FlatPages Documentation', u'Simon Sapin', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'flask-flatpages', u'Flask-FlatPages Documentation', [u'Simon Sapin', u'Igor Davydenko'], 1) ] Flask-FlatPages-0.6/docs/Makefile0000644000175000001440000001521612466021673021442 0ustar playpauseandstopusers00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(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/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask-LazyViews.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask-LazyViews.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/Flask-LazyViews" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Flask-LazyViews" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." Flask-FlatPages-0.6/docs/_themes/0000755000175000001440000000000012466075304021421 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/_themes/.gitignore0000644000175000001440000000002612466022143023400 0ustar playpauseandstopusers00000000000000*.pyc *.pyo .DS_Store Flask-FlatPages-0.6/docs/_themes/flask/0000755000175000001440000000000012466075304022521 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/_themes/flask/static/0000755000175000001440000000000012466075304024010 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/_themes/flask/static/flasky.css_t0000644000175000001440000002154612466022160026336 0ustar playpauseandstopusers00000000000000/* * flasky.css_t * ~~~~~~~~~~~~ * * :copyright: Copyright 2010 by Armin Ronacher. * :license: Flask Design License, see LICENSE for details. */ {% set page_width = '940px' %} {% set sidebar_width = '220px' %} @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: 'Georgia', serif; font-size: 17px; background-color: white; color: #000; margin: 0; padding: 0; } div.document { width: {{ page_width }}; margin: 30px auto 0 auto; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 {{ sidebar_width }}; } div.sphinxsidebar { width: {{ sidebar_width }}; } hr { border: 1px solid #B1B4B6; } div.body { background-color: #ffffff; color: #3E4349; padding: 0 30px 0 30px; } img.floatingflask { padding: 0 0 10px 10px; float: right; } div.footer { width: {{ page_width }}; margin: 20px auto 30px auto; font-size: 14px; color: #888; text-align: right; } div.footer a { color: #888; } div.related { display: none; } div.sphinxsidebar a { color: #444; text-decoration: none; border-bottom: 1px dotted #999; } div.sphinxsidebar a:hover { border-bottom: 1px solid #999; } div.sphinxsidebar { font-size: 14px; line-height: 1.5; } div.sphinxsidebarwrapper { padding: 18px 10px; } div.sphinxsidebarwrapper p.logo { padding: 0 0 20px 0; margin: 0; text-align: center; } div.sphinxsidebar h3, div.sphinxsidebar h4 { font-family: 'Garamond', 'Georgia', serif; color: #444; font-size: 24px; font-weight: normal; margin: 0 0 5px 0; padding: 0; } div.sphinxsidebar h4 { font-size: 20px; } div.sphinxsidebar h3 a { color: #444; } div.sphinxsidebar p.logo a, div.sphinxsidebar h3 a, div.sphinxsidebar p.logo a:hover, div.sphinxsidebar h3 a:hover { border: none; } div.sphinxsidebar p { color: #555; margin: 10px 0; } div.sphinxsidebar ul { margin: 10px 0; padding: 0; color: #000; } div.sphinxsidebar input { border: 1px solid #ccc; font-family: 'Georgia', serif; font-size: 1em; } /* -- body styles ----------------------------------------------------------- */ a { color: #004B6B; text-decoration: underline; } a:hover { color: #6D4100; text-decoration: underline; } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; margin: 30px 0px 10px 0px; padding: 0; } {% if theme_index_logo %} div.indexwrapper h1 { text-indent: -999999px; background: url({{ theme_index_logo }}) no-repeat center center; height: {{ theme_index_logo_height }}; } {% endif %} div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } div.body h2 { font-size: 180%; } div.body h3 { font-size: 150%; } div.body h4 { font-size: 130%; } div.body h5 { font-size: 100%; } div.body h6 { font-size: 100%; } a.headerlink { color: #ddd; padding: 0 4px; text-decoration: none; } a.headerlink:hover { color: #444; background: #eaeaea; } div.body p, div.body dd, div.body li { line-height: 1.4em; } div.admonition { background: #fafafa; margin: 20px -30px; padding: 10px 30px; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; } div.admonition tt.xref, div.admonition a tt { border-bottom: 1px solid #fafafa; } dd div.admonition { margin-left: -60px; padding-left: 60px; } div.admonition p.admonition-title { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; font-size: 24px; margin: 0 0 10px 0; padding: 0; line-height: 1; } div.admonition p.last { margin-bottom: 0; } div.highlight { background-color: white; } dt:target, .highlight { background: #FAF3E8; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre, tt { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.9em; } img.screenshot { } tt.descname, tt.descclassname { font-size: 0.95em; } tt.descname { padding-right: 0.08em; } img.screenshot { -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils { border: 1px solid #888; -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils td, table.docutils th { border: 1px solid #888; padding: 0.25em 0.7em; } table.field-list, table.footnote { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } table.footnote { margin: 15px 0; width: 100%; border: 1px solid #eee; background: #fdfdfd; font-size: 0.9em; } table.footnote + table.footnote { margin-top: -15px; border-top: none; } table.field-list th { padding: 0 0.8em 0 0; } table.field-list td { padding: 0; } table.footnote td.label { width: 0px; padding: 0.3em 0 0.3em 0.5em; } table.footnote td { padding: 0.3em 0.5em; } dl { margin: 0; padding: 0; } dl dd { margin-left: 30px; } blockquote { margin: 0 0 0 30px; padding: 0; } ul, ol { margin: 10px 0 10px 30px; padding: 0; } pre { background: #eee; padding: 7px 30px; margin: 15px -30px; line-height: 1.3em; } dl pre, blockquote pre, li pre { margin-left: -60px; padding-left: 60px; } dl dl pre { margin-left: -90px; padding-left: 90px; } tt { background-color: #ecf0f3; color: #222; /* padding: 1px 2px; */ } tt.xref, a tt { background-color: #FBFBFB; border-bottom: 1px solid white; } a.reference { text-decoration: none; border-bottom: 1px dotted #004B6B; } a.reference:hover { border-bottom: 1px solid #6D4100; } a.footnote-reference { text-decoration: none; font-size: 0.7em; vertical-align: top; border-bottom: 1px dotted #004B6B; } a.footnote-reference:hover { border-bottom: 1px solid #6D4100; } a:hover tt { background: #EEE; } @media screen and (max-width: 870px) { div.sphinxsidebar { display: none; } div.document { width: 100%; } div.documentwrapper { margin-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; } div.bodywrapper { margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; } ul { margin-left: 0; } .document { width: auto; } .footer { width: auto; } .bodywrapper { margin: 0; } .footer { width: auto; } .github { display: none; } } @media screen and (max-width: 875px) { body { margin: 0; padding: 20px 30px; } div.documentwrapper { float: none; background: white; } div.sphinxsidebar { display: block; float: none; width: 102.5%; margin: 50px -30px -20px -30px; padding: 10px 20px; background: #333; color: white; } div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, div.sphinxsidebar h3 a { color: white; } div.sphinxsidebar a { color: #aaa; } div.sphinxsidebar p.logo { display: none; } div.document { width: 100%; margin: 0; } div.related { display: block; margin: 0; padding: 10px 0 20px 0; } div.related ul, div.related ul li { margin: 0; padding: 0; } div.footer { display: none; } div.bodywrapper { margin: 0; } div.body { min-height: 0; padding: 0; } .rtd_doc_footer { display: none; } .document { width: auto; } .footer { width: auto; } .footer { width: auto; } .github { display: none; } } /* scrollbars */ ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-button:start:decrement, ::-webkit-scrollbar-button:end:increment { display: block; height: 10px; } ::-webkit-scrollbar-button:vertical:increment { background-color: #fff; } ::-webkit-scrollbar-track-piece { background-color: #eee; -webkit-border-radius: 3px; } ::-webkit-scrollbar-thumb:vertical { height: 50px; background-color: #ccc; -webkit-border-radius: 3px; } ::-webkit-scrollbar-thumb:horizontal { width: 50px; background-color: #ccc; -webkit-border-radius: 3px; } /* misc. */ .revsys-inline { display: none!important; }Flask-FlatPages-0.6/docs/_themes/flask/relations.html0000644000175000001440000000111612466022143025377 0ustar playpauseandstopusers00000000000000

Related Topics

Flask-FlatPages-0.6/docs/_themes/flask/theme.conf0000644000175000001440000000024412466022143024463 0ustar playpauseandstopusers00000000000000[theme] inherit = basic stylesheet = flasky.css pygments_style = flask_theme_support.FlaskyStyle [options] index_logo = '' index_logo_height = 120px touch_icon = Flask-FlatPages-0.6/docs/_themes/flask/layout.html0000644000175000001440000000126512466022160024720 0ustar playpauseandstopusers00000000000000{%- extends "basic/layout.html" %} {%- block extrahead %} {{ super() }} {% if theme_touch_icon %} {% endif %} {% endblock %} {%- block relbar2 %}{% endblock %} {% block header %} {{ super() }} {% if pagename == 'index' %}
{% endif %} {% endblock %} {%- block footer %} {% if pagename == 'index' %}
{% endif %} {%- endblock %} Flask-FlatPages-0.6/docs/_themes/flask_small/0000755000175000001440000000000012466075304023711 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/_themes/flask_small/static/0000755000175000001440000000000012466075304025200 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/docs/_themes/flask_small/static/flasky.css_t0000644000175000001440000001100112466022143027510 0ustar playpauseandstopusers00000000000000/* * flasky.css_t * ~~~~~~~~~~~~ * * Sphinx stylesheet -- flasky theme based on nature theme. * * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: 'Georgia', serif; font-size: 17px; color: #000; background: white; margin: 0; padding: 0; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 40px auto 0 auto; width: 700px; } hr { border: 1px solid #B1B4B6; } div.body { background-color: #ffffff; color: #3E4349; padding: 0 30px 30px 30px; } img.floatingflask { padding: 0 0 10px 10px; float: right; } div.footer { text-align: right; color: #888; padding: 10px; font-size: 14px; width: 650px; margin: 0 auto 40px auto; } div.footer a { color: #888; text-decoration: underline; } div.related { line-height: 32px; color: #888; } div.related ul { padding: 0 0 0 10px; } div.related a { color: #444; } /* -- body styles ----------------------------------------------------------- */ a { color: #004B6B; text-decoration: underline; } a:hover { color: #6D4100; text-decoration: underline; } div.body { padding-bottom: 40px; /* saved for footer */ } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; margin: 30px 0px 10px 0px; padding: 0; } {% if theme_index_logo %} div.indexwrapper h1 { text-indent: -999999px; background: url({{ theme_index_logo }}) no-repeat center center; height: {{ theme_index_logo_height }}; } {% endif %} div.body h2 { font-size: 180%; } div.body h3 { font-size: 150%; } div.body h4 { font-size: 130%; } div.body h5 { font-size: 100%; } div.body h6 { font-size: 100%; } a.headerlink { color: white; padding: 0 4px; text-decoration: none; } a.headerlink:hover { color: #444; background: #eaeaea; } div.body p, div.body dd, div.body li { line-height: 1.4em; } div.admonition { background: #fafafa; margin: 20px -30px; padding: 10px 30px; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; } div.admonition p.admonition-title { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; font-size: 24px; margin: 0 0 10px 0; padding: 0; line-height: 1; } div.admonition p.last { margin-bottom: 0; } div.highlight{ background-color: white; } dt:target, .highlight { background: #FAF3E8; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } div.warning { background-color: #ffe4e4; border: 1px solid #f66; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre, tt { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.85em; } img.screenshot { } tt.descname, tt.descclassname { font-size: 0.95em; } tt.descname { padding-right: 0.08em; } img.screenshot { -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils { border: 1px solid #888; -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils td, table.docutils th { border: 1px solid #888; padding: 0.25em 0.7em; } table.field-list, table.footnote { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } table.footnote { margin: 15px 0; width: 100%; border: 1px solid #eee; } table.field-list th { padding: 0 0.8em 0 0; } table.field-list td { padding: 0; } table.footnote td { padding: 0.5em; } dl { margin: 0; padding: 0; } dl dd { margin-left: 30px; } pre { padding: 0; margin: 15px -30px; padding: 8px; line-height: 1.3em; padding: 7px 30px; background: #eee; border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; } dl pre { margin-left: -60px; padding-left: 60px; } tt { background-color: #ecf0f3; color: #222; /* padding: 1px 2px; */ } tt.xref, a tt { background-color: #FBFBFB; } a:hover tt { background: #EEE; } Flask-FlatPages-0.6/docs/_themes/flask_small/theme.conf0000644000175000001440000000027012466022143025652 0ustar playpauseandstopusers00000000000000[theme] inherit = basic stylesheet = flasky.css nosidebar = true pygments_style = flask_theme_support.FlaskyStyle [options] index_logo = '' index_logo_height = 120px github_fork = '' Flask-FlatPages-0.6/docs/_themes/flask_small/layout.html0000644000175000001440000000125312466022143026106 0ustar playpauseandstopusers00000000000000{% extends "basic/layout.html" %} {% block header %} {{ super() }} {% if pagename == 'index' %}
{% endif %} {% endblock %} {% block footer %} {% if pagename == 'index' %}
{% endif %} {% endblock %} {# do not display relbars #} {% block relbar1 %}{% endblock %} {% block relbar2 %} {% if theme_github_fork %} Fork me on GitHub {% endif %} {% endblock %} {% block sidebar1 %}{% endblock %} {% block sidebar2 %}{% endblock %} Flask-FlatPages-0.6/docs/_themes/flask_theme_support.py0000644000175000001440000001141312466022143026042 0ustar playpauseandstopusers00000000000000# flasky extensions. flasky pygments style based on tango style from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal class FlaskyStyle(Style): background_color = "#f8f8f8" default_style = "" styles = { # No corresponding class for the following: #Text: "", # class: '' Whitespace: "underline #f8f8f8", # class: 'w' Error: "#a40000 border:#ef2929", # class: 'err' Other: "#000000", # class 'x' Comment: "italic #8f5902", # class: 'c' Comment.Preproc: "noitalic", # class: 'cp' Keyword: "bold #004461", # class: 'k' Keyword.Constant: "bold #004461", # class: 'kc' Keyword.Declaration: "bold #004461", # class: 'kd' Keyword.Namespace: "bold #004461", # class: 'kn' Keyword.Pseudo: "bold #004461", # class: 'kp' Keyword.Reserved: "bold #004461", # class: 'kr' Keyword.Type: "bold #004461", # class: 'kt' Operator: "#582800", # class: 'o' Operator.Word: "bold #004461", # class: 'ow' - like keywords Punctuation: "bold #000000", # class: 'p' # because special names such as Name.Class, Name.Function, etc. # are not recognized as such later in the parsing, we choose them # to look the same as ordinary variables. Name: "#000000", # class: 'n' Name.Attribute: "#c4a000", # class: 'na' - to be revised Name.Builtin: "#004461", # class: 'nb' Name.Builtin.Pseudo: "#3465a4", # class: 'bp' Name.Class: "#000000", # class: 'nc' - to be revised Name.Constant: "#000000", # class: 'no' - to be revised Name.Decorator: "#888", # class: 'nd' - to be revised Name.Entity: "#ce5c00", # class: 'ni' Name.Exception: "bold #cc0000", # class: 'ne' Name.Function: "#000000", # class: 'nf' Name.Property: "#000000", # class: 'py' Name.Label: "#f57900", # class: 'nl' Name.Namespace: "#000000", # class: 'nn' - to be revised Name.Other: "#000000", # class: 'nx' Name.Tag: "bold #004461", # class: 'nt' - like a keyword Name.Variable: "#000000", # class: 'nv' - to be revised Name.Variable.Class: "#000000", # class: 'vc' - to be revised Name.Variable.Global: "#000000", # class: 'vg' - to be revised Name.Variable.Instance: "#000000", # class: 'vi' - to be revised Number: "#990000", # class: 'm' Literal: "#000000", # class: 'l' Literal.Date: "#000000", # class: 'ld' String: "#4e9a06", # class: 's' String.Backtick: "#4e9a06", # class: 'sb' String.Char: "#4e9a06", # class: 'sc' String.Doc: "italic #8f5902", # class: 'sd' - like a comment String.Double: "#4e9a06", # class: 's2' String.Escape: "#4e9a06", # class: 'se' String.Heredoc: "#4e9a06", # class: 'sh' String.Interpol: "#4e9a06", # class: 'si' String.Other: "#4e9a06", # class: 'sx' String.Regex: "#4e9a06", # class: 'sr' String.Single: "#4e9a06", # class: 's1' String.Symbol: "#4e9a06", # class: 'ss' Generic: "#000000", # class: 'g' Generic.Deleted: "#a40000", # class: 'gd' Generic.Emph: "italic #000000", # class: 'ge' Generic.Error: "#ef2929", # class: 'gr' Generic.Heading: "bold #000080", # class: 'gh' Generic.Inserted: "#00A000", # class: 'gi' Generic.Output: "#888", # class: 'go' Generic.Prompt: "#745334", # class: 'gp' Generic.Strong: "bold #000000", # class: 'gs' Generic.Subheading: "bold #800080", # class: 'gu' Generic.Traceback: "bold #a40000", # class: 'gt' } Flask-FlatPages-0.6/docs/_themes/LICENSE0000644000175000001440000000337512466022143022427 0ustar playpauseandstopusers00000000000000Copyright (c) 2010 by Armin Ronacher. Some rights reserved. Redistribution and use in source and binary forms of the theme, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. We kindly ask you to only use these themes in an unmodified manner just for Flask and Flask-related products, not for unrelated projects. If you like the visual style and want to use it for your own projects, please consider making some larger changes to the themes (such as changing font faces, sizes, colors or margins). THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Flask-FlatPages-0.6/docs/_themes/.git0000644000175000001440000000005012466022143022171 0ustar playpauseandstopusers00000000000000gitdir: ../../.git/modules/docs/_themes Flask-FlatPages-0.6/docs/_themes/README0000644000175000001440000000210512466022143022270 0ustar playpauseandstopusers00000000000000Flask Sphinx Styles =================== This repository contains sphinx styles for Flask and Flask related projects. To use this style in your Sphinx documentation, follow this guide: 1. put this folder as _themes into your docs folder. Alternatively you can also use git submodules to check out the contents there. 2. add this to your conf.py: sys.path.append(os.path.abspath('_themes')) html_theme_path = ['_themes'] html_theme = 'flask' The following themes exist: - 'flask' - the standard flask documentation theme for large projects - 'flask_small' - small one-page theme. Intended to be used by very small addon libraries for flask. The following options exist for the flask_small theme: [options] index_logo = '' filename of a picture in _static to be used as replacement for the h1 in the index.rst file. index_logo_height = 120px height of the index logo github_fork = '' repository name on github for the "fork me" badge Flask-FlatPages-0.6/docs/index.rst0000644000175000001440000002721112466074220021635 0ustar playpauseandstopusers00000000000000Flask-FlatPages =============== Flask-FlatPages provides a collection of pages to your `Flask`_ application. Pages are built from “flat” text files as opposed to a relational database. * Works on Python 2.6, 2.7 and 3.3+ * BSD licensed * Latest documentation `on Read the Docs`_ * Source, issues and pull requests `on Github`_ * Releases `on PyPI`_ .. _Flask: http://flask.pocoo.org/ .. _on Read the Docs: http://flask-flatpages.readthedocs.org/ .. _on Github: https://github.com/SimonSapin/Flask-FlatPages/ .. _on PyPI: http://pypi.python.org/pypi/Flask-FlatPages Installation ------------ Install the extension with `pip `_:: $ pip install Flask-FlatPages or you can get the `source code from github `_. Configuration ------------- To get started all you need to do is to instantiate a :class:`FlatPages` object after configuring the application:: from flask import Flask from flask_flatpages import FlatPages app = Flask(__name__) app.config.from_pyfile('mysettings.cfg') pages = FlatPages(app) you can also pass the Flask application object later, by calling :meth:`~.FlatPages.init_app`:: pages = FlatPages() def create_app(config='mysettings.cfg'): app = Flask(__name__) app.config.from_pyfile(config) pages.init_app(app) return app Flask-FlatPages accepts the following configuration values. All of them are optional. ``FLATPAGES_ROOT`` Path to the directory where to look for page files. If relative, interpreted as relative to the application root, next to the ``static`` and ``templates`` directories. Defaults to ``pages``. ``FLATPAGES_EXTENSION`` Filename extension for pages. Files in the ``FLATPAGES_ROOT`` directory without this suffix are ignored. Defaults to ``.html``. .. versionchanged:: 0.6 Support multiple file extensions via sequences, e.g.: ``['.htm', '.html']`` or via comma-separated strings: ``.htm,.html``. ``FLATPAGES_ENCODING`` Encoding of the pages files. Defaults to ``utf8``. ``FLATPAGES_HTML_RENDERER`` Callable or import string for a callable that takes at least the unicode body of a page, and return its HTML rendering as a unicode string. Defaults to :func:`~.pygmented_markdown`. .. versionchanged:: 0.5 Support for passing the :class:`~.FlatPages` instance as second argument. .. versionchanged:: 0.6 Support for passing the :class:`~.Page` instance as third argument. Renderer functions need to have at least one argument, the unicode body. The use of either :class:`~FlatPages` as second argument or :class:`~FlatPages` and :class:`Page` as second respective third argument is optional, and allows for more advanced renderers. ``FLATPAGES_MARKDOWN_EXTENSIONS`` .. versionadded:: 0.4 List of Markdown extensions to use with default HTML renderer. Defaults to ``['codehilite']``. For passing additional arguments to Markdown extension, e.g. in case of using footnotes extension, use next syntax: ``['footnotes(UNIQUE_IDS=True)']``. To disable line numbers in CodeHilite extension, which are enabled by default, use: ``['codehilite(linenums=False)']`` ``FLATPAGES_AUTO_RELOAD`` Wether to reload pages at each request. See :ref:`laziness-and-caching` for more details. The default is to reload in ``DEBUG`` mode only. Please note that multiple FlatPages instances can be configured by using a name for the FlatPages instance at initializaton time: .. code-block:: python flatpages = FlatPages(name="blog") To configure this instance, you must use modified configuration keys, by adding the uppercase name to the configuration variable names: ``FLATPAGES_BLOG_*`` How it works ------------ When first needed (see :ref:`laziness-and-caching` for more about this), the extension loads all pages from the filesystem: a :class:`Page` object is created for all files in ``FLATPAGES_ROOT`` whose name ends with ``FLATPAGES_EXTENSION``. Each of these objects is associated to a path: the slash-separated (whatever the OS) name of the file it was loaded from, relative to the pages root, and excluding the extension. For example, for an app in ``C:\myapp`` with the default configuration, the path for the ``C:\myapp\pages\lorem\ipsum.html`` is ``lorem/ipsum``. Each file is made of a `YAML`_ mapping of metadata, a blank line, and the page body:: title: Hello published: 2010-12-22 Hello, *World*! Lorem ipsum dolor sit amet, … The body format defaults to `Markdown`_ with `Pygments`_ baked in if available, but depends on the ``FLATPAGES_HTML_RENDERER`` configuration value. .. _YAML: http://www.yaml.org/ .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Pygments: http://pygments.org/ To use Pygments, you need to include the style declarations separately. You can get them with :func:`.pygments_style_defs`:: @app.route('/pygments.css') def pygments_css(): return pygments_style_defs('tango'), 200, {'Content-Type': 'text/css'} and in templates: .. code-block:: html+jinja Using custom Markdown extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 0.4 By default, Flask-FlatPages renders flatpage body using `Markdown`_ with `Pygments`_ format. This means passing ``['codehilite']`` extensions list to ``markdown.markdown`` function. But sometimes you need to customize things, like using another extension or disable default approach, this possible by passing special config. For example, using another extension:: FLATPAGES_MARKDOWN_EXTENSIONS = ['codehilite', 'headerid'] Or disabling default approach:: FLATPAGES_MARKDOWN_EXTENSIONS = [] Using custom HTML renderers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ As pointed above, by default Flask-FlatPages expects that flatpage body contains `Markdown`_ markup, so uses ``markdown.markdown`` function to render its content. But due to ``FLATPAGES_HTML_RENDERER`` setting you can specify different approach for rendering flatpage body. The most common necessity of using custom HTML renderer is modifyings default Markdown approach (e.g. by pre-rendering Markdown flatpages with Jinja), or using different markup for rendering flatpage body (e.g. ReStructuredText). Examples below introduce how to use custom renderers for those needs. Pre-rendering Markdown flatpages with Jinja ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: from flask import Flask, render_template_string from flask_flatpages import FlatPages from flask_flatpages.utils import pygmented_markdown def my_renderer(text): prerendered_body = render_template_string(text) return pygmented_markdown(prerendered_body) app = Flask(__name__) app.config['FLATPAGES_HTML_RENDERER'] = my_renderer pages = FlatPages(app) ReStructuredText flatpages ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. note:: For rendering ReStructuredText you need to add `docutils `_ to your project requirements. :: from docuitls.core import publish_parts from flask import Flask from flask_flatpages import FlatPages def rst_renderer(text): parts = publish_parts(source=text, writer_name='html') return parts['fragment'] app = Flask(__name__) app.config['FLATPAGES_HTML_RENDERER'] = rst_renderer pages = FlatPages(app) .. _laziness-and-caching: Laziness and caching -------------------- :class:`.FlatPages` does not hit the filesystem until needed but when it does, it reads all pages from the disk at once. Then, pages are not loaded again unless you explicitly ask for it with :meth:`.FlatPages.reload`, or on new requests depending on the configuration. (See ``FLATPAGES_AUTO_RELOAD``.) This design was decided with `Frozen-Flask`_ in mind but should work even if you don’t use it: you already restart your production server on code changes, you just have to do it on page content change too. This can make sense if the pages are deployed alongside the code in version control. .. _Frozen-Flask: http://packages.python.org/Frozen-Flask/ If you have many pages and loading takes a long time, you can force it at initialization time so that it’s done by the time the first request is served:: pages = FlatPages(app) pages.get('foo') # Force loading now. foo.html may not even exist. Loading everything every time may seem wasteful, but the impact is mitigated by caching: if a file’s modification time hasn’t changed, it is not read again and the previous :class:`.Page` object is re-used. Likewise, the YAML and Markdown parsing is both lazy and cached: not done until needed, and not done again if the file did not change. API --- .. module:: flask_flatpages .. autoclass:: FlatPages :members: init_app, get, get_or_404, __iter__, reload Example usage:: pages = FlatPages(app) @app.route('/') def index(): # Articles are pages with a publication date articles = (p for p in pages if 'published' in p.meta) # Show the 10 most recent articles, most recent first. latest = sorted(articles, reverse=True, key=lambda p: p.meta['published']) return render_template('articles.html', articles=latest[:10]) @app.route('//') def page(path): page = pages.get_or_404(path) template = page.meta.get('template', 'flatpage.html') return render_template(template, page=page) .. autoclass:: Page() :members: With the ``hello.html`` page defined earlier:: # hello.html title: Hello published: 2010-12-22 Hello, *World*! Lorem ipsum dolor sit amet, … :: >>> page = pages.get('hello') >>> page.meta # PyYAML converts YYYY-MM-DD to a date object {'title': u'Hello', 'published': datetime.date(2010, 12, 22)} >>> page['title'] u'Hello' >>> page.body u'Hello, *World*!\n\nLorem ipsum dolor sit amet, \u2026' >>> page.html u'

Hello, World!

\n

Lorem ipsum dolor sit amet, \u2026

' .. automethod:: __getitem__ .. automethod:: __html__ .. autofunction:: pygmented_markdown .. autofunction:: pygments_style_defs Changelog --------- Version 0.6 ~~~~~~~~~~~ Released on 2015-02-09 * Python 3 support. * Allow multiple file extensions for FlatPages. * The renderer function now optionally takes a third argument, namely the :class:`Page` instance. * It is now possible to instantiate multiple instances of :class:`FlatPages` with different configurations. This is done by specifying an additional parameter ``name`` to the initializer and adding the same name in uppercase to the respective Flask configuration settings. Version 0.5 ~~~~~~~~~~~ Released on 2013-04-02 * Change behavior of passing ``FLATPAGES_MARKDOWN_EXTENSIONS`` to renderer function, now the :class:`FlatPages` instance is optionally passed as second argument. This allows more robust renderer functions. Version 0.4 ~~~~~~~~~~~ Released on 2013-04-01 * Add ``FLATPAGES_MARKDOWN_EXTENSIONS`` config to setup list of Markdown extensions to use with default HTML renderer. * Fix a bug with non-ASCII filenames. Version 0.3 ~~~~~~~~~~~ Released on 2012-07-03 * Add :meth:`.FlatPages.init_app` * Do not use namespace packages anymore: rename the package from ``flaskext.flatpages`` to ``flask_flatpages`` * Add configuration files for testing with tox and Travis. Version 0.2 ~~~~~~~~~~~ Released on 2011-06-02 Bugfix and cosmetic release. Tests are now installed alongside the code. Version 0.1 ~~~~~~~~~~~ Released on 2011-02-06. First public release. Flask-FlatPages-0.6/README.rst0000644000175000001440000000152212466024442020531 0ustar playpauseandstopusers00000000000000=============== Flask-FlatPages =============== .. image:: https://secure.travis-ci.org/SimonSapin/Flask-FlatPages.png?branch=master :target: https://travis-ci.org/SimonSapin/Flask-FlatPages .. image:: https://pypip.in/v/Flask-FlatPages/badge.png :target: https://pypi.python.org/pypi/Flask-FlatPages Provides flat static pages to a Flask_ application, based on text files as opposed to a relational database. * Works on Python 2.6, 2.7 and 3.3+ * BSD licensed * Latest documentation `on Read the Docs`_ * Source, issues and pull requests `on Github`_ * Releases `on PyPI`_ * Install with ``pip install Flask-FlatPages`` .. _Flask: http://flask.pocoo.org/ .. _on Read the Docs: http://flask-flatpages.readthedocs.org/ .. _on Github: https://github.com/SimonSapin/Flask-FlatPages/ .. _on PyPI: http://pypi.python.org/pypi/Flask-FlatPages Flask-FlatPages-0.6/PKG-INFO0000644000175000001440000000376612466075304020156 0ustar playpauseandstopusers00000000000000Metadata-Version: 1.1 Name: Flask-FlatPages Version: 0.6 Summary: Provides flat static pages to a Flask application Home-page: https://github.com/SimonSapin/Flask-FlatPages Author: Simon Sapin Author-email: simon.sapin@exyr.org License: BSD Description: =============== Flask-FlatPages =============== .. image:: https://secure.travis-ci.org/SimonSapin/Flask-FlatPages.png?branch=master :target: https://travis-ci.org/SimonSapin/Flask-FlatPages .. image:: https://pypip.in/v/Flask-FlatPages/badge.png :target: https://pypi.python.org/pypi/Flask-FlatPages Provides flat static pages to a Flask_ application, based on text files as opposed to a relational database. * Works on Python 2.6, 2.7 and 3.3+ * BSD licensed * Latest documentation `on Read the Docs`_ * Source, issues and pull requests `on Github`_ * Releases `on PyPI`_ * Install with ``pip install Flask-FlatPages`` .. _Flask: http://flask.pocoo.org/ .. _on Read the Docs: http://flask-flatpages.readthedocs.org/ .. _on Github: https://github.com/SimonSapin/Flask-FlatPages/ .. _on PyPI: http://pypi.python.org/pypi/Flask-FlatPages Platform: any Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: PyPy Flask-FlatPages-0.6/LICENSE0000644000175000001440000000302312273464703020051 0ustar playpauseandstopusers00000000000000Copyright (c) 2010-2014 by Simon Sapin, 2013-2014 by Igor Davydenko. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Flask-FlatPages-0.6/flask_flatpages/0000755000175000001440000000000012466075304022173 5ustar playpauseandstopusers00000000000000Flask-FlatPages-0.6/flask_flatpages/page.py0000644000175000001440000000417312304664112023456 0ustar playpauseandstopusers00000000000000""" ==================== flask_flatpages.page ==================== Define flatpage instance. """ import yaml from werkzeug.utils import cached_property class Page(object): """Simple class to store all necessary information about a flatpage. Main purpose is to render the page's content with a ``html_renderer`` function. """ def __init__(self, path, meta, body, html_renderer): """ Initialize Page instance. :param path: Page path. :param meta: Page meta data in YAML format. :param body: Page body. :param html_renderer: HTML renderer function. """ #: Path this page was obtained from, as in ``pages.get(path)`` self.path = path #: Content of the page self._meta = meta self.body = body #: Renderer function self.html_renderer = html_renderer def __getitem__(self, name): """Shortcut for accessing metadata. ``page['title']`` or, in a template, ``{{ page.title }}`` are equivalent to ``page.meta['title']``. """ return self.meta[name] def __html__(self): """In a template, ``{{ page }}`` is equivalent to ``{{ page.html|safe }}``. """ return self.html def __repr__(self): """Machine representation of :class:`Page` instance. """ return '' % self.path @cached_property def html(self): """The content of the page, rendered as HTML by the configured renderer. """ return self.html_renderer(self) @cached_property def meta(self): """A dict of metadata parsed as YAML from the header of the file. """ meta = yaml.safe_load(self._meta) # YAML documents can be any type but we want a dict # eg. yaml.safe_load('') -> None # yaml.safe_load('- 1\n- a') -> [1, 'a'] if not meta: return {} if not isinstance(meta, dict): raise ValueError("Excpected a dict in metadata for '{0}', got {1}". format(self.path, type(meta).__name__)) return meta Flask-FlatPages-0.6/flask_flatpages/utils.py0000644000175000001440000000361512304664112023702 0ustar playpauseandstopusers00000000000000""" ===================== flask_flatpages.utils ===================== Utility functions to render Markdown text to HTML. """ import markdown from . import compat from .imports import PygmentsHtmlFormatter def force_unicode(value, encoding='utf-8', errors='strict'): """ Convert bytes or any other Python instance to string. """ if isinstance(value, compat.text_type): return value return value.decode(encoding, errors) def pygmented_markdown(text, flatpages=None): """Render Markdown text to HTML. Uses the `CodeHilite`_ extension only if `Pygments`_ is available. If `Pygments`_ is not available, "codehilite" is removed from list of extensions. If you need other extensions, set them up using the ``FLATPAGES_MARKDOWN_EXTENSIONS`` setting, which should be a sequence of strings. .. _CodeHilite: http://www.freewisdom.org/projects/python-markdown/CodeHilite .. _Pygments: http://pygments.org/ """ extensions = flatpages.config('markdown_extensions') if flatpages else [] if PygmentsHtmlFormatter is None: original_extensions = extensions extensions = [] for extension in original_extensions: if extension.startswith('codehilite'): continue extensions.append(extension) elif not extensions: extensions = ['codehilite'] return markdown.markdown(text, extensions) def pygments_style_defs(style='default'): """:return: the CSS definitions for the `CodeHilite`_ Markdown plugin. :param style: The Pygments `style`_ to use. Only available if `Pygments`_ is. .. _CodeHilite: http://www.freewisdom.org/projects/python-markdown/CodeHilite .. _Pygments: http://pygments.org/ .. _style: http://pygments.org/docs/styles/ """ formatter = PygmentsHtmlFormatter(style=style) return formatter.get_style_defs('.codehilite') Flask-FlatPages-0.6/flask_flatpages/imports.py0000644000175000001440000000035512273474236024250 0ustar playpauseandstopusers00000000000000""" ======================= flask_flatpages.imports ======================= Conditional imports. """ try: from pygments.formatters import HtmlFormatter as PygmentsHtmlFormatter except ImportError: PygmentsHtmlFormatter = None Flask-FlatPages-0.6/flask_flatpages/__init__.py0000644000175000001440000000103512466074252024304 0ustar playpauseandstopusers00000000000000""" =============== flask_flatpages =============== Flask-FlatPages provides a collection of pages to your Flask application. Pages are built from "flat" text files as opposed to a relational database. :copyright: (c) 2010-2015 by Simon Sapin, 2013-2015 by Igor Davydenko. :license: BSD, see LICENSE for more details. """ from .flatpages import FlatPages # noqa from .page import Page # noqa from .utils import pygmented_markdown, pygments_style_defs # noqa __author__ = 'Simon Sapin' __license__ = 'BSD License' __version__ = '0.6' Flask-FlatPages-0.6/flask_flatpages/flatpages.py0000644000175000001440000002435112466072065024521 0ustar playpauseandstopusers00000000000000""" ========================= flask_flatpages.flatpages ========================= Flatpages extension. """ import operator import os from inspect import getargspec from itertools import takewhile from flask import abort from werkzeug.utils import cached_property, import_string from . import compat from .page import Page from .utils import force_unicode, pygmented_markdown class FlatPages(object): """A collection of :class:`Page` objects. """ #: Default configuration for FlatPages extension default_config = ( ('root', 'pages'), ('extension', '.html'), ('encoding', 'utf-8'), ('html_renderer', pygmented_markdown), ('markdown_extensions', ['codehilite']), ('auto_reload', 'if debug'), ) def __init__(self, app=None, name=None): """Initialize FlatPages extension. :param app: Your application. Can be omitted if you call :meth:`init_app` later. :type app: A :class:`~flask.Flask` instance :param name: The name for this FlatPages instance. Used for looking up config values using 'FLATPAGES_%s_%s' % (name.upper(), key) By default, no name is used, so configuration is done by specifying config values using 'FLATPAGES_%s' % (key) Typically, you only need to set this parameter if you want to use multiple :class:`FlatPages instances within the same Flask application. :type name: string .. versionchanged:: 0.6 New parameter `name` to support multiple FlatPages instances. """ self.name = name if name is None: self.config_prefix = 'FLATPAGES' else: self.config_prefix = '_'.join(('FLATPAGES', name.upper())) #: dict of filename: (page object, mtime when loaded) self._file_cache = {} if app: self.init_app(app) def __iter__(self): """Iterate on all :class:`Page` objects. """ return compat.itervalues(self._pages) def config(self, key): """Read actual configuration from Flask application config. :param key: Lowercase config key from :attr:`default_config` tuple """ return self.app.config['_'.join((self.config_prefix, key.upper()))] def get(self, path, default=None): """Returns the :class:`Page` object at ``path``, or ``default`` if there is no such page. """ # This may trigger the property. Do it outside of the try block. pages = self._pages try: return pages[path] except KeyError: return default def get_or_404(self, path): """Returns the :class:`Page` object at ``path``, or raise Flask's 404 error if there is no such page. """ page = self.get(path) if not page: abort(404) return page def init_app(self, app): """Used to initialize an application, useful for passing an app later and app factory patterns. :param app: your application :type app: a :class:`~flask.Flask` instance """ # Store default config to application for key, value in self.default_config: config_key = '_'.join((self.config_prefix, key.upper())) app.config.setdefault(config_key, value) # Register function to forget all pages if necessary app.before_request(self._conditional_auto_reset) # And finally store application to current instance and current # instance to application if 'flatpages' not in app.extensions: app.extensions['flatpages'] = {} app.extensions['flatpages'][self.name] = self self.app = app def reload(self): """Forget all pages. All pages will be reloaded next time they're accessed. """ try: # This will "unshadow" the cached_property. # The property will be re-executed on next access. del self.__dict__['_pages'] except KeyError: pass @property def root(self): """Full path to the directory where pages are looked for. This corresponds to the `FLATPAGES_%(name)s_ROOT` config value, interpreted as relative to the app's root directory. """ root_dir = os.path.join(self.app.root_path, self.config('root')) return force_unicode(root_dir) def _conditional_auto_reset(self): """Reset if configured to do so on new requests. """ auto = self.config('auto_reload') if auto == 'if debug': auto = self.app.debug if auto: self.reload() def _load_file(self, path, filename): """Load file from file system and put it to cached dict as :class:`Path` and `mtime` tuple. """ mtime = os.path.getmtime(filename) cached = self._file_cache.get(filename) if cached and cached[1] == mtime: page = cached[0] else: encoding = self.config('encoding') if compat.IS_PY3: with open(filename, encoding=encoding) as handler: content = handler.read() else: with open(filename) as handler: content = handler.read().decode(encoding) page = self._parse(content, path) self._file_cache[filename] = (page, mtime) return page @cached_property def _pages(self): """Walk the page root directory an return a dict of unicode path: page object. """ def _walker(): """ Walk over directory and find all possible flatpages, i.e. files which end with the string or sequence given by ``FLATPAGES_%(name)s_EXTENSION``. """ for cur_path, _, filenames in os.walk(self.root): rel_path = cur_path.replace(self.root, '').lstrip(os.sep) path_prefix = tuple(rel_path.split(os.sep)) if rel_path else () for name in filenames: if not name.endswith(extension): continue full_name = os.path.join(cur_path, name) name_without_extension = [name[:-len(item)] for item in extension if name.endswith(item)][0] path = u'/'.join(path_prefix + (name_without_extension, )) yield (path, full_name) # Read extension from config extension = self.config('extension') # Support for multiple extensions if isinstance(extension, compat.string_types): if ',' in extension: extension = tuple(extension.split(',')) else: extension = (extension, ) elif isinstance(extension, (list, set)): extension = tuple(extension) # FlatPage extension should be a string or a sequence if not isinstance(extension, tuple): raise ValueError( 'Invalid value for FlatPages extension. Should be a string or ' 'a sequence, got {0} instead: {1}'. format(type(extension).__name__, extension) ) return dict([(path, self._load_file(path, full_name)) for path, full_name in _walker()]) def _parse(self, content, path): """Parse a flatpage file, i.e. read and parse its meta data and body. :return: initialized :class:`Page` instance. """ lines = iter(content.split('\n')) # Read lines until an empty line is encountered. meta = '\n'.join(takewhile(operator.methodcaller('strip'), lines)) # The rest is the content. `lines` is an iterator so it continues # where `itertools.takewhile` left it. content = '\n'.join(lines) # Now we ready to get HTML renderer function html_renderer = self.config('html_renderer') # If function is not callable yet, import it if not callable(html_renderer): html_renderer = import_string(html_renderer) # Make able to pass custom arguments to renderer function html_renderer = self._smart_html_renderer(html_renderer) # Initialize and return Page instance return Page(path, meta, content, html_renderer) def _smart_html_renderer(self, html_renderer): """This wraps the rendering function in order to allow the use of rendering functions with differing signatures. We stay backwards compatible by using reflection, i.e. we inspect the given rendering function's signature in order to find out how many arguments the function takes. .. versionchanged:: 0.6 Support for HTML renderer functions with signature ``f(body, flatpages, page)``, where ``page`` is an instance of :class:`Page`. .. versionchanged:: 0.5 Support for HTML renderer functions with signature ``f(body, flatpages)``, where ``flatpages`` is an instance of :class:`FlatPages`. """ def wrapper(page): """Simple wrapper to inspect the HTML renderer function and pass arguments to it based on the number of arguments. * 1 argument -> page body * 2 arguments -> page body, flatpages instance * 3 arguments -> page body, flatpages instance, page instance """ body = page.body try: args_length = len(getargspec(html_renderer).args) except TypeError: return html_renderer(body) if args_length == 1: return html_renderer(body) elif args_length == 2: return html_renderer(body, self) elif args_length == 3: return html_renderer(body, self, page) raise ValueError( 'HTML renderer function {0!r} not supported by ' 'Flask-FlatPages, wrong number of arguments: {1}.'. format(html_renderer, args_length) ) return wrapper Flask-FlatPages-0.6/flask_flatpages/compat.py0000644000175000001440000000064412466067155024041 0ustar playpauseandstopusers00000000000000""" ====================== flask_flatpages.compat ====================== Compatibility module for supporting both Python 2 and Python 3. """ import sys IS_PY3 = sys.version_info[0] == 3 string_types = (str, ) if IS_PY3 else (basestring, ) # noqa text_type = str if IS_PY3 else unicode # noqa def itervalues(obj): """Iterate over dict values.""" return iter(obj.values()) if IS_PY3 else obj.itervalues()