Delete All <a href> and <\a> Tags from a Document

June 14, 2005 on 10:22 pm | In General, Generic Clips | No Comments

This clip will remove all and tags from a document. This includes all links, including all mailto: links. The version as written asks if you want to remove each tag. After you are comfortable with the clip, there is a comment telling you to take out the skip if you don’t want confirmation.

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*** based on work by Larry and Jody and maybe Wayne
;*******************************************************
;delete any a href tags

;start at top of document
^!Jump Doc_Start

;### initialize everything
;look forwards to find the starting < :Loop
^!Find "<" TIS
;exit if find fails
^!IfError Finish
^!SetScreenUpdate Off
^!ClearVariables

;### %TAG% will be empty if cursor is not inside a tag.
^!Set %TAG%="^$GetHtmlTag(TRUE)$"
^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag

;### So we found a tag. What tag is it?
^!Set %TAGNAME%="^$GetHtmlTagName("^%TAG%";UPPERCASE)$"
;react if it is an A tag (opening or closing)
^!If "/A" = "^%TAGNAME%" HREF
^!If "A" = "^%TAGNAME%" HREF ELSE NotTag

:HREF
^!Select HTMLTAG
;delete following line if you want it to not ask before deleting
^!Skip Leave this tag in:^%nl%^$GetSelection$^%nl%^%nl%(Press Ctrl+Alt and click button to abort.)^%nl%
^!Keyboard DELETE
^!Goto Loop

:NotTag
^!Jump Select_End
^!Goto Loop

;### clean up and go home
:Finish
^!SetScreenUpdate On
^!ClearVariables
;line 46 if you have all lines unrapped (including blank lines)

Convert Bible Study Guide to HTML Format

June 9, 2005 on 4:11 pm | In Special Clips - for someone | 3 Comments

Alueet wrote:
> Would somebody like to help me, because I can’t make the clips.
> I’m making my own Daily devotion and I use Notetapro writing it and I
> take the text from the finnish Bible.
> Here is the original text and after that the result what I want the clip
> make.
>
> —————————-
> Fil 4:1-9
> (1) Rakkaat ja kaivatut veljeni, te minun iloni ja kunniaseppeleeni,
> pysykää siis horjumatta Herran yhteydessä, rakkaat ystävät!
> (2) Kehotan Euodiaa ja Syntykeä elämään sovussa Herraa palvellen.
> (3) Pyydän myös sinua, uskollinen työtoverini, auttamaan näitä naisia,
> jotka ovat minun kanssani taistelleet evankeliumin puolesta samoin kuin
> Clemens ja muutkin työtoverini, joiden kaikkien nimet ovat elämän kirjassa.
> (4) Iloitkaa aina Herrassa! Sanon vielä kerran: iloitkaa!
> (5) Tulkoon teidän lempeytenne kaikkien ihmisten tietoon. Herra on jo
> lähellä.
> (6) Älkää olko mistään huolissanne, vaan saattakaa aina se, mitä
> tarvitsette, rukoillen, anoen ja kiittäen Jumalan tietoon.
> (7) Silloin Jumalan rauha, joka ylittää kaiken ymmärryksen, varjelee
> teidän sydämenne ja ajatuksenne, niin että pysytte Kristuksessa
> Jeesuksessa.
> (8) Lopuksi, veljet, ajatelkaa kaikkea mikä on totta, mikä on
> kunnioitettavaa, mikä oikeaa, puhdasta, rakastettavaa ja kaunista, mikä
> vain on hyvää ja ansaitsee kiitoksen.
> (9) Tehkää sitä, mitä olette minulta oppineet ja vastaanottaneet, mitä
> olette minulta kuulleet ja minusta nähneet. Silloin rauhan Jumala on
> oleva teidän kanssanne.
> Saakoon ilo ja lempeys täyttää sydämemme. Muistakaamme, että Jumala on
> luvannut pitää meistä huolen. Jumalan rauha asukoon sydämissämme.
> Rakas Jeesus; opeta meitä ajattelemaan puhtaita asioita.
>
> —————————–
>
> Fil 4:1-9

> (1) Rakkaat ja kaivatut veljeni, te minun iloni ja kunniaseppeleeni,
> pysykää siis horjumatta Herran yhteydessä, rakkaat ystävät!
> (2) Kehotan Euodiaa ja Syntykeä elämään sovussa Herraa palvellen.
> (3) Pyydän myös sinua, uskollinen työtoverini, auttamaan näitä naisia,
> jotka ovat minun kanssani taistelleet evankeliumin puolesta samoin kuin
> Clemens ja muutkin työtoverini, joiden kaikkien nimet ovat elämän
> kirjassa.
> (4) Iloitkaa aina Herrassa! Sanon vielä kerran: iloitkaa!
> (5) Tulkoon teidän lempeytenne kaikkien ihmisten tietoon. Herra on jo
> lähellä.
> (6) Älkää olko mistään huolissanne, vaan saattakaa aina se, mitä
> tarvitsette, rukoillen, anoen ja kiittäen Jumalan tietoon.
> (7) Silloin Jumalan rauha, joka ylittää kaiken ymmärryksen, varjelee
> teidän sydämenne ja ajatuksenne, niin että pysytte Kristuksessa
> Jeesuksessa.
> (8) Lopuksi, veljet, ajatelkaa kaikkea mikä on totta, mikä on
> kunnioitettavaa, mikä oikeaa, puhdasta, rakastettavaa ja kaunista, mikä
> vain on hyvää ja ansaitsee kiitoksen.
> (9) Tehkää sitä, mitä olette minulta oppineet ja vastaanottaneet, mitä
> olette minulta kuulleet ja minusta nähneet. Silloin rauhan Jumala on
> oleva teidän kanssanne.

