mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-01 13:40:25 +00:00
honor encoding in --file-output option
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1875 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
81b5e341e9
commit
ab2f51260a
1 changed files with 19 additions and 7 deletions
26
linkchecker
26
linkchecker
|
|
@ -428,14 +428,26 @@ if options.output:
|
|||
if options.fileoutput:
|
||||
ns = {'fileoutput': 1}
|
||||
for ftype in options.fileoutput:
|
||||
try:
|
||||
ftype, ns['filename'] = ftype.split('/', 1)
|
||||
if not ns['filename']:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
pass
|
||||
# look for (optional) filename and encoding
|
||||
if '/' in ftype:
|
||||
ftype, suffix = ftype.split('/', 1)
|
||||
if suffix:
|
||||
if has_encoding(suffix):
|
||||
# it was an encoding
|
||||
ns['encoding'] = suffix
|
||||
elif '/' in suffix:
|
||||
# look for (optional) encoding
|
||||
encoding, filename = suffix.split('/', 1)
|
||||
if has_encoding(encoding):
|
||||
ns['encoding'] = encoding
|
||||
ns['filename'] = filename
|
||||
else:
|
||||
ns['filename'] = suffix
|
||||
else:
|
||||
ns['filename'] = suffix
|
||||
if linkcheck.Loggers.has_key(ftype):
|
||||
config['fileoutput'].append(config.logger_new(ftype, **ns))
|
||||
logger = config.logger_new(ftype, **ns)
|
||||
config['fileoutput'].append(logger)
|
||||
else:
|
||||
printUsage(_("Illegal argument %r for option %s") % \
|
||||
(ftype, "'-F, --file-output'"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue