Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-10-17 12:39:47

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,912
Website

notes

In our site I use the code below for the article notes:

<txp:if_yield name="pos" value="top">
<sup class="tooltip">
<a href="#fn<txp:yield name="no" />" id="foot<txp:yield name="no" />"><txp:yield name="no" /></a>
<span class="tooltiptext noprint">
<txp:variable name='text<txp:yield name="no" />'><txp:yield name="txt" escape="" /></txp:variable>
<txp:yield name="txt" escape="" />
</span>
</sup>
</txp:if_yield>
<txp:if_yield name="pos" value="bottom">
<li id="fn<txp:yield name="no" />">
<txp:if_yield name="txt">
<txp:yield name="txt" escape="" />
<txp:else />
<txp:variable name='text<txp:yield name="no" />' />
</txp:if_yield> 
<span class="noprint"><a href="#foot<txp:yield name="no" />">&#8679;</a></span>
</li>
</txp:if_yield>

This is how I use it in the text body:

<txp::note no="1" txt="Jacques Lacan, &#8216;Du discors psychanalytique &#8217;, <em>Lacan in Italia 1953-1978</em>, La Salamandra, Milan, 1978" pos="top" />

and in the footnotes

notextle.
<ol class="notes">
<txp::note no="1" pos="bottom" />
...
<txp::note no="n" pos="bottom" />
</ol>

What it does. It allows me to have the notes appear like tooltips in the text body but also appear as proper notes at the end of the article. example.

The above of course is an easy one as it only has 2 notes but when the notes are a lot I have to add each one <txp::note no="n" pos="bottom" /> so as to get them to appear properly there.

The question: Is there a native way to have the bottom notes appear like:

notextle.
<ol>
<txp::note no="1-n" pos="bottom" />
</ol>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Online

#2 2018-10-17 19:43:30

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: notes

Hi Yiannis,

why not to construct your “bottom” list in note form itself:

<sup class="tooltip">
<a href="#fn<txp:yield name="no" />" id="foot<txp:yield name="no" />"><txp:yield name="no" /></a>
<span class="tooltiptext noprint">
<txp:variable name='text<txp:yield name="no" />'><txp:yield name="txt" escape="" /></txp:variable>
<txp:yield name="txt" escape="" />
</span>
</sup>

<txp:variable name="notelist"><txp:variable name="notelist" />
<li id="fn<txp:yield name="no" />">
<txp:if_yield name="txt">
<txp:yield name="txt" escape="" />
<txp:else />
<txp:variable name='text<txp:yield name="no" />' />
</txp:if_yield> 
<span class="noprint"><a href="#foot<txp:yield name="no" />">&#8679;</a></span>
</li>
</txp:variable>

Then you just output

<txp:variable name="notelist" wraptag="ol" />

at the bottom of the article.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2018-10-18 09:06:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,912
Website

Re: notes

Hi Oleg,

That is indeed a great idea but (there is always a but:)) I have some cases where the note is too long for which case I only have part of it in the top (tooltip) and the whole of it in the bottom. example

So my bottom snippet would become

notextle.
<ol>
<txp::note no="1" txt="long note here" pos="bottom" />
<txp::note no="2-n" pos="bottom" />
</ol>

I realise that this might also be a css problem as the long notes on the top of the page are hidden by the fixed menu or or the actual top limit of the browser window. I have to admit that I was looking for an easy way to deal with it but I guess that using your suggestion and changing the css of the tooltips so as for them to become more adaptive might be the best way forward.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Online

#4 2018-10-18 09:39:05

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,160
Website

Re: notes

As far as I can tell, your tooltips are css only, so you need to insert the text at the footnote reference to make it appear there. If you want to have totally different text at the footnote reference and footnote, I can’t think of a way around that.

If you switched to some kind of js-based tooltip, your tooltip-text and footnote text wouldn’t have to be at the same location in the text as the footnote reference. Then you could do as Oleg suggests and perhaps expand your ::notes shortcode to also include a shortform version of the footnote (where you need one). You could output that as a data-shortform attribute attached to your footnote, e.g.

<li id="fn1" data-shortform="In this edited version of what was originally a talk, curator Steve Dietz suggests a way of thinking about new media art.">
     In this edited version of what was originally a talk, curator <a rel="external" href="http://www.yproductions.com/info/archives/000178.html">Steve Dietz</a> suggests a way of thinking about new media art. His starting point was artist <a rel="external" href="http://www.jevbratt.com/">Lisa Jevbratt’s</a> <a rel="external" href="http://www.walkerart.org/gallery9/jevbratt/">A Stillman Project for the Walker Art Center</a>, which he commissioned for the Walker Art Center’s <a rel="external" href="http://gallery9.walkerart.org">Gallery 9</a>. In this project Jevbratt uses the idea of a host-parasite relationship to create her artwork which feeds off the Walker’s own website.
    <span class="noprint"><a href="#foot1">⇧</a></span>
