...
 
Commits (4)
......@@ -23,4 +23,17 @@ The language can be explicitly chosen. For example
returns all links, the target URI of each link or the text of all links alphabetically.
There are more examples on the above page with binaries, the github wiki and in the directory examples.
\ No newline at end of file
There are more examples on the above page with binaries, the github wiki and in the directory examples.
Screenshots
-----------
<p align="center">
<img src="http://www.videlibri.de/img/xidel-linux.png" alt="Xidel on Linux">
<img src="http://www.videlibri.de/img/xidel-windows-blue.png" alt="Xidel on Windows">
</p>
......@@ -92,7 +92,7 @@ function addpaths() {
done < <(find "$1" -type d)
}
#the svn and source tarball contains xidel in programs/internet/xidel and dependencies in components/pascal
#sourceforge and the source tarball contain xidel in programs/internet/xidel and dependencies in components/pascal
#but someone might have checked out the git and installed dependencies elsewhere, so try to guess the local paths
sourceroot=.
sourcepath=.
......
......@@ -2,10 +2,11 @@
Some important changes:
--------Xidel 0.9.7 --------
- fix system(), file:exists, file:move (override), file:path-to-uri on Windows
- Cookie handling follows RFC 6265 rather than sending all cookies to all servers.
- add t:siblings-header/siblings elements to pattern matcher to match certain element siblings regardless of their ordering (e.g. table columns).
- add functions x:call-action, x:get-log, x:clear-log to give programatical access to multipage templates and variable changelog.
- add functions x:call-action, x:has-action, x:get-log, x:clear-log to give programmatic access to multipage templates and variable changelog.
- add --module parameter to load xquery modules into (xpath) queries and properly resolve relative paths for module imports.
- fix system(), file:exists, file:move (override), file:path-to-uri on Windows
- further minor bug fixes and performance improvements
--------Xidel 0.9.6 --------
......
......@@ -43,9 +43,9 @@ function compile(){
function xidelCompileAndroidArm(){
rm xidel
#fpc -Tandroid -Parm -MObjFPC -Scghi -CX -Crt -O3 -g -gl -XX -l -vewnhibq -Filib/arm-android -Fu../../../components/pascal/import/synapse -Fu../../../components/pascal/internet -Fu../../../components/pascal/data -Fu../../../components/pascal/system -Fu../../../components/pascal/import/regexpr/source -Fu../../../components/pascal/import/utf8tools -Fu../../../components/pascal/lib/arm-android -Fu/opt/lazarus/packager/units/arm-android -Fu. -FUlib/arm-android -dUSE_SYNAPSE_WRAPPER -Cg xidel.pas
#fpc -Tandroid -Parm -MObjFPC -Scghi -CX -Crt -O3 -g -gl -XX -l -vewnhibq -Filib/arm-android -Fu../../../components/pascal/import/synapse -Fu../../../components/pascal/internet -Fu../../../components/pascal/data -Fu../../../components/pascal/system -Fu../../../components/pascal/import/regexpr/source -Fu../../../components/pascal/import/utf8tools -Fu../../../components/pascal/lib/arm-android -Fu~/opt/lazarus/packager/units/arm-android -Fu. -FUlib/arm-android -dUSE_SYNAPSE_WRAPPER -Cg xidel.pas
#we cannot compile dependencies, as they default to Java based internet access instead Synapse
/opt/lazarus/lazbuild -d --bm=androidarm xidel.lpi || (echo "FAILED!"; exit)
lazbuild -d --bm=androidarm xidel.lpi || (echo "FAILED!"; exit)
#arm-linux-androideabi-strip --strip-all xidel
}
......@@ -109,13 +109,17 @@ cgi) lazCompileLinux64 xidelcgi
;;
release)
find lib -name "*.o" -delete -or -name "*.ppu" -delete
find lib -name "*.o" -delete -or -name "*.ppu" -delete
cp xidel oldxidel
./manage.sh src
./manage.sh linux32
./manage.sh linux64
./manage.sh win32
./manage.sh win32synapse
./manage.sh linuxarm
./manage.sh androidarm
./manage.sh mirror
mv oldxidel xidel
;;
hg) pushhg
......
......@@ -415,6 +415,8 @@ tests/test.sh moduleFunc1 -e 'declare variable $a:=123; declare function local:x
tests/test.sh moduleFunc2 -e 'declare variable $a:=123; declare function local:xyz(){456}; ()' -e 'declare function local:abc(){$a*1000}; local:xyz() + local:abc()'
tests/test.sh moduleFuncImport -e 'import module namespace foobar = "pseudo://test-module" at "tests/module.xq"; ()' -e '$foobar:abc'
tests/test.sh moduleFuncImport --module tests/module.xq -e '$foobar:abc'
tests/test.sh moduleFuncImport --module-path tests --module tests/module.xq -e '$foobar:abc'
tests/test.sh moduleFuncImport --module-path xyz --module-path tests --module module.xq -e '$foobar:abc'
tests/test.sh moduleFuncImport2 -e 'import module namespace rename = "pseudo://test-module" at "tests/module.xq"; ()' -e 'rename:test()'
tests/test.sh moduleFuncImport2 --module tests/module.xq -e 'foobar:test()'
tests/test.sh moduleFuncImport2 --module rename=tests/module.xq -e 'rename:test()'
......@@ -422,6 +424,7 @@ tests/test.sh moduleFuncImport2 --module tests/module.xq -e 'import module names
tests/test.sh moduleFuncImport2 --module xyz=tests/module.xq -e 'import module "pseudo://test-module"; ()' -e 'foobar:test()'
tests/test.sh moduleFuncImportRel --module tests/module2.xqm -e '$foobar2:def'
tests/test.sh moduleFuncImportRel -e 'import module namespace rename = "pseudo://test-module2" at "tests/module2.xqm"; $rename:def'
tests/test.sh moduleFuncImportRel --module-path tests -e 'import module namespace rename = "pseudo://test-module2" at "module2.xqm"; $rename:def'
tests/test.sh moduleFuncImportRel --module xyz=tests/module2.xqm -e 'import module namespace rename = "pseudo://test-module2" at "tests/module2.xqm"; $rename:def'
tests/test.sh moduleFuncImportRel --extract-file tests/subdir/test.xq
tests/test.sh moduleFuncImportRel tests/subdir/test.xq
......
......@@ -185,7 +185,7 @@
<PackageName Value="internettools"/>
</Item1>
</RequiredPackages>
<Units Count="3">
<Units Count="2">
<Unit0>
<Filename Value="xidel.pas"/>
<IsPartOfProject Value="True"/>
......@@ -194,10 +194,6 @@
<Filename Value="xidelbase.pas"/>
<IsPartOfProject Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../../components/pascal/data/xquery_module_file.pas"/>
<IsPartOfProject Value="True"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
......@@ -210,11 +206,15 @@
<OtherUnitFiles Value="../../../components/pascal/import/synapse;../../../components/pascal/internet;../../../components/pascal/data;../../../components/pascal/system;../../../components/pascal/import/regexpr/source;../../../components/pascal/import/utf8tools"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Checks>
<RangeChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<Optimizations>
<OptimizationLevel Value="2"/>
......
......@@ -1870,7 +1870,10 @@ end;
procedure TProcessingContext.printStatus(s: string);
begin
if not silent then writeln(stderr, s);
if not silent then begin
if not firstItem then writeln(stderr);
writeln(stderr, s);
end;
end;
procedure TProcessingContext.readOptions(reader: TOptionReaderWrapper);
......@@ -2968,6 +2971,7 @@ begin
writeln(stderr, logged);
end;
var modulePaths: TStringArray;
function loadModuleFromAtUrl(const at, base: string): IXQuery; forward;
procedure traceCall(pseudoSelf: tobject; sender: TXQueryEngine; value, info: IXQValue);
......@@ -3429,6 +3433,8 @@ begin
end;
end else if name = 'module' then begin
importModule(value);
end else if name = 'module-path' then begin
arrayAdd(modulePaths, value);
end else if (name = '') or (name = 'data') then begin
if (name = '') and (value = '[') then begin
pushCommandLineState;
......@@ -3538,15 +3544,24 @@ var d: IData;
url, oldBaseUri: String;
visitor: TXQTerm_VisitorFindWeirdGlobalVariableDeclarations;
term: TXQTerm;
begin
url := strResolveURI(at, base);
try
ft := TFollowTo.createFromRetrievalAddress(url);
d := ft.retrieve(baseContext, 0);
ft.free;
except
exit(nil);
oldSilent: Boolean;
begin
d := nil;
oldSilent := baseContext.silent;
for i := -1 to high(modulePaths) do begin
if i = -1 then url := strResolveURI(at, base)
else url := modulePaths[i] + DirectorySeparator + at;
try
ft := TFollowTo.createFromRetrievalAddress(url);
baseContext.silent := true; //always load silent (probably should make it honor --silent option, but this function is called before options are read)
d := ft.retrieve(baseContext, 0);
ft.free;
except
end;
if d <> nil then break;
end;
baseContext.silent := oldSilent;
if d = nil then exit(nil);
oldBaseUri := xpathparser.StaticContext.baseURI;
xpathparser.StaticContext.baseURI := url;
result := xpathparser.parseXQuery3(d.rawData);
......@@ -3639,6 +3654,7 @@ begin
mycmdLine.declareFile('template-file', 'Abbreviation for --extract-kind=multipage --extract-file=...');
mycmdLine.declareString('template-action', 'Select which action from the multipage template should be run (multiple actions separated by commas)');
mycmdLine.declareFile('module', 'Imports an xpath/xquery module');
mycmdLine.declareString('module-path', 'Search path for modules');
mycmdLine.beginDeclarationCategory('Follow options:');
......