Anonymous avatar Anonymous committed b2be57a

Make system messages stand out in HTML output.

Comments (0)

Files changed (4)

 Global TODO
 ===========
 
+- "often used" combo box in sidebar
 - discuss and debug comments system
 - navigation links at the bottom too
 - write new Makefile, handle automatic version info and checkout
 - look at the old tools/ scripts, what functionality should be rewritten
 - add search via Xapian?
 - optionally have a contents tree view in the sidebar (AJAX based)?
-

converter/newfiles/doc_markup.rst

 
 .. describe:: envvar
 
-   An environment variable. Index entries are generated.
+   An environment variable.  Index entries are generated.
 
 .. describe:: file
 
-   The name of a file or directory.
+   The name of a file or directory.  Within the contents, you can use curly
+   braces to indicate a "variable" part, for example::
+
+      ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ...
+
+   In the built documentation, the ``x`` will be displayed differently to
+   indicate that it is to be replaced by the Python minor version.
 
 .. describe:: guilabel
 
 generic_docroles = {
     'command' : nodes.strong,
     'dfn' : nodes.emphasis,
-    'file' : nodes.emphasis,
-    'filenq' : nodes.emphasis,
-    'filevar' : nodes.emphasis,
     'guilabel' : nodes.strong,
     'kbd' : nodes.literal,
     'keyword' : nodes.literal,
 
 
 def menusel_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
-    return [nodes.emphasis(rawtext, text.replace('-->', u'\N{TRIANGULAR BULLET}'))], []
+    return [nodes.emphasis(
+        rawtext, utils.unescape(text).replace('-->', u'\N{TRIANGULAR BULLET}'))], []
+
+
+_filevar_re = re.compile('{([^}]+)}')
+
+def file_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
+    text = utils.unescape(text)
+    retnodes = []
+    pos = 0
+    for m in _filevar_re.finditer(text):
+        if m.start() > pos:
+            txt = text[pos:m.start()]
+            retnodes.append(nodes.literal(txt, txt))
+        retnodes.append(nodes.emphasis('', '', nodes.literal(m.group(1), m.group(1))))
+        pos = m.end()
+    if pos < len(text):
+        retnodes.append(nodes.literal(text[pos:], text[pos:]))
+    return retnodes, []
 
 
 specific_docroles = {
     'token' : xfileref_role,
 
     'menuselection' : menusel_role,
+    'file' : file_role,
 }
 
 for rolename, func in specific_docroles.iteritems():

sphinx/style/default.css

     margin-bottom: 10px;
 }
 
+.system-message {
+    background-color: #fda;
+    padding: 5px;
+    border: 3px solid red;
+}
+
 /* :::: PRINT :::: */
 @media print {
     div.documentwrapper {
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.