testing for broken links to external documents
Dear all, is there a simple TeX/ConTeXt way to test in a TeX file whether a link to an external document is broken so that I get an error message if not? I am using numerous links to external files (on my hard drive) and I'd like to make sure that none of the links are broken without going manually trough them. Though not an issue at this point, and probably more complicated: Can one also check for broken links to web pages? I don't even know whether that's possible in Acrobat or whether there are tools out there that do that. Thanks, Matthias
On Mon, 28 May 2007, Matthias Weber wrote:
is there a simple TeX/ConTeXt way to test in a TeX file whether a link to an external document is broken so that I get an error message if not?
Quick and dirty: \def\UseURL[#1][#2]{% \executesystemcommand{% if wget -qO/dev/null #2 \letterbar\letterbar [ -f #2 ]; then echo \letterbackslash\letterbackslash useURL[#1][#2]; else echo \letterbackslash\letterbackslash#1DoesNotExist; fi >texcmd.tmp}% \input texcmd.tmp} \setupcolors[state=start] \setupinteraction[state=start] \UseURL[fileOk][/tmp/real-file] \UseURL[fileNotOk][/tmp/not-existing-file] \UseURL[urlOk][http://contextgarden.net/] \UseURL[urlNotOk][http://no.contextgarden.net/] \starttext existing file: \from[fileOk] not existing file: \from[fileNotOk] existing url: \from[urlOk] not existing url: \from[urlNotOk] \stoptext Cheers, Peter -- http://pmrb.free.fr/contact/
On Mon, 28 May 2007, Matthias Weber wrote:
is there a simple TeX/ConTeXt way to test in a TeX file whether a link to an external document is broken so that I get an error message if not?
Quick and dirty: \def\UseURL[#1][#2]{% \executesystemcommand{% if wget -qO/dev/null #2 \letterbar\letterbar [ -f #2 ]; then echo \letterbackslash\letterbackslash useURL[#1][#2]; else echo \letterbackslash\letterbackslash#1DoesNotExist; fi >texcmd.tmp}% \input texcmd.tmp} \setupcolors[state=start] \setupinteraction[state=start] \UseURL[fileOk][/tmp/real-file] \UseURL[fileNotOk][/tmp/not-existing-file] \UseURL[urlOk][http://contextgarden.net/] \UseURL[urlNotOk][http://no.contextgarden.net/] \starttext existing file: \from[fileOk] not existing file: \from[fileNotOk] existing url: \from[urlOk] not existing url: \from[urlNotOk] \stoptext Cheers, Peter -- http://pmrb.free.fr/contact/
Thanks, this helps a lot! Matthias On May 29, 2007, at 1:22 PM, Peter Münster wrote:
On Mon, 28 May 2007, Matthias Weber wrote:
is there a simple TeX/ConTeXt way to test in a TeX file whether a link to an external document is broken so that I get an error message if not?
Quick and dirty:
\def\UseURL[#1][#2]{% \executesystemcommand{% if wget -qO/dev/null #2 \letterbar\letterbar [ -f #2 ]; then echo \letterbackslash\letterbackslash useURL[#1][#2]; else echo \letterbackslash\letterbackslash#1DoesNotExist; fi >texcmd.tmp}% \input texcmd.tmp}
\setupcolors[state=start] \setupinteraction[state=start]
\UseURL[fileOk][/tmp/real-file] \UseURL[fileNotOk][/tmp/not-existing-file] \UseURL[urlOk][http://contextgarden.net/] \UseURL[urlNotOk][http://no.contextgarden.net/]
\starttext existing file: \from[fileOk]
not existing file: \from[fileNotOk]
existing url: \from[urlOk]
not existing url: \from[urlNotOk] \stoptext
Cheers, Peter
-- http://pmrb.free.fr/contact/ ______________________________________________________________________ _____________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________________________________________________ _____________
participants (2)
-
Matthias Weber
-
Peter Münster