</li>

Then in your javascript for the tooltip, you could make it check if data-shortform exists for #fn1 and use that for the tooltip text, if not use the footnote text for the tooltip. Many of the javascript tooltips also have edge detection and will push the tooltip to one side or beneath your text if it doesn’t fit on the screen or crashes into other elements.

In your article, you’d just insert your footnote reference and then do your notes at the bottom as Oleg suggests with the added shortform text where you need it.

EDIT: Actually, perhaps I/we misunderstood Oleg’s (once again rather clever) tip. It looks like he’s suggesting putting the whole note where the footnote reference is, and generating a self-extending variable from each item as the text is processed so that the variable containing all the footnotes is then output at the end. Perhaps – instead of the js method – you just need to add a shortform attribute to your ::notes shortcode that you use to create the top part while using the full footnote text for the variable part of the form.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2018-10-18 13:22:07

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: notes

colak wrote #314629:

I have some cases where the note is too long for which case I only have part of it in the top (tooltip) and the whole of it in the bottom.

As @jakob suggests, you can separate them if needed. I would also assign note numbers automatically. Your note form might look like this:

<txp:variable name="no" escape="integer">
    <txp:evaluate query='0<txp:variable name="no" />+1' />
</txp:variable>

<sup class="tooltip">
<a href="#fn<txp:variable name="no" />" id="foot<txp:variable name="no" />">
    <txp:variable name="no" />
</a>
<span class="tooltiptext noprint">
    <txp:yield name="txt" escape="" />
</span>
</sup>

<txp:variable name="notelist"><txp:variable name="notelist" />
<li id="fn<txp:variable name="no" />">
<txp:if_yield>
    <txp:yield escape="" />
<txp:else />
    <txp:yield name="txt" escape="" />
</txp:if_yield> 
<span class="noprint"><a href="#foot<txp:variable name="no" />">&#8679;</a></span>
</li>
</txp:variable>

Now you can use txt attribute for short texts, and the content of the form as long text, if needed. You also don’t have to care about no attribute anymore:

<txp::note txt="common text" />
...
<txp::note txt="short text">
long text
</txp::note>
...
<txp:variable name="notelist" wraptag="ol" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

#6 2018-10-19 06:57:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,912
Website

Re: notes

Whoa!!! This is very cool!! I’ll do the tests and get back with the results. not having to think about numbering the notes will actually be a real time saver!!!


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Online

#7 2018-10-19 15:34:14

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: notes

What would be nice is to have the ‘tooltip’ idea function as an optional part of Textile’s endnotes. I can’t think of how that would be off-hand, but it would look a lot like Wikipedia’s handling too, which I think Steve largely based the original endnotes design on, except that part.

What Colak’s doing here seems a little like reinventing half the wheel if we have the auto-numbering and everything in Textile’s handling. No?


The text persuades, the *notes prove。

Offline

#8 2018-10-19 18:23:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,912
Website

Re: notes

What I do not like in the textile notes is the random anchors it produces. Also, I like the notes to be in an ordered list.

I am indeed re-inventing the textile wheel here and I am also borrowing from the wikipedia idea as it saves trying to find where you left when reading:)


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Online

#9 2018-10-19 19:53:09

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,020
Website

Re: notes

colak wrote #314654:

What I do not like in the textile notes is the random anchors it produces.

You mean the ‘back to citation’ anchors at left of each note? Yeah, those are a tad annoying, but in the web medium, they do make sense, and especially in my case where I can have many notes.

Also, I like the notes to be in an ordered list.

Yeah, my bad. I realize now that I have CSS that makes my notes ordered as desired.

But I do really appreciate the auto-positioning that the endnotes functionality provides. That was a nice touch by Steve. I.e. you can list your notes in any wacky order you want in the draft, but when rendered they automatically appear in order as they are cited. Again, very useful when you’re dealing with lots of notes (easily upwards of 100, working on such a project now).

I’ll have to look closer at your solution sometime. What I’m finding is endnotes in the web are kind of a hassle all around if you deal with more than a dozen. The notes handling alone in the draft phase eats up tonnes of time, easily magnitudes more than the writing itself. That’s just kind of crazy. Mainly because it’s all so fiddly.

More and more I think for my real long-form history efforts, which are heavily annotated, that I’ll probably draft my work in something like Scrivner, which handles endnotes a lot easier, then compile two versions from that; one with notes in more of a print format (i.e. actual footnotes in context to a page) that becomes an epub, and one without that gets published in my site. I can even charge a small sum for the epub versions, for people who want the convenience of an e-reader and the evidence. After all, the text persuades, but the notes prove. ;)


The text persuades, the *notes prove。

Offline

Board footer

Powered by FluxBB