mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix some nits after pulling from http://bitbucket.org/howthebodyworks/sphinx/ and add changelog and authors entries.
This commit is contained in:
parent
d532fc2d9f
commit
9e7c5e88c4
1
AUTHORS
1
AUTHORS
@ -13,6 +13,7 @@ Other contributors, listed alphabetically, are:
|
|||||||
* Martin Hans -- autodoc improvements
|
* Martin Hans -- autodoc improvements
|
||||||
* Dave Kuhlman -- original LaTeX writer
|
* Dave Kuhlman -- original LaTeX writer
|
||||||
* Thomas Lamb -- linkcheck builder
|
* Thomas Lamb -- linkcheck builder
|
||||||
|
* Dan MacKinlay -- metadata fixes
|
||||||
* Will Maier -- directory HTML builder
|
* Will Maier -- directory HTML builder
|
||||||
* Christopher Perkins -- autosummary integration
|
* Christopher Perkins -- autosummary integration
|
||||||
* Benjamin Peterson -- unittests
|
* Benjamin Peterson -- unittests
|
||||||
|
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
|||||||
Release 1.0 (in development)
|
Release 1.0 (in development)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
* All docinfo metadata is now put into the document metadata, not just
|
||||||
|
the author.
|
||||||
|
|
||||||
* Added new HTML theme ``agogo``, created by Andi Albrecht.
|
* Added new HTML theme ``agogo``, created by Andi Albrecht.
|
||||||
|
|
||||||
* Added new minimal theme called scrolls, created by Armin Ronacher.
|
* Added new minimal theme called scrolls, created by Armin Ronacher.
|
||||||
|
@ -12,12 +12,10 @@
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import heapq
|
|
||||||
import types
|
import types
|
||||||
import codecs
|
import codecs
|
||||||
import imghdr
|
import imghdr
|
||||||
import string
|
import string
|
||||||
import difflib
|
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from os import path
|
from os import path
|
||||||
from glob import glob
|
from glob import glob
|
||||||
@ -757,7 +755,7 @@ class BuildEnvironment:
|
|||||||
def process_metadata(self, docname, doctree):
|
def process_metadata(self, docname, doctree):
|
||||||
"""
|
"""
|
||||||
Process the docinfo part of the doctree as metadata.
|
Process the docinfo part of the doctree as metadata.
|
||||||
Keep processing minimal - just return what docutils says.
|
Keep processing minimal -- just return what docutils says.
|
||||||
"""
|
"""
|
||||||
self.metadata[docname] = md = {}
|
self.metadata[docname] = md = {}
|
||||||
try:
|
try:
|
||||||
@ -772,7 +770,7 @@ class BuildEnvironment:
|
|||||||
# nodes are multiply inherited...
|
# nodes are multiply inherited...
|
||||||
if isinstance(node, nodes.authors):
|
if isinstance(node, nodes.authors):
|
||||||
md['authors'] = [author.astext() for author in node]
|
md['authors'] = [author.astext() for author in node]
|
||||||
elif isinstance(node, nodes.TextElement): #e.g. author
|
elif isinstance(node, nodes.TextElement): # e.g. author
|
||||||
md[node.__class__.__name__] = node.astext()
|
md[node.__class__.__name__] = node.astext()
|
||||||
else:
|
else:
|
||||||
name, body = node
|
name, body = node
|
||||||
|
@ -3,23 +3,20 @@
|
|||||||
test_metadata
|
test_metadata
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Test our ahndling of metadata in files with bibliographic metadata
|
Test our handling of metadata in files with bibliographic metadata.
|
||||||
|
|
||||||
:copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
|
:copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
|
||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# adapted from an example of bibliographic metadata at
|
||||||
|
# http://docutils.sourceforge.net/docs/user/rst/demo.txt
|
||||||
# adapted from an example of bibliographic metadata at http://docutils.sourceforge.net/docs/user/rst/demo.txt
|
|
||||||
|
|
||||||
from util import *
|
from util import *
|
||||||
|
|
||||||
from nose.tools import assert_equals
|
from nose.tools import assert_equals
|
||||||
|
|
||||||
from sphinx.environment import BuildEnvironment
|
from sphinx.environment import BuildEnvironment
|
||||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
|
||||||
from sphinx.builders.latex import LaTeXBuilder
|
|
||||||
|
|
||||||
app = env = None
|
app = env = None
|
||||||
warnings = []
|
warnings = []
|
||||||
@ -30,7 +27,7 @@ def setup_module():
|
|||||||
app = TestApp(srcdir='(temp)')
|
app = TestApp(srcdir='(temp)')
|
||||||
env = BuildEnvironment(app.srcdir, app.doctreedir, app.config)
|
env = BuildEnvironment(app.srcdir, app.doctreedir, app.config)
|
||||||
# Huh. Why do I need to do this?
|
# Huh. Why do I need to do this?
|
||||||
env.set_warnfunc(lambda *args: warnings.append(args))
|
env.set_warnfunc(lambda *args: warnings.append(args))
|
||||||
msg, num, it = env.update(app.config, app.srcdir, app.doctreedir, app)
|
msg, num, it = env.update(app.config, app.srcdir, app.doctreedir, app)
|
||||||
for docname in it:
|
for docname in it:
|
||||||
pass
|
pass
|
||||||
@ -40,28 +37,36 @@ def teardown_module():
|
|||||||
|
|
||||||
def test_docinfo():
|
def test_docinfo():
|
||||||
"""
|
"""
|
||||||
inspect the 'docinfo' metadata stored in the first node of the document.
|
Inspect the 'docinfo' metadata stored in the first node of the document.
|
||||||
Note this doesn't give us access to data stored in subsequence blocks
|
Note this doesn't give us access to data stored in subsequence blocks
|
||||||
that might be considered document metadata, such as 'abstract' or
|
that might be considered document metadata, such as 'abstract' or
|
||||||
'dedication' blocks, or the 'meta' role. Doing otherwise is probably more
|
'dedication' blocks, or the 'meta' role. Doing otherwise is probably more
|
||||||
messing with the internals of sphinx than this rare use case merits.
|
messing with the internals of sphinx than this rare use case merits.
|
||||||
"""
|
"""
|
||||||
exampledocinfo = env.metadata['metadata']
|
exampledocinfo = env.metadata['metadata']
|
||||||
expected_metadata = {
|
expecteddocinfo = {
|
||||||
'author': u'David Goodger',
|
'author': u'David Goodger',
|
||||||
'authors': [u'Me', u'Myself', u'I'],
|
'authors': [u'Me', u'Myself', u'I'],
|
||||||
'address': u'123 Example Street\nExample, EX Canada\nA1B 2C3',
|
'address': u'123 Example Street\nExample, EX Canada\nA1B 2C3',
|
||||||
'field name': u'This is a generic bibliographic field.',
|
'field name': u'This is a generic bibliographic field.',
|
||||||
'field name 2': u'Generic bibliographic fields may contain multiple body elements.\n\nLike this.',
|
'field name 2': (u'Generic bibliographic fields may contain multiple '
|
||||||
'status': u'This is a "work in progress"',
|
u'body elements.\n\nLike this.'),
|
||||||
'version': u'1',
|
'status': u'This is a "work in progress"',
|
||||||
'copyright': u"This document has been placed in the public domain. You\nmay do with it as you wish. You may copy, modify,\nredistribute, reattribute, sell, buy, rent, lease,\ndestroy, or improve it, quote it at length, excerpt,\nincorporate, collate, fold, staple, or mutilate it, or do\nanything else to it that your or anyone else's heart\ndesires.",
|
'version': u'1',
|
||||||
'contact': u'goodger@python.org',
|
'copyright': (u'This document has been placed in the public domain. '
|
||||||
'date': u'2006-05-21',
|
u'You\nmay do with it as you wish. You may copy, modify,'
|
||||||
'organization': u'humankind',
|
u'\nredistribute, reattribute, sell, buy, rent, lease,\n'
|
||||||
'revision': u'4564'}
|
u'destroy, or improve it, quote it at length, excerpt,\n'
|
||||||
|
u'incorporate, collate, fold, staple, or mutilate it, or '
|
||||||
|
u'do\nanything else to it that your or anyone else\'s '
|
||||||
|
u'heart\ndesires.'),
|
||||||
|
'contact': u'goodger@python.org',
|
||||||
|
'date': u'2006-05-21',
|
||||||
|
'organization': u'humankind',
|
||||||
|
'revision': u'4564',
|
||||||
|
}
|
||||||
# I like this way of comparing dicts - easier to see the error.
|
# I like this way of comparing dicts - easier to see the error.
|
||||||
for key in exampledocinfo:
|
for key in exampledocinfo:
|
||||||
yield assert_equals, exampledocinfo.get(key), expected_metadata.get(key)
|
yield assert_equals, exampledocinfo.get(key), expecteddocinfo.get(key)
|
||||||
#but then we still have to check for missing keys
|
# but then we still have to check for missing keys
|
||||||
yield assert_equals, set(expected_metadata.keys()), set(exampledocinfo.keys())
|
yield assert_equals, set(expecteddocinfo.keys()), set(exampledocinfo.keys())
|
||||||
|
Loading…
Reference in New Issue
Block a user