checkLinks_w3c.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. commonExcludes="http://groups.google.com/.*|https://github.com/Yakindu/.*|https://www.instagram.com/itemisag/|mailto:.*|https://itemisag.wistia.com/medias/9ek8usz18r|https://bugs.eclipse.org/.*|javascript:.*|tel:.*|https://cta-redirect.hubspot.com/|https://www.facebook.com/ItemisAg/"
  44. if [ "${target}" == "eclipsehelp" ]
  45. then
  46. checklink --broken --dir-redirects \
  47. --recursive --depth 1 \
  48. --exclude "${commonExcludes}" \
  49. ${prefix}user-guide/c-domain.html \
  50. ${prefix}user-guide/code_generation_cpp.textile \
  51. ${prefix}user-guide/code_generation_c.textile \
  52. ${prefix}user-guide/code_generation_custom.textile \
  53. ${prefix}user-guide/code_generation_intro.textile \
  54. ${prefix}user-guide/code_generation_java.textile \
  55. ${prefix}user-guide/code_generation_statechart_image.textile \
  56. ${prefix}user-guide/editing_statecharts.html \
  57. ${prefix}user-guide/generating_code_headless.html \
  58. ${prefix}user-guide/glossary.html \
  59. ${prefix}user-guide/installation.html \
  60. ${prefix}user-guide/overview.html \
  61. ${prefix}user-guide/sctunit.html \
  62. ${prefix}user-guide/simulating_statecharts.html \
  63. ${prefix}user-guide/statechart_language.html \
  64. ${prefix}tutorials/tutorials.html \
  65. 2>&1 | tee log.txt
  66. elif [ "${target}" == "web" ]
  67. then
  68. checklink --broken --dir-redirects \
  69. --recursive --depth 1 \
  70. --exclude "${commonExcludes}"'|http://github.com/Yakindu/statecharts.*' \
  71. https://www.itemis.com/en/yakindu/state-machine/documentation/user-guide/ \
  72. https://www.itemis.com/en/yakindu/state-machine/documentation/tutorials/ \
  73. 2>&1 | tee log.txt
  74. else
  75. echo "Unknown target: ${target}"
  76. usage 1
  77. fi