Make Paragraphs with Links From Input

June 6, 2005 on 3:47 pm | In Special Clips - for someone | No Comments

Ok, take this:
U.S. Dive Travel
Offers packages to Bonaire’s Sand Dollar Condominium Resort.

http://www.usdivetravel[...]ONAIRE-Sand_Dollar.html

Sand Dollar Group
Offers project management and support for the development of web
sites, LAN and WAN design, data center relocations and custom
helpdesk integration.

http://www.sanddollargroup.com

Make it into this:


U.S. Dive Travel

Offers packages to Bonaire’s Sand Dollar Condominium Resort.

http://www.usdivetravel[...]ONAIRE-Sand_Dollar.html


Sand Dollar Group

Offers project management and support for the development of web
sites, LAN and WAN design, data center relocations and custom
helpdesk integration.

http://www.sanddollargroup.com

Obviously correcting it to xhtml formatting … cause I just cannot bring myself to use capital html tags any more.

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*******************************************************
; Take paragraphs and make linked paragraphs
; assume double return between paragraphs

;start at the top (assuming whole file)
^!Jump Doc_Start
;set list delimiter to space and get array elements
^!SetListDelimiter "^P"

:paragraph
^!ClearVariables
;set cursor position
^!Set %row%="^$GetRow$"
^!Set %column%="^$GetCol$"

;find end of this "paragraph" of info
^!Find "^P^P" CIS
^!IfError END

^!Jump Select_End
;select the paragraph
^!SelectTo ^%row%:^%column%

;break the paragraph into an array
;element one is what will go into the
;link tag, "next-to-last" array element will be the
;link url itself and all "middle" elements
;will form the paragraph
;delimited array set by splitting line on returns
^!SetArray %delimited_data%=^$GetSelection$
;make sure it isn't empty item if it is END
^!If "^%delimited_data1%" = "" END

;delete selected paragraph now
^!Keyboard DELETE

;find the second from last element number
^!Set %link_element%=^$Calc(^%delimited_data0%-2)$
;the following could all be done
;on one long line ... or with short insertHTML's
;followed by jumps ... your choice
^!InsertHtml

^%delimited_data1%
^!Jump Select_End
^!InsertHtml

^P
^!Jump Select_End
;increment index for description
^!Set %indx%=2

:Loop_Description
;display each array element
^!InsertHtml ^%delimited_data^%indx%%
^P
^!If ^%indx% = ^$Calc(^%delimited_data0%-3)$ Next_Paragraph
^!Inc %indx%
^!Goto Loop_Description

:Next_Paragraph
^!InsertHtml

^P^P
^!Jump Select_End
^!Goto paragraph

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^

Bad Behavior has blocked 412 access attempts in the last 7 days.