pax_global_header00006660000000000000000000000064150151046150014510gustar00rootroot0000000000000052 comment=81bf73543b8a82c727024df7a86ff3df1683996b googleanalytics-0.5/000077500000000000000000000000001501510461500145405ustar00rootroot00000000000000googleanalytics-0.5/.github/000077500000000000000000000000001501510461500161005ustar00rootroot00000000000000googleanalytics-0.5/.github/workflows/000077500000000000000000000000001501510461500201355ustar00rootroot00000000000000googleanalytics-0.5/.github/workflows/ci.yml000066400000000000000000000020521501510461500212520ustar00rootroot00000000000000--- name: CI "on": push: branches: [master, main] pull_request: branches: [master, main] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e . pip install ruff pytest - name: Run ruff format check run: ruff format --check . - name: Run ruff lint run: ruff check . - name: Run tests run: | # Run pytest if test files exist, otherwise just import the module if [ -d "tests" ] || find . -name "*test*.py" -type f | grep -q .; then pytest else python -c "import sphinxcontrib.googleanalytics; print('Module import successful')" fi googleanalytics-0.5/.gitignore000066400000000000000000000000541501510461500165270ustar00rootroot00000000000000*~ *.egg-info/ __pycache__ *.pyc build dist googleanalytics-0.5/LICENSE000066400000000000000000000027401501510461500155500ustar00rootroot00000000000000BSD 3-Clause License Copyright (c) 2010-2023, Domen Kožar Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder nor the names of its contributors may 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 HOLDER 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. googleanalytics-0.5/MANIFEST.in000066400000000000000000000000611501510461500162730ustar00rootroot00000000000000include README include LICENSE include CHANGES.* googleanalytics-0.5/README.rst000066400000000000000000000023331501510461500162300ustar00rootroot00000000000000.. -*- restructuredtext -*- =========================================== Google Analytics extension for Sphinx =========================================== :author: Domen Kožar About ===== This extensions allows you to track generated html files with Google Analytics web service. Installing from sphinx-contrib checkout --------------------------------------- Checkout googleanalytics sphinx extension:: $ git clone https://github.com/sphinx-contrib/googleanalytics Change into the googleanalytics directory:: $ cd googleanalytics Install the module:: $ python setup.py install Enabling the extension in Sphinx_ --------------------------------- Just add ``sphinxcontrib.googleanalytics`` to the list of extensions in the ``conf.py`` file. For example:: extensions = ['sphinxcontrib.googleanalytics'] Configuration ------------- For now one optional configuration is added to Sphinx_. It can be set in ``conf.py`` file: ``googleanalytics_id`` : UA id for your site, example:: googleanalytics_id = 'UA-123-123-123' ``googleanalytics_enabled`` : True by default, use it to turn off tracking. .. Links: .. _gnuplot: http://www.gnuplot.info/ .. _Sphinx: http://sphinx.pocoo.org/ googleanalytics-0.5/disperse.conf000066400000000000000000000002271501510461500172260ustar00rootroot00000000000000# See https://github.com/jelmer/disperse timeout_days: 5 tag_name: "v$VERSION" update_version { path: "setup.cfg" new_line: "version = $VERSION" } googleanalytics-0.5/pyproject.toml000066400000000000000000000020511501510461500174520ustar00rootroot00000000000000[build-system] requires = ["setuptools>=61.2"] build-backend = "setuptools.build_meta" [project] name = "sphinxcontrib-googleanalytics" version = "0.5" license = "BSD-3-Clause" authors = [{name = "Domen Kozar", email = "domen@dev.si"}] maintainers = [{name = "Jelmer Vernooij", email = "jelmer@jelmer.uk"}] description = "Sphinx extension googleanalytics" readme = "README.rst" classifiers = [ "Development Status :: 4 - Beta", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Documentation", "Topic :: Utilities", ] dependencies = ["Sphinx>=0.6"] [project.urls] Homepage = "https://github.com/sphinx-contrib/googleanalytics" Download = "http://pypi.python.org/pypi/sphinxcontrib-googleanalytics" Repository = "https://github.com/sphinx-contrib/googleanalytics" [tool.setuptools] zip-safe = false include-package-data = true platforms = ["any"] [tool.setuptools.packages] find = {namespaces = false} googleanalytics-0.5/setup.py000077500000000000000000000000711501510461500162530ustar00rootroot00000000000000#!/usr/bin/python3 from setuptools import setup setup() googleanalytics-0.5/sphinxcontrib/000077500000000000000000000000001501510461500174325ustar00rootroot00000000000000googleanalytics-0.5/sphinxcontrib/__init__.py000066400000000000000000000005251501510461500215450ustar00rootroot00000000000000# -*- coding: utf-8 -*- """ sphinxcontrib ~~~~~~~~~~~~~ This package is a namespace package that contains all extensions distributed in the ``sphinx-contrib`` distribution. :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ __import__("pkg_resources").declare_namespace(__name__) googleanalytics-0.5/sphinxcontrib/googleanalytics.py000066400000000000000000000025461501510461500231770ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- from sphinx.errors import ExtensionError def add_ga_javascript(app, pagename, templatename, context, doctree): if not app.config.googleanalytics_enabled: return metatags = context.get("metatags", "") metatags += ( """ """ % app.config.googleanalytics_id ) metatags += ( """ """ % app.config.googleanalytics_id ) context["metatags"] = metatags def check_config(app): if app.config.googleanalytics_enabled and not app.config.googleanalytics_id: raise ExtensionError( "'googleanalytics_id' config value must be set for ga statistics to function properly." ) def setup(app): app.add_config_value("googleanalytics_id", "", "html") app.add_config_value("googleanalytics_enabled", True, "html") app.connect("html-page-context", add_ga_javascript) app.connect("builder-inited", check_config) return { "version": "0.3", "parallel_read_safe": True, "parallel_write_safe": True, }