Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add html template.

  • Loading branch information...
commit 41fc1909c6f32788c17c0ffe7109d1de54dc5294 1 parent 48c7ccf
@thijstriemstra authored
View
1  .gitignore
@@ -2,3 +2,4 @@
*.egg-info
doc/build
doc/themes
+doc/html/intro.html
View
16 doc/conf.py
@@ -19,7 +19,7 @@
# documentation root, use os.path.abspath to make it absolute.
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath('.'))
-#sys.path.append(os.path.abspath('html'))
+sys.path.append(os.path.abspath('html'))
# -- General configuration -----------------------------------------------------
@@ -31,7 +31,7 @@
extensions = ['sphinx.ext.intersphinx']
# Paths that contain additional templates, relative to this directory.
-#templates_path = ['html']
+templates_path = ['html']
# The suffix of source filenames.
source_suffix = '.rst'
@@ -39,6 +39,10 @@
# The encoding of source files.
#source_encoding = 'utf-8'
+# create content template for the homepage
+from util import rst2html
+readme = rst2html('../README.rst', 'html/intro.html')
+
# General substitutions.
project = 'TracFacebookPlugins'
url = 'http://trac-hacks.org/wiki/TracFacebookPluginsMacro'
@@ -108,7 +112,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-#html_static_path = ['html/static']
+html_static_path = ['html/static']
# The name of an image file (.ico) that is the favicon of the docs.
#html_favicon = 'html/static/favicon.ico'
@@ -123,9 +127,9 @@
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {
-# 'index': 'defindex.html',
-#}
+html_additional_pages = {
+ 'index': 'defindex.html',
+}
# If false, no module index is generated.
html_use_modindex = True
View
2  doc/contents.rst
@@ -4,5 +4,3 @@
.. toctree::
:maxdepth: 2
-
-.. include:: ../README.rst
View
7 doc/html/defindex.html
@@ -0,0 +1,7 @@
+{% extends "basic/defindex.html" %}
+
+{% block body %}
+
+{% include 'intro.html' %}
+
+{% endblock %}
View
27 doc/util.py
@@ -0,0 +1,27 @@
+# Copyright (c) The TracFacebookPlugins Project.
+# See LICENSE.txt for details.
+
+import os
+
+from docutils.core import publish_parts
+
+
+def rst2html( input, output ):
+ """
+ Create html file from rst file.
+
+ :param input: Path to rst source file
+ :type: `str`
+ :param output: Path to html output file
+ :type: `str`
+ """
+ file = os.path.abspath(input)
+ rst = open(file, 'r').read()
+ html = publish_parts(rst, writer_name='html')
+ body = html['html_body']
+
+ tmp = open(output, 'w')
+ tmp.write(body)
+ tmp.close()
+
+ return body
Please sign in to comment.
Something went wrong with that request. Please try again.