├── docs ├── build │ └── empty ├── source │ ├── _static │ │ └── empty │ ├── _templates │ │ └── empty │ ├── api.rst │ ├── index.rst │ ├── quickstart.rst │ ├── rst_guide.rst │ └── conf.py ├── requirements.txt └── Makefile ├── yaturbo ├── models.py ├── apps.py ├── tests │ ├── conftest.py │ └── test_basic.py ├── __init__.py ├── settings.py └── toolbox.py ├── pytest.ini ├── setup.cfg ├── .coveragerc ├── .gitignore ├── AUTHORS ├── MANIFEST.in ├── tox.ini ├── INSTALL ├── CONTRIBUTING ├── CHANGELOG ├── .github └── workflows │ └── python-package.yml ├── LICENSE ├── README.rst └── setup.py /docs/build/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /yaturbo/models.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/_static/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/_templates/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | django 2 | bleach -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --pyargs yaturbo 3 | -------------------------------------------------------------------------------- /docs/source/api.rst: -------------------------------------------------------------------------------- 1 | API 2 | === 3 | 4 | .. automodule:: yaturbo.toolbox 5 | :members: 6 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | release = clean --all sdist bdist_wheel upload 3 | test = pytest 4 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | include = yaturbo/* 3 | omit = yaturbo/migrations/*, yaturbo/tests/* 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .pydevproject 3 | .idea 4 | .tox 5 | __pycache__ 6 | *.pyc 7 | *.pyo 8 | *.egg-info 9 | docs/_build/ 10 | 11 | -------------------------------------------------------------------------------- /yaturbo/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | from django.utils.translation import gettext_lazy as _ 3 | 4 | 5 | class YaturboConfig(AppConfig): 6 | """Application configuration.""" 7 | 8 | name = 'yaturbo' 9 | verbose_name = _('Yandex Turbo Pages') 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | django-yaturbo authors 2 | ====================== 3 | 4 | Created by Igor `idle sign` Starikov. 5 | 6 | 7 | Contributors 8 | ------------ 9 | 10 | Here could be your name. 11 | 12 | 13 | 14 | Translators 15 | ----------- 16 | 17 | Here could be your name. 18 | 19 | -------------------------------------------------------------------------------- /yaturbo/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from pytest_djangoapp import configure_djangoapp_plugin 5 | 6 | 7 | pytest_plugins = configure_djangoapp_plugin({ 8 | 'INSTALLED_APPS': ['django.contrib.sites'], 9 | 'SITE_ID': 1, 10 | }) 11 | -------------------------------------------------------------------------------- /yaturbo/__init__.py: -------------------------------------------------------------------------------- 1 | from .toolbox import YandexTurboFeed, sanitize_turbo 2 | 3 | 4 | VERSION = (1, 0, 1) 5 | """Application version number tuple.""" 6 | 7 | VERSION_STR = '.'.join(map(str, VERSION)) 8 | """Application version number string.""" 9 | 10 | 11 | default_app_config = 'yaturbo.apps.YaturboConfig' -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include CHANGELOG 3 | include INSTALL 4 | include LICENSE 5 | include README.rst 6 | 7 | include docs/Makefile 8 | recursive-include docs *.rst 9 | recursive-include docs *.py 10 | recursive-include tests * 11 | 12 | recursive-include yaturbo/locale * 13 | recursive-include yaturbo/tests * 14 | recursive-include yaturbo/migrations *.py 15 | recursive-include yaturbo/templates *.html 16 | recursive-include yaturbo/templatetags *.py 17 | recursive-include yaturbo/management *.py 18 | 19 | recursive-exclude * __pycache__ 20 | recursive-exclude * *.py[co] 21 | recursive-exclude * empty 22 | 23 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # See http://tox.readthedocs.org/en/latest/examples.html for samples. 2 | [tox] 3 | envlist = 4 | py{36}-django{20,21,22,30,31,32} 5 | py{37,38,39,310}-django{20,21,22,30,31,32,40} 6 | 7 | skip_missing_interpreters = True 8 | 9 | install_command = pip install {opts} {packages} 10 | 11 | [testenv] 12 | commands = 13 | python setup.py test 14 | 15 | deps = 16 | django20: Django>=2.0,<2.1 17 | django21: Django>=2.1,<2.2 18 | django22: Django>=2.2,<2.3 19 | django30: Django>=3.0,<3.1 20 | django31: Django>=3.1,<3.2 21 | django32: Django>=3.2,<3.3 22 | django40: Django>=4.0,<4.1 23 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | django-yaturbo installation 2 | =========================== 3 | 4 | 5 | Python ``pip`` package is required to install ``django-yaturbo``. 6 | 7 | 8 | From sources 9 | ------------ 10 | 11 | Use the following command line to install ``django-yaturbo`` from sources directory (containing setup.py): 12 | 13 | pip install . 14 | 15 | or 16 | 17 | python setup.py install 18 | 19 | 20 | From PyPI 21 | --------- 22 | 23 | Alternatively you can install ``django-yaturbo`` from PyPI: 24 | 25 | pip install django-yaturbo 26 | 27 | 28 | Use `-U` flag for upgrade: 29 | 30 | pip install -U django-yaturbo 31 | 32 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | django-yaturbo documentation 2 | ============================ 3 | https://github.com/idlesign/django-yaturbo 4 | 5 | 6 | 7 | Description 8 | ----------- 9 | 10 | *Reusable Django app to enable Yandex Turbo Pages for your site* 11 | 12 | 13 | This app allows you to define Yandex Turbo pages feeds in term similar to those 14 | of Django Syndication Feed Framework contrib. 15 | 16 | 17 | 18 | Requirements 19 | ------------ 20 | 21 | 1. Python 3.6+ 22 | 2. Django 2.0+ 23 | 24 | 25 | 26 | Table of Contents 27 | ----------------- 28 | 29 | .. toctree:: 30 | :maxdepth: 2 31 | 32 | quickstart 33 | api 34 | -------------------------------------------------------------------------------- /CONTRIBUTING: -------------------------------------------------------------------------------- 1 | django-yaturbo contributing 2 | =========================== 3 | 4 | 5 | Submit issues 6 | ------------- 7 | 8 | If you spotted something weird in application behavior or want to propose a feature you are welcome. 9 | 10 | 11 | Write code 12 | ---------- 13 | If you are eager to participate in application development and to work on an existing issue (whether it should 14 | be a bugfix or a feature implementation), fork, write code, and make a pull request right from the forked project page. 15 | 16 | 17 | Spread the word 18 | --------------- 19 | 20 | If you have some tips and tricks or any other words that you think might be of interest for the others — publish it 21 | wherever you find convenient. 22 | 23 | 24 | See also: https://github.com/idlesign/django-yaturbo 25 | 26 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | django-yaturbo changelog 2 | ======================== 3 | 4 | 5 | v1.0.1 [2021-12-18] 6 | ------------------- 7 | * Django 4.0 compatibility improved. 8 | 9 | 10 | v1.0.0 [2020-05-29] 11 | ------------------- 12 | ! Dropped support for Django<2.0. 13 | ! Dropped support for Python 2 and 3.5. 14 | 15 | 16 | v0.3.0 [2019-10-24] 17 | ------------------- 18 | ! Dropped QA for Django 1.7. 19 | ! Dropped QA for Python 2. 20 | ! Dropped QA for Python 3.4. 21 | + 'sanitize_turbo' now supports more HTML tags, including 'video' and 'iframe'. 22 | 23 | 24 | v0.2.1 25 | ------ 26 | * 'bleach' is now required only if sanitization is enabled (see #1). 27 | 28 | 29 | v0.2.0 30 | ------ 31 | + Introduced turbo contents sanitizing tools. 32 | + Now can define turbo item 'source' and 'topic'. 33 | + YandexTurboFeed is now importable from package root. 34 | 35 | 36 | v0.1.0 37 | ------ 38 | + Basic functionality. -------------------------------------------------------------------------------- /.github/workflows/python-package.yml: -------------------------------------------------------------------------------- 1 | name: Python package 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] 18 | django-version: [2.0, 2.1, 2.2, 3.0, 3.1, 3.2, 4.0] 19 | 20 | exclude: 21 | 22 | - python-version: 3.7 23 | django-version: 4.0 24 | 25 | - python-version: 3.6 26 | django-version: 4.0 27 | 28 | steps: 29 | - uses: actions/checkout@v2 30 | - name: Set up Python ${{ matrix.python-version }} & Django ${{ matrix.django-version }} 31 | uses: actions/setup-python@v2 32 | with: 33 | python-version: ${{ matrix.python-version }} 34 | - name: Install deps 35 | run: | 36 | python -m pip install pytest coverage coveralls "Django~=${{ matrix.django-version }}.0" 37 | - name: Run tests 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.github_token }} 40 | run: | 41 | coverage run --source=yaturbo setup.py test 42 | coveralls --service=github 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2022, Igor `idle sign` Starikov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the django-yaturbo nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-yaturbo 2 | ============== 3 | https://github.com/idlesign/django-yaturbo 4 | 5 | |release| |lic| |coverage| 6 | 7 | .. |release| image:: https://img.shields.io/pypi/v/django-yaturbo.svg 8 | :target: https://pypi.python.org/pypi/django-yaturbo 9 | 10 | .. |lic| image:: https://img.shields.io/pypi/l/django-yaturbo.svg 11 | :target: https://pypi.python.org/pypi/django-yaturbo 12 | 13 | .. |coverage| image:: https://img.shields.io/coveralls/idlesign/django-yaturbo/master.svg 14 | :target: https://coveralls.io/r/idlesign/django-yaturbo 15 | 16 | 17 | Description 18 | ----------- 19 | 20 | *Reusable Django app to enable Yandex Turbo Pages for your site* 21 | 22 | This app allows you to define Yandex Turbo pages feeds in term similar to those 23 | of Django Syndication Feed Framework contrib: 24 | 25 | 1. Inherit your feed class from **YandexTurboFeed**: 26 | 27 | .. code-block:: python 28 | 29 | # feeds.py 30 | from yaturbo import YandexTurboFeed 31 | 32 | class TurboFeed(YandexTurboFeed): 33 | """ 34 | More information on Django Syndication Feed Framework configuration: 35 | https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/ 36 | """ 37 | 38 | 2. Pass an instantiated (and optionally configured) feed object to `urlpatterns`: 39 | 40 | .. code-block:: python 41 | 42 | # urls.py 43 | from .feeds import TurboFeed 44 | 45 | urlpatterns = [ 46 | ... 47 | path('feeds/turbo/', TurboFeed()), 48 | ... 49 | ] 50 | 51 | 52 | Read the docs for further information. 53 | 54 | 55 | Documentation 56 | ------------- 57 | 58 | http://django-yaturbo.readthedocs.org/ 59 | -------------------------------------------------------------------------------- /docs/source/quickstart.rst: -------------------------------------------------------------------------------- 1 | Quickstart 2 | ========== 3 | 4 | 5 | 1. Inherit your feed class from **YandexTurboFeed**: 6 | 7 | .. code-block:: python 8 | 9 | # feeds.py 10 | from yaturbo import YandexTurboFeed 11 | 12 | class TurboFeed(YandexTurboFeed): 13 | """ 14 | More information on Django Syndication Feed Framework configuration: 15 | https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/ 16 | """ 17 | 18 | turbo_sanitize = True # Let's strip HTML tags unsupported by Turbo pages. 19 | 20 | def item_turbo(self, item): 21 | # By default Turbo contents is taken from `item_description`. 22 | # Here we take turbo page contents from `html` attribute of an item. 23 | # Since we have `turbo_sanitize = True`, our HTML will be sanitized 24 | # automatically. 25 | # 26 | # Take a note, that if we return falsy item would be considered 27 | # as not having turbo contents at all. 28 | # 29 | return item.get('html', '') 30 | 31 | # You can also override other item_turbo_* family members. 32 | 33 | 34 | 2. Pass an instantiated (and optionally configured) feed object to `urlpatterns`: 35 | 36 | .. code-block:: python 37 | 38 | # urls.py 39 | from .feeds import TurboFeed 40 | 41 | feed = TurboFeed() 42 | 43 | # configure Yandex Metrika counter 44 | feed.configure_analytics_yandex('123456789') 45 | 46 | # configure Yandex Advertisement Network 47 | feed.configure_ad_yandex('A-123', 'page-top') 48 | 49 | urlpatterns = [ 50 | ... 51 | path('feeds/turbo/', feed), 52 | ... 53 | ] 54 | 55 | -------------------------------------------------------------------------------- /docs/source/rst_guide.rst: -------------------------------------------------------------------------------- 1 | RST Quick guide 2 | =============== 3 | 4 | Online reStructuredText editor - http://rst.ninjs.org/ 5 | 6 | 7 | Main heading 8 | ============ 9 | 10 | 11 | Secondary heading 12 | ----------------- 13 | 14 | Minor heading 15 | ~~~~~~~~~~~~~ 16 | 17 | 18 | Typography 19 | ---------- 20 | 21 | **Bold** 22 | 23 | `Italic` 24 | 25 | ``Accent`` 26 | 27 | 28 | 29 | Blocks 30 | ------ 31 | 32 | Double colon to consider the following paragraphs preformatted:: 33 | 34 | This text is preformated. Can be used for code samples. 35 | 36 | 37 | .. code-block:: python 38 | 39 | # code-block accepts language name to highlight code 40 | # E.g.: python, html 41 | import this 42 | 43 | 44 | .. note:: 45 | 46 | This text will be rendered as a note block (usually green). 47 | 48 | 49 | .. warning:: 50 | 51 | This text will be rendered as a warning block (usually red). 52 | 53 | 54 | 55 | Lists 56 | ----- 57 | 58 | 1. Ordered item 1. 59 | 60 | Indent paragraph to make in belong to the above list item. 61 | 62 | 2. Ordered item 2. 63 | 64 | 65 | + Unordered item 1. 66 | + Unordered item . 67 | 68 | 69 | 70 | Links 71 | ----- 72 | 73 | :ref:`Documentation inner link label ` 74 | 75 | .. _some-marker: 76 | 77 | 78 | `Outer link label `_ 79 | 80 | Inline URLs are converted to links automatically: http://github.com/idlesign/makeapp/ 81 | 82 | 83 | Images 84 | ------ 85 | 86 | .. image:: path_to_image/image.png 87 | 88 | 89 | Automation 90 | ---------- 91 | 92 | http://sphinx-doc.org/ext/autodoc.html 93 | 94 | .. automodule:: my_module 95 | :members: 96 | 97 | .. autoclass:: my_module.MyClass 98 | :members: do_this, do_that 99 | :inherited-members: 100 | :undoc-members: 101 | :private-members: 102 | :special-members: 103 | :show-inheritance: 104 | 105 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import io 2 | import os 3 | import re 4 | 5 | from setuptools import setup, find_packages 6 | 7 | import sys 8 | 9 | PATH_BASE = os.path.dirname(__file__) 10 | 11 | 12 | def read_file(fpath): 13 | """Reads a file within package directories.""" 14 | with io.open(os.path.join(PATH_BASE, fpath)) as f: 15 | return f.read() 16 | 17 | 18 | def get_version(): 19 | """Returns version number, without module import (which can lead to ImportError 20 | if some dependencies are unavailable before install.""" 21 | contents = read_file(os.path.join('yaturbo', '__init__.py')) 22 | version = re.search('VERSION = \(([^)]+)\)', contents) 23 | version = version.group(1).replace(', ', '.').strip() 24 | return version 25 | 26 | 27 | setup( 28 | name='django-yaturbo', 29 | version=get_version(), 30 | url='https://github.com/idlesign/django-yaturbo', 31 | 32 | description='Reusable Django app to enable Yandex Turbo Pages for your site', 33 | long_description=read_file('README.rst'), 34 | license='BSD 3-Clause License', 35 | 36 | author='Igor `idle sign` Starikov', 37 | author_email='idlesign@yandex.ru', 38 | 39 | packages=find_packages(), 40 | include_package_data=True, 41 | zip_safe=False, 42 | 43 | install_requires=[], 44 | setup_requires=[] + (['pytest-runner'] if 'test' in sys.argv else []) + [], 45 | 46 | test_suite='tests', 47 | tests_require=[ 48 | 'pytest', 49 | 'bleach', 50 | 'pytest-djangoapp>=0.15.1', 51 | ], 52 | 53 | classifiers=[ 54 | # As in https://pypi.python.org/pypi?:action=list_classifiers 55 | 'Development Status :: 5 - Production/Stable', 56 | 'Operating System :: OS Independent', 57 | 'Programming Language :: Python', 58 | 'Programming Language :: Python :: 3', 59 | 'Programming Language :: Python :: 3.6', 60 | 'Programming Language :: Python :: 3.7', 61 | 'Programming Language :: Python :: 3.8', 62 | 'Programming Language :: Python :: 3.9', 63 | 'Programming Language :: Python :: 3.10', 64 | 'License :: OSI Approved :: BSD License' 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /yaturbo/settings.py: -------------------------------------------------------------------------------- 1 | 2 | TURBO_ALLOWED_TAGS = [ 3 | 'a', 4 | 'abbr', 5 | 'b', 6 | 'big', 7 | 'blockquote', 8 | 'br', 9 | 'button', 10 | 'code', 11 | 'dd', 12 | 'del', 13 | 'div', 14 | 'dl', 15 | 'dt', 16 | 'em', 17 | 'figcaption', 18 | 'figure', 19 | 'form', 20 | 'h1', 21 | 'h2', 22 | 'h3', 23 | 'h4', 24 | 'h5', 25 | 'h6', 26 | 'header', 27 | 'hr', 28 | 'i', 29 | 'iframe', 30 | 'img', 31 | 'ins', 32 | 'li', 33 | 'menu', 34 | 'meta', 35 | 'ol', 36 | 'p', 37 | 'pre', 38 | 'small', 39 | 'source', 40 | 'strong', 41 | 'sub', 42 | 'sup', 43 | 'table', 44 | 'td', 45 | 'th', 46 | 'tr', 47 | 'u', 48 | 'ul', 49 | 'video', 50 | ] 51 | 52 | TURBO_ALLOWED_ATTRS = { 53 | 'a': [ 54 | 'data-turbo', 55 | 'href', 56 | ], 57 | 'abbr': [ 58 | 'title', 59 | ], 60 | 'img': [ 61 | 'src', 62 | ], 63 | 'source': [ 64 | 'data-duration', 65 | 'data-title', 66 | 'src', 67 | 'type', 68 | ], 69 | 'video': [ 70 | 'height', 71 | 'width', 72 | ], 73 | 'iframe': [ 74 | 'allowfullscreen', 75 | 'frameborder', 76 | 'hd', 77 | 'height', 78 | 'referrerpolicy', 79 | 'sandbox', 80 | 'src', 81 | 'width', 82 | ], 83 | 'figure': [ 84 | 'data-platform-desktop', 85 | 'data-platform-mobile', 86 | 'data-turbo-ad-id', 87 | ], 88 | 'div': [ 89 | 'data-agreement-company', 90 | 'data-agreement-link', 91 | 'data-author', 92 | 'data-avatar-url', 93 | 'data-block', 94 | 'data-color', 95 | 'data-description', 96 | 'data-expanded', 97 | 'data-height', 98 | 'data-icon', 99 | 'data-item-view', 100 | 'data-layout', 101 | 'data-network', 102 | 'data-send-to', 103 | 'data-stick', 104 | 'data-subtitle', 105 | 'data-thumb', 106 | 'data-thumb-position', 107 | 'data-thumb-ratio', 108 | 'data-title', 109 | 'data-type', 110 | 'data-url', 111 | 'data-value', 112 | 'data-view', 113 | 'itemscope', 114 | 'itemtype', 115 | ], 116 | 'table': [ 117 | 'data-invisible', 118 | ], 119 | 'meta': [ 120 | 'content', 121 | 'itemprop', 122 | ], 123 | 'form': [ 124 | 'action', 125 | 'data-agreement-company', 126 | 'data-agreement-link', 127 | 'data-send-to', 128 | 'data-type', 129 | 'method', 130 | 'name', 131 | 'placeholder', 132 | 'type', 133 | ], 134 | 'button': [ 135 | 'data-agreement-company', 136 | 'data-agreement-link', 137 | 'data-background-color', 138 | 'data-color', 139 | 'data-primary', 140 | 'data-send-to', 141 | 'data-turbo', 142 | 'disabled', 143 | 'formaction', 144 | ], 145 | } 146 | -------------------------------------------------------------------------------- /yaturbo/tests/test_basic.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from yaturbo import YandexTurboFeed 5 | 6 | 7 | class MyFeed(YandexTurboFeed): 8 | 9 | title = 'title' 10 | link = '/here/' 11 | description = 'descr' 12 | 13 | turbo_sanitize = True 14 | 15 | def __init__(self, items): 16 | super(MyFeed, self).__init__() 17 | self.items = items 18 | 19 | def item_title(self, item): 20 | return item['title'] 21 | 22 | def item_description(self, item): 23 | return item['descr'] 24 | 25 | def item_link(self, item): 26 | return item['link'] 27 | 28 | def item_turbo_source(self, item): 29 | return item.get('source') 30 | 31 | def item_turbo_topic(self, item): 32 | return item.get('topic') 33 | 34 | 35 | class MyFeedDefaults(YandexTurboFeed): 36 | 37 | title = 'title1' 38 | link = '/there/' 39 | description = 'descr' 40 | 41 | def __init__(self, items): 42 | super(MyFeedDefaults, self).__init__() 43 | self.items = items 44 | 45 | def item_title(self, item): 46 | return item['title'] 47 | 48 | def item_description(self, item): 49 | return item['descr'] 50 | 51 | def item_link(self, item): 52 | return item['link'] 53 | 54 | 55 | def test_feed(request_get): 56 | 57 | feed = MyFeed([ 58 | { 59 | 'title': 'a', 60 | 'descr': 'turbo!', 61 | 'link': 'd', 62 | 'source': 'http://some.com', 63 | 'topic': 'Title', 64 | }, 65 | { 66 | 'title': 'b', 67 | 'descr': '
sanitized
', 68 | 'link': 'link_b', 69 | } 70 | ]) 71 | 72 | feed.configure_ad_yandex('A-123', 'page-top') 73 | feed.configure_ad_yandex('B-123', 'page-bottom') 74 | 75 | feed.configure_analytics_yandex('12345', params={'key': 'value'}) 76 | feed.configure_analytics_google('7890') 77 | 78 | content = feed(request_get('/')).content.decode('utf-8') 79 | 80 | chunks = [ 81 | 'xmlns:turbo="http://turbo.yandex.ru"', 82 | 'xmlns:yandex="http://news.yandex.ru"', 83 | 'turbo:analytics', 84 | 'id="12345"', 85 | 'id="7890"', 86 | 'turbo:adNetwork', 87 | 'id="A-123"', 88 | 'turbo-ad-id="page-top"', 89 | 'id="B-123"', 90 | 'turbo-ad-id="page-bottom"', 91 | 'item turbo="true"', 92 | '', 93 | 'http://some.com', 94 | 'Title', 95 | 'sanitized]]>', 96 | ] 97 | 98 | for chunk in chunks: 99 | assert chunk in content 100 | 101 | 102 | def test_noturbo(request_get): 103 | 104 | feed = MyFeedDefaults([ 105 | { 106 | 'title': 'a', 107 | 'descr': '', 108 | 'link': 'd', 109 | } 110 | ]) 111 | 112 | content = feed(request_get('/')).content.decode('utf-8') 113 | 114 | assert 'turbo="true"' not in content 115 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 14 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " singlehtml to make a single large HTML file" 22 | @echo " pickle to make pickle files" 23 | @echo " json to make JSON files" 24 | @echo " htmlhelp to make HTML files and a HTML help project" 25 | @echo " qthelp to make HTML files and a qthelp project" 26 | @echo " devhelp to make HTML files and a Devhelp project" 27 | @echo " epub to make an epub" 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 30 | @echo " text to make text files" 31 | @echo " man to make manual pages" 32 | @echo " changes to make an overview of all changed/added/deprecated items" 33 | @echo " linkcheck to check all external links for integrity" 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 35 | 36 | clean: 37 | -rm -rf $(BUILDDIR)/* 38 | 39 | html: 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 43 | 44 | dirhtml: 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 48 | 49 | singlehtml: 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 51 | @echo 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 53 | 54 | pickle: 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 56 | @echo 57 | @echo "Build finished; now you can process the pickle files." 58 | 59 | json: 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 61 | @echo 62 | @echo "Build finished; now you can process the JSON files." 63 | 64 | htmlhelp: 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 66 | @echo 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." 69 | 70 | qthelp: 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 72 | @echo 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-yaturbo.qhcp" 76 | @echo "To view the help file:" 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-yaturbo.qhc" 78 | 79 | devhelp: 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 81 | @echo 82 | @echo "Build finished." 83 | @echo "To view the help file:" 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/django-yaturbo" 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-yaturbo" 86 | @echo "# devhelp" 87 | 88 | epub: 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 90 | @echo 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 92 | 93 | latex: 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 95 | @echo 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 98 | "(use \`make latexpdf' here to do that automatically)." 99 | 100 | latexpdf: 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 102 | @echo "Running LaTeX files through pdflatex..." 103 | make -C $(BUILDDIR)/latex all-pdf 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 105 | 106 | text: 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 108 | @echo 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 110 | 111 | man: 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 113 | @echo 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 115 | 116 | changes: 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 118 | @echo 119 | @echo "The overview file is in $(BUILDDIR)/changes." 120 | 121 | linkcheck: 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 123 | @echo 124 | @echo "Link check complete; look for any errors in the above output " \ 125 | "or in $(BUILDDIR)/linkcheck/output.txt." 126 | 127 | doctest: 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 129 | @echo "Testing of doctests in the sources finished, look at the " \ 130 | "results in $(BUILDDIR)/doctest/output.txt." 131 | 132 | -------------------------------------------------------------------------------- /yaturbo/toolbox.py: -------------------------------------------------------------------------------- 1 | from typing import List, Dict 2 | 3 | try: 4 | from bleach import clean 5 | 6 | except ImportError: 7 | 8 | def clean(*args, **kwargs): 9 | raise ImportError('Please install `bleach` package to use sanitization.') 10 | 11 | from django.contrib.syndication.views import Feed as _Feed 12 | from django.utils.feedgenerator import Rss201rev2Feed as FeedType 13 | 14 | from .settings import TURBO_ALLOWED_ATTRS, TURBO_ALLOWED_TAGS 15 | 16 | 17 | def sanitize_turbo( 18 | html: str, 19 | allowed_tags: List[str] = TURBO_ALLOWED_TAGS, 20 | allowed_attrs: Dict[str, List[str]] = TURBO_ALLOWED_ATTRS 21 | 22 | ) -> str: 23 | """Sanitizes HTML, removing not allowed tags and attributes. 24 | 25 | :param html: 26 | 27 | :param allowed_tags: List of allowed tags. 28 | :param allowed_attrs: Dictionary with attributes allowed for tags. 29 | 30 | """ 31 | return clean(html, tags=allowed_tags, attributes=allowed_attrs, strip=True) 32 | 33 | 34 | class YandexTurboFeedType(FeedType): 35 | 36 | def __init__(self, *args, **kwargs): 37 | 38 | self._analytics: list = kwargs.pop('ya_analytics', []) 39 | self._ads: list = kwargs.pop('ya_ads', []) 40 | 41 | super(YandexTurboFeedType, self).__init__(*args, **kwargs) 42 | 43 | def rss_attributes(self) -> dict: 44 | attrs = super(YandexTurboFeedType, self).rss_attributes() 45 | 46 | attrs.update({ 47 | 'xmlns:turbo': 'http://turbo.yandex.ru', 48 | 'xmlns:yandex': 'http://news.yandex.ru', 49 | }) 50 | 51 | return attrs 52 | 53 | def item_attributes(self, item: dict) -> dict: 54 | attrs = super(YandexTurboFeedType, self).item_attributes(item) 55 | 56 | if not item['ya_contents']: 57 | # No turbo content available. 58 | return attrs 59 | 60 | attrs.update({ 61 | 'turbo': 'true', 62 | }) 63 | 64 | return attrs 65 | 66 | def add_root_elements(self, handler): 67 | super(YandexTurboFeedType, self).add_root_elements(handler) 68 | 69 | for params in self._analytics: 70 | handler.startElement('turbo:analytics', params) 71 | handler.endElement('turbo:analytics') 72 | 73 | for params in self._ads: 74 | handler.startElement('turbo:adNetwork', params) 75 | handler.endElement('turbo:adNetwork') 76 | 77 | def add_item_elements(self, handler, item): 78 | super(YandexTurboFeedType, self).add_item_elements(handler, item) 79 | 80 | # todo maybe 81 | # yandex:related 82 | 83 | turbo_contents = item['ya_contents'] 84 | 85 | if not turbo_contents: 86 | return 87 | 88 | handler.startElement('turbo:content', {}) 89 | handler.ignorableWhitespace('' % turbo_contents) 90 | handler.endElement('turbo:content') 91 | 92 | source = item['ya_source'] 93 | if source: 94 | handler.addQuickElement('turbo:source', source) 95 | 96 | topic = item['ya_topic'] 97 | if topic: 98 | handler.addQuickElement('turbo:topic', topic) 99 | 100 | 101 | class YandexTurboFeed(_Feed): 102 | """Yandex Turbo Pages Feed. 103 | 104 | .. code-block:: python 105 | 106 | from yaturbo import YandexTurboFeed 107 | 108 | class TurboFeed(YandexTurboFeed): 109 | ''' 110 | More information on Django Syndication Feed Framework configuration: 111 | https://docs.djangoproject.com/en/2.0/ref/contrib/syndication/ 112 | 113 | ''' 114 | 115 | turbo_sanitize = True # Let's strip HTML tags unsupported by Turbo pages. 116 | 117 | def item_turbo(self, item): 118 | return 'turbo contents' 119 | 120 | 121 | feed = TurboFeed() 122 | 123 | # configure Yandex Metrika counter 124 | feed.configure_analytics_yandex('123456789') 125 | 126 | # configure Yandex Advertisement Network 127 | feed.configure_ad_yandex('A-123', 'page-top') 128 | 129 | 130 | urlpatterns = [ 131 | ... 132 | path('turbo/', feed), 133 | ... 134 | ] 135 | 136 | 137 | """ 138 | feed_type = YandexTurboFeedType 139 | 140 | turbo_sanitize: bool = False 141 | """Whether to automatically sanitize HTML contents returned from `.item_turbo()`. 142 | 143 | Can be useful if you do not keep special HTML for Turbo pages. 144 | 145 | """ 146 | 147 | def __init__(self): 148 | super(YandexTurboFeed, self).__init__() 149 | self.analytics: List[Dict] = [] 150 | self.ads: List[Dict] = [] 151 | 152 | def configure_ad_yandex(self, ident: str, turbo_id: str = ''): 153 | """Configure Yandex Advertisement Network. 154 | 155 | :param ident: Ad ID. 156 | 157 | :param turbo_id: ID of a place (figure) on Turbo page where to put an Ad block. 158 | 159 | """ 160 | self.ads.append({ 161 | 'type': 'Yandex', 162 | 'id': ident, 163 | 'turbo-ad-id': turbo_id, 164 | }) 165 | 166 | # todo maybe ad methods for 167 | # adfox 168 | 169 | def configure_analytics_yandex(self, ident: str, params: dict = None): 170 | """Configure Yandex Metrika analytics counter. 171 | 172 | :param ident: Metrika counter ID. 173 | 174 | :param params: Additional params. 175 | 176 | """ 177 | params = params or {} 178 | 179 | data = { 180 | 'type': 'Yandex', 181 | 'id': ident, 182 | } 183 | 184 | if params: 185 | data['params'] = '%s' % params 186 | 187 | self.analytics.append(data) 188 | 189 | def configure_analytics_google(self, ident: str): 190 | """Configure Google Analytics counter. 191 | 192 | :param ident: Counter ID. 193 | 194 | """ 195 | self.analytics.append({ 196 | 'type': 'Google', 197 | 'id': ident, 198 | }) 199 | 200 | # todo maybe analytics methods for 201 | # LiveInternet 202 | # Mail.RU 203 | # Rambler 204 | # Mediascope(TNS) 205 | # + custom 206 | 207 | def item_turbo(self, item) -> str: 208 | """This can be overridden to set turbo contents. 209 | 210 | :param item: 211 | 212 | """ 213 | # todo maybe automatic html transform, e.g. with bleach 214 | return self.item_description(item) 215 | 216 | def item_turbo_source(self, item) -> str: 217 | """This can be overridden to set turbo source URL. 218 | 219 | Can be used with Yandex Metrika. 220 | 221 | :param item: 222 | 223 | """ 224 | return '' 225 | 226 | def item_turbo_topic(self, item) -> str: 227 | """This can be overridden to set turbo page topic (title). 228 | 229 | Can be used with Yandex Metrika. 230 | 231 | :param item: 232 | 233 | """ 234 | return '' 235 | 236 | def item_extra_kwargs(self, item) -> dict: 237 | kwargs = super(YandexTurboFeed, self).item_extra_kwargs(item) 238 | 239 | get_dyn = self._get_dynamic_attr 240 | 241 | contents = get_dyn('item_turbo', item) 242 | 243 | if contents and self.turbo_sanitize: 244 | contents = sanitize_turbo(contents) 245 | 246 | kwargs.update({ 247 | 'ya_contents': contents, 248 | 'ya_source': get_dyn('item_turbo_source', item), 249 | 'ya_topic': get_dyn('item_turbo_topic', item), 250 | }) 251 | 252 | return kwargs 253 | 254 | def feed_extra_kwargs(self, obj) -> dict: 255 | kwargs = super(YandexTurboFeed, self).feed_extra_kwargs(obj) 256 | 257 | kwargs.update({ 258 | 'ya_analytics': self.analytics, 259 | 'ya_ads': self.ads, 260 | }) 261 | 262 | return kwargs 263 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # django-yaturbo documentation build configuration file. 4 | # 5 | # This file is execfile()d with the current directory set to its containing dir. 6 | # 7 | # Note that not all possible configuration values are present in this 8 | # autogenerated file. 9 | # 10 | # All configuration values have a default; values that are commented out 11 | # serve to show the default. 12 | 13 | import sys, os 14 | 15 | # If extensions (or modules to document with autodoc) are in another directory, 16 | # add these directories to sys.path here. If the directory is relative to the 17 | # documentation root, use os.path.abspath to make it absolute, like shown here. 18 | sys.path.insert(0, os.path.abspath('../../')) 19 | from yaturbo import VERSION 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.autodoc'] 29 | 30 | # Instruct autoclass directive to document both class and __init__ docstrings. 31 | autoclass_content = 'both' 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['_templates'] 35 | 36 | # The suffix of source filenames. 37 | source_suffix = '.rst' 38 | 39 | # The encoding of source files. 40 | #source_encoding = 'utf-8-sig' 41 | 42 | # The master toctree document. 43 | master_doc = 'index' 44 | 45 | # General information about the project. 46 | project = u'django-yaturbo' 47 | copyright = u'2018-2022, Igor `idle sign` Starikov' 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = '.'.join(map(str, VERSION)) 55 | # The full version, including alpha/beta/rc tags. 56 | release = '.'.join(map(str, VERSION)) 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = ['rst_guide.rst'] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all documents. 73 | #default_role = None 74 | 75 | # If true, '()' will be appended to :func: etc. cross-reference text. 76 | #add_function_parentheses = True 77 | 78 | # If true, the current module name will be prepended to all description 79 | # unit titles (such as .. function::). 80 | #add_module_names = True 81 | 82 | # If true, sectionauthor and moduleauthor directives will be shown in the 83 | # output. They are ignored by default. 84 | #show_authors = False 85 | 86 | # The name of the Pygments (syntax highlighting) style to use. 87 | pygments_style = 'sphinx' 88 | 89 | # A list of ignored prefixes for module index sorting. 90 | #modindex_common_prefix = [] 91 | 92 | 93 | # -- Options for HTML output --------------------------------------------------- 94 | 95 | # The theme to use for HTML and HTML Help pages. See the documentation for 96 | # a list of builtin themes. 97 | html_theme = 'default' 98 | 99 | # Theme options are theme-specific and customize the look and feel of a theme 100 | # further. For a list of options available for each theme, see the 101 | # documentation. 102 | #html_theme_options = {} 103 | 104 | # Add any paths that contain custom themes here, relative to this directory. 105 | #html_theme_path = [] 106 | 107 | # The name for this set of Sphinx documents. If None, it defaults to 108 | # " v documentation". 109 | #html_title = None 110 | 111 | # A shorter title for the navigation bar. Default is the same as html_title. 112 | #html_short_title = None 113 | 114 | # The name of an image file (relative to this directory) to place at the top 115 | # of the sidebar. 116 | #html_logo = None 117 | 118 | # The name of an image file (within the static path) to use as favicon of the 119 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 120 | # pixels large. 121 | #html_favicon = None 122 | 123 | # Add any paths that contain custom static files (such as style sheets) here, 124 | # relative to this directory. They are copied after the builtin static files, 125 | # so a file named "default.css" will overwrite the builtin "default.css". 126 | html_static_path = ['_static'] 127 | 128 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 129 | # using the given strftime format. 130 | #html_last_updated_fmt = '%b %d, %Y' 131 | 132 | # If true, SmartyPants will be used to convert quotes and dashes to 133 | # typographically correct entities. 134 | #html_use_smartypants = True 135 | 136 | # Custom sidebar templates, maps document names to template names. 137 | #html_sidebars = {} 138 | 139 | # Additional templates that should be rendered to pages, maps page names to 140 | # template names. 141 | #html_additional_pages = {} 142 | 143 | # If false, no module index is generated. 144 | #html_domain_indices = True 145 | 146 | # If false, no index is generated. 147 | #html_use_index = True 148 | 149 | # If true, the index is split into individual pages for each letter. 150 | #html_split_index = False 151 | 152 | # If true, links to the reST sources are added to the pages. 153 | #html_show_sourcelink = True 154 | 155 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 156 | #html_show_sphinx = True 157 | 158 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 159 | #html_show_copyright = True 160 | 161 | # If true, an OpenSearch description file will be output, and all pages will 162 | # contain a tag referring to it. The value of this option must be the 163 | # base URL from which the finished HTML is served. 164 | #html_use_opensearch = '' 165 | 166 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 167 | #html_file_suffix = None 168 | 169 | # Output file base name for HTML help builder. 170 | htmlhelp_basename = 'django-yaturbodoc' 171 | 172 | 173 | # -- Options for LaTeX output -------------------------------------------------- 174 | 175 | # The paper size ('letter' or 'a4'). 176 | #latex_paper_size = 'letter' 177 | 178 | # The font size ('10pt', '11pt' or '12pt'). 179 | #latex_font_size = '10pt' 180 | 181 | # Grouping the document tree into LaTeX files. List of tuples 182 | # (source start file, target name, title, author, documentclass [howto/manual]). 183 | latex_documents = [ 184 | ('index', 'django-yaturbo.tex', u'django-yaturbo Documentation', 185 | u'Igor `idle sign` Starikov', 'manual'), 186 | ] 187 | 188 | # The name of an image file (relative to this directory) to place at the top of 189 | # the title page. 190 | #latex_logo = None 191 | 192 | # For "manual" documents, if this is true, then toplevel headings are parts, 193 | # not chapters. 194 | #latex_use_parts = False 195 | 196 | # If true, show page references after internal links. 197 | #latex_show_pagerefs = False 198 | 199 | # If true, show URL addresses after external links. 200 | #latex_show_urls = False 201 | 202 | # Additional stuff for the LaTeX preamble. 203 | #latex_preamble = '' 204 | 205 | # Documents to append as an appendix to all manuals. 206 | #latex_appendices = [] 207 | 208 | # If false, no module index is generated. 209 | #latex_domain_indices = True 210 | 211 | 212 | # -- Options for manual page output -------------------------------------------- 213 | 214 | # One entry per manual page. List of tuples 215 | # (source start file, name, description, authors, manual section). 216 | man_pages = [ 217 | ('index', 'django-yaturbo', u'django-yaturbo Documentation', 218 | [u'Igor `idle sign` Starikov'], 1) 219 | ] 220 | 221 | --------------------------------------------------------------------------------