checkLinks_w3c.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #
  3. # Check links in the generated documentation. This script runs on Linux and
  4. # assumes
  5. # - the W3C "checklink" program to be installed,
  6. # - the generated documentation being "online", i.e. served by a web server.
  7. #
  8. # Use "python3 -m http.server 8082" to start a web server that serves
  9. # the current directory.
  10. #
  11. #
  12. prefix="http://localhost:8082/"
  13. target="eclipsehelp"
  14. usage() {
  15. echo "Usage: $0 { --eclipsehelp | --web | --help }"
  16. exit $1
  17. }
  18. # Read command line parameters
  19. while [ "$1" != "" ]
  20. do
  21. case "$1" in
  22. -e | --eclipsehelp)
  23. target="eclipsehelp"
  24. shift
  25. ;;
  26. -w | --web)
  27. target="web"
  28. shift
  29. ;;
  30. -h | --help)
  31. usage 0
  32. ;;
  33. -*)
  34. echo "Illegal option: $1"
  35. usage 1
  36. ;;
  37. *)
  38. file="$1"
  39. shift
  40. ;;
  41. esac
  42. done
  43. if [ "${target}" == "eclipsehelp" ]
  44. then
  45. checklink --broken --dir-redirects \
  46. --recursive --depth 1 \
  47. --exclude https://github.com/Yakindu/.* \
  48. ${prefix}user-guide/c-domain.html \
  49. ${prefix}user-guide/editing_statecharts.html \
  50. ${prefix}user-guide/generating_code_headless.html \
  51. ${prefix}user-guide/generating_code.html \
  52. ${prefix}user-guide/glossary.html \
  53. ${prefix}user-guide/overview.html \
  54. ${prefix}user-guide/sctunit.html \
  55. ${prefix}user-guide/simulating_statecharts.html \
  56. ${prefix}user-guide/statechart_language.html \
  57. ${prefix}tutorials/tutorials.html \
  58. 2>&1 | tee log.txt
  59. elif [ "${target}" == "web" ]
  60. then
  61. checklink --broken --dir-redirects \
  62. --recursive --depth 1 \
  63. --exclude 'https://github.com/Yakindu/.*|http://groups.google.com/.*|javascript:.*|tel:.*|mailto:.*|https://cta-redirect.hubspot.com/' \
  64. https://www.itemis.com/en/yakindu/state-machine/documentation/user-guide/ \
  65. https://www.itemis.com/en/yakindu/state-machine/documentation/tutorials/ \
  66. 2>&1 | tee log.txt
  67. else
  68. echo "Unknown target: ${target}"
  69. usage 1
  70. fi