/Articles/Forth/PHP/GenerateHTML.cfg
6,6 → 6,7
// Source Files
$CFG["SourceDir"]="../../../../amforth/trunk/";
$CFG["SourceAsm"]="amforth.asm";
$CFG["SvnInfoFileName"]=".svn-info.txt";
 
// Template Files
$CFG["TemplateDir"]="../Templates/";
/Articles/Forth/PHP/GenerateHTML.php
165,6 → 165,7
print " EnableApache={0|1} - Enable to run in Apache\n";
print " SourceDir=path - path to asm source directory\n";
print " SourceAsm=file - name of top level asm source file\n";
print " SvnInfoFileName - name of Svn Info File\n";
print " TemplateDir=path - path to HTML template\n";
print " DestinationDir=path - path to destination HTML\n";
Error("\n");
174,12 → 175,11
function Parameters(&$CFG)
// Function process Command Line parameters
{
// Info
print "Parameters\n";
// Dummy values
$CFG["EnableApache"] = 0; // Do not allow run in Apache
$CFG["SourceDir"] = "";
$CFG["SourceAsm"] = "";
$CFG["SvnInfoFileName"] = "";
$CFG["TemplateDir"] = "";
$CFG["DestinationDir"] = "";
// Default values (in cfg file)
208,6 → 208,13
}
}
 
// Check if alowed to run in Apache
if ($_SERVER["argc"]==0 & ! $CFG["EnableApache"])
return "<b>This Script is configured so that it will not run in Apache.</b>";
 
// Info
print "Parameters\n";
 
// Correct paths and existence
foreach($CFG as $Key => $Value)
{
233,10 → 240,6
print " $Key=$Value\n";
print "\n";
 
// Check if alowed to run in Apache
if ($_SERVER["argc"]==0 & ! $CFG["Apache"])
return "This Script is configured so that it will not run in Apache.";
 
// No Error
return "";
}
428,7 → 431,7
}
 
 
function GenerateWordList($TemplateDir, $DestinationDir, &$LabelList, &$WordList)
function GenerateWordList($TemplateDir, $SvnInfoFileName, $DestinationDir, &$LabelList, &$WordList)
// Creates HTML pages with Word List
// Returns Error String
// IN $TemplateDir - template directory (file WordList.*.html)
449,6 → 452,34
if ($Error!="")
return $Error;
 
// Find <<SvnInfo>>
if (!preg_match("/( *)(<<SvnInfo>>)/i",$FileContent,$Matches))
{
unset($FileContent);
return "Missing <<SvnInfo>> in template file";
}
$Indent=$Matches[1];
 
// Read Svn Info file
$Error=MyReadFileString($SvnInfoFileName, $SvnInfoFile);
if ($Error!="")
{
// We do not have Svn Info File
$SvnInfoFile="";
}
else
{
// We have Svn Info File
$SvnInfoFile=preg_replace("/^((?:URL|Repository|Last)[^:]*):(.*$)|^.*$/im","<tr><td>$1</td><td>$2</td></tr>",$SvnInfoFile);
$SvnInfoFile=preg_replace("~<tr><td></td><td></td></tr>\n~i","",$SvnInfoFile);
$SvnInfoFile="<tr><th colspan=\"2\">Subversion Info</th></tr>".$SvnInfoFile;
}
 
// Put Svn Info into HTML template
$FileContent=str_ireplace("<<SvnInfo>>", $SvnInfoFile, $FileContent);
#print $FileContent;
 
 
// Find <<WordList>>
if (!preg_match("/( *)(<<WordList>>)/i",$FileContent,$Matches))
{
487,7 → 518,8
// Indent and Concatenate lines
foreach($WordListHTML as $Key => $Value)
{
$WordListHTML[$Key]=$Indent.preg_replace("/\n/","<br>",$Value);
if ($Key>0)
$WordListHTML[$Key]=$Indent.preg_replace("/\n/","<br>",$Value);
}
$WordListHTML=implode("\n",$WordListHTML);
586,7 → 618,11
Error(CreateWordList($CFG["SourceDir"], $LabelList, $WordList));
 
// Create HTML WordList
Error(GenerateWordList($CFG["TemplateDir"], $CFG["DestinationDir"], $LabelList, $WordList));
Error(GenerateWordList(
$CFG["TemplateDir"],
$CFG["SourceDir"].$CFG["SvnInfoFileName"],
$CFG["DestinationDir"],
$LabelList, $WordList));
 
// Copy ASM files and convert them into HTML
Error(GenerateAsmFiles($CFG["TemplateDir"], $CFG["SourceDir"], $SourceAsmFiles, $CFG["DestinationDir"]));
595,7 → 631,8
print "O.K.\n";
return
 
// Zpracování readme autora + verze
// Zpracování readme autora
// Vyplatilo by se udělat samostatny formatovaci a nahrazovaci mechanizmus
// Zpracování templejtů do samostatného podprogramu (vyřešit indent...)
// tím se vyřeší i en/cs verze Asm souboru
// Generovat log do souboru místo printu (zvážit) oddělit chyby a varování
/Articles/Forth/PHP/amforth
100,6 → 100,7
EnableApache="0" \
SourceDir="$WorkingDir/source-exported/" \
SourceAsm="amforth.asm" \
SvnInfoFile="$SvnInfoFile" \
TemplateDir="$WebForthInPath/Templates/" \
DestinationDir="$WebForthOutPath/HTML/" \
> $LogFileGenerate 2>> $LogFile
/Articles/Forth/Templates/WordList.cs.html
52,11 → 52,34
</p>
<p class="Subtitle">
Tato stránka zpřístupňuje křížovou referenci jazyka amforth. Odkazy se
generují automaticky na základě zdrojových souborů jazyka amforth, které
jsou umístěny na (přístupné pomocí klienta Subversion)
<a href="https://amforth.svn.sourceforge.net/svnroot/amforth">https://amforth.svn.sourceforge.net/svnroot/amforth</a>.
generují automaticky na základě zdrojových souborů jazyka amforth.
</p>
 
<h1> Verze </h1>
 
<table class="Compact">
<tr>
<th colspan="2" class="center"> Základní informace </th>
</tr>
<tr>
<td> Stránka jazyka amforth </td>
<td> <a href="http://amforth.sourceforge.net/">http://amforth.sourceforge.net/</a></td>
</tr>
<tr>
<td> Stránka pro download </td>
<td> <a href="http://sourceforge.net/projects/amforth">http://sourceforge.net/projects/amforth</a></td>
</tr>
<tr>
<td> Subversion server </td>
<td> <a href="https://amforth.svn.sourceforge.net/svnroot/amforth">https://amforth.svn.sourceforge.net/svnroot/amforth</a></td>
</tr>
<<SvnInfo>>
</table>
<!--
<<ReadMe>>
-->
 
<h1> Seznam slov </h1>
 
<<WordList>>
/Articles/Forth/Templates/WordList.en.html
51,12 → 51,35
amforth - Forth for ATmega
</p>
<p class="Subtitle">
This page is automaticaly generated cross reference for language
amforth. Links are generated directly from source files of the language
which is available at (needs Subversion Client)
<a href="https://amforth.svn.sourceforge.net/svnroot/amforth">https://amforth.svn.sourceforge.net/svnroot/amforth</a>.
This page provides cross reference of the language amforth. The list is
automaticaly generated drectly from assemble source files.
</p>
 
<h1> Vesion </h1>
 
<table class="Compact">
<tr>
<th colspan="2" class="center"> Basic information </th>
</tr>
<tr>
<td> amforth main page </td>
<td> <a href="http://amforth.sourceforge.net/">http://amforth.sourceforge.net/</a></td>
</tr>
<tr>
<td> amforth download page </td>
<td> <a href="http://sourceforge.net/projects/amforth">http://sourceforge.net/projects/amforth</a></td>
</tr>
<tr>
<td> Subversion server </td>
<td> <a href="https://amforth.svn.sourceforge.net/svnroot/amforth">https://amforth.svn.sourceforge.net/svnroot/amforth</a></td>
</tr>
<<SvnInfo>>
</table>
 
<!--
<<ReadMe>>
-->
 
<h1> Vocabulary </h1>
 
<<WordList>>