Just re-read your email, and I'm not sure how this would work.

In html, I'd have two divs, something like this:

<div class="help-only"><a id="h002" class="block-link" title="Title"
href="javascript:toggleBlock('002')" target="_self">    
    Click here to see an example.</a></div>     
    
    <div id="d002" class="expandingblock" style="display:none;">
            <p>Here is the example</p> 

One is the link to expand or collapse the 2nd div.

Without an extension, how do I end up with a link to the javascript?

-----Original Message-----
From: sphinx-dev@googlegroups.com [mailto:sphinx-...@googlegroups.com]
On Behalf Of Max Battcher
Sent: 15 September 2010 19:04
To: sphinx-dev@googlegroups.com
Subject: Re: [sphinx-dev] Re: secondary windows or hidden sections in
html output

On 09/15/2010 08:42 AM, Alastair Dent wrote:
> Hmm.
>
> I've tried using .. raw: html to escape and put some extra javascript
in one of the standard js files.
>
> That worked - sortof. Except that the html builder doesn't copy over
any images that aren't referenced in rst.
>
> I guess I'll have to look at making my own extension for this. Blast.

You might not need an extension for this. I would use the rst-class
directive myself to apply arbitrary CSS classes to the content I wanted
to hide. Example:

   .. rst-class:: html-start-hidden

   This is the following reST paragraph that the class applies to.

Then you just tell your JS library of choice to act upon items of that
class (rst-class gets added to HTML CSS class list), for instance with
the right plugin for jQuery you might have something like:

$('.html-start-hidden').expandCollapse({'start-hidden': true});

No .. raw:: html needed (just add the JS to the static templates), and
the reST content shows up in your PDF and other builds as well.

--
--Max Battcher--
http://worldmaker.net

--
You received this message because you are subscribed to the Google
Groups "sphinx-dev" group.
To post to this group, send email to sphinx-...@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.


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@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.

Reply via email to