NISUS Archives

July 2012

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Þorvarður Davíðsson <[log in to unmask]>
Reply To:
Date:
Tue, 24 Jul 2012 15:58:32 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (92 lines)
On 21.07.2012, at 19:46, Philip Spaelti wrote:

> 
> as I was suspecting there is actually a macro to do this kind of thing in the Nisus Macro Repository
> called:
> Convert Notes to Inline Snippets (and vice versa)"


Hello Philip,

I did not read your mail until today. Guess I was too busy writing my own macro, so I didn’t know that the task had been already accomplished. :-) :-)

In the meantime I have written a simple and crude macro that does the job. It just automatizes steps I would otherwise have done manually. A randomly selected sample-documents can be found here for those who like to test it or see how it works. 

http://minus.com/myU8PkeRJ/
and
http://minus.com/myU8PkeRJ/2


You can run the macro on the sample documents. I split the original document into two parts (text and endnotes). I did not format or clean up the text in any way. 

I wrote some introductory words for the other list members here regarding the purpose of the macro and how to use it. 

PURPOSE
This macro assumes we have a document with reference markers in the text body and endnotes with corresponding reference numbers which may or may not have a different format. Hot links between reference markers and endnotes are broken. The purpose is to establish the hot links again. The macro assumes we have created a paragraph style called "Endnote Style". This style will be used to format the endnotes. You can disable this part if you don't want to create such a style.


ADJUST THE FIND COMMANDS
Now, the only thing we have to do before we run the macro is to adjust the two Find commands in the macro so that they match the form of the reference markers and the endnote numbers in our document respectively. If the samples are used then there is no need to adjust the Find commands, of course.

HOW TO RUN THE MACRO
Select all the endnotes in the document, and cut and create a new Nisus document; paste the endnotes and save the new document. Make sure you have only the two Nisus documents open. Make the document that contains the text body active and run the macro from there.


### Endnotes and restored Hyperlinks ###
# July 22, 2012

#$found = Find '(Space)[(AnyDigit)(1+)]', 'e'
$found = Find ' \[[[:digit:]]+]', 'E'
Select Document Start
$counter = 0

While $found
#$found = Find '(Space)[(AnyDigit)(1+)]', 'e'
$found = Find ' \[[[:digit:]]+]', 'E'
if $found == 0
Select All
# Since the insertion point is in the notes only the notes will be selected, not the whole #document
Endnote Style
# Assumes you have created an individual endnote style called "Endnote Style"
# The notes remain selected so that you can assign language attribute, if necessary, and do #further formatting
prompt "$counter endnote markers were converted!"
exit
End
$counter = $counter + 1
Endnote
Next Window
#-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Select Document Start
#Find '(Start of Paragraph)(AnyDigit)(1+).(Space)', 'e'
Find '^[[:digit:]]+. ', 'E'
Delete
#Find '(AnyParagraph)', 'e'
Find '(?:^.+$)', 'E'
Cut
Next Window
#-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Paste
End

### end of macro



> 
> I have tried writing a very bare-bones macro for my purposes. (…) The following is my *in-progress* (alpha, not beta) macro


I’ll take a close look at this, Philip, and come back to you if I have any questions. As always, your kind help and encouragement is greatly appreciated. 


> 
> 
> If the notes are in a separate file, one would simply switch documents after collecting the note contents from the first document.

I switch back and forth in my macro; that takes up extra time and I’m sure it can be done in a more elegant way by putting the contents into a variable. But I don’t know how to do that yet. -- In Nisus Classic one was able to "close" the screen, i.e. it would look like as if it were frozen, but behind the scenes the macro would go on. This seems not to be possible in NWP.


Þorvarður Davíðsson
 OS X 10.7.4
 MacBook Pro 17’' 

ATOM RSS1 RSS2