Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

scaffold.sh 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. inc_scaffold=true
  3. [ -z "$inc_xmlfiles" ] && . "$basedir/build/xmlfiles.sh"
  4. [ -z "$inc_translations" ] && . "$basedir/build/translations.sh"
  5. [ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
  6. [ -z "$inc_fundraising" ] && . "$basedir/build/fundraising.sh"
  7. [ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
  8. build_xmlstream(){
  9. # assemble the xml stream for feeding into xsltproc
  10. # the expected shortname and language flag indicate
  11. # a single xhtml page to be built
  12. shortname="$1"
  13. lang="$2"
  14. olang="$(echo "${shortname}".[a-z][a-z].xhtml "${shortname}".[e]n.xhtml |sed -rn 's;^.*\.([a-z]{2})\.xhtml.*$;\1;p')"
  15. dirname="${shortname%/*}/"
  16. texts_xml=$(get_textsfile $lang)
  17. fundraising_xml=$(get_fundraisingfile $lang)
  18. date="$(date +%Y-%m-%d)"
  19. time="$(date +%H:%M:%S)"
  20. outdated=no
  21. if [ -f "${shortname}.${lang}.xhtml" ]; then
  22. act_lang="$lang"
  23. basename=${shortname/*\/}
  24. outdatedtranslations="${dirname}.${basename}.en.xhtml.outdated-translations"
  25. if [ -f "${outdatedtranslations}" ]; then
  26. grep -q "${lang}.xhtml" "${outdatedtranslations}" && outdated=yes
  27. else
  28. echo "* Sidecar file ${outdatedtranslations} is missing" >&2
  29. [ "${shortname}.${olang}.xhtml" -nt "${shortname}.${lang}.xhtml" ] && outdated=yes
  30. fi
  31. else
  32. act_lang="$olang"
  33. fi
  34. infile="${shortname}.${act_lang}.xhtml"
  35. cat <<-EOF
  36. <buildinfo
  37. date="$date"
  38. original="$olang"
  39. filename="/${shortname#$basedir/}"
  40. dirname="/${dirname#$basedir/}"
  41. language="$lang"
  42. outdated="$outdated"
  43. >
  44. <trlist>
  45. $(list_langs "$shortname")
  46. </trlist>
  47. <menuset>$(include_xml "$basedir/tools/menu-global.xml")</menuset>
  48. <textsetbackup>$(include_xml "$basedir/tools/texts-en.xml")</textsetbackup>
  49. <textset>$(include_xml "$texts_xml")</textset>
  50. <fundraising>$(include_xml "$fundraising_xml")</fundraising>
  51. <document
  52. language="$act_lang"
  53. $(get_attributes "$infile")
  54. >
  55. <timestamp>
  56. \$Date: $date $time \$
  57. \$Author: automatic \$
  58. </timestamp>
  59. <set>
  60. $(auto_sources "${shortname}" "$lang")
  61. </set>
  62. $(include_xml "$infile")
  63. </document>
  64. </buildinfo>
  65. EOF
  66. }