/contrib/groff/doc/fixinfo.sh

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 46 lines · 22 code · 2 blank · 22 comment · 0 complexity · a59b95a5df2256938cc4612004e55797 MD5 · raw file

  1. #! /bin/sh
  2. #
  3. # Fix a problem with HTML output produced by makeinfo 4.8.
  4. #
  5. # groff.texinfo uses (after macro expansion) something like
  6. #
  7. # @deffn ...
  8. # @XXindex ...
  9. # @deffnx ...
  10. #
  11. # which has worked with earlier versions (using an undocumented feature
  12. # of the implementation of @deffn and @deffnx). Version 4.8 has new
  13. # code for generating HTML, and the above construction produces wrong
  14. # HTML output: It starts a new <blockquote> without closing it properly.
  15. # The very problem is that, according to the documentation, the @deffnx
  16. # must immediately follow the @deffn line, making it impossible to add
  17. # entries into user-defined indices if supplied with macro wrappers around
  18. # @deffn and @deffnx.
  19. #
  20. # Note that this script is a quick hack and tightly bound to the current
  21. # groff.texinfo macro code. Hopefully, a new texinfo version makes it
  22. # unnecessary.
  23. t=${TMPDIR-.}/gro$$.tmp
  24. cat $1 | sed '
  25. 1 {
  26. N
  27. N
  28. }
  29. :b
  30. $b
  31. N
  32. /^<blockquote>\n<p>.*\n\n \&mdash;/ {
  33. s/^<blockquote>\n<p>\(.*\n\)\n \&mdash;/\1\&mdash;/
  34. n
  35. N
  36. N
  37. bb
  38. }
  39. $b
  40. P
  41. D
  42. ' > $t
  43. rm $1
  44. mv $t $1