Rename static to _static and consistently name _sources.

This commit is contained in:
Georg Brandl 2008-03-25 18:32:23 +00:00
parent aa9ba35f23
commit 7a4cfd3d05
5 changed files with 20 additions and 12 deletions

View File

@ -4,6 +4,9 @@ Changes in trunk
* sphinx.htmlwriter, sphinx.latexwriter: Support the ``.. image::``
directive by copying image files to the output directory.
* sphinx.builder: Consistently name "special" HTML output directories
with a leading underscore; this means ``_sources`` and ``_static``.
* sphinx.environment: Take dependent files into account when collecting
the set of outdated sources.

View File

@ -496,7 +496,7 @@ class StandaloneHTMLBuilder(Builder):
# copy static files
self.info(bold('copying static files...'))
ensuredir(path.join(self.outdir, 'static'))
ensuredir(path.join(self.outdir, '_static'))
staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
[path.join(self.srcdir, spath)
for spath in self.config.html_static_path]
@ -504,9 +504,9 @@ class StandaloneHTMLBuilder(Builder):
for filename in os.listdir(staticdirname):
if not filename.startswith('.'):
shutil.copyfile(path.join(staticdirname, filename),
path.join(self.outdir, 'static', filename))
path.join(self.outdir, '_static', filename))
# add pygments style file
f = open(path.join(self.outdir, 'static', 'pygments.css'), 'w')
f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
f.close()
@ -514,7 +514,10 @@ class StandaloneHTMLBuilder(Builder):
self.handle_finish()
def get_outdated_docs(self):
template_mtime = max(mtimes_of_files(self.templates_path, '.html'))
if self.templates_path:
template_mtime = max(mtimes_of_files(self.templates_path, '.html'))
else:
template_mtime = 0
for docname in self.env.found_docs:
if docname not in self.env.all_docs:
yield docname
@ -603,6 +606,8 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder):
def init(self):
self.init_translator_class()
# no templates used, but get_outdated_docs() needs this attribute
self.templates_path = []
def get_target_uri(self, docname, typ=None):
if docname == 'index':
@ -627,7 +632,7 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder):
# if there is a source file, copy the source file for the
# "show source" link
if ctx.get('sourcename'):
source_name = path.join(self.outdir, 'sources',
source_name = path.join(self.outdir, '_sources',
os_path(ctx['sourcename']))
ensuredir(path.dirname(source_name))
shutil.copyfile(self.env.doc2path(pagename), source_name)

View File

@ -46,8 +46,8 @@
<link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}">
{%- endfor %}
{%- else %}
<link rel="stylesheet" href="{{ pathto('static/' + style, 1) }}" type="text/css">
<link rel="stylesheet" href="{{ pathto('static/pygments.css', 1) }}" type="text/css">
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css">
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css">
{%- endif %}
{%- if builder != 'htmlhelp' %}
<script type="text/javascript">
@ -56,9 +56,9 @@
VERSION: '{{ release }}'
};
</script>
<script type="text/javascript" src="{{ pathto('static/jquery.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('static/interface.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('static/doctools.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/jquery.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/interface.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/doctools.js', 1) }}"></script>
{%- endif %}
{%- block rellinks %}
{%- if hasdoc('about') %}

View File

@ -32,7 +32,7 @@
{%- else -%}
<tr{% if indent %} class="cg-{{ cgroup }}"{% endif %}>
<td>{% if collapse -%}
<img src="{{ pathto('static/minus.png', 1) }}" id="toggle-{{ cgroup }}"
<img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ cgroup }}"
class="toggler" style="display: none">
{%- endif %}</td>
<td>{% if indent %}&nbsp;&nbsp;&nbsp;{% endif %}

View File

@ -1,7 +1,7 @@
{% extends "layout.html" %}
{% set title = 'Search Documentation' %}
{% block extrahead %}
<script type="text/javascript" src="{{ pathto('static/searchtools.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
{% endblock %}
{% block body %}
<h1 id="search-documentation">Search Documentation</h1>