#
# fix-privacy-breach
# (c) 2014-2015 Norbert Preining
#
# try to fix the *very* helpful lintian error about privacy breach.
# Especially the privacy-breach-w3c-valid-html tag just tells us
# that it is bad, but we cannot copy the icon into the package since
# it is not free ... aaahhh what a wonderful world
#

pkg="$1"

jadetexfiles="
	usr/share/doc/texlive-doc/otherformats/jadetex/base/index.html
"

pdfjamfiles="
	usr/share/doc/texlive-doc/support/pdfjam/PDFjam-README.html
"
komafiles="
	usr/share/doc/texlive-doc/latex/koma-script/koma-script.html 
	usr/share/doc/texlive-doc/latex/koma-script/komascr.html
	usr/share/doc/texlive-doc/latex/koma-script/komascript.html
	usr/share/doc/texlive-doc/latex/koma-script/scraddr.html
	usr/share/doc/texlive-doc/latex/koma-script/scrartcl.html
	usr/share/doc/texlive-doc/latex/koma-script/scrbase.html
	usr/share/doc/texlive-doc/latex/koma-script/scrbook.html
	usr/share/doc/texlive-doc/latex/koma-script/scrdate.html
	usr/share/doc/texlive-doc/latex/koma-script/scrextend.html
	usr/share/doc/texlive-doc/latex/koma-script/scrguide.html
	usr/share/doc/texlive-doc/latex/koma-script/scrguien.html
	usr/share/doc/texlive-doc/latex/koma-script/scrhack.html
	usr/share/doc/texlive-doc/latex/koma-script/scrlayer-notecolumn.html
	usr/share/doc/texlive-doc/latex/koma-script/scrlayer-scrpage.html
	usr/share/doc/texlive-doc/latex/koma-script/scrlayer.html
	usr/share/doc/texlive-doc/latex/koma-script/scrletter.html
	usr/share/doc/texlive-doc/latex/koma-script/scrlfile.html
	usr/share/doc/texlive-doc/latex/koma-script/scrlttr2.html
	usr/share/doc/texlive-doc/latex/koma-script/scrreprt.html
	usr/share/doc/texlive-doc/latex/koma-script/scrtime.html
	usr/share/doc/texlive-doc/latex/koma-script/scrwfile.html
	usr/share/doc/texlive-doc/latex/koma-script/tocbasic.html
	usr/share/doc/texlive-doc/latex/koma-script/typearea.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/koma-script.html 
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/komascr.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/komascript.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scraddr.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrartcl.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrbase.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrbook.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrdate.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrextend.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrguide.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrguien.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrhack.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrlayer-notecolumn.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrlayer-scrpage.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrlayer.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrletter.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrlfile.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrlttr2.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrreprt.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrtime.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/scrwfile.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/tocbasic.html
	usr/share/texlive/texmf-dist/source/latex/koma-script/doc/typearea.html
"

for f in $pdfjamfiles ; do
  ff="debian/$pkg/$f"
  if [ -r $ff ] ; then
    sed -e 's/<img src="http:[^"]*" alt="PDF file"[^>]*>/(PDF)/g' $ff > $ff.new
    mv $ff.new $ff
  fi
done

for f in $komafiles ; do
  ff="debian/$pkg/$f"
  if [ -r $ff ] ; then
    sed \
        -e 's!src="http://www.w3.org/Icons/valid-xhtml11"!!g'  \
        -e 's!src="http://www.w3.org/Icons/valid-html40"!!g'  \
	   $ff > $ff.new
    mv $ff.new $ff
  fi
done

for f in $jadetexfiles ; do
  ff="debian/$pkg/$f"
  if [ -r $ff ] ; then
    sed \
        -e 's!src="http://sourceforge.net/sflogo.php[^"]*"!!g'  \
	   $ff > $ff.new
    mv $ff.new $ff
  fi
done
  
