Sphinx拡張 文字数表示パネル pageinfo.py に、翻訳率表示を加えた拡張です。
pageinfo.py と pageinfo.html を以下のように配置:
sphinx-project/ +- index.rst +- conf.py +- ext/pageinfo.py +- _templates/pageinfo.html
| # How to use: | |
| # fio fio-wsl.ini | |
| [seq-read] | |
| rw=read | |
| filename=/tmp/test2g | |
| direct=1 | |
| bs=4k | |
| size=2G | |
| numjobs=64 |
Sphinx拡張 文字数表示パネル pageinfo.py に、翻訳率表示を加えた拡張です。
pageinfo.py と pageinfo.html を以下のように配置:
sphinx-project/ +- index.rst +- conf.py +- ext/pageinfo.py +- _templates/pageinfo.html
| # -*- coding: utf-8 -*- | |
| import concurrent.futures | |
| import asyncio | |
| import time | |
| import sys | |
| import signal | |
| import functools | |
| import logging | |
| logging.basicConfig(format='%(asctime)s [%(process)d] %(name)s %(levelname)s: %(message)s', level=logging.INFO) | |
| logger = logging.getLogger(__name__) |
| # -- directive/role definition ------------------------------------------------> | |
| from docutils.parsers.rst.directives.admonitions import BaseAdmonition | |
| from docutils import nodes | |
| class NamedNoteDirective(BaseAdmonition): | |
| node_class = nodes.admonition | |
| css_class = 'note' | |
| #required_arguments = 1 |
| # I want display calculation tutorial with using PythonAnywhere. But I worry about that this code will confuse students. | |
| # run this code on: https://www.pythonanywhere.com/gists/e870369b20c089981850e40e02713b8c/type-int.py/python3/ | |
| import time | |
| import sys | |
| ps1 = '>>> ' | |
| def emulate(text): | |
| print(ps1, sep='', end='') | |
| sys.stdout.flush() | |
| time.sleep(2) |
| # -*- coding: utf-8 -*- | |
| #----- copy of sphinx/util/console.py ----- | |
| """ | |
| sphinx.util.console | |
| ~~~~~~~~~~~~~~~~~~~ | |
| Format colored console output. | |
| :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. | |
| :license: BSD, see LICENSE for details. |
| Checking dependencies... | |
| Temporary files will be placed in /tmp/pytest. | |
| Running Sphinx test suite (with Python 3.5.2)... | |
| test_intl.test_image_glob_intl ... ok | |
| test_intl.test_image_glob_intl_using_figure_language_filename ... ok | |
| test_intl.test_additional_targets_should_be_translated(2, 2, ('CODE-BLOCKS', <literalblock.html contents>)) ... ok | |
| test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="s1">'RESULT'</span>', <literalblock.html contents>)) ... ok | |
| test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="c1">#include <STDLIB.H></span>', <literalblock.html contents>)) ... ok | |
| test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="cp">#include</span> <span class="cpf"><STDIO.H></span>', <literalblock.html contents>)) ... ok | |
| test_intl.test_additional_targets_should_be_translated(1, 1, ('<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sys</span> <span class="c1"># SYS IMPORTING</span>', <lite |
| class Foo(object): | |
| def __init__(self): | |
| self.data = DelegateDict() | |
| self.data.set_delegation('py:class', 'py:class_stack') | |