|
CONVLNK PBCC (32-bit) Procedure |
|
CONVLNK procedure (external program executable from the DOS command prompt) converts plain text link list into HTML insert for preexisting specially formatted HTML link page. This permits to minimize the effort of supporting link lists — all editing is done basically by simple cutting-and-pasting into plain text link list using any text editor, while the tedious job of maintaining the hyperlinked HTML link page is handled by the CONVLNK procedure. Direct dependencies:
CONVLNK Source Program Debugging examples |
' CONVLNK(2.4) Conv Plain Text Link List into HTML 02/11/2003-07/21/2005
' --------------------------------------------------------------------------
' Copyright (C) 2003-2005 by Vladimir Veytsel www.davar.net
' Type ---------------------------------------------------------------------
' Procedure
' Parameters (up to 2 Optional Separated by "," or " ") --------------------
' 1. Name of the links TXT/HTM file (Deflt: LINKS in the CURRENT direct)
' 2. Replacement specification (Default: No replacements)
' Form: <Key_1>-<Val_1>/<Key_2>-<Val_2>/<Key_3>-<Val_3>...
' E.g.: INT-E/INF-H
' ("-" is used instead of "=" to simplify setting it via environment)
' Up to 10 replacements may be specified as the second parameter.
' Replacement might be necessary only for conversion of personal
' links that are used instead on Netscape's "Personal Toolbar".
' They provide the mechanism to specify local drives for the local
' links, so that the same *.TXT personal links file could be adjusted
' to the specific computer at the time of links' conversion.
' TXT Links File Format ----------------------------------------------------
' - First line is always a title, last 10 positions of which represent
' link list modification date to be inserted into the <name>.HTM file
' first and second lines. Title should be delimited from dates by
' at least TWO spaces. Year is inserted in the right part of the
' Copyright range if one is found.
' - Any blank lines are ignored (serve as convenient vertical visual
' delimiter) - link formatting is controlled by the indentation only.
' - Any lines starting with "*" (which might be preceded by spaces)
' are ignored. This permits to imbed any comments within <name>.TXT
' links file as well as to comment out certain lines.
' - Line consisting of all "=" terminates reading of plain text links
' file. This permits to keep any links yet to be verified below
' this EOF line.
' - If replacement is specified, every *.TXT line is checked for the
' presence of every specified %<Key_x>%, and, if found, it gets
' replaced by the corresponding value. This permits to tune personal
' links during conversion (substitute for "personal toolbar") according
' to the specific computer where it has to be used.
' E.g.: Manual (vendor manuals) | file:///%INF%:/Manual/HTM
' The "Manual" directory is located on different drives for different
' computers of the group, and using %INF% parameter in *.TXT permits
' to replace it with the proper drive letter at the time of conversion
' (conversion batch script has to take care of that).
' - Unindented lines are section headers in the form of:
' <text> [(<comment>)] [| <URL>]
' <text> represents the name of the section (preferably short, since
' it goes into top and bottom internal navigation bars),
' <comment> is optional (might be useful to explain short section name),
' <URL> is optional and, if used, provides the link to the related
' section of the same web site (directory structure), where
' the <name>.HTM links page is located.
' - Indented lines (indent size is irrelevant - at least one blank
' is sufficient) are links in the form of:
' <text> [(<comment>)] | <URL>
' <text> represents the name of the link,
' <comment> is optional,
' <URL> provides link to the named page.
' - The most obvious way to specify the URL is to specify it complete
' with the protocol, i.e., "http://www.davar.net", not "www.davar.net".
' However, it's obvious that close to 100% of all URLs will always
' start with "http://", and it's pointless and wasteful to specify it
' each time. Exceptions, though negligible in volume, are still very
' important, so, while assuming the "http://" as a default, the following
' rules are used to handle the exceptions:
' - If URL starts with the "_" (protocol is not necessary),
' then "_" is trimmed away and the rest of URL is taken as is -
' this covers rare, but vital case when it refers to the
' page within the same directory structure.
' - If URL contains "://" within the first 8 characters
' (protocol is specified explicitly),
' then URL is taken as is - this covers the cases when either
' "http://" is already specified (e.g.: got there by
' cut-and-paste), or another protocol is necessary for
' this link, e.g.: "https://", or "ftp://", or "file:///"
' - If none of the above conditions is met (protocol is defaulted),
' then "http://" is inserted in front of specified URL.
' Note: The above doesn't apply to section links - they are needed only
' for cross-references (if any) within the same web site (directory
' structure), and for this reason are always taken as is.
' - E.g.:
' Client / Server Links (DAVAR\CS\LINKS.TXT) 09/27/2001-08/29/2002
' Reference | REFER/REFER.HTM
' On-Line Dictionary of Computing | wombat.doc.ic.ac.uk/foldoc
' Dictionary of PC Hardware and Data Communication Terms | www.oreilly...
' UNIX
' UNIX References (HTML and PDF, University of Northern Carolina) | help...
' UNIX Commands (University of Central Florida) | www.acs.ucf.edu/man...
' HTM Links File Format ----------------------------------------------------
' - HTML prologue of the <name>.HTM links page that is finished by the line
' "<!-- Links Start -->" (possibly padded with blanks on on both or any
' side). Indent of this line (if any) is used as the BASE indent for
' all converted links.
' - List of links to be substituted by the newly generated from <name>.TXT
' file. Note: There is no <HR> before the FIRST section.
' - E.g.:
' <CENTER><FONT SIZE=4 COLOR=Red><B><U>Client / Server Links</U></B></FONT></CENTER>
' <BR><!--------------------------------------------------------------->
' <A NAME="Reference"></A>
' <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
' <TR>
' <TD> <A HREF="REFER/REFER.HTM"><I><B>Reference</B></I></A></TD>
' <TD ALIGN=Right>
' <I>
' <FONT COLOR=Green>Go to:</FONT>
' <A HREF="#UNIX">Next sect</A>
' <FONT COLOR=Green>|</FONT>
' <A HREF="#Bottom">List bot</A>
' </I>
' </TD>
' </TR>
' </TABLE>
'
' <A HREF="http://wombat.doc.ic.ac.uk/foldoc/index.html">
' On-Line Dictionary of Computing</A>
' <BR>
' <A HREF="http://www.oreilly.com/reference/dictionary/">
' Dictionary of PC Hardware and Data Communication Terms</A>
' <HR><!--------------------------------------------------------------->
' <A NAME="UNIX"></A>
' <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
' <TR>
' <TD> <FONT COLOR=Navy><I><B>UNIX</B></I></FONT></TD>
' <TD ALIGN=Right>
' <I>
' <FONT COLOR=Green>Go to:</FONT>
' <A HREF="#Top">List top</A>
' <FONT COLOR=Green>|</FONT>
' <A HREF="#Reference">Prev sect</A>
' <FONT COLOR=Green>|</FONT>
' <A HREF="#Solaris">Next sect</A>
' <FONT COLOR=Green>|</FONT>
' <A HREF="#Bottom">List bot</A>
' </I>
' </TD>
' </TR>
' </TABLE>
'
' <A HREF="http://help.unc.edu/index.xsp?id=1603&trail=1146,1603&sort=score&">
' UNIX References</A> (University of Northern Carolina – HTML and PDF)
' <BR>
' <A HREF="http://www.acs.ucf.edu/manuals/unix/commands.html">
' UNIX Commands</A> (University of Central Florida)
' <BR>
' <A HREF="http://www.acs.ucf.edu/manuals/unix/email.html">
' E-Mail</A> (University of Central Florida)
' - HTML epilogue of the <name>.HTM links page that is started by the line
' "<!-- Links Finish -->".
' Action -------------------------------------------------------------------
' - Reads <name>.TXT file and saves section titles to be used for
' generating of the internal navigation links.
' - Reads <name>.HTM file until it encounterers the line
' "<!-- Links Start -->". Every line of input file <name>.HTM gets
' copied to temporary file <name>.ZZZ; modification date in the first
' two lines being substituted by modification date from <name>.TXT file.
' - Skips all lines of <name>.HTM file up to "<!-- Links Finish --> line.
' - Writes top internal navigation bar to the <name>.ZZZ file.
' - Converts all links in <name>.TXT file writing their HTML text to the
' <name>.ZZZ file.
' - Writes bottom internal navigation bar to the <name>.ZZZ file.
' - Writes to the <name>.ZZZ file "<!-- Links Finish --> line.
' - Reads <name>.HTM file up to its end copying every line to <name>.ZZZ
' file.
' - Deletes <name>.HTM file.
' - Renames <name>.ZZZ file file into <name>.HTM file.
' Notes --------------------------------------------------------------------
' - CONVLNK serves to support the 2-level link hierarchy that is quite
' sufficient for most practical purposes.
' 1. Link page within the web site.
' 2. Link section within the link page.
' - To avoid any possible problems with the presentation of delimiter lines
' "<!-- Links Start -->" and <!-- Links Finish -->" text of lines read
' gets converted to the upper case before testing for delimiter line,
' all successive internal spaces get compressed to single space, and
' external spaces get truncated.
' - If the line that immediately precedes the "<!-- Links Start -->"
' delimiter line ends with "<I>", internal inter-section navigation
' bars at section title get italicized.
' - CONVLNK is supposed to be triggered by batch script that checks if the
' <name>.TXT file date-time is later than that of the <name>.HTM file,
' in which case CONVLNK is called to refresh the <name>.HTM file.
' - This procedure presumes that ALL changes to the links list are done
' ONLY in the corresponding <name>.TXT file. Any direct changes to the
' links body of the <name>.HTM file will be overwritten by the nearest
' CONVLNK run.
' - CONVLNK also is suited to be run from command line to convert the
' individual links file. In this case the most simple way is to run
' CONVLNK within the current directory of the links file.
' - CONVLNK operation is controlled by processing flags that are defined
' separately as string constants and are expected to be present in the
' <name>.HTM file. Their absence in an anticipated context will yield
' an unpredictable results.
' External SubProgram Library ----------------------------------------------
$LINK "MODULE.PBL"
' External Functions -------------------------------------------------------
DECLARE FUNCTION COMPRES$(Strng$,Chars$)
DECLARE FUNCTION PARSE% (Strng$,SubStr$(),Delim$)
DECLARE FUNCTION REVERSE$(Strng$)
DECLARE FUNCTION TAILSTR$(Strng$,Delim$)
' External Routine ---------------------------------------------------------
DECLARE SUB PRNTCLR(Text$)
DECLARE SUB PROGRES(File%,Nam$,Title$,Record$,Mode$,Appear$)
' Start Procedure ----------------------------------------------------------
DEFINT A-Z ' All defaulted variables are integer
OPTION BASE 1 ' Default array indexation starts from "1"
' Constants ----------------------------------------------------------------
Q$ =CHR$(34) ' Quotation mark
HR$="<HR><!--------------------------------------------------------------->"
' Processing Flags ---------------------------------------------------------
Copyright$ ="<!-- Copyright (C)"
Top.Nav.Bar$ ="Go to:</FONT> <A HREF="
Bot.Tag$ ="<A HREF="+Q$+"#Bottom"+Q$+">"
Links.Start$ ="<!-- LINKS START -->"
Links.Finish$="<!-- LINKS FINISH -->"
' Working Variables --------------------------------------------------------
DIM Parameter$(2)
DIM Repl$(10)
DIM Src$(10)
DIM Trg$(10)
' Get and Validate Control Parameter (Links' File Name) --------------------
Parm$=UCASE$(COMMAND$)
' Parm$="C:\DEBUG\LINKS-X" ' Non-existent LINKS-X.TXT file
' Parm$="C:\DEBUG\LINKS-0" ' Non-existent LINKS-0.HTM file
' Parm$="C:\DEBUG\LINKS-1" ' Single section layout
' Parm$="C:\DEBUG\LINKS-2" ' Two sections layout
' Parm$="C:\DEBUG\LINKS-3" ' Three sections layout
' Parm$="C:\DEBUG\LINKS-R" ' Regular font test (no Italics)
' Parm$="C:\DEBUG\LINKS-M" ' Mother's links (special formats)
' Parm$="C:\DEBUG\LINKS-V,INF-H" ' Vlad's personal links (toolbar equivalent)
I=PARSE%(Parm$,Parameter$(),"")
' Form File Name Actual Value ----------------------------------------------
File.Name$=Parameter$(1)
IF (File.Name$="") THEN
File.Name$="LINKS"
END IF
' Form Replacement Table ---------------------------------------------------
IF (I>1) THEN
Replacements=PARSE%(Parameter$(2),Repl$(),"/")
FOR I=1 TO Replacements
Src$(I)="%"+EXTRACT$(Repl$(I),"-")+"%"
Trg$(I)= TAILSTR$(Repl$(I),"-")
NEXT I
END IF
' Check Files' Existence ---------------------------------------------------
IF (LEN(DIR$(File.Name$+".TXT"))=0) THEN
CALL PRNTCLR("%R%CONVLNK(2.4) Text file %M%"+File.Name$+".TXT %R%doesn't exist - %M%program stopped%D%")
STOP
END IF
IF (LEN(DIR$(File.Name$+".HTM"))=0) THEN
CALL PRNTCLR("%R%CONVLNK(2.4) Link file %M%"+File.Name$+".TXT %R%doesn't exist - %M%program stopped%D%")
STOP
END IF
' Allocate Array for Section Titles ----------------------------------------
OPEN File.Name$+".TXT" FOR INPUT AS #2
LINE INPUT #2,Link.Line$ ' Skip link list title
WHILE NOT EOF(2)
LINE INPUT #2,Link.Line$
IF (LEFT$(Link.Line$,1)<>" ") THEN ' Section title
Max.Sections=Max.Sections+1
END IF
WEND
CLOSE
DIM Section$(Max.Sections)
' Read and Save Section Titles ---------------------------------------------
OPEN File.Name$+".TXT" FOR INPUT AS #2
LINE INPUT #2,Link.Line$ ' Skip link list title
WHILE NOT EOF(2)
LINE INPUT #2,Link.Line$
IF (Link.Line$="") THEN ITERATE ' Ignore blank line
IF (LEFT$(LTRIM$(Link.Line$),1)="*") THEN ITERATE ' Ignore comment line
IF (VERIFY(Link.Line$,"=")=0) THEN EXIT ' EOF line of all "="
IF (LEFT$(Link.Line$,1)<>" ") THEN
IF (INSTR(Link.Line$,"(")>0) THEN
Section.Title$=COMPRES$(LTRIM$(RTRIM$(EXTRACT$(Link.Line$,"(")))," ")
ELSEIF (INSTR(Link.Line$,"|")>0) THEN
Section.Title$=COMPRES$(LTRIM$(RTRIM$(EXTRACT$(Link.Line$,"|")))," ")
ELSE
Section.Title$=LTRIM$(RTRIM$(Link.Line$))
END IF
Sections=Sections+1
Section$(Sections)=Section.Title$
END IF
WEND
CLOSE
' Open Data Files ----------------------------------------------------------
OPEN File.Name$+".HTM" FOR INPUT AS #1
OPEN File.Name$+".TXT" FOR INPUT AS #2
OPEN File.Name$+".ZZZ" FOR OUTPUT AS #3
' Get Link List Title and New <name>.HTM Date from <name>.TXT --------------
CALL PROGRES(1,"CONVLNK(2.4)","Convert Link List "+File.Name$+".TXT"+" into HTML","","S","")
LINE INPUT #1,HTML.Line$
LINE INPUT #2,Link.Line$
PRINT #3,LEFT$(HTML.Line$,LEN(HTML.Line$)-14);RIGHT$(Link.Line$,10);" -->"
Year$=RIGHT$(Link.Line$,4)
Work$=LTRIM$(EXTRACT$(Link.Line$," "))
Title$=LEFT$(Work$,1)
FOR I=2 TO LEN(Work$)-1
IF (MID$(Work$,I,1)=" ") THEN
IF ((UCASE$(MID$(Work$,I-1,1))<>LCASE$(MID$(Work$,I-1,1)))AND _
(UCASE$(MID$(Work$,I+1,1))<>LCASE$(MID$(Work$,I+1,1)))) THEN
Title$=Title$+" "
ELSE
Title$=Title$+" "
END IF
ELSE
Title$=Title$+MID$(Work$,I,1)
END IF
NEXT I
Title$=Title$+RIGHT$(Work$,1)
LINE INPUT #1,HTML.Line$
PRINT #3,LEFT$(HTML.Line$,LEN(HTML.Line$)-14);RIGHT$(Link.Line$,10);" -->"
' Insert Converted Links into Links HTML Text ------------------------------
WHILE NOT EOF(1)
Prev.Line$=HTML.Line$
LINE INPUT #1,HTML.Line$
IF (LEFT$(HTML.Line$,18)=Copyright$) THEN
PRINT #3,LEFT$(HTML.Line$,24);Year$;MID$(HTML.Line$,29)
ELSEIF (INSTR(HTML.Line$,Top.Nav.Bar$)>0) THEN
Top.Nav=-1
Nav.Length=LEN(EXTRACT$(MID$(LTRIM$(REVERSE$(HTML.Line$)),5),">"))+9
PRINT #3,HTML.Line$
ELSEIF (Top.Nav) THEN
Nav.Length=Nav.Length+LEN(EXTRACT$(MID$(LTRIM$(REVERSE$(HTML.Line$)),5),">"))+3
PRINT #3,HTML.Line$
IF (INSTR(HTML.Line$,Bot.Tag$)>0) THEN
Top.Nav=0
Nav.Length=Nav.Length-3
END IF
ELSEIF (UCASE$(LTRIM$(RTRIM$(HTML.Line$)))=Links.Start$) THEN
Links.Body=-1
IF (RIGHT$(RTRIM$(Prev.Line$),3)="<I>") THEN
Italics=-1
END IF
Base.Pos=VERIFY(HTML.Line$," ")
Base.Pos.4=Base.Pos+4
Base.Pos.6=Base.Pos+6
Base.Pos.7=Base.Pos+7
Base.Pos.8=Base.Pos+8
Base.Pos.12=Base.Pos+12
Base.Pos.13=Base.Pos+13
Base.Pos.18=Base.Pos+18
Base.Pos.19=Base.Pos+19
Base.Pos.29=Base.Pos+29
Base.Pos.37=Base.Pos+37
PRINT #3,TAB(Base.Pos);"<!-- Links Start -->"
ELSEIF (UCASE$(LTRIM$(RTRIM$(HTML.Line$)))=Links.Finish$) THEN
Links.Body=0
GOSUB Convert.and.Insert.Links
PRINT #3,TAB(Base.Pos);"<!-- Links Finish -->"
ELSEIF (NOT Links.Body) THEN
PRINT #3,HTML.Line$
END IF
WEND
' Finish Program -----------------------------------------------------------
CALL PROGRES(1,"","","","F","")
CLOSE
KILL File.Name$+".HTM"
NAME File.Name$+".ZZZ" AS File.Name$+".HTM"
END
Convert.and.Insert.Links: ' Routine ---------------------------------------
GOSUB Write.Internal.Navigation.Bar
WHILE NOT EOF(2)
LINE INPUT #2,Link.Line$
CALL PROGRES(1,"","",Link.Line$,"P","")
IF (Link.Line$="") THEN ITERATE ' Ignore blank line
IF (LEFT$(LTRIM$(Link.Line$),1)="*") THEN ITERATE ' Ignore comment line
IF (VERIFY(Link.Line$,"=")=0) THEN EXIT ' EOF line of all "="
IF (Replacements>0) THEN
FOR I=1 TO Replacements
REPLACE Src$(I) WITH Trg$(I) IN Link.Line$
NEXT I
END IF
IF (LEFT$(Link.Line$,1)<>" ") THEN ' Process section header
Curr.Sect=Curr.Sect+1
IF (INSTR(Link.Line$,"|")>0) THEN
Section.Title$=COMPRES$(LTRIM$(RTRIM$(EXTRACT$(Link.Line$,"|")))," ")
Section.Link$ =COMPRES$(LTRIM$(RTRIM$(TAILSTR$(Link.Line$,"|")))," ")
ELSE
Section.Title$=LTRIM$(RTRIM$(Link.Line$))
Section.Link$ =""
END IF
IF (INSTR(Section.Title$,"(")>0) THEN
Section.Comm$ ="("+LTRIM$(RTRIM$(TAILSTR$(Section.Title$,"(")))+" "
Section.Title$= LTRIM$(RTRIM$(EXTRACT$(Section.Title$,"(")))
ELSE
Section.Comm$ =""
END IF
GOSUB Write.Section.Entry
ELSE ' Process link
Link.Name$=COMPRES$(LTRIM$(RTRIM$(EXTRACT$(Link.Line$,"|")))," ")
Link.URL$ =COMPRES$(LTRIM$(RTRIM$(TAILSTR$(Link.Line$,"|")))," ")
IF (LEFT$(Link.URL$,1)="_") THEN
Link.URL$=MID$(Link.URL$,2)
ELSEIF (INSTR(LEFT$(Link.URL$,8),"://")=0) THEN
Link.URL$="http://"+Link.URL$
END IF
Link.Comm$=""
IF (INSTR(Link.Name$,"(")>0) THEN
Link.Comm$="("+TAILSTR$(Link.Name$,"(")
Link.Name$=RTRIM$(LTRIM$(EXTRACT$(Link.Name$,"(")))
END IF
GOSUB Write.Link.Entry
END IF
WEND
GOSUB Write.Internal.Navigation.Bar
RETURN ' From Convert.and.Insert.Links routine
Write.Internal.Navigation.Bar: ' Routine ----------------------------------
IF (Sections=1) THEN RETURN ' From Write.Internal.Navigation.Bar Routine
Top.Bar=(Curr.Sect=0)
IF (NOT(Top.Bar)) THEN ' Bottom internal navigation bar
PRINT #3,TAB(Base.Pos);HR$
END IF
PRINT #3,TAB(Base.Pos);"<CENTER>"
PRINT #3,TAB(Base.Pos);" <FONT COLOR=Green> Go to:</FONT> "
Bar.Length=8
FOR I=1-Top.Bar TO Sections ' Start with "2" for Top Bar
IF (Bar.Length+3+LEN(Section$(I))<Nav.Length) THEN
IF (I=1-Top.Bar) THEN
PRINT #3,TAB(Base.Pos.29);"<A HREF=";Q$;"#";Section$(I);Q$;">";Section$(I);"</A>"
Bar.Length=Bar.Length+LEN(Section$(I))
ELSE
PRINT #3,TAB(Base.Pos);" <FONT COLOR=Green>|</FONT> <A HREF=";Q$;"#";Section$(I);Q$;">";Section$(I);"</A> "
Bar.Length=Bar.Length+LEN(Section$(I))+3
END IF
ELSE
PRINT #3,TAB(Base.Pos.13);" <BR> <A HREF=";Q$;"#";Section$(I);Q$;">";Section$(I);"</A>"
Bar.Length=LEN(Section$(I))
END IF
NEXT I
PRINT #3,TAB(Base.Pos);"</CENTER>"
IF (Top.Bar) THEN
PRINT #3,TAB(Base.Pos);HR$
END IF
RETURN ' From Write.Internal.Navigation.Bar routine
Write.Section.Entry: ' Routine --------------------------------------------
IF (Curr.Sect=1) THEN
PRINT #3,TAB(Base.Pos);"<CENTER><FONT SIZE=4 COLOR=Red><B><U>";Title$;"</U></B></FONT></CENTER>"
PRINT #3,TAB(Base.Pos);"<BR><!--------------------------------------------------------------->"
ELSE
PRINT #3,TAB(Base.Pos);HR$
END IF
IF (Sections=1) THEN
PRINT #3,TAB(Base.Pos.4);
GOSUB Write.Section.Title
RETURN ' From Write.Section.Title routine
END IF
PRINT #3,TAB(Base.Pos.4);"<A NAME=";Q$;Section.Title$;Q$;"></A>"
PRINT #3,TAB(Base.Pos.4);"<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>"
PRINT #3,TAB(Base.Pos.6);"<TR>"
PRINT #3,TAB(Base.Pos.8);"<TD>";
GOSUB Write.Section.Title
PRINT #3,"</TD>"
PRINT #3,TAB(Base.Pos.8);"<TD ALIGN=Right>"
IF (Italics) THEN
PRINT #3,TAB(Base.Pos.8);" <I>"
END IF
PRINT #3,TAB(Base.Pos.8);" <FONT COLOR=Green>Go to:</FONT> "
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#Top";Q$;">List top</A>"
IF (Curr.Sect=1) THEN
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#";Section$(Curr.Sect+1);Q$;">Next section</A>"
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#Bottom";Q$;">List bottom</A> "
ELSEIF (Curr.Sect=Sections) THEN
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#";Section$(Curr.Sect-1);Q$;">Previous section</A>"
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#Bottom";Q$;">List bottom</A> "
ELSE
IF (Curr.Sect>1) THEN
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#";Section$(Curr.Sect-1);Q$;">Prev sect</A>"
END IF
IF (Curr.Sect<Sections) THEN
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#";Section$(Curr.Sect+1);Q$;">Next sect</A>"
END IF
PRINT #3,TAB(Base.Pos.12);"<FONT COLOR=Green>|</FONT>"
PRINT #3,TAB(Base.Pos.37);"<A HREF=";Q$;"#Bottom";Q$;">List bot</A> "
END IF
IF (Italics) THEN
PRINT #3,TAB(Base.Pos.8);" </I>"
END IF
PRINT #3,TAB(Base.Pos.8);"</TD>"
PRINT #3,TAB(Base.Pos.6);"</TR>"
PRINT #3,TAB(Base.Pos.4);"</TABLE>"
First.Link=-1 ' For spec prefix of the first link after section title
' (for the multisection page only)
RETURN ' From Write.Section.Entry routine
Write.Link.Entry: ' Routine -----------------------------------------------
IF (First.Link) THEN
PRINT #3,TAB(Base.Pos.4);" "
First.Link=0
ELSE
PRINT #3,TAB(Base.Pos);"<BR> "
END IF
PRINT #3,TAB(Base.Pos.4);"<A HREF=";Q$;Link.URL$;Q$;">"
PRINT #3,TAB(Base.Pos.7);Link.Name$;"</A>";
IF (Link.Comm$<>"") THEN
PRINT #3," ";Link.Comm$
END IF
RETURN ' From Write.Section.Link routine
Write.Section.Title: ' Routine --------------------------------------------
IF (Section.Link$ ="") THEN
IF (Italics) THEN
PRINT #3," <FONT COLOR=Navy><I><B>";Section.Title$;"</B></I></FONT>";
ELSE
PRINT #3," <FONT COLOR=Navy><B>";Section.Title$;"</B></FONT>";
END IF
ELSE
IF (Italics) THEN
PRINT #3," <A HREF=";Q$;Section.Link$;Q$;"><I><B>";Section.Title$;"</B></I></A>";
ELSE
PRINT #3," <A HREF=";Q$;Section.Link$;Q$;"><B>";Section.Title$;"</B></A>";
END IF
END IF
IF (Section.Comm$<>"") THEN
IF (Italics) THEN
PRINT #3," <I>";Section.Comm$;"</I>";
ELSE
PRINT #3," ";Section.Comm$;
END IF
END IF
RETURN ' From Write.Section.Title routine
|
CONVLNK Debugging Examples Source program |
|||||||||||||||||||||||||||||||||
For each test case below (defined by uncommenting the corresponding Parm$ line) the CONVLNK program was executed with the corresponding *.TXT and *.HTM files as its input. |
|||||||||||||||||||||||||||||||||
Parm$="C:\DEBUG\LINKS-X" ' Non-existent LINKS-X.TXT file
Parm$="C:\DEBUG\LINKS-0" ' Non-existent LINKS-0.HTM file
Parm$="C:\DEBUG\LINKS-1" ' Single section layout
Parm$="C:\DEBUG\LINKS-2" ' Two sections layout
Parm$="C:\DEBUG\LINKS-3" ' Three sections layout
Parm$="C:\DEBUG\LINKS-R" ' Regular font test (no Italics)
Parm$="C:\DEBUG\LINKS-M" ' Mother's links (special formats)
Parm$="C:\DEBUG\LINKS-V,INF-H" ' Vlad's personal links (toolbar equivalent)
|
|||||||||||||||||||||||||||||||||
Thu 7-21-05 8:10 C:\> PBE CONVLNK
CONVLNK(2.4) Text file C:\DEBUG\LINKS-X.TXT doesn't exist - program stopped
CONVLNK(2.4) Link file C:\DEBUG\LINKS-0.HTM doesn't exist - program stopped
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-1.TXT into HTML
100% [*] ================================================
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-2.TXT into HTML
100% [*] ================================================
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-3.TXT into HTML
100% [*] ================================================
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-R.TXT into HTML
100% [*] ================================================
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-M.TXT into HTML
100% [*] ================================================
CONVLNK(2.4) Convert Link List C:\DEBUG\LINKS-V.TXT into HTML
100% [*] ================================================
|
|||||||||||||||||||||||||||||||||
Results of CONVLNK debugging executions are presented in the table below, where:
|
|
View [and save] CONVLNK.BAS text Download CONVLNK.EXE file (Use [Back] button or [Alt]+[CL] to return here from the viewed text) To make CONVLNK.BAS source text compilable change globally of "<" into "<" signs and "&" into "&" signs. Copyright © 2003–2005 by Go to: Davar site entry | Site contents | Site index | Personal Computer | PBCC | Text top |