> Saakoon ilo ja lempeys täyttää sydämemme. Muistakaamme, että Jumala on
> luvannut pitää meistä huolen. Jumalan rauha asukoon sydämissämme.
>

> Rakas Jeesus; opeta meitä ajattelemaan puhtaita asioita.

This clip seems to fill the bill:

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*******************************************************
; reformat bible verses

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

;verify that there are no blank leading lines
:Check_Leading_Returns
^!Select Eol
;make sure it isn't empty item if it is END
^!If "^$GetSelection$" = "" Leading_Returns ELSE Format_Line_One
:Leading_Returns
^!Continue You have a blank line at the top of your document, can we delete it?
^!Keyboard DELETE

;Format First Line
:Format_Line_One
^!InsertHtml ^$GetSelection$

^!Jump +1

;Find end of (1)
^!Find "1)" TIS
^!IfError ABORT

;find next paragraph
:Process_Paragraph
^!Replace "^P(" >> "
^P(" TIS
^!IfError Process_Final_Paragraphs
^!Goto Process_Paragraph

^!SetDebug On
:Process_Final_Paragraphs
^!Replace ".^P" >> ".

^P" ATIS
^!Info [C]Successful Run, Congratulations
^!Goto End

:ABORT
^!Info [C]An Error Has Occurred -- Sorry

Remove Table Tags from XHTML or HTML Document

June 9, 2005 on 2:04 am | In Generic Clips | No Comments

This clip should remove all table, tr, and td tags from a document including end tags.

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*******************************************************
;clip strips html table tags from entire document

;go to start of document
^!Jump Doc_Start

;loop to check each tag to see if it is a table tag
:Loop
;find next tag start
^!Find "< " TIS
;quit when no more tags
^!IfError Finish

^!ClearVariables
;### %TAG% will be empty if cursor is not inside a tag.
;determine if tag and get the name of the tag
;if not table tag cycle to next via NotTag subroutine
^!Set %TAG%="^$GetHtmlTag(TRUE)$"
^!IfTrue ^$IsEmpty(^%TAG%)$ NotTag
^!Set %TAGNAME%="^$GetHtmlTagName("^%TAG%";UPPERCASE)$"
;I think there are six tags in tables so
;these six options are tested and tag deleted if match
^!If "TABLE" = "^%TAGNAME%" Table
^!If "TD" = "^%TAGNAME%" Table
^!If "TR" = "^%TAGNAME%" Table
^!If "/TABLE" = "^%TAGNAME%" Table
^!If "/TD" = "^%TAGNAME%" Table
^!If "/TR" = "^%TAGNAME%" Table
^!Goto NotTag

:NotTag
^!Jump Select_End
^!Goto Loop

;if TABLE tag delete it
:Table
;delete the tag
;could just replace it with a
;or something like that if you wish
^!Keyboard DELETE

^!Goto NotTag

:Finish
^!Info [C]finished with this file
^!Goto End
;line 51 including all blanks and comments

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

Splitting a Line of Text on Spaces

June 3, 2005 on 5:53 pm | In Generic Clips, Notetab Clips | No Comments

You can create an array by dividing on a set character. In this example I split on spaces per the request of the writer.

;*** Effort by Don Passenger
;*** don a-t htmlfixit d-o-t com
;*** discuss things live in chat at http://htmlfixit.com
;*******************************************************
;I assume each line in the file is this 9 field data format:
;"title 1 some text title 2 other text 567034"

;start at the top (assuming whole file)
^!Jump Doc_Start

;set list delimiter to space and get array elements
^!SetListDelimiter " "

:Loop
;get the row we are in
^!Set %row%="^$GetRow$"
;select the current line where cursor resides
;this will select the entire line from prior
;line feed to this one
^!Select Paragraph
;delimited array set by splitting line on spaces
^!SetArray %delimited_data%=^$GetSelection$
^!Set %indx%=1
:Loop_Display
;display each array element
^!Info Row is: ^%row% ^PElement ^%indx% is ^%delimited_data^%indx%%
;check if we have used all elements in current row
;compare current index number to number of elements
;in the array using delimited_data0 - which stores
;the number of elements in an array
^!If ^%indx% = ^%delimited_data0% Next_Line

^!Inc %indx%
^!Goto Loop_Display
;move to next line and then continue
:Next_Line
;go to next line
^!Jump Select_End
;loop again if there are more rows
^!If ^%row% = ^$GetLinecount$ END ELSE Loop

Significant points in this clip:
1. use of the ^!SetArray command to divide on a preset delimiter (in this case a space)
2. use of the special 0 element in the array to determine how many elements are in the array
3. use of the line: “^!If ^%row% = ^$GetLinecount$ END ELSE Loop” to test if we are at the end of our file
testing if you are at the end of a file is a common necessity in notetab clips.

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

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