Discussion:
Extension hooks to get text for popups at end of html
Rob van der Valk
2018-09-28 21:05:13 UTC
Permalink
Hi dear reader,

A small test after 10 tries for uploading a real question was not working
If this works more follows
Rob
--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rob van der Valk
2018-09-28 21:06:00 UTC
Permalink
Maybe no I can upload?

Hi dear reader,

I have an extension that works semi okay for making popups: a directive
popup, a role 'popup' and working code with JavaScript. Unfortunately the
webclients 'see'
my <div> and script parts and decide to throw in a <p> meaning the place
where I have my :popup: role ends with a new paragraph. Ugly as...

There is a very small issue with z-index, caused by a big happening of
z-indices in accompanying sageCell example... Trivial to solve, z-index may
be 100 in my css I guess... But that is not my problem...

I have the rest working, so I am now trying to build the text in the
following way:
- directive added as usual, with app.add_directive('popup',popupDirective)

- added a popupRole with app.add_role('popup',popupRole)

- and finally app.add_node(popupNode,html=(visitPopupNode, departPopupNode))

Nothing particular there...

The central work is done in popupRole

My current thinking is:
- In the directive call I collect all of interest. Return an empty node,
actual contents to be put later.
- in the role call I want to put in the button towards the script call.

- HOWEVER: scriptcall needs to be specific (tied to a certain popup text)
and fully outside the regular text flow: presence of any script definition
'inline'
forces the client to insert a <p> => my text is partitioned in several
paragraphs... Ouch.
- Ditto: the actual <div> with the text that can be made invisible yes/no
also must be outside the flow, again the client will insert a </p>,p>
otherwise, so again no definition 'inline'

So these two, script definition and <div> need to be glued at the 'end' of
the doctree, outside of the regular text flow. Current code just plugs it
smack into the textflow, giving me the paragraph effect.

But how do you do that, getting data from your earlier material, in an
extension? I was looking at the EnvironmentCollector stuff, but I have a
big hunch I am misunderstanding that stuff.... Anybody a suggestion? I am
considering pushing the text out as a separate html file, but again, how do
you do that (elegantly/robustly) within the extension environment?

The only (should be) working solution is to have yet another directive
(popupFinish) , near the end of the file, and use that as regular RST
oriented solution. I am not particularly thrilled about that, although I
use then same trick as TODO lists... But todolist:: creates a sort of
direct visual feedback on precisely the location where .. todolist:: is
called.
For popups that is not so great I find...

Any suggestions are welcome!

Rob
--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rob van der Valk
2018-09-28 21:11:13 UTC
Permalink
And adding files with contents... Maybe that was the issue...
Post by Rob van der Valk
Hi dear reader,
A small test after 10 tries for uploading a real question was not working
If this works more follows
Rob
--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rob van der Valk
2018-09-28 21:23:39 UTC
Permalink
Uploading of tars is forbidden? I cannot get the actual testbed up....Made
it as a tar, too much for anything else I guess..
Or is zie more an issue? Or something else yet?
--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...