Commits

Artur Barseghyan committed aa59ff0 Draft

docs update

Comments (0)

Files changed (7)

 # -*- coding: utf-8 -*-
 #
-# tld documentation build configuration file, created by
+# eximagination documentation build configuration file, created by
 # sphinx-quickstart on Sun May 12 18:40:37 2013.
 #
 # This file is execfile()d with the current directory set to its containing dir.
 master_doc = 'index'
 
 # General information about the project.
-project = u'tld'
+project = u'eximagination'
 copyright = u'2013, Artur Barseghyan <artur.barseghyan@gmail.com>'
 
 # The version info for the project you're documenting, acts as replacement for
 #html_file_suffix = None
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = 'tlddoc'
+htmlhelp_basename = 'eximagination'
 
 
 # -- Options for LaTeX output --------------------------------------------------
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, documentclass [howto/manual]).
 latex_documents = [
-  ('index', 'tld.tex', u'tld Documentation',
+  ('index', 'eximagination.tex', u'eximagination Documentation',
    u'Artur Barseghyan \\textless{}artur.barseghyan@gmail.com\\textgreater{}', 'manual'),
 ]
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'tld', u'tld Documentation',
+    ('index', 'eximagination', u'eximagination Documentation',
      [u'Artur Barseghyan <artur.barseghyan@gmail.com>'], 1)
 ]
 
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-  ('index', 'tld', u'tld Documentation',
-   u'Artur Barseghyan <artur.barseghyan@gmail.com>', 'tld', 'One line description of project.',
+  ('index', 'eximagination', u'eximagination Documentation',
+   u'Artur Barseghyan <artur.barseghyan@gmail.com>', 'eximagination', 'One line description of project.',
    'Miscellaneous'),
 ]
 
 # -- Options for Epub output ---------------------------------------------------
 
 # Bibliographic Dublin Core info.
-epub_title = u'tld'
+epub_title = u'eximagination'
 epub_author = u'Artur Barseghyan <artur.barseghyan@gmail.com>'
 epub_publisher = u'Artur Barseghyan <artur.barseghyan@gmail.com>'
 epub_copyright = u'2013, Artur Barseghyan <artur.barseghyan@gmail.com>'

docs/eximagination.rst

-eximagination Package
-=====================
-
-:mod:`conf` Module
-------------------
-
-.. automodule:: eximagination.conf
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-:mod:`defaults` Module
-----------------------
-
-.. automodule:: eximagination.defaults
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-:mod:`utils` Module
--------------------
-
-.. automodule:: eximagination.utils
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-Subpackages
------------
-
-.. toctree::
-
-    eximagination.templatetags
-

docs/eximagination.templatetags.rst

-templatetags Package
-====================
-
-:mod:`eximaginate` Module
--------------------------
-
-.. automodule:: eximagination.templatetags.eximaginate
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-.. tld documentation master file, created by
-   sphinx-quickstart on Sun May 12 18:40:37 2013.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
+eximagination Package
+=====================
+A Django template tag library which allows downloading of external images right from the template and save it into a
+desired context variable along with `width` and `height` of the image fetched. Caches the fetched images locally.
 
-Welcome to tld's documentation!
-===============================
+:mod:`eximaginate` Module
+-------------------------
 
-Contents:
+.. automodule:: eximagination.templatetags.eximaginate
+    :members:
+    :show-inheritance:
 
-.. toctree::
-   :maxdepth: 20
+:mod:`conf` Module
+------------------
 
-   eximagination
-
+.. automodule:: eximagination.conf
+    :members:
+    :show-inheritance:
 
 Indices and tables
 ==================

src/eximagination/conf.py

     Get a setting from eximagination conf module, falling back to the default.
 
     If override is not None, it will be used instead of the setting.
+
+    There are some app settings you may want to override. You can override any of the following default settings in
+    your project settings module:
+
+        `MEDIA_ROOT`
+
+        `MEDIA_URL`
+
+        `MEDIA_RELATIVE_ROOT`
+
+    :param str setting: Name of the setting.
+    :param override: Default value
+    :return: Desired setting value
+
+    :example:
+    >>> from eximagination.conf import get_setting
+    >>> MEDIA_ROOT = get_setting('MEDIA_ROOT')
     """
     if override is not None:
         return override

src/eximagination/defaults.py

 PROJECT_DIR = lambda base : os.path.join(os.path.dirname(__file__), base).replace('\\','/')
 
 DEBUG = False
-MEDIA_ROOT = PROJECT_DIR('media/external_images')
-MEDIA_URL = '/media/external_images/'
-MEDIA_RELATIVE_ROOT = 'external_images/'
+MEDIA_ROOT = PROJECT_DIR('media/external_images') # Where eximagination cached images will be stored
+MEDIA_URL = '/media/external_images/' # Media URL for stored images
+MEDIA_RELATIVE_ROOT = 'external_images/' # Relative root for images

src/eximagination/templatetags/eximaginate.py

 MEDIA_RELATIVE_ROOT = get_setting('MEDIA_RELATIVE_ROOT')
 
 class EximaginateNode(template.Node):
+    """
+
+    """
     def __init__(self, source_var, force_update, context_name):
         self.source_var = template.Variable(source_var)
         self.force_update = bool(force_update)
 
     To just output the absolute url to the thumbnail::
 
+        {% load eximaginate %}
+
         {% eximaginate 'http://www.google.com/intl/en/images/logo.gif' %}
 
     To put the the downloaded image URL on the context instead of just rendering
     the relative url, finish the tag with ``as [context_var_name]``::
 
+        {% load eximaginate thumbnail %}
+
         {% eximaginate 'http://www.google.com/intl/en/images/logo.gif' as original %}
 
+        {% thumbnail original 100x100 %}
+
     Eximagination will automatically add "ei_width" and "ei_height" variables to the content - those are the original
     width and height values of the obtained image.