The R Project SVN R

Rev

Rev 15253 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15253 Rev 20002
Line 5... Line 5...
5
## Examples:
5
## Examples:
6
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
6
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
7
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
7
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
8
##                  /path/to/Rsrc/src/library/base/man/*.Rd | sort | uniq`
8
##                  /path/to/Rsrc/src/library/base/man/*.Rd | sort | uniq`
9
 
9
 
10
revision='$Revision: 1.36 $'
10
revision='$Revision: 1.37 $'
11
version=`set - ${revision}; echo ${2}`
11
version=`set - ${revision}; echo ${2}`
12
version="Rd2dvi ${version}
12
version="Rd2dvi ${version}
13
 
13
 
14
Copyright (C) 2000-2001 The R Core Development Team.
14
Copyright (C) 2000-2001 The R Core Development Team.
15
This is free software; see the GNU General Public Licence version 2
15
This is free software; see the GNU General Public Licence version 2
Line 19... Line 19...
19
 
19
 
20
Generate DVI (or PDF) output from the Rd sources specified by files, by
20
Generate DVI (or PDF) output from the Rd sources specified by files, by
21
either giving the paths to the files, or the path to a directory with
21
either giving the paths to the files, or the path to a directory with
22
the sources of a package.
22
the sources of a package.
23
 
23
 
24
Unless specified via option \`--output', the basename of the output file
24
Unless specified via option '--output', the basename of the output file
25
equals the basename of argument \`files' if this specifies a package
25
equals the basename of argument 'files' if this specifies a package
26
(bundle) or a single file, and \`Rd2' otherwise.
26
(bundle) or a single file, and 'Rd2' otherwise.
27
 
27
 
28
Options:
28
Options:
29
  -h, --help		print short help message and exit
29
  -h, --help		print short help message and exit
30
  -v, --version		print version info and exit  
30
  -v, --version		print version info and exit  
31
      --debug		turn on shell debugging (set -x)
31
      --debug		turn on shell debugging (set -x)
32
      --no-clean	do not remove created temporary files
32
      --no-clean	do not remove created temporary files
33
      --no-preview	do not preview generated output file
33
      --no-preview	do not preview generated output file
34
      --os=NAME		use OS subdir \`NAME' (unix, mac or windows)
34
      --os=NAME		use OS subdir 'NAME' (unix, mac or windows)
35
      --OS=NAME		the same as \`--os'
35
      --OS=NAME		the same as '--os'
36
  -o, --output=FILE	write output to FILE
36
  -o, --output=FILE	write output to FILE
37
      --pdf		generate PDF output
37
      --pdf		generate PDF output
38
      --title=NAME	use NAME as the title of the document
38
      --title=NAME	use NAME as the title of the document
39
  -V, --verbose		report on what is done
39
  -V, --verbose		report on what is done
40
 
40
 
Line 78... Line 78...
78
      title=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
78
      title=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
79
    -o)
79
    -o)
80
      if test -n "`echo ${2} | sed 's/^-.*//'`"; then      
80
      if test -n "`echo ${2} | sed 's/^-.*//'`"; then      
81
	output="${2}"; shift
81
	output="${2}"; shift
82
      else
82
      else
83
	${echo} "ERROR: option \`${1}' requires an argument"
83
	${echo} "ERROR: option '${1}' requires an argument"
84
	exit 1
84
	exit 1
85
      fi
85
      fi
86
      ;;
86
      ;;
87
    --output=*)
87
    --output=*)
88
      output=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
88
      output=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
Line 203... Line 203...
203
## Prepare for building the documentation.
203
## Prepare for building the documentation.
204
if test -z "${output}"; then
204
if test -z "${output}"; then
205
  output="Rd2.${out_ext}"
205
  output="Rd2.${out_ext}"
206
fi
206
fi
207
if test -f ${output}; then
207
if test -f ${output}; then
208
  ${echo} "file \`${output}' exists; please remove first"
208
  ${echo} "file '${output}' exists; please remove first"
209
  exit 1
209
  exit 1
210
fi
210
fi
211
build_dir=.Rd2dvi${$}
211
build_dir=.Rd2dvi${$}
212
if test -d ${build_dir}; then
212
if test -d ${build_dir}; then
213
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
213
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
Line 270... Line 270...
270
\\tableofcontents{}
270
\\tableofcontents{}
271
\\cleardoublepage{}
271
\\cleardoublepage{}
272
\\pagenumbering{arabic}
272
\\pagenumbering{arabic}
273
EOF
273
EOF
274
  for p in ${bundle_pkgs}; do
274
  for p in ${bundle_pkgs}; do
275
    ${echo} "Bundle package: \`${p}'"
275
    ${echo} "Bundle package: '${p}'"
276
    ${echo} "\\chapter{Package \`${p}'}" >> ${build_dir}/Rd2.tex
276
    ${echo} "\\chapter{Package \`${p}'}" >> ${build_dir}/Rd2.tex
277
    if test -f ${1}/${p}/DESCRIPTION.in; then
277
    if test -f ${1}/${p}/DESCRIPTION.in; then
278
      Rd_DESCRIPTION_to_LaTeX ${1}/${p}/DESCRIPTION.in \
278
      Rd_DESCRIPTION_to_LaTeX ${1}/${p}/DESCRIPTION.in \
279
        >> ${build_dir}/Rd2.tex
279
        >> ${build_dir}/Rd2.tex
280
    fi
280
    fi
Line 297... Line 297...
297
${R_LATEXCMD-latex} Rd2
297
${R_LATEXCMD-latex} Rd2
298
if test "${out_ext}" = pdf; then
298
if test "${out_ext}" = pdf; then
299
  ${R_LATEXCMD-latex} Rd2
299
  ${R_LATEXCMD-latex} Rd2
300
fi
300
fi
301
cd ${start_dir}
301
cd ${start_dir}
302
${echo} "Saving output to \`${output}' ..."
302
${echo} "Saving output to '${output}' ..."
303
cp ${build_dir}/Rd2.${out_ext} ${output}
303
cp ${build_dir}/Rd2.${out_ext} ${output}
304
echo "Done"
304
echo "Done"
305
 
305
 
306
if ${clean}; then
306
if ${clean}; then
307
  rm -rf ${build_dir}
307
  rm -rf ${build_dir}
308
else
308
else
309
  ${echo} "You may want to clean up by \`rm -rf ${build_dir}'"
309
  ${echo} "You may want to clean up by 'rm -rf ${build_dir}'"
310
fi
310
fi
311
${preview} ${output}
311
${preview} ${output}
312
exit 0
312
exit 0
313
 
313
 
314
### Local Variables: ***
314
### Local Variables: ***