Re: [sphinx-dev] Add JavaScript to every generated page

2012-06-25 Thread TP
On Fri, Jun 22, 2012 at 5:59 AM, Tobias Oberstein
 wrote:
> Is there a way to add some JS to $(document).ready() for every page
> generated by Sphinx via configuration (thus avoid patching the generated
> stuff afterwards)?

You can do this by using the *basic* theme's *extrahead* "block". See
[1] for details.

[1] http://sphinx.pocoo.org/templating.html

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] want "hidden" toctree included in parent trees

2012-06-25 Thread Eric
Regarding the toctree "hidden" option, from the changelog:

#367: Added automatic exclusion of hidden members in inheritance diagrams, 
and an option
to selectively enable it.

Where can I enable hidden toctree members to show up in the inheritance 
diagram?

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/a822nkh9wRwJ.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] Add JavaScript to every generated page

2012-06-25 Thread Tobias Oberstein
Is there a way to add some JS to $(document).ready() for every page 
generated by Sphinx via configuration (thus avoid patching the generated 
stuff afterwards)?

In particular, currently I am patching the generated

_static/doctools.js

for

$(document).ready(function() {
  Documentation.init();
 * var frame = $('#thisframe', window.parent.document);
  frame.height(document.body.offsetHeight);*
});

This is for dynamically adjusting the IFrame height containing the Sphinx 
generated docs. The IFrame is integrated into a site.

   
  **
Your browser does not support iframes.
  


This works great, but as said I'd like to avoid patching the generated 
stuff ..

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/I3I6Jz3Fv0wJ.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] want toctree "hidden" members in parent trees

2012-06-25 Thread Eric
Regarding the toctree "hidden" option, from the changelog:

#367: Added automatic exclusion of hidden members in inheritance diagrams, 
and an option
to selectively enable it.

Where can I enable hidden toctree members to show up in the inheritance 
diagram?

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/h9GMutDhys0J.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] sphinx hangs in headless mode with "GLib-GObject-CRITICAL assertion failed"

2012-06-25 Thread Martin Luessi
Hi,

I am in the process of setting up an automated doc build system for 
mne-python . It works fine when 
running the build when logged into the X11 session, but when I run it in 
headless mode (cronjob), sphinx is hanging at the end of building an 
example with the following output (truncated):

Reading 103891 ... 109897  =172.974 ...   182.974 secs...  [done] 
Writing ...  [done] 
Reading 109898 ... 115892  =182.976 ...   192.956 secs...  [done] 
Writing ...  [done] 

(process:50748): GLib-GObject-CRITICAL **: gtype.c:2458: initialization 
assertion failed, use IA__g_type_init() prior to this function 

(process:50748): GLib-CRITICAL **: g_once_init_leave: assertion 
`initialization_value != 0' failed 
... 

This happens at the end of every example. Strangely, the example it was 
building successfully got built. The matplotlib generated images are there, 
so it doesn't seem to be a matplotlib backend issue (I tested it to work in 
headless mode) but sphinx somehow crashes at the end of building an 
example. When re-running  sphinx again, the same thing happens with the 
next example. 

Has anyone seen this problem before? We are using pylab (matplotlib) and 
mlab in the examples. This problem happens with EPD-7.2.2 and on Gentoo 
Linux using sphinx 1.1.2 and 1.1.3.

Best,

Martin 


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/GeK5BAoUQSwJ.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.



[sphinx-dev] Three suggestions for Sphinx

2012-06-25 Thread Mikael Lyngvig
Hi,

I am trying to help the LLVM dev group by converting existing HTML 
documentation into reSt.  During that conversion stage, we've discovered 
some frequently occuring mishaps in our documents that I'd like Sphinx to 
catch, if possible.  Currently, I am using a tiny Python script (see the 
attached file) to check for these inconsistencies, but it would be very 
nifty if Sphinx could catch them on its own.

The three checks are:

1. Trailing whitespace in lines.
2. Too long or too short section marker (the ===/---/ line is 
shorter than or longer than the text that preceeds it).
3. Too long lines: the LLVM group uses as standard 80 chars per line so 
it would be nice with a warning, possibly by adding a new option (-maxlen 
or whatever).

The three checks are all cosmetic and does not affect the behavior of 
Sphinx as far as I know.


Regards,
Mikael

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/NaEV510lJroJ.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

#! /usr/bin/python
# A small script, which checks Sphinx reStructured Text (.rst) files for various inconsistencies and errors so as to save
# bandwidth by catching some of the most obvious problems before the document is sent off for review.

import glob
import sys

class RestructuredTextChecker:

def __init__(self):
pass

def load(self, filename, stderr=sys.stdout):
stream = open(filename, "rt")
number = 0  # line number
last   = "" # last/previous line
while 1:
# read yet another line
line = stream.readline()

# if None, we're at the end of the input
if not line:
break

# increment line number
number += 1

# drop trailing newline, if any
if line[-1] == '\n':
line = line[:-1]

# check for trailing whitespace
if line.rstrip() != line:
stderr.write("(%s %d) Warning: Trailing whitespace detected\n" % ( filename, number ))
line = line.rstrip()   # make comparisons of marker text possible

# check for too short or too long section marker
if len(line) > 0 and line[0] in "=-^":
if last != "" and len(line) < len(last):
stderr.write("(%s %d) Warning: Marker line too short\n" % ( filename, number ))
elif last != "" and len(line) > len(last):
stderr.write("(%s %d) Warning: Marker line too long\n" % ( filename, number ))
last = "" # disable line-too-long check of section headers
continue

# check for too long lines (in excess of 79 characters)
if len(last) > 79:
stderr.write("(%s %d) Warning: Line exceeds 79 characters\n" % ( filename, number - 1 ))

# todo: add other checks as they are discovered and deemed usable

# save this line for possible future marker comparison
last = line

stream.close()


def main(args):
 # redirect all output to stdout (stderr belongs to the `yes` family of utterly insane inventions).
 output = sys.stdout

 # if no args given, show help
 if len(args) == 0:
 output.write("reStructured Text Checker v0.03\n")
 output.write("Copyright (C) 2012 The LLVM Team.  All Rights Reserved.\n")
 output.write("\n")
 output.write("Syntax: \"chkrst\" source-file(s)\n")
 output.write("\n")
 output.write("Scans and checks .rst files for obvious yet embarrassing errors.\n")
 return 0

 # expand wildcards in arguments
 files = []
 for arg in args:
 found = glob.glob(arg)
 if found == []:
 output.write("Warning: Pattern '%s' not matched\n" % arg)
 files += found

 # process each file in turn
 for file in files:
 checker = RestructuredTextChecker()
 checker.load(file, output)
 del checker

 return 0
 

if __name__ == "__main__":
result = main(sys.argv[1:])
sys.exit(result)