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::`` * sphinx.htmlwriter, sphinx.latexwriter: Support the ``.. image::``
directive by copying image files to the output directory. 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 * sphinx.environment: Take dependent files into account when collecting
the set of outdated sources. the set of outdated sources.

View File

@ -496,7 +496,7 @@ class StandaloneHTMLBuilder(Builder):
# copy static files # copy static files
self.info(bold('copying 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')] + \ staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
[path.join(self.srcdir, spath) [path.join(self.srcdir, spath)
for spath in self.config.html_static_path] for spath in self.config.html_static_path]
@ -504,9 +504,9 @@ class StandaloneHTMLBuilder(Builder):
for filename in os.listdir(staticdirname): for filename in os.listdir(staticdirname):
if not filename.startswith('.'): if not filename.startswith('.'):
shutil.copyfile(path.join(staticdirname, filename), shutil.copyfile(path.join(staticdirname, filename),
path.join(self.outdir, 'static', filename)) path.join(self.outdir, '_static', filename))
# add pygments style file # 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.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
f.close() f.close()
@ -514,7 +514,10 @@ class StandaloneHTMLBuilder(Builder):
self.handle_finish() self.handle_finish()
def get_outdated_docs(self): 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: for docname in self.env.found_docs:
if docname not in self.env.all_docs: if docname not in self.env.all_docs:
yield docname yield docname
@ -603,6 +606,8 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder):
def init(self): def init(self):
self.init_translator_class() 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): def get_target_uri(self, docname, typ=None):
if docname == 'index': if docname == 'index':
@ -627,7 +632,7 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder):
# if there is a source file, copy the source file for the # if there is a source file, copy the source file for the
# "show source" link # "show source" link
if ctx.get('sourcename'): if ctx.get('sourcename'):
source_name = path.join(self.outdir, 'sources', source_name = path.join(self.outdir, '_sources',
os_path(ctx['sourcename'])) os_path(ctx['sourcename']))
ensuredir(path.dirname(source_name)) ensuredir(path.dirname(source_name))
shutil.copyfile(self.env.doc2path(pagename), 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) }}"> <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}">
{%- endfor %} {%- endfor %}
{%- else %} {%- else %}
<link rel="stylesheet" href="{{ pathto('static/' + style, 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"> <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css">
{%- endif %} {%- endif %}
{%- if builder != 'htmlhelp' %} {%- if builder != 'htmlhelp' %}
<script type="text/javascript"> <script type="text/javascript">
@ -56,9 +56,9 @@
VERSION: '{{ release }}' VERSION: '{{ release }}'
}; };
</script> </script>
<script type="text/javascript" src="{{ pathto('static/jquery.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/interface.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('static/doctools.js', 1) }}"></script> <script type="text/javascript" src="{{ pathto('_static/doctools.js', 1) }}"></script>
{%- endif %} {%- endif %}
{%- block rellinks %} {%- block rellinks %}
{%- if hasdoc('about') %} {%- if hasdoc('about') %}

View File

@ -32,7 +32,7 @@
{%- else -%} {%- else -%}
<tr{% if indent %} class="cg-{{ cgroup }}"{% endif %}> <tr{% if indent %} class="cg-{{ cgroup }}"{% endif %}>
<td>{% if collapse -%} <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"> class="toggler" style="display: none">
{%- endif %}</td> {%- endif %}</td>
<td>{% if indent %}&nbsp;&nbsp;&nbsp;{% endif %} <td>{% if indent %}&nbsp;&nbsp;&nbsp;{% endif %}

View File

@ -1,7 +1,7 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set title = 'Search Documentation' %} {% set title = 'Search Documentation' %}
{% block extrahead %} {% 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 %} {% endblock %}
{% block body %} {% block body %}
<h1 id="search-documentation">Search Documentation</h1> <h1 id="search-documentation">Search Documentation</h1>