patches for tds2texi, tds.{sed,awk}

Ulrik Vieth twg-tds@mail.tug.org
Tue, 19 Nov 1996 12:06:10 +0100


Hi Karl,

here comes a patch for tds2texi.el and tds.{sed,awk} that addresses
most of my technical comments I send yesterday.  I also touched up the
tdsSummary environments in tds.tex to get the indentation consistent.
Apart from whitespace there should be no changes to the document.

Let's hope we can concentrate on the contents again from now on and
get along without having to spend much time on the technical issues.

Cheers, Ulrik.


diff -c ORIG/ChangeLog ./ChangeLog
*** ORIG/ChangeLog	Sat Nov 16 15:48:51 1996
--- ./ChangeLog	Tue Nov 19 01:38:27 1996
***************
*** 1,3 ****
--- 1,18 ----
+ Tue Nov 19 01:24:46 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
+ 
+ 	* tds.tex: Fix up indentation in `tdsSummary' environments
+ 	for the sake of Texinfo, should be consistent everywhere now.
+ 	
+ 	* tds2texi.el: Fix bug when combining multiple @file tags.
+ 	Added some missing functionality from tds.sed and tds.awk.
+ 
+ 	* tds.sed: Handle a few translations in Elisp where possible.
+   	Only leave those that are specific to document context.
+ 	
+ 	* tds.awk: File made redundant.
+ 
+ 	* Makefile: Eliminate unnecessary gawk translation step.
+ 	
  Sat Nov 16 07:16:03 1996  Karl Berry  <karl@cs.umb.edu>
  
  	* tds.tex: Version 0.991.
diff -c ORIG/Makefile ./Makefile
*** ORIG/Makefile	Sat Nov 16 15:55:16 1996
--- ./Makefile	Tue Nov 19 00:34:54 1996
***************
*** 9,16 ****
  tds.texi.tmp: tds.tex tds2texi.el 
  	emacs -batch -l tds2texi.el -f tds2texi-convert --eval '(write-file "$@")'
  
! tds.texi: tds.texi.tmp tds.sed tds.awk
! 	sed -f tds.sed $< | gawk -f tds.awk >$@
  
  tds.dvi: tds.tex tdsguide.cls
  	latex '\nonstopmode \input tds'
--- 9,16 ----
  tds.texi.tmp: tds.tex tds2texi.el 
  	emacs -batch -l tds2texi.el -f tds2texi-convert --eval '(write-file "$@")'
  
! tds.texi: tds.texi.tmp tds.sed
! 	sed -f tds.sed $< >$@
  
  tds.dvi: tds.tex tdsguide.cls
  	latex '\nonstopmode \input tds'
diff -c ORIG/tds.awk ./tds.awk
*** ORIG/tds.awk	Fri Nov 15 17:49:12 1996
--- ./tds.awk	Tue Nov 19 00:33:00 1996
***************
*** 1,3 ****
- # Only insert @end detailmenu at the end of the first menu.
- !did_detail && /@end menu/ { print "@end detailmenu"; did_detail = 1; }
- { print }
--- 0 ----
diff -c ORIG/tds.sed ./tds.sed
*** ORIG/tds.sed	Sat Nov 16 15:19:01 1996
--- ./tds.sed	Tue Nov 19 01:14:18 1996
***************
*** 1,11 ****
  # Things that are too hard to do in Elisp.  Run after tds2texi-convert.
  
  # Indentation blocks in tdsSummary environments.
! s/ \./ /g
! s/^\.//
! 
! # Accents (just one, but still).
! s/\\"/@"/
  
  # References that are too hard to convert automatically.
  s/Non-font MF files/Non-font METAFONT files/
--- 1,7 ----
  # Things that are too hard to do in Elisp.  Run after tds2texi-convert.
  
  # Indentation blocks in tdsSummary environments.
! s/ \./  /g
  
  # References that are too hard to convert automatically.
  s/Non-font MF files/Non-font METAFONT files/
***************
*** 15,21 ****
  s/Walsh,/Walsh./
  s/Yeung,/Yeung./
  
- # Work around Makeinfo lossage (that is too hard to fix).
- # The @end detailmenu is put in by tds.awk.
- /The Detailed Node Listing/i\
- @detailmenu
--- 11,13 ----
diff -c ORIG/tds.tex ./tds.tex
*** ORIG/tds.tex	Sat Nov 16 15:34:39 1996
--- ./tds.tex	Tue Nov 19 01:12:04 1996
***************
*** 794,804 ****
    . <package>/      name of a package
    doc/              see Section~\ref{sec:Documentation} and the summary below
    fonts/            font-related files
!   . <type>/     file type (e.g., \path|pk|)
!   . . <mode>/   type of output device (for \path|pk| and \path|gf| only)
!   . . . <supplier>/   name of a font supplier (e.g., \path|public|)
!   . . . . <typeface>/ name of a typeface (e.g., \path|cm|)
!   . . . . . dpi<nnn>/  font resolution (for \path|pk| and \path|gf| only)
    <implementation>/ \TeX{} implementations, by name (e.g., \path|emtex|)
    metafont/         \MF{} (non-font) input files
    . base/           base distribution (e.g., \path|plain.mf|)
--- 794,804 ----
    . <package>/      name of a package
    doc/              see Section~\ref{sec:Documentation} and the summary below
    fonts/            font-related files
!   . <type>/         file type (e.g., \path|pk|)
!   . . <mode>/       type of output device (for \path|pk| and \path|gf| only)
!   . . . <supplier>/     name of a font supplier (e.g., \path|public|)
!   . . . . <typeface>/   name of a typeface (e.g., \path|cm|)
!   . . . . . dpi<nnn>/   font resolution (for \path|pk| and \path|gf| only)
    <implementation>/ \TeX{} implementations, by name (e.g., \path|emtex|)
    metafont/         \MF{} (non-font) input files
    . base/           base distribution (e.g., \path|plain.mf|)
***************
*** 834,870 ****
  
  \begin{tdsSummary}
    ams/
!   . amsfonts/     \path|amsfonts.faq|, \path|amfndoc|
!   . amslatex/     \path|amslatex.faq|, \path|amsldoc|
!   . amstex/       \path|amsguide|, \path|joyerr|
!   bibtex/         \BibTeX{}
!   . base/         \path|btxdoc.tex|
    fonts/
!   . fontname/     \citetitle{Filenames for \TeX{} fonts}
!   . oldgerm/      \path|corkpapr|
!   <format>/       name of a \TeX{} format (e.g., \path|generic|, \path|latex|)
!   . base/         for the base distribution
!   . misc/         for contributed single-file package documentation
!   . <package>/    for \emphasis{package}
!   general/        across programs, generalities
!   . errata/       \path|errata|, \path|errata[1-8]|
!   . texcomp/      \citetitle{Components of \TeX{}}
!   generic/        for non-format-specific \TeX{} packages
!   . babel/      
!   . german/       \path|germdoc|
!   help/           meta-information
!   . ctan/         info about \abbr{ctan} mirror sites
!   . faq/          \abbr{faq}s of \path|comp.text.tex|, etc.
!   html/           \abbr{html} files
!   info/           \abbr{gnu} Info files, made from Texinfo sources
!   latex/          example of \replaceable{format}
!   . base/         \path|ltnews*|, \path|*guide|, etc.
!   . graphics/     \path|grfguide|
!   <program>/      \TeX{}-related programs, by name (examples follow)
!   metafont/       \path|mfbook.tex|, \path|metafont-for-beginners|, etc.
!   metapost/       \path|mpman|, \path|manfig|, etc.
!   tex/            \path|texbook.tex|, \citetitle{A Gentle Introduction to \TeX{}}, etc.
!   web/            \path|webman|, \path|cwebman|
  \end{tdsSummary}
  
  
--- 834,870 ----
  
  \begin{tdsSummary}
    ams/
!   . amsfonts/       \path|amsfonts.faq|, \path|amfndoc|
!   . amslatex/       \path|amslatex.faq|, \path|amsldoc|
!   . amstex/         \path|amsguide|, \path|joyerr|
!   bibtex/           \BibTeX{}
!   . base/           \path|btxdoc.tex|
    fonts/
!   . fontname/       \citetitle{Filenames for \TeX{} fonts}
!   . oldgerm/        \path|corkpapr|
!   <format>/         name of a \TeX{} format (e.g., \path|generic|, \path|latex|)
!   . base/           for the base distribution
!   . misc/           for contributed single-file package documentation
!   . <package>/      for \emphasis{package}
!   general/          across programs, generalities
!   . errata/         \path|errata|, \path|errata[1-8]|
!   . texcomp/        \citetitle{Components of \TeX{}}
!   generic/          for non-format-specific \TeX{} packages
!   . babel/          
!   . german/         \path|germdoc|
!   help/             meta-information
!   . ctan/           info about \abbr{ctan} mirror sites
!   . faq/            \abbr{faq}s of \path|comp.text.tex|, etc.
!   html/             \abbr{html} files
!   info/             \abbr{gnu} Info files, made from Texinfo sources
!   latex/            example of \replaceable{format}
!   . base/           \path|ltnews*|, \path|*guide|, etc.
!   . graphics/       \path|grfguide|
!   <program>/        \TeX{}-related programs, by name (examples follow)
!   metafont/         \path|mfbook.tex|, \path|metafont-for-beginners|, etc.
!   metapost/         \path|mpman|, \path|manfig|, etc.
!   tex/              \path|texbook.tex|, \citetitle{A Gentle Introduction to \TeX{}}, etc.
!   web/              \path|webman|, \path|cwebman|
  \end{tdsSummary}
  
  
***************
*** 946,952 ****
  The deepest \abbr{TDS} path needs only seven levels:
  \begin{ttdisplay}
  texmf/fonts/pk/cx/public/cm/dpi300/cmr10.pk
! 1     2     3  4      5  6  7  
  \end{ttdisplay}
  
  \end{itemize-squeeze}
--- 946,952 ----
  The deepest \abbr{TDS} path needs only seven levels:
  \begin{ttdisplay}
  texmf/fonts/pk/cx/public/cm/dpi300/cmr10.pk
! 1     2     3  4  5      6  7
  \end{ttdisplay}
  
  \end{itemize-squeeze}
***************
*** 1127,1145 ****
  \path|TeXMF:web2c/| extending the form used by Web2c~7.0:
  
  \begin{tdsSummary}
! TeXMF:           \abbr{TDS} root (also \path|ls-R| and \path|MakeTeXls-R|)
! . web2c/         configuration file \path|texmf.cnf|
! . . bases/       \MF{} bases, separated by name, e.g.,
! . . . plain/     the ``plain'' base
! . . formats/     \TeX{} formats, separated by name, e.g.,
! . . . e-plain/   the plain format for ``extended \TeX{}''
! . . . latex/     the \LaTeX{} format
! . . . plain/     the plain \TeX{} format
! . . mems/        \MP\ memory files, separated by name, e.g.,
! . . . mfplain/   the ``plain mem'' extended for \MF{} input
! . . . plain/     the ``plain'' memory file
! . . pool/        pool files for \TeX{}, \MF{}, and \MP{}
! . . rexx/        \path|MakeMPX.rexx|, \path|CallMF|
  \end{tdsSummary}
  
  Documentation files in AmigaGuide format should be stored at
--- 1127,1145 ----
  \path|TeXMF:web2c/| extending the form used by Web2c~7.0:
  
  \begin{tdsSummary}
!   TeXMF:            \abbr{TDS} root (also \path|ls-R| and \path|MakeTeXls-R|)
!   . web2c/          configuration file \path|texmf.cnf|
!   . . bases/        \MF{} bases, separated by name, e.g.,
!   . . . plain/      the ``plain'' base
!   . . formats/      \TeX{} formats, separated by name, e.g.,
!   . . . e-plain/    the plain format for ``extended \TeX{}''
!   . . . latex/      the \LaTeX{} format
!   . . . plain/      the plain \TeX{} format
!   . . mems/         \MP{} memory files, separated by name, e.g.,
!   . . . mfplain/    the ``plain mem'' extended for \MF{} input
!   . . . plain/      the ``plain'' memory file
!   . . pool/         pool files for \TeX{}, \MF{}, and \MP{}
!   . . rexx/         \path|MakeMPX.rexx|, \path|CallMF|
  \end{tdsSummary}
  
  Documentation files in AmigaGuide format should be stored at
***************
*** 1153,1167 ****
  something more specific (e.g., \path|vms_decus|).
  
  \begin{tdsSummary}
! texmf/
! . vms/           \abbr{VMS} implementation specific files
! . . exe/         end-user commands
! . . . common/    command procedures, command definition files, etc.
! . . . axp/       binary executables for Alpha \abbr{AXP}
! . . . vax/       binary executables for \abbr{VAX}
! . . formats/     pool files, formats, bases
! . . help/        \abbr{VMS} help library, and miscellaneous help sources
! . . mgr/         command procedures, programs, docs, etc., for system management
  \end{tdsSummary}
  
  
--- 1153,1167 ----
  something more specific (e.g., \path|vms_decus|).
  
  \begin{tdsSummary}
!   texmf/
!   . vms/            \abbr{VMS} implementation specific files
!   . . exe/          end-user commands
!   . . . common/     command procedures, command definition files, etc.
!   . . . axp/        binary executables for Alpha \abbr{AXP}
!   . . . vax/        binary executables for \abbr{VAX}
!   . . formats/      pool files, formats, bases
!   . . help/         \abbr{VMS} help library, and miscellaneous help sources
!   . . mgr/          command procedures, programs, docs, etc., for system management
  \end{tdsSummary}
  
  
***************
*** 1178,1191 ****
  (\path|/usr/local| by default), we have default locations as follows:
  
  \begin{tdsSummary}
!   <prefix>/       installation root (\path|/usr/local| by default)
!   . bin/          executables
!   . man/          man pages
!   . info/         info files
!   . lib/          libraries (\path|libkpathsea.*|)
!   . share/        architecture-independent files
!   . . texmf/      \abbr{TDS} root
!   . . . web2c/    implementation-dependent files (\path|.pool|, \path|.fmt|, \path|texmf.cnf|, etc.)
  \end{tdsSummary}
  
  See \url|ftp://ftp.gnu.ai.mit.edu/pub/gnu/standards.text| for the
--- 1178,1191 ----
  (\path|/usr/local| by default), we have default locations as follows:
  
  \begin{tdsSummary}
!   <prefix>/         installation root (\path|/usr/local| by default)
!   . bin/            executables
!   . man/            man pages
!   . info/           info files
!   . lib/            libraries (\path|libkpathsea.*|)
!   . share/          architecture-independent files
!   . . texmf/        \abbr{TDS} root
!   . . . web2c/      implementation-dependent files (\path|.pool|, \path|.fmt|, \path|texmf.cnf|, etc.)
  \end{tdsSummary}
  
  See \url|ftp://ftp.gnu.ai.mit.edu/pub/gnu/standards.text| for the
diff -c ORIG/tds2texi.el ./tds2texi.el
*** ORIG/tds2texi.el	Sat Nov 16 15:28:03 1996
--- ./tds2texi.el	Tue Nov 19 01:39:04 1996
***************
*** 90,95 ****
--- 90,100 ----
  ;;                          also fixed a minor typo in "@item samp"
  ;; v 1.1 -- 1996/11/12  KB  no node pointers, no double blank line after
  ;;                          sections, allow braces after abbrevs.
+ ;; v 1.2 -- 1996/11/16  KB  ??? (see ChangeLog)
+ ;; v 1.3 -- 1996/11/18  UV  added translation for umlaut accents,
+ ;;                          added tds2texi-direntry header lines,
+ ;;                          added function tds2texi-fixup-texinfo,
+ ;;                          fixed bug when combining multiple "@file"s.
  
  
  ;;; Code:
***************
*** 107,112 ****
--- 112,124 ----
  (defvar tds2texi-filename "tds.info"
    "File name of Info file to be inserted in Texinfo header.")
  
+ (defvar tds2texi-direntry
+   (concat
+    "@dircategory TeX\n"
+    "@direntry\n"
+    "* TeX Directories: (tds).       A directory structure for TeX files.\n"
+    "@end direntry\n"))
+ 
  ;; translation tables
  
  (defvar tds2texi-logos-alist
***************
*** 245,251 ****
    ; (texinfo-every-node-update) ; I don't like the extra node pointers.
    (texinfo-all-menus-update)
    (texinfo-master-menu nil)
!   
    ;; all that's left to do is saving the buffer to a file
    ;; -- we simply select the buffer and leave saving it to
    ;; the user in case some manual intervention is needed
--- 257,265 ----
    ; (texinfo-every-node-update) ; I don't like the extra node pointers.
    (texinfo-all-menus-update)
    (texinfo-master-menu nil)
! 
!   (tds2texi-fixup-texinfo)
! 
    ;; all that's left to do is saving the buffer to a file
    ;; -- we simply select the buffer and leave saving it to
    ;; the user in case some manual intervention is needed
***************
*** 274,279 ****
--- 288,296 ----
    ;; "\," -- thin space used with dimensions like "dpi" or "pt"
    (tds2texi-regexp-replace "\\\\,\\([a-z]+\\)" "@dmn{\\1}")
  
+   ;; "\"" -- umlaut accents are now also supported in Texinfo:
+   (tds2texi-string-replace "\\\"" "@\"")
+ 
    ;; special TeX characters that needn't be quoted in Texinfo:
    (tds2texi-string-replace "\\_" "_")
    (tds2texi-string-replace "\\&" "&")
***************
*** 402,414 ****
    
    ;; ... and combine multiple @file{}s in one line
    (tds2texi-regexp-replace 
!    "@file{\\(.*\\)}@file{\\(.*\\)}@file{\\(.*\\)}" "@file{\\1\\2\\3}")
    (tds2texi-regexp-replace 
!    "@file{\\(.*\\)}@file{\\(.*\\)}" "@file{\\1\\2}")
  
    ;; ... also simplify cases of nested @file{}s
    (tds2texi-regexp-replace 
!    "@file{\\(.*\\)@file{\\(.*\\)}\\(.*\\)}" "@file{\\1\\2\\3}")
  
    ;; literal `~' -- if it hasn't been converted to space earlier,
    ;; we can now do the conversion to @w{word1 word2} without
