wiki-clean.sh 2.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. dir=wiki
  3. sed --in-place --regexp-extended \
  4. -e 's|<script>.+window\.RLQ=window\.RLQ[^<]+</script>|<!-- script purged -->|g' \
  5. -e 's|Cached time:\s+[0-9]+|Cached time: foo|g' \
  6. -e 's|Preprocessor visited node count:\s+[0-9]+/[0-9]+|Preprocessor visited node count: foo/bar|g' \
  7. -e 's|Preprocessor generated node count:\s+[0-9]+/[0-9]+|Preprocessor generated node count: foo/bar|g' \
  8. -e 's|Post‐expand include size:\s+[0-9]+/[0-9]+ bytes|Post‐expand include size: foo/bar bytes|g' \
  9. -e 's|Template argument size:\s+[0-9]+/[0-9]+ bytes|Template argument size: foo/bar bytes|g' \
  10. -e 's|[^-]+- -total|foo - -total|g' \
  11. -e 's|[^-]+- Template:Assembly/TableEntry|foo - Template:Assembly/TableEntry|g' \
  12. -e 's|[^-]+- Template:Assembly/TagLinks|foo - Template:Assembly/TagLinks|g' \
  13. -e 's|[^-]+- Template:Assembly/CenterList|foo - Template:Assembly/CenterList|g' \
  14. -e 's|[^-]+- Template:List/End|foo - Template:List/End|g' \
  15. -e 's|[^-]+- Template:List/Start|foo - Template:List/Start|g' \
  16. -e 's|[^-]+- Template:Refresh|foo - Template:Refresh|g' \
  17. -e 's|and timestamp [0-9]+ and revision id [0-9]*|and timestamp foo and revision bar|g' \
  18. -e 's|CPU time usage: [0-9.]+ seconds|CPU time usage: bar seconds|g' \
  19. -e 's|Expensive parser function count: [0-9]+/[0-9]+|Expensive parser function count: foo/bar|g' \
  20. -e 's|Highest expansion depth: [0-9]+/[0-9]+|Highest expansion depth: foo/bar|g' \
  21. -e 's|mw\.config\.set.."wgBackendResponseTime":[0-9]*..;|mw.config.set({"wgBackendResponseTime":-123});|g' \
  22. -e 's|Post.+expand include size: [0-9]+/[0-9]+ bytes|Post-expand include size: foo/bar bytes|g' \
  23. -e 's|Preprocessor generated node count: [0-9]+/[0-9]+|Preprocessor generated node count: foo/bar|g' \
  24. -e 's|Preprocessor visited node count: [0-9]+/[0-9]+|Preprocessor visited node count: foo/bar|g' \
  25. -e 's|Real time usage: [0-9.]* seconds|Real time usage: foo seconds|g' \
  26. -e 's|Template argument size: [0-9]+/[0-9]+ bytes|Template argument size: foo/bar bytes|g' \
  27. -e 's|This page has been accessed [0-9,]* times\.|This page has been accessed foo times.|g' \
  28. "${dir}"/*/*.html