Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Addressing specific paragraph at export (Read 4345 times)
Robert Matzken
Full Member
*
Offline



Posts: 21

Addressing specific paragraph at export
Mar 10th, 2010, 9:31am
 
Good day, all.

I am trying to construct a kind of stretchtext website (I'm using some of Nathan's code). My main problem right now is how to add a certain div declaration at a specific paragraph in a note (other then typing, of course).

The idea is that the expanding note and the originating paragraph (the paragraph with the referring link) need to be wrapped in one div in order for the JQuery effects to work.

The system works if every referring link is written as a separate paragraph/note, but one paragraph per note is tedious writing. Moreover, one does not always know in advance where the margin and/or expanding notes are needed.

Is this possible? Many thanks,
Robert
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Addressing specific paragraph at export
Reply #1 - Mar 10th, 2010, 10:03am
 
Macros might be one possibility.

Currently, there's separate markup for the first paragraph and subsequent paragraphs.  That might help, too.

Another approach might use ^include to include a selected child note that contains, for example, the replacement text wrapped in markup that  initially hides it.
Back to top
 
 
WWW   IP Logged
Robert Matzken
Full Member
*
Offline



Posts: 21

Re: Addressing specific paragraph at export
Reply #2 - Mar 10th, 2010, 5:17pm
 
Thanks, Mark. I had tried out all the possibilities you mention, but none work. The thing is, a div-tag needs to be added before the paragraph from which the link originates, but only if there is a link leading from it.

One would think the solution would be to simply wrap all paragraphs each in an extra div, but in this case this doesn't work because the div needs to wrap both the originating paragraph as well as the target which gets included on export. So the originating paragraph needs to have a starting div added, but not a closing div since this comes after the included paragraph containing the margin text.

It is a piece of cake to add the closing div to the template used to include the target, there really is tremendous flexibility in tinderbox. It's just that I can't seem to get this thing sorted.

Incidentally, there are two reasons for not implementing Nathan's stretchtext: 1) his expanding text is inserted at the link, thereby breaking sentences when the link is in the middle of a sentence, and often leaving the sentence's period 'widowed' underneath the inserted text, and 2) the position of the margin text is calculated from the link as well, so the margin note often doesn't vertically align with the referring paragraph. Apart from this, I love his concepts, and would like to enhance them with a bit of JQuery.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Addressing specific paragraph at export
Reply #3 - Mar 10th, 2010, 5:32pm
 
I did a related variation on Matias' stretchtext for Hypertext 2009, using combinations of macros, child-notes and template strategies to place appropriate markup.
Back to top
 
 
WWW   IP Logged
Robert Matzken
Full Member
*
Offline



Posts: 21

Re: Addressing specific paragraph at export
Reply #4 - Mar 11th, 2010, 1:12pm
 
The work-around to the above. My aim was to address one specific - the last - paragraph inside a note, in order to add an opening div before it.

I could not find a way to do this, but I kept staring at Mark's comment "...that might help, too" referring to Tinderbox allowing different code applied to various paragraphs: to the first, to all subsequent ones, and to indented ones. How to address the last one? By indenting it. I add the div to the last paragraph not on account of it being the last, but on account of it being the indented one. So whenever I need to include a margin note, I indent the respective paragraph and write the do macro command which will generate the link to trigger the margin note.

The requirement for the last paragraph stems from the fact that the closing div gets added from the included template file after ^text^ - after the entire note content. True, the flow of writing is interrupted, but this is the matter anyway when adding the note with margin text, so that was not too bad. The thing is, of course, not forgetting to indent.

Why this quest? Well, by wrapping the paragraph which contains the referring link with its margin note into one div of class="wrapper", with a css declaration of position = relative, and the margin note having a position = absolute, it is possible to have the referring link, which is generated by a macro, remain generic and simple:

Code:
<a href="javascript:void()" class="togglelink"> 


This triggers the toggle or slideToggle JQuery effect which expands the margin note relative to the originating paragraph. By applying different HTML templates to different notes, this same link code (and thus the same macro) can be used to either trigger a margin note in the sidebar, or a sliding down expanding paragraph.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print