--- 419,431 ----
    
    ;; ... and combine multiple @file{}s in one line
    (tds2texi-regexp-replace 
!    "@file{\\([^ ]+\\)}@file{\\([^ ]+\\)}@file{\\([^ ]+\\)}" "@file{\\1\\2\\3}")
    (tds2texi-regexp-replace 
!    "@file{\\([^ ]+\\)}@file{\\([^ ]+\\)}" "@file{\\1\\2}")
  
    ;; ... also simplify cases of nested @file{}s
    (tds2texi-regexp-replace 
!    "@file{@file{\\([^ ]+\\)}\\([^ ]+\\)}" "@file{\\1\\2}")
  
    ;; literal `~' -- if it hasn't been converted to space earlier,
    ;; we can now do the conversion to @w{word1 word2} without
***************
*** 481,486 ****
--- 498,504 ----
        (insert "@setfilename " tds2texi-filename "\n")
        (insert "@settitle " title-string "\n\n")
        (insert "@set version " version-string "\n\n")
+       (insert tds2texi-direntry "\n")
        )
   
      ;; discard \begin{document} and \maketitle
***************
*** 549,553 ****
--- 567,584 ----
    ;; convert \end{document} to @contents and @bye
    (tds2texi-string-replace "\\end{document}" "@contents\n@bye\n")
    )
+ 
+ (defun tds2texi-fixup-texinfo ()
+   "Fix up a few last-minute items.  Used in \\[tds2texi-convert]."
+ 
+   (save-excursion
+     (goto-char 
+      (search-forward "--- The Detailed Node Listing ---\n" nil t))
+     (insert "@detailmenu\n")
+     (goto-char 
+      (progn (search-forward "@end menu\n" nil t)
+ 	    (match-beginning 0)))
+     (insert "@end detailmenu\n")
+     ))
  
  ;;; tds2texi.el ends here