Automated merge with file:///home/gbr/devel/sphinx0.5

This commit is contained in:
Georg Brandl
2008-12-07 22:36:44 +01:00
33 changed files with 1780 additions and 1531 deletions

View File

@@ -20,7 +20,7 @@ from util import *
from etree13 import ElementTree as ET
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
from sphinx.latexwriter import LaTeXTranslator
from sphinx.writers.latex import LaTeXTranslator
html_warnfile = StringIO()

View File

@@ -15,7 +15,8 @@ from util import *
from sphinx.application import ExtensionError
@with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True'})
@with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True',
'latex_elements.docclass': 'scrartcl'})
def test_core_config(app):
cfg = app.config
@@ -26,6 +27,7 @@ def test_core_config(app):
# overrides
assert cfg.master_doc == 'master'
assert cfg.latex_elements['docclass'] == 'scrartcl'
# simple default values
assert 'exclude_dirs' not in cfg.__dict__

View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
"""
test_highlighting
~~~~~~~~~~~~~~~~~
Test the Pygments highlighting bridge.
:copyright: 2008 by Georg Brandl.
:license: BSD.
"""
from util import *
from pygments.lexer import RegexLexer
from pygments.token import Text, Name
from pygments.formatters.html import HtmlFormatter
from sphinx.highlighting import PygmentsBridge
class MyLexer(RegexLexer):
name = 'testlexer'
tokens = {
'root': [
('a', Name),
('b', Text),
],
}
class MyFormatter(HtmlFormatter):
def format(self, tokensource, outfile):
outfile.write('test')
@with_app()
def test_add_lexer(app):
app.add_lexer('test', MyLexer())
bridge = PygmentsBridge('html')
ret = bridge.highlight_block('ab', 'test')
assert '<span class="n">a</span>b' in ret
def test_set_formatter():
PygmentsBridge.html_formatter = MyFormatter
try:
bridge = PygmentsBridge('html')
ret = bridge.highlight_block('foo', 'python')
assert ret == 'test'
finally:
PygmentsBridge.html_formatter = HtmlFormatter

View File

@@ -17,8 +17,8 @@ from docutils import frontend, utils, nodes
from docutils.parsers import rst
from sphinx import addnodes
from sphinx.htmlwriter import HTMLWriter, SmartyPantsHTMLTranslator
from sphinx.latexwriter import LaTeXWriter, LaTeXTranslator
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
def setup_module():
global app, settings, parser