Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
custom footnotes
I’ve been using a custom footnotes setup for some time now, but admittedly I’m finding it a pain to update as I have to insert the footnote in the body of the text rather than the bottom. My efforts to remedy this are not working.
<txp:variable name="txt1"><txp:yield name="txt" escape="" /></txp:variable>
<txp:variable name="no1"><txp:yield name="no" /></txp:variable>
<txp:if_yield name="pos" value="top"> <sup class="tooltip">
<a href="#fn<txp:variable name="no1" />" id="foot<txp:variable name="no1" />"><txp:variable name="no1" /></a>
<span class="tooltiptext noprint" <txp:if_yield name="lang">lang='<txp:yield name="lang" />'</txp:if_yield>><txp:variable name="txt1" /></span></sup></txp:if_yield>
<txp:if_yield name="pos" value="bottom">
<li id="fn<txp:variable name="no1" />"<txp:if_yield name="lang"> lang="<txp:yield name="lang" />"</txp:if_yield>>
<txp:if_yield name="txt"><txp:yield name="txt" escape="" /><txp:else /><txp:variable name='text<txp:variable name="no1" />' /></txp:if_yield><span class="noprint">
<a href="#foot<txp:variable name="no1" />">⇧</a></span>
</li>
</txp:if_yield>
The ideal situation would be to have to only insert
<txp::note pos="top" txt id="1" />
on the top, where txt
would populate from the bottom
yield and <txp::note pos="bottom" txt id="1">Someone. "someting," in _My note_ now</txp::note>
at the bottom where txt
is enclosed within the tags to avoid issues with all sorts of quotation marks. Any ideas where I’m missing the shortcode concept?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: custom footnotes
Interesting Yiannis. I worked on a footnote model too. ;)
Into your shortcode, you need to distinguish the different #IDs. Try this:
<txp:variable name="txt1"><txp:yield name="txt" escape="" /></txp:variable>
<txp:variable name="no"><txp:yield name="no" /></txp:variable>
<txp:if_yield name="pos" value="top"> <sup class="tooltip">
<a href="#fn<txp:variable name="no" />" id="link-fn<txp:variable name="no" />"><txp:variable name="no" /></a>
<span class="tooltip noprint" <txp:if_yield name="lang">lang='<txp:yield name="lang" />'</txp:if_yield>><txp:variable name="txt1" /></span></sup></txp:if_yield>
<txp:if_yield name="pos" value="bottom">
<li id="fn<txp:variable name="no" />"<txp:if_yield name="lang"> lang="<txp:yield name="lang" />"</txp:if_yield>>
<txp:if_yield name="txt"><txp:yield name="txt" escape="" /><txp:else /><txp:variable name='text<txp:variable name="no" />' /></txp:if_yield><span class="noprint">
<a href="#link-fn<txp:variable name="no" />">⇧</a></span>
</li>
</txp:if_yield>
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: custom footnotes
That didn’t work, as it only returned the no
variable number:(
The ids are distinguished. The top sup
id is foot<txp:variable name="nos" />
and the bottom li
id is fn<txp:variable name="no" />
.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: custom footnotes
However, that seems to work for me…
Within the body text:
Lorem ipsum<txp::note txt="" no="1" pos="top" />...
And, at the bottom of the text:
<txp::note txt="The Footnote Content." no="1" pos="bottom" />
Tested with multiple notes.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: custom footnotes
Pat64 wrote #339459:
However, that seems to work for me…
Within the body text:
Lorem ipsum<txp::note txt="" no="1" pos="top" />......
And, at the bottom of the text:
<txp::note txt="The Footnote Content." no="1" pos="bottom" />...
Tested with multiple notes.
Maybe I‘m misunderstanding something here but how does this latest variant improve on textile‘s footnotes?
I think Yiannis wants to populate the top instance of the footnote with text written in the bottom instance in the article. Off hand I can’t think of a direct way of doing that within the textile text. Possibly one could post-process the html that gets output on article save using a plugin. I think it would probably be easier to add the notes tooltips after the page is rendered using javascript in the browser. I remember we discussed variants once before.
Pat64 wrote #339453:
I worked on a footnote model too. ;)
I’m intrigued. How did you approach this issue?
TXP Builders – finely-crafted code, design and txp
Offline
Re: custom footnotes
@Julian.
As I’m reading this sort code, it seems Yiannis want to create a Textile alternative. This isn’t a Textile approch.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: custom footnotes
Hi guys,
I’m not trying to create a textile approach. What I’m trying is to
- Write the notes at the bottom, but also enclose them in a shortcode so as to allow textile. ie my example at the begining of this thread:
<txp::note pos="bottom" txt id="1">Someone. "someting," in _My note_ now</txp::note>
- I would also like the notes to appear on the top on mouse-over, as they do now. www.neme.org/texts/dark-matter but without having to insert them on the top, just the bottom.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: custom footnotes
Yes, I get that this not using textile‘s own footnotes. I just didn’t understand how Patrick‘s stripped down version improves on it. It seems a lot of code to input to achieve essentially the same result.
I meant that within the body field (set to textile formatting) the top to bottom method you‘ve used up to now works (similarly Oleg’s clever idea in the other thread to build a variable collecting a list of footnotes) because it corresponds to the natural processing flow. Putting your actual footnote text content at the bottom and having it fill the footnote tooltips further up doesn’t. I understand why editing at the bottom would be a better workflow for you.
The only options I can think of right now are:
- post-processing your article text on save with a to-be-written plugin.
- use javascript to attach a tooltip to your
<sup>
tags and show the content of the corresponding href (or a data-attribute of the href if you want to show a precis of the footnote) on click / rollover.
At first glance the second option seems easier to me, but maybe someone else has a better idea.
TXP Builders – finely-crafted code, design and txp
Offline
Re: custom footnotes
Sorry, I’m a bit lost in details, but might altering the processing order help you?
<!-- txt variables are used in shortcodes -->
<txp::note pos="top" id="1" />
<txp::note pos="top" id="2" />
...
<!-- txt variables must be populated in this block -->
<txp:hide[1] process="1">
<txp::note pos="bottom" id="1">Someone. "someting," in _My note_ now</txp::note>
<txp::note pos="bottom" id="2">Someone. "someting," in _My note_ now</txp::note>
</txp:hide>
Offline
Re: custom footnotes
etc wrote #339465:
Sorry, I’m a bit lost in details, but might altering the processing order help you?
<!-- txt variables are used in shortcodes -->...
Cool, if that works, that would potentially solve it. If it does, I must remember that, a great trick to populate something “up-page” with data you process “down-page”.
TXP Builders – finely-crafted code, design and txp
Offline
Re: custom footnotes
jakob wrote #339464:
use javascript to attach a tooltip to your
<sup>
tags and show the content of the corresponding href (or a data-attribute of the href if you want to show a precis of the footnote) on click / rollover.
You might be right!!! Any recommendations?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: custom footnotes
colak wrote #339468:
You might be right!!! Any recommendations?
Is not exactly what you are doing, but I prefer this pattern: showing the full footnote in a sticky block at the bottom of the page, like this: redsails.org/a-prova-do-algodao/ (script is here: redsails.org/static/footnote.js), sample url ‘cause I had that page open. Le Monde diplomatique uses a similar pattern; other open page, Orient XXI, has a sticky block on the side (orientxxi.info/lu-vu-entendu/liban-la-danse-du-combattant-pour-un-passeport,8126) – it is not as nice as it blocks the view.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline