From e9ae80694875f869892f13f4fcaf1170a00dea41 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- quanta/scripts/Makefile.am | 17 + quanta/scripts/TemplateMagic.pl | 380 +++++++++++ quanta/scripts/TemplateMagic.pl.info | 14 + quanta/scripts/checkxml.kmdr | 286 ++++++++ quanta/scripts/checkxml.kmdr.info | 14 + quanta/scripts/docbook_table.kmdr | 250 +++++++ quanta/scripts/dwt.kmdr | 192 ++++++ quanta/scripts/dwt.kmdr.info | 14 + quanta/scripts/dwt.pl | 409 ++++++++++++ quanta/scripts/dwt.pl.info | 13 + quanta/scripts/externalpreview.sh | 22 + quanta/scripts/externalpreview.sh.info | 14 + quanta/scripts/gubed_install.kmdr | 295 +++++++++ quanta/scripts/gubed_install.kmdr.info | 13 + quanta/scripts/htmlquickstart.kmdr | 987 ++++++++++++++++++++++++++++ quanta/scripts/htmlquickstart.kmdr.info | 14 + quanta/scripts/info.css | 13 + quanta/scripts/info.xsl | 73 +++ quanta/scripts/listwizard.kmdr | 441 +++++++++++++ quanta/scripts/meinproc.kmdr | 284 ++++++++ quanta/scripts/meinproc.kmdr.info | 14 + quanta/scripts/picturewizard.kmdr | 587 +++++++++++++++++ quanta/scripts/scriptinfo.kmdr | 454 +++++++++++++ quanta/scripts/scriptinfo.kmdr.info | 13 + quanta/scripts/tablewizard.kmdr | 449 +++++++++++++ quanta/scripts/tidy.kmdr | 1078 +++++++++++++++++++++++++++++++ quanta/scripts/tidy.kmdr.info | 9 + quanta/scripts/xmlval.kmdr | 499 ++++++++++++++ quanta/scripts/xmlval.kmdr.info | 14 + quanta/scripts/xsltproc.kmdr | 294 +++++++++ quanta/scripts/xsltproc.kmdr.info | 14 + 31 files changed, 7170 insertions(+) create mode 100644 quanta/scripts/Makefile.am create mode 100644 quanta/scripts/TemplateMagic.pl create mode 100644 quanta/scripts/TemplateMagic.pl.info create mode 100755 quanta/scripts/checkxml.kmdr create mode 100644 quanta/scripts/checkxml.kmdr.info create mode 100755 quanta/scripts/docbook_table.kmdr create mode 100755 quanta/scripts/dwt.kmdr create mode 100644 quanta/scripts/dwt.kmdr.info create mode 100644 quanta/scripts/dwt.pl create mode 100644 quanta/scripts/dwt.pl.info create mode 100644 quanta/scripts/externalpreview.sh create mode 100644 quanta/scripts/externalpreview.sh.info create mode 100755 quanta/scripts/gubed_install.kmdr create mode 100644 quanta/scripts/gubed_install.kmdr.info create mode 100755 quanta/scripts/htmlquickstart.kmdr create mode 100644 quanta/scripts/htmlquickstart.kmdr.info create mode 100644 quanta/scripts/info.css create mode 100644 quanta/scripts/info.xsl create mode 100755 quanta/scripts/listwizard.kmdr create mode 100755 quanta/scripts/meinproc.kmdr create mode 100644 quanta/scripts/meinproc.kmdr.info create mode 100755 quanta/scripts/picturewizard.kmdr create mode 100755 quanta/scripts/scriptinfo.kmdr create mode 100644 quanta/scripts/scriptinfo.kmdr.info create mode 100755 quanta/scripts/tablewizard.kmdr create mode 100755 quanta/scripts/tidy.kmdr create mode 100644 quanta/scripts/tidy.kmdr.info create mode 100755 quanta/scripts/xmlval.kmdr create mode 100644 quanta/scripts/xmlval.kmdr.info create mode 100755 quanta/scripts/xsltproc.kmdr create mode 100644 quanta/scripts/xsltproc.kmdr.info (limited to 'quanta/scripts') diff --git a/quanta/scripts/Makefile.am b/quanta/scripts/Makefile.am new file mode 100644 index 00000000..00a74dea --- /dev/null +++ b/quanta/scripts/Makefile.am @@ -0,0 +1,17 @@ +quantadir = ${quanta_datadir}/scripts + +quanta_DATA = scriptinfo.kmdr.info dwt.pl dwt.kmdr.info \ + tidy.kmdr.info checkxml.kmdr.info meinproc.kmdr.info \ + xmlval.kmdr.info xsltproc.kmdr.info htmlquickstart.kmdr.info \ + TemplateMagic.pl TemplateMagic.pl.info info.css externalpreview.sh \ + info.xsl externalpreview.sh.info dwt.pl.info gubed_install.kmdr.info + + +execquantadir = ${quanta_datadir}/scripts + +execquanta_SCRIPTS = scriptinfo.kmdr dwt.kmdr tidy.kmdr \ + checkxml.kmdr meinproc.kmdr \ + xmlval.kmdr xsltproc.kmdr \ + htmlquickstart.kmdr \ + gubed_install.kmdr \ + listwizard.kmdr picturewizard.kmdr tablewizard.kmdr docbook_table.kmdr diff --git a/quanta/scripts/TemplateMagic.pl b/quanta/scripts/TemplateMagic.pl new file mode 100644 index 00000000..40b3b2d1 --- /dev/null +++ b/quanta/scripts/TemplateMagic.pl @@ -0,0 +1,380 @@ +#!/usr/bin/perl +# +# Template Magic for Quanta: +# This script is intended to be used as a sample of some of the possibilities of integrating +# Kommander and Quanta. It's hoped that this can serve as a basic example of how Kommander works +# and how it can speed you're web development. +# +# This script exists in the public domain and may be freely copied and redistributed. Please just +# let me know that you used my script and what you're doing (I like new ideas). +# +# As usual, if this script by some means manages to do any harm to you, your computer, your animal, +# your relatives or your animal relatives, feel free to vent to me in email and I'll try to fix the +# script. You'll have to take care of the livestock. +# +# Template variables are of the form [ varname:vartype ] where vartype can be either +# 'file', 'filename' or 'text'. Filename and file are two slight variations on the same theme +# as both allow you to select a file from your filesystem, file will insert the contents of that +# file whereas filename will simply insert the filename (with the path). Text is simply a rich +# text field that can take a good little bit of text (the limitation if any will exist in +# Kommander or your computers memory). +# +# Cheers, +# --Robert Nickel +# Quanta Development Team Groupie +#' + +use strict; +# disable buffereing - otherwise everything waits till we quit +$| = 1; + +my $tmversion = "2.0"; + +#my $template=`kmdr-executor /tmp/TM.kmdr`; + +# adapt - passed parameter is template + +my $template = @ARGV[0]; + +open(IFH, "< $template") || die("Couldn't read $template\n"); + +my ($tmp,@ar,@OrderedVars,%Vars,%Vals,$i,$k,$v,$l,$r,$ns,@filechars,$fname,@VarData,@VD,$j); + +my $max_ui_height=800; #Maximum screen height of ui dialog +my $calcHeight=0; #Height of ui dialog, up to a max of $max_ui_height +parseTemplateVars(); + +close(IFH); + +srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`); +for (48..57,65..90,97..122) { push @filechars, chr(); } #Chars for tmp filename +$fname="/tmp/"; +for (0..10) { $fname.=$filechars[rand 62]; } +$fname.=".quanta.template"; + +#uncomment this line if you're having grief with the generated kmdr file.' +#and comment out the rm -f a little farther down. +#$fname="/tmp/quanta_template.kmdr"; + +open(OFH, "> $fname") || die("Couldn't create temp file $fname\n"); +&createUI(); +close(OFH); + +@VarData=`kmdr-executor $fname`; #We now have var:value one per line. + +#Ok. Let's get that pesky template loaded and output it to something useful.' +#print "Data from kommander:\n"; +$j=0; +for $i (@VarData) { + chomp($i); + if($i=~/^\+\+\+\+\z/) { #end of record marker + $j++; + } else { #add the contents to the end of the string + if(length($VD[$j])>0) { $VD[$j].=" "; } + $VD[$j].=$i; + } +} + +for $i (@VD) { + chomp($i); + if($i ne "") { + ($k,$v)=split(/:/,$i,2); #This should give us key:value pair separated. +# print "$k: '$v'\n"; + if(exists($Vars{$k})) { + $Vals{$k}=$v; + } else { die("Inconsistent variable: $k.\nBailing....\n"); } + } +} + +open(IFH, "< $template") || die("Couldn't read $template\n"); #reopen file to reset file pointer + +&insertTemplateValues(); + +close(IFH); + +#cleanup temp file +`rm -f $fname`; +exit(0); + +sub usage() { + my $msg=shift(); + print "$msg\n\nUsage: $0 \n"; + exit(1); +} + +sub parseTemplateVars() { + $calcHeight=40; #base height for button. + @OrderedVars=(); #initialize this! Who knows? + while($tmp=) { + chomp($tmp); + if($tmp=~/\[\s*\S+\s*\]/) { #Only parse on matches - Changed delimieters from |<- ->| to [ ] + $tmp=~s/^[^\[]*(\[\s*\S+\s*\])[^\[]*/$1/g; + $l=index($tmp,"["); + while($l>=0) { + $r=index($tmp,"]"); + $ns=substr($tmp,$l+1,$r-1); + $ns=~s/\[\s*(\S+)\s*\]/$1/; + $ns=~s/\s//g; #no spaces! + ($k,$v)=split(/:/,$ns,2); + if(exists($Vars{$k}) && $v ne $Vars{$k}) { + die("Multiple definitions for variable $k - '$v' != '$Vars{$k}'.\n"); + } + if(! exists($Vars{$k})) { push @OrderedVars, ["$k","$v"]; } + $Vars{$k}=$v; + $calcHeight+=$v eq "text" ? 35 : 25; + $tmp=substr($tmp,$r+1); + $l=index($tmp,"["); + } + } + } + +=pod + print "="x80 . "\n"; + print "Variables found:\n"; + for $i (keys %Vars) { + print "$i - $Vars{$i}\n"; + } +=cut +} + +sub insertTemplateValues() { + my ($subcntr, $pre, $post); + + while($tmp=) { + $subcntr=0; #sanity. Make sure we don't run away with substitutions.' + while($tmp=~/\[\s*\S+\s*\]/ && $subcntr<100) { #Only do substitutions on matches. + for $k (keys %Vars) { + $tmp=~s/\[\s*$k:$Vars{$k}\s*]/$Vals{$k}/; + } + $subcntr++; + } + print $tmp; + } +} + +sub header() { + #----------- Header ----------- + if($calcHeight>$max_ui_height) { $calcHeight=$max_ui_height; } #Max! + print OFH < + TemplateVarList + + + TemplateVarList + + + + 0 + 0 + 600 + $calcHeight + + + + Template Magic (for Quanta 3.1.9) version $tmversion + +E +; +} + +sub footer() { + #----------- Footer ----------- + my $theSpot=$calcHeight-30; + print OFH < + + CloseButton2 + + + + 300 + $theSpot + 121 + 21 + + + + Create Document + + + + +E +; + + $i=0; + for $k (keys %Vars) { + if($i>0) { print OFH "\n"; } + $i++; + print OFH "echo -e '$k:\@$k\\n++++'"; + } +print OFH < + + + + true + + + + + + +E +; +} + +sub createUI() { +=pod +Structure for label widget: height is 20 + + + + TextLabel2_2 + + + + 10 + 40 + 130 + 20 + + + + Variable2-FileInput + + + +Structure for a file widget: height is 20 + + + + FileSelector2 + + + + 140 + 50 + 441 + 20 + + + + +Structure for a text widget: height is 30 + + + + TextEdit1 + + + + 140 + 10 + 440 + 30 + + + + AlwaysOff + + + AlwaysOff + + +. +=cut + + header(); + + my %Layouts; + my ($y_loc)=0; + for $k (0..$#OrderedVars) { + $Layouts{$OrderedVars[$k][0]}{y}=$y_loc; + print OFH < + + LBL_$OrderedVars[$k][0] + + + + 10 + $y_loc + 130 + 20 + + + + $OrderedVars[$k][0]: + + +E +; + SWITCH: for ($OrderedVars[$k][1]) { + /file|filename/ && do { $y_loc+=25; last SWITCH; }; + /text/ && do { $y_loc+=35; last SWITCH; }; + } + } + + for $k (0..$#OrderedVars) { + + SWITCH: for ($OrderedVars[$k][1]) { + /file|filename/ && do { + print OFH < + + $OrderedVars[$k][0] + + + + 140 + $Layouts{$OrderedVars[$k][0]}{y} + 440 + 20 + + +        +            +                \@widgetText +            +        + +E +; + last SWITCH; + }; + /text/ && do { + print OFH < + + $OrderedVars[$k][0] + + + + 140 + $Layouts{$OrderedVars[$k][0]}{y} + 440 + 30 + + +        +            +                \@widgetText +            +        + + AlwaysOff + + + AlwaysOff + + +E +; + last SWITCH; + }; + } + } + + footer(); +} diff --git a/quanta/scripts/TemplateMagic.pl.info b/quanta/scripts/TemplateMagic.pl.info new file mode 100644 index 00000000..4f10013e --- /dev/null +++ b/quanta/scripts/TemplateMagic.pl.info @@ -0,0 +1,14 @@ + + + + + +TemplateMagic +Eric Laffoon and Robert Nickel +sequitur@kde.org +http://quanta.sf.net +2.0 +GPL +This is mostly written by Robert and a result of a collaboration to enhance Quanta templates and demonstrate uses for Kommander.

+You can create fields in your templates by placing them in square brackets like so [fieldname:type] where type is text, file or filename. File and filename being different in either contents or name. The fields will be replaced with template insertion. This works with text (text/all) and document (template/all) templates. Other fields and functionality are planned. If you enhance this script please send us a copy.
+
diff --git a/quanta/scripts/checkxml.kmdr b/quanta/scripts/checkxml.kmdr new file mode 100755 index 00000000..4e83a9f6 --- /dev/null +++ b/quanta/scripts/checkxml.kmdr @@ -0,0 +1,286 @@ + +Form3 +Quanta+ KDE XML Validator is a Kommander front-end for checkXML. +Chris Hornbaker + + + Form3 + + + + 0 + 0 + 432 + 153 + + + + Quanta+ KDE XML Validator + + + + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout26 + + + + unnamed + + + 0 + + + 6 + + + + Layout7 + + + + unnamed + + + 0 + + + 6 + + + + Spacer8 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton2 + + + + 1 + 0 + 0 + 0 + + + + TabFocus + + + &Validate + + + false + + + true + + + + if [ !@FileSelector4 ] + then + CUR=1 + else + CUR='' +fi +if [ !$CUR ] + then + TMP0=`dcop | grep quanta` + TMP1=`dcop $TMP0 WindowManagerIf projectURL` + DIR=`echo $TMP1 | cut -b6-` + else + DIR=`echo '@FileSelector4'` +fi +cd $DIR +#meinproc --check --stdout index.docbook +checkXML index.docbook 2>&1 + + + + + + CloseButton1 + + + &Close + + + + + + + + + + + + ValScript + + + + + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout10 + + + + unnamed + + + 0 + + + 6 + + + + CheckBox4 + + + C&urrent working folder + + + false + + + true + + + + + + + + + + + + Spacer9 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + TextLabel3 + + + false + + + Other folder: + + + + + Spacer5 + + + Horizontal + + + Expanding + + + + 89 + 0 + + + + + + FileSelector4 + + + false + + + + @widgetText + + + + + + + + + + + + CheckBox4 + toggled(bool) + FileSelector4 + setDisabled(bool) + + + CheckBox4 + toggled(bool) + TextLabel3 + setDisabled(bool) + + + + CheckBox4 + ExecButton2 + CloseButton1 + + + diff --git a/quanta/scripts/checkxml.kmdr.info b/quanta/scripts/checkxml.kmdr.info new file mode 100644 index 00000000..74d5d488 --- /dev/null +++ b/quanta/scripts/checkxml.kmdr.info @@ -0,0 +1,14 @@ + + + + + +checkxml +Chris Hornbaker +jilks@openschooling.org + +1.0 +GPL v2 +This Kommander script uses checkXML from kdelibs to validate KDE DocBook files. + + diff --git a/quanta/scripts/docbook_table.kmdr b/quanta/scripts/docbook_table.kmdr new file mode 100755 index 00000000..69778134 --- /dev/null +++ b/quanta/scripts/docbook_table.kmdr @@ -0,0 +1,250 @@ + +DocBook_Table +Cria uma tabela em um documento docbook +Huberto Gastal Mayer + + + Form1 + + + + 0 + 0 + 266 + 401 + + + + Docbook Table + + + + unnamed + + + 11 + + + 6 + + + + TextLabel1_2 + + + + 15 + 1 + + + + DocBook Table + + + AlignCenter + + + + + GroupBox1 + + + + + + + echo '<table id="@le_id">' +echo ' <title>@te_descr</title>' +echo ' <tgroup cols="">' + +@cb_title + +echo ' <tbody>' +@sb_lin +echo ' </tbody>' + +echo ' </tgroup>' +echo '</table>' + + + + + + + + unnamed + + + 11 + + + 6 + + + + TextLabel4 + + + id: + + + + + le_id + + + + @widgetText + + + + + + te_descr + + + + @widgetText + + + + + + TextLabel5 + + + Description: + + + + + TextLabel1 + + + Columns + + + + + sb_lin + + + + l=0 +while [ $l -le @widgetText ] +do + + echo ' <row>'; + + @sb_col + + echo ' </row>'; + + l=$((l+1)) + +done + + + + + + + TextLabel2 + + + Lines + + + + + sb_col + + + + c=0 +while [ $c -le @widgetText ] +do + + echo " <entry></entry>" + + c=$((c+1)) + +done + + + + + + + cb_title + + + &Include title line + + + + + + echo ' <thead>'; +echo ' <row>'; + +@sb_col + +echo ' </row>'; +echo ' </thead>'; + + + + + + + + CloseButton1 + + + &OK + + + false + + + + @GroupBox1 + + + + true + + + + + CloseButton1_2 + + + &Cancel + + + false + + + + + + + + true + + + + + + sb_col + sb_lin + cb_title + le_id + te_descr + CloseButton1 + CloseButton1_2 + + + diff --git a/quanta/scripts/dwt.kmdr b/quanta/scripts/dwt.kmdr new file mode 100755 index 00000000..1fab1576 --- /dev/null +++ b/quanta/scripts/dwt.kmdr @@ -0,0 +1,192 @@ + +dwt +Kommander dialog for the dwt script. +Benjamin Stocker + + + dwt + + + + 0 + 0 + 408 + 338 + + + + dwt - Apply Dreamweaver Template + + + + unnamed + + + 11 + + + 6 + + + + cmdClose + + + &Close + + + + + cmdOK + + + &OK + + + + xclock sdsdsdsdsd + + + + + + tabMain + + + + tab + + + Script + + + + unnamed + + + 11 + + + 6 + + + + lblProject + + + Full project path: + + + + + chkDebug + + + Show debug messages + + + + + txtScript + + + dwt.pl + + + + @widgetText + + + + + + lblScript + + + Script location: + + + + + txtProjectPath + + + + @widgetText + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 80 + + + + + + + + tab + + + Help + + + + unnamed + + + 11 + + + 6 + + + + txtHelp + + + The dwt Script will apply actual Dreamweaver templates to all your project files. Just enter the FULL project path and specify where the script dwt.pl can be found. + + + AutoText + + + WordBreak|AlignTop|AlignLeft + + + + + + + + Spacer4 + + + Horizontal + + + Expanding + + + + 225 + 0 + + + + + + + diff --git a/quanta/scripts/dwt.kmdr.info b/quanta/scripts/dwt.kmdr.info new file mode 100644 index 00000000..1aca85a1 --- /dev/null +++ b/quanta/scripts/dwt.kmdr.info @@ -0,0 +1,14 @@ + + + +dwt +Benjamin Stocker +bstocker@4s-hosting.ch +http://www.4s-hosting.ch/bstocker/dwt +1.11 +GPL +DreamWeaver Template functionality. +This is a perl script to apply a modified Dreamweaver (DW) template to files using this template. Macromedia Dreamweaver manages this automatically whenever you change a tepmplate. See DW Documentation for more infos. +When you have a DW-Project with templates but no DW, you can change templates, but this changes will not be added to files using the template. +This script can solve this problem. It takes the name of the FULL project path as argument, scans this path for html files with Template references and updates them. Therefore, all you have to do after updating a template is running this script instead of loading Dreamweaver. + diff --git a/quanta/scripts/dwt.pl b/quanta/scripts/dwt.pl new file mode 100644 index 00000000..af823663 --- /dev/null +++ b/quanta/scripts/dwt.pl @@ -0,0 +1,409 @@ +#!/usr/bin/perl + +## dwt - perl script to support dreamweaver templates +## Copyright (C) 2003 Benjamin Stocker +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +## DESCRIPTION: +## This is a perl script to apply a modified Dreamweaver (DW) +## template to a file using this template. Macromedia +## Dreamweaver manages this automatically whenever you +## change a tepmplate. See DW Documentation for more infos. +## When you have a DW-Project with templates but no DW, you +## cann change templates, but this changes will not be added +## to files using the template. +## This script can solve this problem. It takes the name of a +## file as argument, scans this file for a template and adds +## all template changes to the file. +## +## Check http://sys.4s-hosting.ch/bstocker/dwt/ +## for more informations and updates. +## +## Please, let me know it this script works for you, your questions +## and comments are welcome! + +use Getopt::Std; +use IO::Dir; + +# Write debug informations to STDOUT (-d) +$DEBUG=0; +# Version +$VERSION="1.11 (06/9/2003)"; +# Display result on screen (-o); +$SCREEN=0; +# Extensions to search +$SEXT="php:php3:php4:htm:html:phtml"; +@AEXT=split(':',$SEXT); + +&CheckArguments(); + +## Check command line arguments +if ($ARGV[0] eq '') { + &Usage; +} +$PROJECTPATH=$ARGV[0]; +$PROJECTPATH=&ExpandPath($PROJECTPATH); +unless (-d $PROJECTPATH) { + print "FATAL: Cannot stat '$PROJECTPATH'. argument must be a directory\n"; + exit; +} + +&ScanDir($PROJECTPATH); + +# All done! +exit(0); + +## +## Scan all directories and files in specified path +## +sub ScanDir($) { + my $path=$_[0]; + my ($dirname,$newpath,%dhf); + tie %dhf, IO::Dir, $path; + if (defined %dhf) { + foreach $dirname(keys(%dhf)) { + if ($dirname ne '.' and $dirname ne '..') { + $newpath="$path/$dirname"; + &CheckExtension($newpath); + if (-d $newpath) { + &ScanDir($newpath); + } + } + } + } else { + die "FATAL: Cannot list $path"; + } + undef $dhf; +} + +## +## Check if extension matches +## +sub CheckExtension($) { + my $filename=$_[0]; + my $s; + foreach $s (@AEXT) { + if ($filename=~/\.$s$/i) { + &DebugMsg($filename); + &DoDWT($filename); + } + } +} + +## +## Merge template and document +## +sub DoDWT($) { + my $filename=$_[0]; + my (@v,$source,$templatesource,$templatename); + my ($p1,$p2,$region,$rbegin,$rend,$rbuf,$q1,$q2); + + # Read file into buffer + open HF, $filename or die "FATAL: Cannot open: $filename"; + @v=; $source=join("",@v); $source=&Dos2Unix($source); + close HF; + + # Extract template name from buffer + $templatename=&GetTemplateName($source); + if ($templatename eq '') { + print "NOTE: Could not extract template name from $filename\n"; + return; # function execution ends here! NW would not like that :) + } + + # Open template file + $templatename=&BuildPathName($templatename,$PROJECTPATH); + open HF, $templatename or die "FATAL: Cannot open template file: $templatename"; + @v=; $templatesource=join("",@v); + $templatesource=&Dos2Unix($templatesource); + close HF; + + # Correct links in template + $templatesource=&CorrectLinks($templatesource,$PROJECTPATH,$filename); + + # Rebuild file using template + $p1=index($templatesource,""; + $rend=""; # 21 characters, see below! + $q1=index($source,$rbegin); + $q2=index($source,$rend,$q1); + if ($q1>=0 and $q2>=0) { + # Extract from file + $rbuf=substr($source,$q1,$q2-$q1+21); + # Paste into template + $q1=index($templatesource,$rbegin); + $q2=index($templatesource,$rend,$q1); + if ($q1>=0 and $q2>=0) { + $q2=$q2+21; + $templatesource=substr($templatesource,0,$q1).$rbuf.substr($templatesource,$q2); + } else { + print "WARNING: Could not find region '$region' in template $templatename"; + } + } else { + print "WARNING: Could not find region '$region' in $filename"; + } + } + $p1=index($templatesource,"", $p2); + if ($p2>=0) { + $p2=$p2+3; + $p3=index($source, "", $p2); + if ($p3>=0) { + # Build the updated document + $source=substr($source, 0, $p2) . $lb . substr($source, $p3); + } else { + print "WARNING: End tag for library $lib not found "; + } + } else { + print "WARNING: Error in library tag $lib. Please correcet markup"; + } + } + $p1=index($source,"