Loading ...
Sorry, an error occurred while loading the content.

24420Re: [Clip] Re: Problem with footnote clip

Expand Messages
  • Lee Underwood
    Apr 23, 2014

      It's not that I don't know ANYTHING about clips, it's just that I have never had the time to get deeper into them, such as with this clip.

      As for the clip code below, it works on the first three footnotes and part of the fourth but missed the other 41. I only used the "Process footnotes" portion as the other is for the most part, the same. If you want, so as not to tie up this list, I can send you the entire file directly, with all the text and footnotes. Then the working clip can be posted back here.

      I do appreciate all your help. And I do intend on trying to understand this clip, once it works correctly. I just can't understand why the original didn't work in the first place when it has worked in the past (although yours does look a bit more streamlined).



      On Tue, Apr 22, 2014, flo.gehrke@... <flo.gehrke@...> wrote:

      > ---In ntb-clips@yahoogroups.com, Lee wrote :
      > > Flo, As I mentioned in my original email, the clip was written by Bob
      > > McAllister. I don't have enough expertise to write something like that.
      > > (...) I don't really know. In fact, I am not even sure what part your clip
      > > would be replacing. Could you list the clip as it should look completed?
      > Lee,
      > I tried to rewrite this clip from scratch. Now you may copy all this and insert it in an existing library, or you create a new library and copy it to that library.
      > If we are lucky, this will work as intended ;-)
      > I fear it may be difficult to explain all this to someone who is not sufficiently familiar with clip code. On the other hand, I'm not quite sure what the result should look like in the end.
      > Regards,
      > Flo
      > Try this (watch long lines!) ...
      > H=";Footnotes"
      > H="Mark refs"
      > ^!IfFalse ^$GetSelSize$ Next Else Skip_2
      > ^!Prompt This clip requires a selection
      > ^!Goto End
      > ^!InsertHTML <ref>^&</ref>
      > H="Footnote position"
      > ^!InsertText <Create footnotes here>
      > H="Process footnotes"
      > ; Check for '<Create footnotes here>' mark
      > ^!Find "<Create footnotes here>" WS
      > ^!IfError Next Else Skip_2
      > ^!Info [L]This file is not ready to be processed.^PIt does not have a location marked to place the footnotes.
      > ^!Goto End
      > ; Make a copy of original file
      > ^!TextToFile "^#_unprocessed^$GetExt(^##)$" ^$GetText$
      > ; Collect refs and assign them to an array %refs%
      > ^!Select 0
      > ^!SetListDelimiter ^%NL%
      > ^!SetArray %refs%=^$GetDocMatchAll("<ref>\K[^<]+(?=</ref>)")$
      > ^!Set %idx%=1
      > ^!Jump Doc_Start
      > :ftrf_loop
      > ^!Replace "<ref>^%refs^%idx%%</ref>" >> "<a href="#ftnt^%idx%" class="ftrf">^%idx%</a><a name="ftrf^%idx%"></a>" S
      > ^!Inc %idx%
      > ^!If ^%idx% <= ^%refs0% ftrf_loop
      > ; Write footnotes
      > ^!Find "<Create footnotes here>"
      > ^!Set %idx%=1
      > ^!InsertHTML <div class="ftnt">^%NL%<h3>Footnotes</h3>^%NL%
      > :ftnt_loop
      > ^!InsertHTML <span><a name="ftnt^%idx%">^%idx%.</a>^%SPACE%^%refs^%idx%%<a href="#ftrf^%idx%">^%SPACE%[return]</a></span><br>^%NL%
      > ^!Inc %idx%
      > ^!If ^%idx% <= ^%refs0% ftnt_loop
      > ^!InsertHTML </div>
      > ; Save processed file
      > ^!Save
      > H="Insert styles"
      > ; This was left unchanged since it doesn't affect the procedure so far
      > ;Caution - Works in FF but something here breaks IE
      > ;long line follows
      > ^!InsertText .ftrf{font-size: x-small;vertical-align:
      > text-top;padding:0 0.5ex;}^%NL%.ftnt {border-top: thin solid
      > black;}^%NL%.ftnt h4 {padding:0;margin:0;}^%NL%.ftnt span
      > {display:block;font-size: small;}
    • Show all 9 messages in this topic