comparison doc/interpreter/munge-texi.pl @ 19630:0e1f5a750d00

maint: Periodic merge of gui-release to default.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:24:46 -0500
parents c8240a60dd01 446c46af4b42
children
comparison
equal deleted inserted replaced
19626:37d37297acf8 19630:0e1f5a750d00
21 # Skip comments 21 # Skip comments
22 while (defined ($_ = <DOCFH>) and /$comment_line/o) {;} 22 while (defined ($_ = <DOCFH>) and /$comment_line/o) {;}
23 23
24 # Validate DOCSTRING file format 24 # Validate DOCSTRING file format
25 die "invalid doc file format\n" if (! /$doc_delim/o); 25 die "invalid doc file format\n" if (! /$doc_delim/o);
26 26
27 do 27 do
28 { 28 {
29 s/\s*$//; # strip EOL character(s) 29 s/\s*$//; # strip EOL character(s)
30 $symbol = substr ($_,1); 30 $symbol = substr ($_,1);
31 $docstring = extract_docstring (); 31 $docstring = extract_docstring ();
32 if ($help_text{$symbol}) 32 if ($help_text{$symbol})
69 if (/^\s*\@EXAMPLEFILE\((\S+)\)/) 69 if (/^\s*\@EXAMPLEFILE\((\S+)\)/)
70 { 70 {
71 $fname = "$top_srcdir/examples/code/$1"; 71 $fname = "$top_srcdir/examples/code/$1";
72 print '@verbatim',"\n"; 72 print '@verbatim',"\n";
73 open (EXAMPFH, $fname) or die "unable to open example file $fname\n"; 73 open (EXAMPFH, $fname) or die "unable to open example file $fname\n";
74 while (<EXAMPFH>) 74 while (<EXAMPFH>)
75 { 75 {
76 print $_; 76 print $_;
77 print "\n" if (eof and substr ($_, -1) ne "\n"); 77 print "\n" if (eof and substr ($_, -1) ne "\n");
78 } 78 }
79 close (EXAMPFH); 79 close (EXAMPFH);
80 print '@end verbatim',"\n\n"; 80 print '@end verbatim',"\n\n";
86 print $_; 86 print $_;
87 } 87 }
88 88
89 89
90 ################################################################################ 90 ################################################################################
91 # Subroutines 91 # Subroutines
92 ################################################################################ 92 ################################################################################
93 sub extract_docstring 93 sub extract_docstring
94 { 94 {
95 my ($docstring, $arg_list, $func_list, $repl, $rest_of_line); 95 my ($docstring, $arg_list, $func_list, $repl, $rest_of_line);
96 96
97 while (defined ($_ = <DOCFH>) and ! /$doc_delim/o) 97 while (defined ($_ = <DOCFH>) and ! /$doc_delim/o)
98 { 98 {
99 # expand any @seealso references 99 # expand any @seealso references
100 if (m'^@seealso{') 100 if (m'^@seealso{')
101 { 101 {
102 # Join multiple lines until full macro body found 102 # Join multiple lines until full macro body found
103 while (! /}/m) { $_ .= <DOCFH>; } 103 while (! /}/m) { $_ .= <DOCFH>; }
104 104
105 ($arg_list, $rest_of_line) = m'^@seealso{(.*)}(.*)?'s; 105 ($arg_list, $rest_of_line) = m'^@seealso{(.*)}(.*)?'s;
106 106
107 $func_list = $arg_list; 107 $func_list = $arg_list;
108 $func_list =~ s/\s+//gs; 108 $func_list =~ s/\s+//gs;
109 $repl = ""; 109 $repl = "";
110 foreach $func (split (/,/, $func_list)) 110 foreach $func (split (/,/, $func_list))
111 { 111 {
112 $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' 112 $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@'
113 $repl .= "\@ref{XREF$func,,$func}, "; 113 $repl .= "\@ref{XREF$func,,$func}, ";
114 } 114 }
115 substr($repl,-2) = ""; # Remove last ', ' 115 substr($repl,-2) = ""; # Remove last ', '
116 $_ = "\@seealso{$repl}$rest_of_line"; 116 $_ = "\@seealso{$repl}$rest_of_line";
117 } 117 }
118 118
119 $docstring .= $_; 119 $docstring .= $_;
120 } 120 }