Flask-AutoIndex-0.5/docs/_themes/flask/layout.html 0000644 0001750 0001750 00000001106 11436747640 022765 0 ustar sublee sublee 0000000 0000000 {%- extends "basic/layout.html" %}
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
{% endif %}
{% endblock %}
{%- block relbar2 %}{% endblock %}
{%- block footer %}
{%- endblock %}
Flask-AutoIndex-0.5/docs/_themes/flask/theme.conf 0000644 0001750 0001750 00000000172 11436747640 022535 0 ustar sublee sublee 0000000 0000000 [theme]
inherit = basic
stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
touch_icon =
Flask-AutoIndex-0.5/docs/_themes/README 0000644 0001750 0001750 00000002105 11436747640 020342 0 ustar sublee sublee 0000000 0000000 Flask 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-AutoIndex-0.5/docs/index.rst 0000664 0001750 0001750 00000011602 12123622634 017670 0 ustar sublee sublee 0000000 0000000 Flask-AutoIndex
~~~~~~~~~~~~~~~
.. module:: flask_autoindex
Flask-AutoIndex generates an index page for your `Flask`_ application
automatically. The result just like `mod_autoindex`_, but the look is more
awesome! Look at this:
.. figure:: _static/example.png
:alt: The screenshot of index page generated by Flask-AutoIndex
This module contains pre-designed template and css file. It is default
style, but you can make your own style.
.. _Flask: http://flask.pocoo.org/
.. _mod_autoindex: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
Installation
============
Install Flask-AutoIndex with ``easy_install`` or ``pip`` command::
$ easy_install Flask-AutoIndex
::
$ pip install Flask-AutoIndex
or check out development version::
$ git clone git://github.com/sublee/flask-autoindex.git
How to Use
==========
Flask-AutoIndex is easy and extensible. It supports flask application.
We will make the application in flask application. There is a basic usage::
import os.path
from flask import Flask
from flask.ext.autoindex import AutoIndex
app = Flask(__name__)
AutoIndex(app, browse_root=os.path.curdir)
if __name__ == '__main__':
app.run()
After running the application, ``http://localhost/`` serves a generated index
page which contains the file and directory list in current directory.
Customizing
===========
Routing a specified URL
```````````````````````
Just like a nomal flask application or module. Follow the below example::
@app.route('/helloworld')
def helloworld():
return 'Hello, world!', 200
``http://localhost/helloworld`` will serve ``Hello, world!`` not
``/helloworld`` directory.
Adding an icon rule
```````````````````
If you want to present ``*.feed`` files with ``rss.png`` icon and present
a directory named ``picture`` with ``folder_picture.png`` icon, follow the
below example::
idx.add_icon_rule('rss.png', ext='feed')
idx.add_icon_rule('folder_picture.png', dirname='pictures')
You can change the root directory's icon to your own icon::
idx.add_icon_rule('http://example.org/favicon.ico', cls=RootDirectory)
Also you can add the more complex rule with a function::
import re
def is_flaskext(ent):
return isinstance(ent, Directory) and re.match('[Ff]lask-', ent.name)
idx.add_icon_rule('http://example.org/flask-extenstion.png', is_flaskext)
Here is a nice example for changing directory's icon to its ``favicon.ico``
file if it exists::
def get_favicon(ent):
favicon = 'favicon.ico'
if type(ent) is Directory and favicon in ent:
return '/' + os.path.join(ent.path, favicon)
return False
idx.add_icon_rule(get_favicon)
.. seealso:: :meth:`AutoIndex.add_icon_rule`
Changing Silk's path
````````````````````
:class:`AutoIndex` has ``**silk_options`` keyword arguments for :class:`Silk`.
If you want to use the another path for serving silk icons, use ``silk_path``
keyword argument::
idx = AutoIndex(app, silk_path='/myicons')
Now you can get a silk icon from ``http://localhost/myicons/folder.png`` not
``http://localhost/__icons__/folder.png``.
.. seealso::
The documentation for `Flask-Silk `_
Redesigning the template
````````````````````````
:meth:`AutoIndex.render_autoindex` finds the template from the application's
template directory first. When you made the ``autoindex.html`` to the
application's template directory, :meth:`AutoIndex.render_autoindex` renders
your template::
- myapplication
- templates
- autoindex.html
- __init__.py
- views.py
Your templates could extend the default Flask-AutoIndex's template, it named
``__autoindex__/autoindex.html``. Here is a basic example:
.. sourcecode:: jinja
{% extends '__autoindex__/autoindex.html' %}
{% block meta %}
{{ super() }}
{% endblock %}
{% block header %}
My Application
{% endblock %}
{% block footer %}
{% endblock %}
API
===
Configuration
`````````````
.. autoclass:: AutoIndex
:members:
Models
``````
.. autoclass:: Entry
:members:
.. autoclass:: File
:members:
.. autoclass:: Directory
:members:
.. autoclass:: RootDirectory
:members:
Template
````````
Blocks
------
`meta`
The innerHTML of ````.
`header`
The top of ````.
`table`
The table for the entry list.
`footer`
The bottom of ````.
Variables
---------
`curdir`
The current directory object.
`entries`
The child entry list of ``curdir``.
`sort_by`
The sorting key.
`order`
Ascending order(``1``) or Descending order(``-1``).
`endpoint`
The endpoint which renders a generated page.
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Flask-AutoIndex-0.5/docs/_static/ 0000775 0001750 0001750 00000000000 12124040374 017451 5 ustar sublee sublee 0000000 0000000 Flask-AutoIndex-0.5/docs/_static/example.png 0000644 0001750 0001750 00000060126 11437371571 021631 0 ustar sublee sublee 0000000 0000000 PNG
IHDR } jS' tEXtSoftware Adobe ImageReadyqe<