Sebastian Wiesner avatar Sebastian Wiesner committed f6633ec

Closed issues are automatically struck through in HTML output

Comments (0)

Files changed (4)

issuetracker/CHANGES.rst

 0.5 (in development)
 ====================
 
+- Closed issues are automatically struck trough in HTML output
 - Require Sphinx 1.0 now
 - Fixed #2:  Installation on windows
 

issuetracker/MANIFEST.in

 include README
 include LICENSE
 include CHANGES.*
+recursive-include sphinxcontrib *.css
 recursive-include doc *.rst *.py Makefile
 prune doc/_build

issuetracker/sphinxcontrib/issuetracker.css

+.issue-closed {
+    text-decoration: line-through;
+}
+
+.issue-closed:hover {
+    text-decoration: line-through underline;
+}
+
+.issue-closed:visited {
+    text-decoration: line-through;
+}

issuetracker/sphinxcontrib/issuetracker.py

 import urllib
 from contextlib import closing
 from functools import partial
+from os import path
 
 from docutils import nodes
 from docutils.transforms import Transform
 from sphinx.addnodes import pending_xref
+from sphinx.util.osutil import copyfile
+from sphinx.util.console import bold
 
 
 GITHUB_URL = 'http://github.com/%(user)s/%(project)s/issues/%(issue_id)s'
                     BUILTIN_ISSUE_TRACKERS[app.config.issuetracker.lower()])
 
 
+def add_stylesheet(app):
+    app.add_stylesheet('issuetracker.css')
+
+
+def copy_stylesheet(app, exception):
+    if app.builder.name != 'html' or exception:
+        return
+    app.info(bold('Copying issuetracker stylesheet... '), nonl=True)
+    dest = path.join(app.builder.outdir, '_static', 'issuetracker.css')
+    source = path.join(path.abspath(path.dirname(__file__)),
+                          'issuetracker.css')
+    copyfile(source, dest)
+    app.info('done')
+
+
 def setup(app):
     app.require_sphinx('1.0')
     app.add_transform(IssuesReferences)
     app.add_config_value('issuetracker_user', None, 'env')
     app.add_config_value('issuetracker_project', None, 'env')
     app.add_config_value('issuetracker', None, 'env')
+    app.connect('builder-inited', add_stylesheet)
+    app.connect('build-finished', copy_stylesheet)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.