disable search

651 views
Skip to first unread message

Rita

unread,
Mar 4, 2012, 12:07:44 AM3/4/12
to sphin...@googlegroups.com
How can I disable the search box? It doesnt seem to work.



--
--- Get your facts first, then you can distort them as you please.--

TP

unread,
Mar 4, 2012, 6:56:44 PM3/4/12
to sphin...@googlegroups.com
On Sat, Mar 3, 2012 at 9:07 PM, Rita <rmorg...@gmail.com> wrote:
> How can I disable the search box? It doesnt seem to work.

See http://sphinx.pocoo.org/config.html#confval-html_sidebars

Rita Morgan

unread,
Mar 6, 2012, 7:47:59 AM3/6/12
to sphinx-dev
Thanks for your reply.

I made a change in my config.py

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {'localtoc.html'}

Then I do a make html and I get the following message

Running Sphinx v1.0.1
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
preparing documents... done
writing output... [100%]
index
Exception occurred:
File "/usr/lib/pymodules/python2.7/sphinx/builders/html.py", line
644, in add_sidebars
for pattern, patsidebars in self.config.html_sidebars.iteritems():
AttributeError: 'set' object has no attribute 'iteritems'
The full traceback has been saved in /tmp/sphinx-err-AZLTXh.log, if
you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error
message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/
group/sphinx-dev/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/
sphinx/issues/>. Thanks!
make: *** [html] Error 1





On Mar 4, 6:56 pm, TP <wing...@gmail.com> wrote:

TP

unread,
Mar 6, 2012, 4:33:16 PM3/6/12
to sphin...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
> To post to this group, send email to sphin...@googlegroups.com.
> To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
>

Since the example says do this:

html_sidebars = {
'**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
'using/windows': ['windowssidebar.html', 'searchbox.html'],
}

I assume you should do:

html_sidebars = {
'**': ['localtoc.html',]
}

Viktor Haag

unread,
Mar 7, 2012, 9:39:46 AM3/7/12
to sphin...@googlegroups.com

On Tuesday, 6 March 2012 07:47:59 UTC-5, Rita Morgan wrote:
I made a change in my config.py

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {'localtoc.html'}

I /think/ that html_sidebars actually takes a list of dictionary values?

html_sidebars = { 'document_name' : [ 'list.html', 'of.html', 'template_names.html' ],
  'another_doc_name' : [ 'template_name.html' ]  } 

A dictionary is a list of key-value pairs: in this case, it's using "document names" as keys, and "list of templates" as values.

Your assignment just creates a set with a single value: (['localtoc.html']), which Sphinx will deal with unpredictably.

I don't have any html_sidebar value at all, because I'm using a theme that doesn't use the sidebar. But, I /think/ that if you're using a theme that supports a sidebar (like the default one), and you want to avoid having the search box show up in them, you first have to build an html_sidebar map like this:

html_sidebars = { 'contents' : [ 'globaltoc.html' ],
                  'content/*' :  [ 'localtoc.html' ] }

And you might also have to monkey with the theme's template itself to prevent any insertion of a search bar into the HTML output (but I'm unsure about that last part). Note that building the list for html_sidebars is tricky -- you don't want to have the "document names" match twice for a document, but you also want patterns that will match everything in your doc set. I handled that issue by putting only a few "preface-y" type topic files at the root level of my project, and sticking all the other document files in subdirectories... this made it much easier to build groups of document naming pattnerns like this for my project.

Hope this helps -- it's sort of the same as TP's answer, but maybe is a bit more info on why things are working the way they're working?

--
Viktor

Viktor Haag

unread,
Mar 7, 2012, 9:43:34 AM3/7/12
to sphin...@googlegroups.com
On Wednesday, 7 March 2012 09:39:46 UTC-5, Viktor Haag wrote:
Your assignment just creates a set with a single value: (['localtoc.html']), which Sphinx will deal with unpredictably.

It helps to remember that conf.py is, in fact, executable Python code that gets "run" as part of the Sphinx program every time you build the docs.

That is, you're not just writing in configuration values that Sphinx will read and parse and digest. You are writing bits of Python, assigning things to variables, writing functions, and so on, that become "part of" the Sphinx program when it runs.

Thus, it helps enormously to have even just a bit of understanding about how the Python programming language works. I'm not sure if you're in that camp or not. If you're not, then I encourage you to seek out resources on the web that cover just the basics of Python. It really helped me a lot when I realized that (a) my conf.py was actually a Python module of sorts that was part of the "running program", and then (b) Hey! I could write Python code and put it in conf.py to do various things to help my docs builds!

--
V.

Viktor Haag

unread,
Mar 7, 2012, 9:51:42 AM3/7/12
to sphin...@googlegroups.com
On Tuesday, 6 March 2012 07:47:59 UTC-5, Rita Morgan wrote:
Exception occurred:
  File "/usr/lib/pymodules/python2.7/sphinx/builders/html.py", line
644, in add_sidebars
    for pattern, patsidebars in self.config.html_sidebars.iteritems():
AttributeError: 'set' object has no attribute 'iteritems'

One final comment on this subject (which I should have included in my original post). 8)

What Python is telling you here is that it expects "html_sidebars" to point to an object ("have a value") that is an "iterable" (that is, it's an ordered list-y type thing that has certain built-in properties, one of which being that it can iteratively (in order) return each contained item in its sequence, with the built-in function iteritems() ). For the precise language definition of "iterable", see <http://docs.python.org/glossary.html#term-iterable>

Your assignment created a "set" which I believe is not an "iterable" thing because it's by definition "un-ordered".

--
V.
Reply all
Reply to author
Forward
0 new messages