|
#!/usr/local/bin/vipsi
/* create online book from easy source
***TODO*** Tables
authoritative Text functions: file Instructions: filefile: /pub/Develop/projects/vipsi/libs/BOOK.vl
*/
Instructions: var How does VScript::Value() work?: Var*&var Startzeit = Numeric functions: nownow
Instructions: var How does VScript::Value() work?: Var*&var Statistics = {}
Instructions: var How does VScript::Value() work?: Var*&var LibDir = "/usr/local/lib/vipsi/"
Instructions: var How does VScript::Value() work?: Var*&var NumFiles = 0
Instructions: var How does VScript::Value() work?: Var*&var Seed = 0
Flow control: if … thenif !Numeric functions: existsexists verbose Instructions: var How does VScript::Value() work?: Var*&var verbose=0 Flow control: if … then Flow control: try … thenthen
/* ---- Defaults ----------------------
*/
Instructions: var How does VScript::Value() work?: Var*&var SourceFile = "*.toc" // Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist of source Text functions: file Instructions: filefiles, Operators: Multiply "*"wildcards allowed
Instructions: var How does VScript::Value() work?: Var*&var TargetDir = ""
Instructions: var How does VScript::Value() work?: Var*&var FilenameIndex = "Numeric functions: indexindex.html"
Instructions: var How does VScript::Value() work?: Var*&var FilenameBook = "z%%.htm" // Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername for target Text functions: file Instructions: filefiles; %% = sequential Glossary: number, num_valnumber
Instructions: var How does VScript::Value() work?: Var*&var SplitFileSize = 20000 // limit for splitting chapters into multiple Text functions: file Instructions: filefiles
Instructions: var How does VScript::Value() work?: Var*&var TabWidth = 4 // used to detab <pre> sections
Instructions: var How does VScript::Value() work?: Var*&var XrefMaxWords = 4 // Numeric functions: maxmax. significant List functions: words Shell Immediate Commands: wordswords for automatic cross Text functions: link Instructions: linklinks generation
Instructions: var How does VScript::Value() work?: Var*&var PageTocMinCount = 2 // Numeric functions: minmin. Glossary: number, num_valnumber of Text functions: link Instructions: linklinks in TOC of single Text functions: file Instructions: filefile for TOC present; Flow control: if … then Flow control: try … thenelse no TOC
/* ---- Basic Html Templates ----------------------------
Template.Page für normale Seiten
Template.Numeric functions: indexIndex für die Startseite
Template.List functions: split Instructions: splitSplit für die TOC-Seite von Kapiteln, die gesplittet wurden
*/
Instructions: var How does VScript::Value() work?: Var*&var Template.Page =
«<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<META http-equiv=Content-Type content="Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=UTF-8">
<title>%%TITLE%%</title>
<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername="keywords" content="%%KEYWORDS%%">
<style type="Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/css">
.titel { background:white; text-align:center; }
.head { background:white; text-align:center; }
.toc { background:white; padding:0.25em; margin:1em; }
.toc p { text-align:center; font-weight:bold; padding:0em; margin:0em; }
.L { background:#ffffdd; }
.L span { background:#ffff88; visibility:hidden; position:absolute; z-index:50; padding:0.2em; }
</style>
<Example Scripts: CGI Scripts Example Scripts: Scriptsscript type="Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/javascript">
Instructions: var How does VScript::Value() work?: Var*&var o="";
Vipsi command syntax: Functions Functions Glossary: Functionfunction S(n) { H(); document.getElementById(n).style.visibility='visible'; o=n; }
Vipsi command syntax: Functions Functions Glossary: Functionfunction H() { Flow control: if … thenif(o!="") document.getElementById(o).style.visibility='hidden'; o=""; }
</Example Scripts: CGI Scripts Example Scripts: Scriptsscript>
</head><body id="A">
%%HEADLINE0%%%%HEADLINE1%%
<p align=center><a href="%%PREV%%">[<prev]</a> <a href="%%Flow control: nextNEXT%%">[Flow control: nextnext>]</a></p>
%%HEADLINE2%%%%HEADLINE3%%%%HEADLINE4%%%%HEADLINE5%%%%HEADLINE6%%
%%TOC%%%%BODY%%
</body></html>
»
// Headlines as they appear Operators: Make Identifier "@"at top of a page
// called for %%HEADLINEx%%
Instructions: procproc Style.Headline( i /* Buch[i] */ )
{
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Instructions: var How does VScript::Value() work?: Var*&var Url = Buch[i].Filename
Instructions: var How does VScript::Value() work?: Var*&var Label = Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText
Flow control: if … thenif Tag=="h0"
Instructions: var How does VScript::Value() work?: Var*&var r = «\n<h1 class="titel"><a href="»#Url# «">» #Label# «</a></h1>»
Flow control: try … thentry
r #= «\n<h1 class="head"><a href="» #Url# «">» #TocTitle# «</a></h1>»
Instructions: deldel TocTitle
Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn r
Flow control: if … then Flow control: try … thenelse
Flow control: returnreturn «\n<»#Tag#« class="head"><a href="»#Url# «">» #Label# «</a></»#Tag#«>»
Flow control: if … then Flow control: try … thenthen
}
// Headlines as they appear in a TOC
// called in preparation for %%TOC%%
Instructions: procproc Style.TocItem ( i /* Buch[i] */ )
{
Instructions: var How does VScript::Value() work?: Var*&var Label = Buch[i].Glossary: text_ref, text_varText
var Url = "#" # Buch[i].Anker
Flow control: try … thentry Url = Buch[i].Filename # Url Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn «<p><a href="» #Url# «">» #Label# «</a></p>»
}
// Table of contents:
// called for %%TOC%%
Instructions: procproc Style.Toc ( i /* Buch[i] */, TocListe )
{
Flow control: returnreturn Numeric functions: existsexists Buch[i].List functions: split Instructions: splitSplit || Numeric functions: countcount TocListe >= PageTocMinCount
? «\n<div class="toc">»#TEXT.JoinText(TocListe,Constants: nlnl)#«</div>»
: ""
}
// Querverweis-Linklist-Popup:
// for Xref
Instructions: procproc Style.Linklist ( Label, Linklist ) // Linklist = { {Url="",Label=""}, ... }
{
Instructions: var How does VScript::Value() work?: Var*&var i=0, Text functions: link Instructions: linkLinks="", id = ++Seed
Instructions: var How does VScript::Value() work?: Var*&var ID="" Flow control: do … loopdo ID #= Text functions: charstrcharstr('A'+id%26) id/=26 Flow control: whilewhile id>=1 Flow control: do … looploop
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Linklist
Text functions: link Instructions: linkLinks #= «<br><a href="» #Linklist[i].Url# «">» #Linklist[i].Label# «</a>»
Flow control: do … looploop
Flow control: returnreturn «<span class=L onMouseOver="S('»#ID#«')">\
<span id=»#ID#« onMouseOut="H()">»#Links[5 to]#«</span>»#Label#«</span>»
}
/* *********************************************************************
TAG DEFINITIONS
********************************************************************* */
Instructions: procproc SkipBlock(i) // --> Flow control: nextnext block
{
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i++]
Flow control: do … loopdo
Flow control: whilewhile i <= Numeric functions: countcount Buch && contains_tag(Tag,Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i])
// rekursion notwendig, weil manche tags nur indirekt enthalten sein können, z.b. h4>ol>li
i = SkipBlock(i)
Flow control: do … looploop
Flow control: returnreturn i
}
Instructions: procproc SizeofBlock(i)
{
Instructions: var How does VScript::Value() work?: Var*&var j = SkipBlock(i)
Instructions: var How does VScript::Value() work?: Var*&var n = 0
Flow control: do … loopdo
n += Numeric functions: countcount Data Types: Text Text functions: stringstring(Buch[i])
Flow control: whilewhile ++i < j
Flow control: do … looploop
Flow control: returnreturn n
}
Instructions: procproc ReadContainedTags(i)
{
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i++]
Flow control: do … loopdo
Flow control: whilewhile i <= Numeric functions: countcount Buch
Instructions: var How does VScript::Value() work?: Var*&var Subtag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Flow control: whilewhile contains_tag(Tag,Subtag)
i = Tags.@Subtag.Instructions: readRead(i)
Flow control: do … looploop
Flow control: returnreturn i
}
Instructions: procproc WriteContainedTags(F,i)
{
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i++]
Flow control: do … loopdo
Flow control: whilewhile i <= Numeric functions: countcount Buch
Instructions: var How does VScript::Value() work?: Var*&var Subtag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Flow control: whilewhile contains_tag(Tag,Subtag)
i = Tags.@Subtag.Instructions: writeWrite(F,i)
Flow control: do … looploop
Flow control: returnreturn i
}
Instructions: procproc WriteStartTag(F,i)
{
Instructions: var How does VScript::Value() work?: Var*&var id = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Flow control: try … thentry id #= « class=» # Buch[i].Class Flow control: if … then Flow control: try … thenthen // Flow control: if … thenif Numeric functions: existsexists
Flow control: try … thentry id #= « style="» # Buch[i].Style # «"» Flow control: if … then Flow control: try … thenthen // Flow control: if … thenif Numeric functions: existsexists
Flow control: try … thentry id #= « id=» # Buch[i].Anker Flow control: if … then Flow control: try … thenthen // Flow control: if … thenif Numeric functions: existsexists
Instructions: putput #F, Constants: nlnl, "<" # id # ">"
}
Instructions: procproc WriteText(F,i)
{
Instructions: putput #F, Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText
}
Instructions: procproc WriteEndTag(F,i)
{
Instructions: putput #F, "</", Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i], ">"
}
// default Instructions: readread/Instructions: writewrite handler
Instructions: procproc r0(i)
{
Flow control: if … thenif verbose Instructions: putput "["#name Buch[i]#"]" Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn ReadContainedTags(i)
}
Instructions: procproc w0(F,i)
{
WriteStartTag(F,i); WriteText(F,i); WriteEndTag(F,i);
Flow control: returnreturn i+1
}
/* ---- Tag Handler -------------------------------------------------------------------------
Class = PARA paragraphs: enthalten keine anderen Tags: z.B. <p>
BLOCK Block-Tags: enthalten andere Tags: alle Headlines und z.B. <ul>
PRE Vorformatierter Data Types: Text Item selector "[]": Text Glossary: text, text_valText. Sonderform des PARA-Tags: White spaces usw. werden erhalten
DEF spezielle Tags: z.B.: toc und #
Instructions: readRead = Lesefunktion: Liest via Numeric functions: indexIndex i aus Buch[] und gibt den weitergestellten Numeric functions: indexIndex zurück.
Die Default-Lesefunktion r0() für viele Tags inkrementiert nur den Numeric functions: indexIndex und tut sonst nichts.
Instructions: writeWrite = Schreibfunktion: Schreibt in Stream F via Numeric functions: indexIndex i aus Buch[] und gibt weitergestellten Numeric functions: indexIndex zurück.
Die Default-Schreibfunktion w0() schreibt Start-Tag, Data Types: Text Item selector "[]": Text Glossary: text, text_valText und End-Tag.
Tag-Name ist der Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName des Buch-Eintrags Buch[i]
Data Types: Text Item selector "[]": Text Glossary: text, text_valText ist Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText
Buch[i] kann noch Buch[i].Class, Buch[i].Style und Buch[i].Anker enthalten.
Where = Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_valListe der Tags, in denen dieses Tag vorkommen kann.
*/
// p: plain paragraph, subsequent untagged lines are appended with <br>
Instructions: var How does VScript::Value() work?: Var*&var Tags.p = { Class='PARA', Instructions: readRead=r0, Instructions: writeWrite=w0, Where=" h0 h1 h2 h3 h4 h5 h6 " }
// pre: preformatted paragraph, monospaced, subsequent untagged lines are appended with \n
Instructions: var How does VScript::Value() work?: Var*&var Tags.pre = { Class='PRE', Instructions: readRead=r0, Instructions: writeWrite=w0, Where=" h0 h1 h2 h3 h4 h5 h6 " }
// li: Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist item; subsequent untagged lines are appended with <br>
Instructions: var How does VScript::Value() work?: Var*&var Tags.li = { Class='PARA', Instructions: readRead=r0, Instructions: writeWrite=w0, Where=" ol ul " }
// hr: horizontal Operators: Divide with Variable "/=" Operators: Divide "/"divider line
Instructions: procproc w(F,i) { WriteStartTag(F,i); Flow control: returnreturn i+1 }
Instructions: var How does VScript::Value() work?: Var*&var Tags.hr = { Class='DEF', Instructions: readRead=r0, Instructions: writeWrite=w, Where=" h0 h1 h2 h3 h4 " } // TODO: why Operators: Bitwise Not "~" Operators: Boolean Negation "!"not PARA ?!?
// #: provide customized Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername for anchor
Instructions: procproc r(i)
{
Flow control: if … thenif verbose Instructions: putput "["#name Buch[i]#"]" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: existsexists Buch[i-1].Keywords
Buch[i-1] ##= { Anker = Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText }
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, « Tag "#" (custom anchor Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername) darf nur nach Überschriften stehen: ignoriert»
Flow control: if … then Flow control: try … thenthen
Instructions: deldel Buch[i]; Flow control: returnreturn i
}
Instructions: var How does VScript::Value() work?: Var*&var Tags.@"#" = { Class='DEF', Instructions: readRead=r, Instructions: writeWrite=w0, Where=" h0 h1 h2 h3 h4 h5 h6 " }
// toc: define title for TOC on Numeric functions: indexindex page
Instructions: procproc r(i)
{
Flow control: if … thenif verbose Instructions: putput "["#name Buch[i]#"]" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: existsexists Style.TocTitle Numeric functions: log Numeric functions: loge Instructions: loglog " toc doppelt! " Flow control: if … then Flow control: try … thenthen
Text functions: convert Instructions: convertconvert Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText to html
Style ##= { TocTitle = Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText };
Instructions: deldel Buch[i]; Flow control: returnreturn i
}
Instructions: var How does VScript::Value() work?: Var*&var Tags.toc = { Class='DEF', Instructions: readRead=r, Instructions: writeWrite=w0, Where=" h0 " }
// ol, ul: (un)ordered Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist; contains only li
Instructions: procproc w(F,i) { WriteStartTag(F,i); Instructions: var How does VScript::Value() work?: Var*&var j=WriteContainedTags(F,i); WriteEndTag(F,i); Flow control: returnreturn j }
Instructions: var How does VScript::Value() work?: Var*&var Tags.ol = { Class='BLOCK', Instructions: readRead=r0, Instructions: writeWrite=w, Where=" h0 h1 h2 h3 h4 h5 h6 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.ul = { Class='BLOCK', Instructions: readRead=r0, Instructions: writeWrite=w, Where=" h0 h1 h2 h3 h4 h5 h6 " }
// h0 .. h6: Buchtitel, Headlines
Instructions: procproc r(i)
{
Instructions: var How does VScript::Value() work?: Var*&var j=Numeric functions: findfind("h0h1h2h3h4h5h6",Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i])
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl, "["#name Buch[i]#"]", " "[to j], Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText == ""
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, « Kapitel ohne Titel: "», Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i], «"», Constants: nlnl, « aborted.» Flow control: end Shell Immediate Commands: exit, quit, endend 1
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: countcount Buch[i].Keywords==0
Numeric functions: log Numeric functions: loge Instructions: loglog « Keine Schlüsselwörter! »
Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn i+1
}
Instructions: procproc w(F,i)
{ // Operators: Bitwise Not "~" Operators: Boolean Negation "!"note: only headlines in %%Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT%% are written using List functions: thisthis Instructions: procproc
// headlines in page header Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or toc are written using Style.xx()
Instructions: var How does VScript::Value() work?: Var*&var Anker = Buch[i].Anker
Instructions: var How does VScript::Value() work?: Var*&var Titel = Buch[i].Glossary: text_ref, text_varText
var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
WriteStartTag(F,i)
Instructions: putput#F, «<a href="#», Anker, «">», Titel, «</a>»
WriteEndTag(F,i)
Flow control: returnreturn i+1
}
Instructions: var How does VScript::Value() work?: Var*&var Tags.h0 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h1 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h0 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h2 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h1 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h3 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h1 h2 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h4 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h1 h2 h3 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h5 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h1 h2 h3 h4 " }
Instructions: var How does VScript::Value() work?: Var*&var Tags.h6 = { Class='BLOCK', Instructions: readRead=r, Instructions: writeWrite=w, Where=" h1 h2 h3 h4 h5 " }
Instructions: procproc is_valid_tag ( Tag ) { Flow control: returnreturn Numeric functions: existsexists Tags.@Tag }
Instructions: procproc is_para_tag ( Tag ) { Flow control: returnreturn Tags.@Tag.Class=='PARA' }
Instructions: procproc is_pre_tag ( Tag ) { Flow control: returnreturn Tags.@Tag.Class=='PRE' }
Instructions: procproc is_block_tag ( Tag ) { Flow control: returnreturn Tags.@Tag.Class=='BLOCK' }
Instructions: procproc is_def_tag ( Tag ) { Flow control: returnreturn Tags.@Tag.Class=='DEF' }
Instructions: procproc contains_tag ( Tag, Subtag ) { Flow control: returnreturn Numeric functions: findfind( Tags.@Subtag.Where, " "#Tag#" " ) != 0 }
/* ---- Generated filenames ----------------------------------------------
first filename is 'Buch.dir: fnamefname' = 'FilenameIndex' = "Numeric functions: indexindex.html"
subsequent filenames are named according to 'FilenameBook' = "%%.html"
*/
Instructions: procproc FilenameFromIndex(idx)
{
Flow control: returnreturn idx==1 ? FilenameIndex : Text functions: replace Instructions: replacereplace( FilenameBook, "%%", Data Types: Text Text functions: stringstring(idx) );
}
Instructions: procproc NewFilename()
{
Flow control: returnreturn FilenameFromIndex( ++NumFiles )
}
Instructions: procproc IndexFromFilename(dir: fnamefname)
{
Flow control: if … thenif dir: fnamefname==FilenameIndex Flow control: returnreturn 1 Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: findfind(FilenameBook,"%%")
Instructions: var How does VScript::Value() work?: Var*&var n = 2 +Numeric functions: countcount dir: fnamefname -Numeric functions: countcount FilenameBook
Flow control: returnreturn Functions with varying return types: eval Instructions: evaleval( Text functions: midstrmidstr(dir: fnamefname,i,n ) )
}
Instructions: procproc NextFilename(dir: fnamefname)
{
Instructions: var How does VScript::Value() work?: Var*&var i = IndexFromFilename(dir: fnamefname)
Flow control: returnreturn FilenameFromIndex( i%NumFiles +1 )
}
Instructions: procproc PrevFilename(dir: fnamefname)
{
Instructions: var How does VScript::Value() work?: Var*&var i = IndexFromFilename(dir: fnamefname)
Flow control: returnreturn FilenameFromIndex( i==1 ? NumFiles : (i-1)%NumFiles )
}
/* ---- Die Querverweis-Datei -----------------------------------------------
Zu jedem Schlüsselwort enthält sie die passenden Text functions: link Instructions: linkLinks,
bestehend aus Beschriftung (Label) und Url,
die wiederum aus Dateiname und idR. Anker besteht.
Das Label setzt sich aus den hierarchischen Kapitelüberschriften zusammen
der besseren Lesbarkeit wegen nur eigene HL + übergeordnetes Kapitel
*/
Instructions: var How does VScript::Value() work?: Var*&var Xref = {}
Instructions: procproc AddXref ( Keyword, Label, Text functions: file Instructions: fileFile, Anker )
{
Instructions: var How does VScript::Value() work?: Var*&var Url = Text functions: file Instructions: fileFile # "#" # Anker
Instructions: var How does VScript::Value() work?: Var*&var Text functions: link Instructions: linkLink = { Label=Label, Text functions: file Instructions: fileFile=Text functions: file Instructions: fileFile, Anker=Anker }
Flow control: if … thenif Numeric functions: existsexists Xref.@Keyword
// Text functions: link Instructions: linkLink mit bereits existierendem Schlüsselwort
Flow control: if … thenif !Numeric functions: existsexists Xref.@Keyword.@Url // vermeide Dubletten
Xref.@Keyword ##= { @Url = Text functions: link Instructions: linkLink }
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, " Verweisziel-Dublette: ",Label," "
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
// Text functions: link Instructions: linkLink mit neuem Schlüsselwort
Xref ##= { @Keyword = { @Url = Text functions: link Instructions: linkLink } }
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc FindXref ( Keyword )
{
Flow control: try … thentry
Flow control: returnreturn Xref.@Keyword
Flow control: if … then Flow control: try … thenelse
Flow control: returnreturn {}
Flow control: if … then Flow control: try … thenthen
}
/* *********************************************************************
INITIALIZE & TEST for QUICK Flow control: exit Shell Immediate Commands: exit, quit, endEXIT
********************************************************************* */
/* ---- flatten Instructions: var How does VScript::Value() work?: Var*&var SourceFiles -------------------------------------
Instructions: readread all directory informations of source Text functions: file Instructions: filefiles into Instructions: var How does VScript::Value() work?: Var*&var sourcefile
Instructions: var How does VScript::Value() work?: Var*&var SourceFiles becomes a directory Online Chat: Listings Search Site: Listing Print Environment: Listing Online Z80 Assembler: Listing Show Beautified Folder Listings: Listing Sort-of-a Shell: Listing Factorial "!": Listing Prime Factor Factorizing: Listing Speedometer: Listing VIP Script Test Suite: Listinglisting, except that dir: fnamefnames are
extended to full partial path. ((that is: including subdirectory paths))
Text functions: file Instructions: filefiles are kept in order of appearance in SourceFiles[] Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist
multiple Text functions: file Instructions: filefiles matching a Operators: Multiply "*"wildcard pattern are sorted alphabetically
duplicate Text functions: file Instructions: filefiles are removed ((first occurance is kept))
*/
Instructions: var How does VScript::Value() work?: Var*&var SourceText = ""
Instructions: var How does VScript::Value() work?: Var*&var SourceMdate = 0
Instructions: var How does VScript::Value() work?: Var*&var SourceFiles = 0
Instructions: procproc QuelltextEinlesen()
{
/* Instructions: readread source Text functions: file Instructions: filefile including all included Text functions: file Instructions: filefiles
Flow control: returnreturn Data Types: Text Item selector "[]": Text Glossary: text, text_valtext from Text functions: file Instructions: filefiles
sfile can be:
- path/filename
- path/
- path/pattern
Flow control: if … thenif directory contains one *.toc Text functions: file Instructions: filefile Flow control: if … then Flow control: try … thenthen only List functions: thisthis is included
assuming that it will Functions with varying return types: include Instructions: includeinclude Flow control: if … then Flow control: try … thenthe rest.
*/
Instructions: procproc read_source(indent, sfile)
{
indent += 2
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl, " "[to indent], sfile, " "
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: isfileisfile sfile
// Text functions: file Instructions: filefile
SourceMdate = Numeric functions: maxmax(SourceMdate,Numeric functions: mdatemdate sfile)
SourceFiles ++
Instructions: var How does VScript::Value() work?: Var*&var sdir = sfile[to Numeric functions: rfindrfind(sfile,"/")]
Instructions: var How does VScript::Value() work?: Var*&var result = ""
Instructions: var How does VScript::Value() work?: Var*&var Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = Text functions: file Instructions: filefile sfile
Text functions: convert Instructions: convertconvert Data Types: Text Item selector "[]": Text Glossary: text, text_valtext from utf8
Text functions: replace Instructions: replacereplace Data Types: Text Item selector "[]": Text Glossary: text, text_valtext, "%%DATE%%", Text functions: datestrdatestr(Numeric functions: nownow)
Text functions: replace Instructions: replacereplace Data Types: Text Item selector "[]": Text Glossary: text, text_valtext, "%%Text functions: file Instructions: fileFILE%%", sfile
Flow control: do … loopdo
Instructions: var How does VScript::Value() work?: Var*&var j = Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[1]=="+" ? 0 : Numeric functions: findfind(Data Types: Text Item selector "[]": Text Glossary: text, text_valtext,"\n+")
Flow control: whilewhile Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[j+1]=="+"
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[j+2]>" " result #= Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[to j+1] Data Types: Text Item selector "[]": Text Glossary: text, text_valtext=Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[j+2 to] Flow control: nextnext Flow control: if … then Flow control: try … thenthen
result #= Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[to j]
sfile = Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[j+2 to Numeric functions: findfind(Data Types: Text Item selector "[]": Text Glossary: text, text_valtext,Constants: nlnl,j+2)-1]
Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[Numeric functions: findfind(Data Types: Text Item selector "[]": Text Glossary: text, text_valtext,Constants: nlnl,j+2)+1 to]
sfile = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces(sfile)
result #= read_source(indent,sdir#sfile)
Flow control: do … looploop
Flow control: returnreturn result # Data Types: Text Item selector "[]": Text Glossary: text, text_valtext
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: isdirisdir sfile
// List functions: dir Instructions: dir Shell Immediate Commands: dirdir
Instructions: var How does VScript::Value() work?: Var*&var sdir = sfile Flow control: if … thenif Text functions: rightstrrightstr(sdir,1)!="/" sdir#="/" Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var d = List functions: dir Instructions: dir Shell Immediate Commands: dirdir(sdir#"*.toc")
Flow control: if … thenif Numeric functions: countcount d == 1
Flow control: returnreturn read_source(indent-2,sdir#d[1].dir: fnamefname)
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var d = List functions: dir Instructions: dir Shell Immediate Commands: dirdir sdir
Flow control: if … thenif Numeric functions: countcount d == 0 Numeric functions: log Numeric functions: loge Instructions: loglog "empty!" Flow control: returnreturn "" Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
// List functions: dir Instructions: dir Shell Immediate Commands: dirdir/pattern
Instructions: var How does VScript::Value() work?: Var*&var sdir = sfile[to Numeric functions: rfindrfind(sfile,"/")]
Instructions: var How does VScript::Value() work?: Var*&var d = List functions: dir Instructions: dir Shell Immediate Commands: dirdir(sfile)
Flow control: if … then Flow control: try … thenthen
Instructions: sortsort d
Instructions: var How does VScript::Value() work?: Var*&var n=0, result = ""
Instructions: var How does VScript::Value() work?: Var*&var i=0, Operators: Named Item Selector "."dot = sfile[Numeric functions: countcount(sdir)+1]=="." ? "" : "."
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount d
sfile = d[i].dir: fnamefname
Flow control: if … thenif Numeric functions: findfind(" alt old backup back-up ",sfile) Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: leftstrleftstr (sfile,1)==Operators: Named Item Selector "."dot Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(sfile,1)=="~" Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(sfile,4)==".bak" Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(sfile,4)==".alt" Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(sfile,4)==".xxx" Flow control: nextnext Flow control: if … then Flow control: try … thenthen
n++
result #= read_source(indent,sdir#sfile)
Flow control: do … looploop
Flow control: if … thenif n==0 Numeric functions: log Numeric functions: loge Instructions: loglog "no Numeric functions: matchmatch!" Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn result
}
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount=0
Instructions: putput Constants: nlnl, "Quelltext einlesen "
SourceText = read_source(0,SourceFile)
Flow control: if … thenif !verbose
Instructions: putput "--> ", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount, " Dateien & Ordner"
Flow control: if … then Flow control: try … thenthen
}
/* ---- ist Numeric functions: indexindex.html up-to-date? ------------------------------
--> nothing to Flow control: do … loopdo
--> QUICK Flow control: exit Shell Immediate Commands: exit, quit, endEXIT
*/
Instructions: procproc ÄnderungsdatumPrüfen()
{
Instructions: putput Constants: nlnl, "Änderungsdatum prüfen "
Flow control: try … thentry Flow control: if … thenif force==1 Flow control: returnreturn Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthen // assumption: command line Vipsi command syntax: Arguments Glossary: Argumentsargument "-f" --> Instructions: var How does VScript::Value() work?: Var*&var force=1
Flow control: if … thenif Numeric functions: existsexists Text functions: file Instructions: filefile(TargetDir#FilenameIndex)
{
Flow control: if … thenif Numeric functions: maxmax(Numeric functions: mdatemdate(LibDir#"BOOK.vl"),Numeric functions: mdatemdate"automate.vs",SourceMdate) <= Numeric functions: mdatemdate(TargetDir#FilenameIndex)
Instructions: putput "... up to date.", Constants: nlnl, Constants: nlnl
Flow control: end Shell Immediate Commands: exit, quit, endend 0
Flow control: if … then Flow control: try … thenthen
}
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc StatisticsAnzeigen()
{
Instructions: var How does VScript::Value() work?: Var*&var Laufzeit = Data Types: Text Text functions: stringstring(Numeric functions: intint((now-Startzeit)*1000))
Laufzeit = Laufzeit[to Numeric functions: countcount Laufzeit-3] # "." # Text functions: rightstrrightstr(Laufzeit,3) # " sek."
Statistics ##= { Laufzeit = Laufzeit }
Instructions: putput Constants: nlnl,Constants: nlnl, "Statistics: "
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Statistics
Instructions: putput Constants: nlnl, " ", Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Statistics[i], " = ", Statistics[i]
Flow control: do … looploop
}
/* ******************************************************************************
MAIN Vipsi command syntax: Procedures Data Types: Procedures Glossary: ProcedurePROCEDURES
****************************************************************************** */
/* ---- Lese Buchquellen ein --------------------------------
Lese SourceFiles und verschmelze alle Dateien zur Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_valListe "Buch"
Items sind Data Types: Text Item selector "[]": Text Glossary: text, text_valtext und mit ihrem Tag benamt
Leerzeilen und Kommentare sind entfernt
'pre'-Tags sind ausgetabt
p_tags sind verschmolzen; z.B. pre=" a = anton\n b = berta"
list_tags mit folgenden untagged Zeilen sind kombiniert; z.B. ort="Land, Wasser, Wald"
Blöcke sind rekursiv in Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_valListen gewandelt
Die Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_valListen werden letztendlich an die Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_valListe "Buch" angehängt
*/
Instructions: procproc TagsAbtrennen()
{
Instructions: putput Constants: nlnl, "Zeilen trennen "
Buch = List functions: split Instructions: splitsplit(SourceText) // List functions: split Instructions: splitsplit into lines
Statistics ##= { AnzahlQuelldateien = SourceFiles }
Statistics ##= { LetzteÄnderung = Text functions: datestrdatestr(SourceMdate) }
Statistics ##= { ZeichenGesamt = Numeric functions: countcount SourceText }
Statistics ##= { ZeilenGesamt = Numeric functions: countcount Buch }
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl, " ", Numeric functions: countcount SourceText, " Zeichen "
Instructions: putput Constants: nlnl, " ", Numeric functions: countcount Buch, " Zeilen "
Flow control: if … then Flow control: try … thenthen
Instructions: putput Constants: nlnl, "Tags abtrennen "
// "<tag> <Data Types: Text Item selector "[]": Text Glossary: text, text_valtext>" --> <tag> = { Data Types: Text Item selector "[]": Text Glossary: text, text_valText="<Data Types: Text Item selector "[]": Text Glossary: text, text_valtext>" }
// "<tag.class> <Data Types: Text Item selector "[]": Text Glossary: text, text_valtext>" --> <tag> = { Class="<class>", Data Types: Text Item selector "[]": Text Glossary: text, text_valText="<Data Types: Text Item selector "[]": Text Glossary: text, text_valtext>" }
// Crop spaces left Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and right
// Kommentare entfernen
// unbekannte Tags löschen
Instructions: var How does VScript::Value() work?: Var*&var keyword
Instructions: var How does VScript::Value() work?: Var*&var Data Types: Text Item selector "[]": Text Glossary: text, text_valText, Tag, PreTag
Instructions: var How does VScript::Value() work?: Var*&var i=0, j, k
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Buch
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Buch[i]
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valText[to 2]=="//" Instructions: deldel Buch[i--] Flow control: nextnext Flow control: if … then Flow control: try … thenthen // Kommentar
Buch[i] = {}
// List functions: split Instructions: splitsplit tag
j=0 Flow control: do … loopdo Flow control: whilewhile ++j<=Numeric functions: countcount Data Types: Text Item selector "[]": Text Glossary: text, text_valText && Data Types: Text Item selector "[]": Text Glossary: text, text_valText[j]>" " Flow control: do … looploop
Tag = Data Types: Text Item selector "[]": Text Glossary: text, text_valText[to j-1]
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valText[j to] // preserve Separatorsseparator & remember j for <pre> tag
// Zeilen mit Tag
Flow control: if … thenif Tag!=""
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel();
// List functions: split Instructions: splitsplit css class
k = Numeric functions: findfind(Tag,".")
Flow control: if … thenif k
Buch[i] ##= { Class = Tag[k+1 to] } // store Class
Tag = Tag[to k-1]
Flow control: if … then Flow control: try … thenthen
// Store Tag
Tag = Text functions: lowerstrlowerstr(Tag)
Instructions: renamerename Buch[i] = Tag
// ungültige Tags löschen
Flow control: if … thenif !is_valid_tag(Tag)
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, « Unbekanntes Tag "», Tag, «": übersprungen»
Instructions: deldel Buch[i--]; Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
// crop spaces
// bei leerem Data Types: Text Item selector "[]": Text Glossary: text, text_valText die Folgezeile nachziehen
Flow control: do … loopdo
// crop spaces
Flow control: if … thenif is_pre_tag(Tag)
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Text functions: spacestrspacestr(j-1) # Data Types: Text Item selector "[]": Text Glossary: text, text_valText // overwrite Tag with spaces
Text functions: convert Instructions: convertconvert Data Types: Text Item selector "[]": Text Glossary: text, text_valText from @("Constants: tabtab"#TabWidth); // Constants: tabtabs durch spaces ersetzen
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valText[TabWidth+1 Text functions: stringto]
Text = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces_R(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … then Flow control: try … thenthen
// bei leerem Data Types: Text Item selector "[]": Text Glossary: text, text_valText nächste Zeile nachziehen
Flow control: whilewhile Data Types: Text Item selector "[]": Text Glossary: text, text_valText == "" // solange Data Types: Text Item selector "[]": Text Glossary: text, text_valText leer
Flow control: whilewhile i<Numeric functions: countcount Buch // und nicht Buch-Ende
Flow control: whilewhile Buch[i+1][1] <= " " // und nächste Zeile ohne Tag
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Buch[i+1]
Instructions: deldel Buch[i+1]
j=0
Flow control: do … looploop
// Data Types: Text Item selector "[]": Text Glossary: text, text_valText speichern
Buch[i] ##= { Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valText }
// Keyword für Block-Tag speichern
Flow control: if … thenif is_block_tag(Tag)
Buch[i] ##= { Keywords = {} }
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SplitIntoWords(Data Types: Text Item selector "[]": Text Glossary: text, text_valText) // List functions: split Instructions: splitsplit into List functions: words Shell Immediate Commands: wordswords & Separatorsseparators
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.RemoveOddItems(keyword) // keep List functions: words Shell Immediate Commands: wordswords
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.NormalizeName(keyword[to XrefMaxWords]) // normalized joined_words
Flow control: if … thenif keyword!="" Buch[i].Keywords ##= keyword Flow control: if … then Flow control: try … thenthen // store keyword
Flow control: if … then Flow control: try … thenthen
// Zeilen ohne Tag
// Data Types: Text Item selector "[]": Text Glossary: text, text_valText an vorherige Zeile anhängen
Flow control: if … then Flow control: try … thenelse
// vorangehendes Tag bestimmen
Flow control: if … thenif i==1
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valText!="" Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, « Zeile 1 hat kein Tag: übersprungen» Flow control: if … then Flow control: try … thenthen
Instructions: deldel Buch[i--]; Flow control: nextnext
Flow control: if … then Flow control: try … thenelse
PreTag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i-1]
Flow control: if … then Flow control: try … thenthen
// nach Block-Tag: Zeilen ohne Tag werden als Keyword-Liste interpretiert
Flow control: if … thenif is_block_tag(PreTag)
List functions: split Instructions: splitsplit Data Types: Text Item selector "[]": Text Glossary: text, text_valText,","
j=0 Flow control: do … loopdo
Flow control: whilewhile ++j <= Numeric functions: countcount Data Types: Text Item selector "[]": Text Glossary: text, text_valText
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SplitIntoWords(Data Types: Text Item selector "[]": Text Glossary: text, text_valText[j]) // List functions: split Instructions: splitsplit into List functions: words Shell Immediate Commands: wordswords & Separatorsseparators
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.RemoveOddItems(keyword) // keep List functions: words Shell Immediate Commands: wordswords
keyword = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.NormalizeName(keyword[to XrefMaxWords]) // normalized_joined_words
Flow control: if … thenif keyword!="" Buch[i-1].Keywords ##= keyword Flow control: if … then Flow control: try … thenthen // store keyword
Flow control: do … looploop
// <pre> Absatz
Flow control: if … thenelif is_pre_tag(PreTag)
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces_R(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Text functions: convert Instructions: convertconvert Data Types: Text Item selector "[]": Text Glossary: text, text_valText from @("Constants: tabtab"#TabWidth); // Constants: tabtabs durch spaces ersetzen
Buch[i-1].Data Types: Text Item selector "[]": Text Glossary: text, text_valText #= Constants: nlnl # Data Types: Text Item selector "[]": Text Glossary: text, text_valText[TabWidth+1 to]
// <p> Absatz
Flow control: if … thenelif is_para_tag(PreTag)
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valText!="" Buch[i-1].Data Types: Text Item selector "[]": Text Glossary: text, text_valText #= "<br>" # Data Types: Text Item selector "[]": Text Glossary: text, text_valText Flow control: if … then Flow control: try … thenthen
// nach Definition Tag
Flow control: if … thenelif is_def_tag(PreTag)
Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.CropSpaces(Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valText!="" Buch[i-1].Data Types: Text Item selector "[]": Text Glossary: text, text_valText #= ", " # Data Types: Text Item selector "[]": Text Glossary: text, text_valText Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, "List functions: thisthis cannot happen" Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … then Flow control: try … thenthen
// Zeile wurde an vorherige angehängt => diese Zeile löschen
Instructions: deldel Buch[i--]
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl, " ", Numeric functions: countcount Buch, " Tags "
Flow control: if … then Flow control: try … thenelse
Instructions: putput " "
Flow control: if … then Flow control: try … thenthen
Statistics ##= { TagsGesamt = Numeric functions: countcount Buch }
// Leerzeilen am Flow control: end Shell Immediate Commands: exit, quit, endEnde von <pre> tags löschen
i=0 Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Buch
Flow control: do … loopdo
Flow control: whilewhile Text functions: rightstrrightstr(Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText,1)==Constants: nlnl
Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText [ to Numeric functions: countcount(Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText) -1 ]
Flow control: do … looploop
Flow control: do … looploop
// Hierarchie prüfen:
Instructions: putput Constants: nlnl, "Hierarchie prüfen "
Flow control: if … thenif Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[1] != "h0"
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, «Buch beginnt nicht mit Tag "h0"»
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, "aborted.", Constants: nlnl
DumpBuch()
Flow control: end Shell Immediate Commands: exit, quit, endend 1
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var n=Numeric functions: countcount Buch
Flow control: do … loopdo
Instructions: var How does VScript::Value() work?: Var*&var i = SkipBlock(1)
Flow control: whilewhile i<=Numeric functions: countcount Buch
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, « Tag "»#name Buch[i]#«" hier nicht erlaubt»
Instructions: deldel Buch[i]
Flow control: do … looploop
Flow control: if … thenif n!=Numeric functions: countcount Buch
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, "aborted.", Constants: nlnl
DumpBuch()
Flow control: end Shell Immediate Commands: exit, quit, endend 1
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc TagsBehandeln()
{
Instructions: putput Constants: nlnl, "Tags behandeln "
// Tags, die einen Anker benötigen, müssen hier ihr Keywords-Element erzeugen
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount = 0
Instructions: var How does VScript::Value() work?: Var*&var i=1
Flow control: do … loopdo
Flow control: whilewhile i <= Numeric functions: countcount Buch
i = Tags.@(Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]).Instructions: readRead(i)
Flow control: do … looploop
Flow control: if … thenif !verbose
Instructions: putput "--> ", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount, " Überschriften"
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc BuchAufDateienVerteilen()
{
Instructions: putput Constants: nlnl, "Buch auf mehrere Dateien verteilen "
// Kapitel mit mehr als filesplitsize Zeichen splitten
// --> Filesplit anmerken mit Buch[i].List functions: split Instructions: splitSplit
// --> Dateinamen eintragen in Buch[i].Filename
// UP: Kapitel Buch[i] kommt in eine eigene Datei
// Testen: noch weiter zerlegen?
Instructions: procproc split_block(i)
{
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Buch[i] ##= { Filename = NewFilename() }
Instructions: var How does VScript::Value() work?: Var*&var j=Numeric functions: findfind("h0h1h2h3h4",Tag)
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl, " "[to j+1], Buch[i].Filename, " --> ", Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif SizeofBlock(i)<SplitFileSize Flow control: returnreturn SkipBlock(i) Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var n = NumFiles
Instructions: var How does VScript::Value() work?: Var*&var j = i+1
Flow control: do … loopdo
Flow control: whilewhile j<Numeric functions: countcount Buch && contains_tag( Tag, Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[j] )
Flow control: if … thenif Numeric functions: existsexists Buch[j].Keywords j = split_block(j)
Flow control: if … then Flow control: try … thenelse j = SkipBlock(j)
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Flow control: if … thenif NumFiles>n Buch[i] ##= { List functions: split Instructions: splitSplit=1 } Flow control: if … then Flow control: try … thenthen // Flow control: if … then Flow control: try … thenelse: List functions: split Instructions: splitSplit n.ex.
Flow control: returnreturn j
}
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount=0
split_block(1)
Statistics ##= { HtmlDateien = NumFiles }
Flow control: if … thenif verbose
Flow control: if … thenif NumFiles == 1
Instructions: putput Constants: nlnl, " Buch besteht aus einer Datei. "
Flow control: if … then Flow control: try … thenelse
Instructions: putput Constants: nlnl, " Buch besteht aus ", NumFiles, " Dateien. "
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
Instructions: putput "--> ", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount, " Dateien"
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc AnkerErzeugen()
{
Instructions: putput Constants: nlnl, "Verweisziele zusammentragen "
Instructions: var How does VScript::Value() work?: Var*&var acnt = 0
Instructions: procproc anker_benennen(i,CurrentFile,HeadlineListe)
{
acnt++
Flow control: if … thenif i!=1 HeadlineListe ##= Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: countcount HeadlineListe > 2 Instructions: deldel HeadlineListe[1] Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var f = Numeric functions: existsexists Buch[i].Filename
Flow control: if … thenif f
Instructions: var How does VScript::Value() work?: Var*&var a = Seed // pro Datei wieder mit "A" beginnen
Seed = 0 // fast die Frage, ob der Aufwand lohnt
CurrentFile = Buch[i].Filename
Flow control: if … then Flow control: try … thenthen
Flow control: try … thentry
Instructions: var How does VScript::Value() work?: Var*&var Anker = Buch[i].Anker // falls Ankername vorgegeben wurde
Flow control: if … then Flow control: try … thenelse
Instructions: var How does VScript::Value() work?: Var*&var id = Seed++
Instructions: var How does VScript::Value() work?: Var*&var Anker = "" Flow control: do … loopdo Anker #= Text functions: charstrcharstr('A'+id%26) id/=26 Flow control: whilewhile id>=1 Flow control: do … looploop
Buch[i] ##= { Anker = Anker }
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var j=0
Flow control: do … loopdo
Flow control: whilewhile ++j <= Numeric functions: countcount Buch[i].Keywords
Flow control: if … thenif Numeric functions: countcount HeadlineListe>=2 Instructions: var How does VScript::Value() work?: Var*&var hl = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.JoinText(HeadlineListe,": ")
Flow control: if … thenelif Numeric functions: countcount HeadlineListe==1 Instructions: var How does VScript::Value() work?: Var*&var hl = HTML.B(HeadlineListe[1])
Flow control: if … then Flow control: try … thenelse Instructions: var How does VScript::Value() work?: Var*&var hl = HTML.B(Buch[1].Data Types: Text Item selector "[]": Text Glossary: text, text_valText) /* Buchtitel */
Flow control: if … then Flow control: try … thenthen
AddXref( Buch[i].Keywords[j], hl, CurrentFile, Anker )
Flow control: do … looploop
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Instructions: var How does VScript::Value() work?: Var*&var j = i+1
Flow control: do … loopdo
Flow control: whilewhile j <= Numeric functions: countcount Buch
Flow control: whilewhile contains_tag(Tag,Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[j])
Flow control: if … thenif Numeric functions: existsexists Buch[j].Keywords j = anker_benennen(j,CurrentFile,HeadlineListe)
Flow control: if … then Flow control: try … thenelse j = SkipBlock(j)
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Flow control: if … thenif f
Buch[i] ##= { Seed=Seed } // --> für IDs der Multilink-Popups
Seed = a
Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn j
}
anker_benennen(1,"",{})
Statistics ##= { AnzahlAnker=acnt, AnzahlKeywords=Numeric functions: countcount Xref }
}
Instructions: procproc QuerverweiseEinfügen()
{
Instructions: putput Constants: nlnl, "Querverweise einfügen "
/* UP: Text functions: link Instructions: linkLinks in eine Zeile einfügen
in: Zeile liegt als Wortliste {Sep,Wort,...Sep} vor
aktuelle Wortzahl für Keyphrase-Suche
EigeneDatei -> Urls ohne Dateinamen
out: Zeile als Wort-Liste
*/
Instructions: var How does VScript::Value() work?: Var*&var xrefs=0
Instructions: var How does VScript::Value() work?: Var*&var xref={0,0,0,0,0,0,0,0,0,0,0,0}[to XrefMaxWords]
Instructions: procproc add_refs ( Wortliste/*Zeile*/, Wortzahl/*Keyphrase*/, EigeneDatei/*wg.Text functions: link Instructions: linkLink*/ )
{
// Instructions: putput Constants: nlnl, Wortliste
Instructions: var How does VScript::Value() work?: Var*&var Worte = {} // => Keyphrase
Instructions: var How does VScript::Value() work?: Var*&var e_worte=0 // Worte <=> Wortliste[ a_worte to e_worte ]
Instructions: var How does VScript::Value() work?: Var*&var a_worte=2
// sliding-window such nach Such-Phrasen in Anker-Liste
Flow control: do … loopdo
// erste Suchphrase basteln / Suchphrase komplettieren
Flow control: if … thenif Numeric functions: countcount Worte < Wortzahl
e_worte += 2
Flow control: if … thenif e_worte > Numeric functions: countcount Wortliste Flow control: returnreturn Wortliste Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Wortliste[e_worte][1]=="<" && HTML.IsAnyTag(Wortliste[e_worte])
Worte = {} // avoid tag interleaving: <Text functions: link Instructions: linklink> .. <tag> .. </Text functions: link Instructions: linklink> .. </tag>
a_worte = e_worte+2
// ***TODO***: <Text functions: link Instructions: linklink> .. <tag> .. </tag> .. </Text functions: link Instructions: linklink> is possible for certain tags
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Worte ##= Wortliste[e_worte]
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
// suchen:
Instructions: var How does VScript::Value() work?: Var*&var Keyphrase = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.NormalizeName(Worte)
Instructions: var How does VScript::Value() work?: Var*&var Ankerliste = FindXref(Keyphrase)
Flow control: if … thenif Numeric functions: countcount Ankerliste == 0 // no Numeric functions: matchmatch
a_worte += 2
Instructions: deldel Worte[1]
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
xrefs++
xref[Wortzahl]++
// Einträge in Ankerliste umschrumpeln:
// <url>={Label=<label>, Text functions: file Instructions: fileFile=<Text functions: file Instructions: filefile>, Anker=<anker>} --> { Label=<label>, Url=<url> }
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Ankerliste
Instructions: renamerename Ankerliste[i].Text functions: file Instructions: fileFile = "Url"
Flow control: if … thenif Ankerliste[i].Url == EigeneDatei Ankerliste[i].Url = "" Flow control: if … then Flow control: try … thenthen
Ankerliste[i].Url #= "#" # Ankerliste[i].Anker
Flow control: do … looploop
Flow control: if … thenif verbose
Instructions: putput verbose >=2
? "<"#Keyphrase#":"#count Ankerliste#">"
: Wortzahl#Numeric functions: countcount Ankerliste#" "
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Flow control: if … then Flow control: try … thenthen
// List functions: join Instructions: joinjoin List functions: words Shell Immediate Commands: wordswords => Text functions: link Instructions: linkLink darf nicht mehr zerbrochen werden
Wortliste[a_worte] = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.JoinText(Wortliste[a_worte to e_worte])
Flow control: do … loopdo Flow control: whilewhile e_worte>a_worte Instructions: deldel Wortliste[e_worte--] Flow control: do … looploop
// whole Text functions: link Instructions: linklink := one single List functions: words Shell Immediate Commands: wordsword!
Wortliste[a_worte] = Style.Linklist(Wortliste[a_worte],Ankerliste)
a_worte += 2
Worte = {}
Flow control: do … looploop
}
/* Text functions: link Instructions: linkLinks in alle Textzeilen ((p_tags)) einfügen
Blocktags rekursiv abarbeiten.
*/
Instructions: procproc QuerverweiseEinfügen ( i, CurrentFile )
{
// neues Text functions: file Instructions: filefile => IDs für multiankertags können wieder bei 0 beginnen
Instructions: var How does VScript::Value() work?: Var*&var f = Numeric functions: existsexists Buch[i].Filename
Flow control: if … thenif f
Instructions: var How does VScript::Value() work?: Var*&var OLDseed = Seed
Seed = Buch[i].Seed // von Anker-Nummerierung gesetzt
CurrentFile = Buch[i].Filename
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
Instructions: var How does VScript::Value() work?: Var*&var j = i+1
Flow control: do … loopdo
Flow control: whilewhile j <= Numeric functions: countcount Buch
Instructions: var How does VScript::Value() work?: Var*&var Subtag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[j]
Flow control: whilewhile contains_tag(Tag,Subtag)
// PARA + PRE tags => Querverweise einfügen
Flow control: if … thenif is_para_tag(Subtag) || is_pre_tag(Subtag)
Instructions: var How does VScript::Value() work?: Var*&var Zeile = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SplitIntoWords(Buch[j].Data Types: Text Item selector "[]": Text Glossary: text, text_valText) // -> { sep, List functions: words Shell Immediate Commands: wordsword, sep, ... sep }
Instructions: var How does VScript::Value() work?: Var*&var Worte = XrefMaxWords
Flow control: do … loopdo
Zeile = add_refs ( Zeile, Worte, CurrentFile )
Flow control: whilewhile --Worte
Flow control: do … looploop
Buch[j++].Data Types: Text Item selector "[]": Text Glossary: text, text_valText = Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.JoinText( Zeile )
Flow control: if … then Flow control: try … thenelse
j = QuerverweiseEinfügen(j,CurrentFile)
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
// zurück zum alten Text functions: file Instructions: filefile => zurück zum alten Seed
Flow control: if … thenif f
Buch[i].Seed = Seed
Seed = OLDseed
Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn j
}
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount=0
QuerverweiseEinfügen(1,"")
Flow control: if … thenif !verbose
Instructions: putput "--> ", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount, " Querverweise"
Flow control: if … then Flow control: try … thenthen
Statistics ##= { AnzahlQuerverweise=xrefs, QuerverweiseNachWortzahl=xref }
}
/* ********************************************************************
SCHREIBE DATEIEN
******************************************************************** */
/* ---- Erstelle alle Dateien für ein Kapitel --------------------
Kapitelhierarchie = Buch-Index-Liste der übergeordneten Kapitel
*/
Instructions: procproc SchreibeKapitel ( i, Kapitelhierarchie )
{
Flow control: if … thenif verbose
Instructions: putput Constants: nlnl," "[to 2+2*Numeric functions: countcount Kapitelhierarchie],Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText," "
Flow control: if … then Flow control: try … thenelse
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Flow control: if … then Flow control: try … thenthen
Kapitelhierarchie ##= i
// Template lesen
Instructions: var How does VScript::Value() work?: Var*&var List functions: split Instructions: splitSplit = Numeric functions: existsexists Buch[i].List functions: split Instructions: splitSplit
Flow control: if … thenif i == 1 Instructions: var How does VScript::Value() work?: Var*&var PageData = Template.Numeric functions: indexIndex
Flow control: if … thenelif List functions: split Instructions: splitSplit Instructions: var How does VScript::Value() work?: Var*&var PageData = Template.List functions: split Instructions: splitSplit
Flow control: if … then Flow control: try … thenelse Instructions: var How does VScript::Value() work?: Var*&var PageData = Template.Page
Flow control: if … then Flow control: try … thenthen
// TITLE Tag:
Instructions: var How does VScript::Value() work?: Var*&var HL = {} Instructions: var How does VScript::Value() work?: Var*&var j=0
Flow control: do … loopdo Flow control: whilewhile ++j <= Numeric functions: countcount Kapitelhierarchie HL ##= Buch[Kapitelhierarchie[j]].Data Types: Text Item selector "[]": Text Glossary: text, text_valText Flow control: do … looploop
Text functions: replace Instructions: replacereplace PageData, "%%TITLE%%", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.JoinText(HL,": ")
// Keywords Meta Tag:
Text functions: replace Instructions: replacereplace PageData, "%%KEYWORDS%%", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.JoinText(HL,", ")
// H0 (Buchtitel), H1 .. H6
Instructions: var How does VScript::Value() work?: Var*&var j = 0
Flow control: do … loopdo
Flow control: whilewhile ++j <= 7
Text functions: replace Instructions: replacereplace PageData, "%%HEADLINE"#(j-1)#"%%",
j <= Numeric functions: countcount Kapitelhierarchie ? Style.Headline(Kapitelhierarchie[j]) : ""
Flow control: do … looploop
// [<prev] [Flow control: nextnext>] buttons
Text functions: replace Instructions: replacereplace PageData, "%%PREV%%", PrevFilename(Buch[i].Filename)
Text functions: replace Instructions: replacereplace PageData, "%%Flow control: nextNEXT%%", NextFilename(Buch[i].Filename)
Instructions: var How does VScript::Value() work?: Var*&var Flow control: end Shell Immediate Commands: exit, quit, endEnd = SkipBlock(i)
Instructions: var How does VScript::Value() work?: Var*&var Tag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i]
// TOC
Instructions: var How does VScript::Value() work?: Var*&var TocText = {}
Instructions: var How does VScript::Value() work?: Var*&var j = i+1
Flow control: do … loopdo
Flow control: whilewhile j < Flow control: end Shell Immediate Commands: exit, quit, endEnd
Flow control: if … thenif Numeric functions: existsexists Buch[j].Keywords
TocText ##= Style.TocItem(j)
Flow control: if … then Flow control: try … thenthen
j = SkipBlock(j)
Flow control: do … looploop
Text functions: replace Instructions: replacereplace PageData, "%%TOC%%", Style.Toc(i,TocText)
// Preface, Body
Instructions: var How does VScript::Value() work?: Var*&var F = 3 + Numeric functions: countcount Kapitelhierarchie
Instructions: openoutopenout #F, TargetDir#Buch[i].Filename
Instructions: putput #F, PageData[to Numeric functions: findfind(PageData,"%%BODY%%")-1]
Instructions: var How does VScript::Value() work?: Var*&var j=i+1
Flow control: do … loopdo
Flow control: whilewhile j < Flow control: end Shell Immediate Commands: exit, quit, endEnd
Instructions: var How does VScript::Value() work?: Var*&var Subtag = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[j]
Flow control: if … thenif Numeric functions: existsexists Buch[j].Filename
j = SchreibeKapitel( j, Kapitelhierarchie )
Flow control: if … then Flow control: try … thenelse
j = Tags.@Subtag.Instructions: writeWrite(F,j)
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Instructions: putput #F, PageData[Numeric functions: findfind(PageData,"%%BODY%%")+8 to]
Instructions: closeclose #F
Flow control: returnreturn Flow control: end Shell Immediate Commands: exit, quit, endEnd
}
Instructions: procproc BuchNachHtmlKonvertieren()
{
Instructions: putput Constants: nlnl, "Nach Html konvertieren "
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile ++i <= Numeric functions: countcount Buch
Flow control: try … thentry
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel()
Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText = HTML.ConvertToHtml(Buch[i].Data Types: Text Item selector "[]": Text Glossary: text, text_valText)
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl,"[",Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Buch[i],"] ",errorstr
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Instructions: putput " " // remove SpinWheel
}
Instructions: procproc AlteDateienLöschen()
{
Instructions: putput Constants: nlnl,"Lösche alte Dateien "
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Instructions: var How does VScript::Value() work?: Var*&var dir: fnamefname = TargetDir # FilenameFromIndex(++i)
Flow control: whilewhile Numeric functions: existsexists Text functions: file Instructions: filefile dir: fnamefname
Flow control: if … thenif verbose Instructions: putput "*" Flow control: if … then Flow control: try … thenelse Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinWheel() Flow control: if … then Flow control: try … thenthen
Instructions: deldel Text functions: file Instructions: filefile dir: fnamefname
Flow control: do … looploop
Instructions: putput " " // remove SpinWheel
}
Instructions: procproc BuchdateienSchreiben()
{
Instructions: putput Constants: nlnl,"Schreibe Buch-Dateien "
// Template.Numeric functions: indexIndex Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Template.List functions: split Instructions: splitSplit default to Template.Page
Flow control: if … thenif !Numeric functions: existsexists Template.Numeric functions: indexIndex Template ##= { Numeric functions: indexIndex = Template.Page } Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !Numeric functions: existsexists Template.List functions: split Instructions: splitSplit Template ##= { List functions: split Instructions: splitSplit = Template.Page } Flow control: if … then Flow control: try … thenthen
Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount=0
SchreibeKapitel ( 1, {} )
Flow control: if … thenif !verbose
Instructions: putput "--> ", Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.SpinCount, " Dateien"
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc DumpBuch()
{
Instructions: var How does VScript::Value() work?: Var*&var B=4
Instructions: openoutopenout#B,"Buch.txt"
Numeric functions: log Numeric functions: loge Instructions: loglog"%"
Instructions: var How does VScript::Value() work?: Var*&var z = Data Types: Text Text functions: stringstring(Buch)
Numeric functions: log Numeric functions: loge Instructions: loglog"%"
Text functions: replace Instructions: replacereplace z,"}, ","},\n"
Numeric functions: log Numeric functions: loge Instructions: loglog"%"
Text functions: replace Instructions: replacereplace z,«", »,«",\n»
Numeric functions: log Numeric functions: loge Instructions: loglog"%"
Instructions: putput#B,z,Constants: nlnl
Numeric functions: log Numeric functions: loge Instructions: loglog"%"
Instructions: closeclose#B
}
Instructions: procproc DumpXref()
{
Instructions: var How does VScript::Value() work?: Var*&var X=4
Instructions: openoutopenout#X,"Xref.txt"
Instructions: var How does VScript::Value() work?: Var*&var z = Data Types: Text Text functions: stringstring(Xref)
Text functions: replace Instructions: replacereplace z,"}, ","},\n"
Text functions: replace Instructions: replacereplace z,«", »,«",\n»
Instructions: putput#X,z,Constants: nlnl
Instructions: closeclose#X
}
Instructions: procproc DumpGlobals()
{
Instructions: var How does VScript::Value() work?: Var*&var G=4
Instructions: openoutopenout#G,"List functions: globals Shell Immediate Commands: globalsglobals.txt"
Instructions: var How does VScript::Value() work?: Var*&var z = Data Types: Text Text functions: stringstring List functions: globals Shell Immediate Commands: globalsglobals
Text functions: replace Instructions: replacereplace z,"}, ","},\n"
Text functions: replace Instructions: replacereplace z,«", »,«",\n»
Instructions: putput#G, z, Constants: nlnl
Instructions: closeclose#G
}
Instructions: procproc Doit()
{
QuelltextEinlesen()
ÄnderungsdatumPrüfen()
TagsAbtrennen()
TagsBehandeln()
BuchAufDateienVerteilen()
AnkerErzeugen()
QuerverweiseEinfügen()
BuchNachHtmlKonvertieren()
AlteDateienLöschen()
BuchdateienSchreiben()
StatisticsAnzeigen()
}
Functions with varying return types: include Instructions: includeinclude LibDir # "HTML.vl"
Functions with varying return types: include Instructions: includeinclude LibDir # "Data Types: Text Item selector "[]": Text Glossary: text, text_valTEXT.vl"
/* ******************************************************************************
MAIN DATA: "DAS BUCH"
****************************************************************************** */
Instructions: var How does VScript::Value() work?: Var*&var Buch = ""
Flow control: end Shell Immediate Commands: exit, quit, endend 0
| |