Mercurial > octave
annotate scripts/miscellaneous/private/__publish_latex_output__.m @ 31548:c8ad083a5802 stable
maint: Clean up m-files before Octave 8.1 release.
* external.txi, oop.txi, Table.h, documentation.cc, gui-preferences-ed.h,
lo-specfun.cc, range.tst : Eliminate triple newlines.
* Map.m, MemoizedFunction.m, delaunayn.m, inputParser.m,
__publish_latex_output__.m, publish.m, unpack.m, fminbnd.m,
__add_default_menu__.m, gammainc.m, gallery.m, hadamard.m, weboptions.m:
Add newline after keyword "function" or before keyword "endfunction" for
readability.
* getaudiodata.m, pkg.m : Add semicolon to end of line for error() statement.
* movegui.m: Combine mutliple calls to set() into one for performance.
* __unimplemented__.m (missing_functions): Remove missing functions that have
been implemented.
* __vectorize__.m, check_default_input.m, betaincinv.m, gammaincinv.m:
Remove semicolon at end of line with "function" declaration.
* weboptions.m: Remove semicolon at end of line with "if" keyword.
* integrate_adaptive.m, factor.m: Use keyword "endif" rather than bare "end".
author | Rik <rik@octave.org> |
---|---|
date | Fri, 25 Nov 2022 21:23:54 -0800 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30379
diff
changeset
|
3 ## Copyright (C) 2016-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
7 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
8 ## This file is part of Octave. |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24491
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24491
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
13 ## (at your option) any later version. |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
14 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
18 ## GNU General Public License for more details. |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
19 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24491
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
25 |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
26 ## -*- texinfo -*- |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
27 ## @deftypefn {} {@var{outstr} =} __publish_latex_output__ (@var{type}, @var{varargin}) |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
28 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
29 ## Internal function. |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
30 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
31 ## The first input argument @var{type} defines the required strings |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
32 ## (@samp{str}) or cell-strings (@samp{cstr}) in @var{varargin} in order |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
33 ## to produce @LaTeX{} output. |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
34 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
35 ## @var{type} is one of |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
36 ## |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
37 ## @itemize @bullet |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
38 ## @item |
23188
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
39 ## @samp{output_file_extension} () |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
40 ## |
23188
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
41 ## @item |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
42 ## @samp{header} (title_str, intro_str, toc_cstr) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
43 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
44 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
45 ## @samp{footer} () |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
46 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
47 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
48 ## @samp{code} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
49 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
50 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
51 ## @samp{code_output} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
52 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
53 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
54 ## @samp{section} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
55 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
56 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
57 ## @samp{preformatted_code} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
58 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
59 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
60 ## @samp{preformatted_text} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
61 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
62 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
63 ## @samp{bulleted_list} (cstr) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
64 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
65 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
66 ## @samp{numbered_list} (cstr) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
67 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
68 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
69 ## @samp{graphic} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
70 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
71 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
72 ## @samp{html} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
73 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
74 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
75 ## @samp{latex} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
76 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
77 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
78 ## @samp{text} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
79 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
80 ## @item |
23923
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
81 ## @samp{blockmath} (str) |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
82 ## |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
83 ## @item |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
84 ## @samp{inlinemath} (str) |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
85 ## |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
86 ## @item |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
87 ## @samp{bold} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
88 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
89 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
90 ## @samp{italic} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
91 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
92 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
93 ## @samp{monospaced} (str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
94 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
95 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
96 ## @samp{link} (url_str, url_str, str) |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
97 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
98 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
99 ## @samp{TM} () |
23565
3a730821e4a2
doc: Peridoc grammarcheck of documentation.
Rik <rik@octave.org>
parents:
23188
diff
changeset
|
100 ## |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
101 ## @item |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
102 ## @samp{R} () |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
103 ## |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
104 ## @item |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
105 ## @samp{escape_special_chars} (str) |
22781
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
106 ## @end itemize |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
107 ## @end deftypefn |
449a5e84185a
doc: Add copyright notice and improve docstring.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22705
diff
changeset
|
108 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
109 function outstr = __publish_latex_output__ (type, varargin) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
110 outstr = feval (["do_" type], varargin{:}); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
111 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
112 |
23188
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
113 function outstr = do_output_file_extension () |
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
114 outstr = ".tex"; |
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
115 endfunction |
e2e182a8e699
Allow custom output generators for code publishing.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23086
diff
changeset
|
116 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
117 function outstr = do_header (title_str, intro_str, toc_cstr) |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
118 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
119 publish_comment = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
120 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
121 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
122 "% This document was generated by the publish-function", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
123 ["% from GNU Octave " version()], |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
124 ""); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
125 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
126 latex_preamble = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
127 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
128 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
129 '\documentclass[10pt]{article}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
130 '\usepackage{listings}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
131 '\usepackage{mathtools}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
132 '\usepackage{amssymb}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
133 '\usepackage{graphicx}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
134 '\usepackage{hyperref}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
135 '\usepackage{xcolor}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
136 '\usepackage{titlesec}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
137 '\usepackage[utf8]{inputenc}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
138 '\usepackage[T1]{fontenc}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
139 '\usepackage{lmodern}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
140 |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
141 ## "lstlisting" doesn't support multi-byte UTF-8 characters. |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
142 ## Add substitution rules for some characters (commonly used in languages with |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
143 ## Latin-based script). |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
144 ## Set of substitions taken from: |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
145 ## https://en.wikibooks.org/w/index.php?title=LaTeX/Source_Code_Listings&oldid=3815132#Encoding_issue |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
146 ## FIXME: Any multi-byte UTF-8 character in a non-section comment without a |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
147 ## substitution rule will still cause an error. This should be fixed |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
148 ## more generally, or a way how to work around this limitation should |
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
149 ## be documented. |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
150 listings_option = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
151 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
152 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
153 '\lstset{', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
154 'language=Octave,', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
155 'numbers=none,', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
156 'frame=single,', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
157 'tabsize=2,', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
158 'showstringspaces=false,', |
30242
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
159 'breaklines=true,', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
160 'inputencoding=utf8,', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
161 'extendedchars=true,', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
162 'literate=', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
163 ' {á}{{\''a}}1 {é}{{\''e}}1 {í}{{\''i}}1 {ó}{{\''o}}1 {ú}{{\''u}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
164 ' {Á}{{\''A}}1 {É}{{\''E}}1 {Í}{{\''I}}1 {Ó}{{\''O}}1 {Ú}{{\''U}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
165 ' {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
166 ' {À}{{\`A}}1 {È}{{\''E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
167 ' {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
168 ' {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
169 ' {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
170 ' {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
171 ' {ã}{{\~a}}1 {ẽ}{{\~e}}1 {ĩ}{{\~i}}1 {õ}{{\~o}}1 {ũ}{{\~u}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
172 ' {Ã}{{\~A}}1 {Ẽ}{{\~E}}1 {Ĩ}{{\~I}}1 {Õ}{{\~O}}1 {Ũ}{{\~U}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
173 ' {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
174 ' {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
175 ' {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
176 ' {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
177 ' {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1 {¡}{{!`}}1', |
33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
178 '}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
179 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
180 latex_head = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
181 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
182 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
183 '\titleformat*{\section}{\Huge\bfseries}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
184 '\titleformat*{\subsection}{\large\bfseries}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
185 '\renewcommand{\contentsname}{\Large\bfseries Contents}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
186 '\setlength{\parindent}{0pt}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
187 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
188 '\begin{document}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
189 "", |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
190 ['{\Huge\section*{' title_str '}}'], |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
191 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
192 '\tableofcontents', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
193 '\vspace*{4em}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
194 ""); |
22157
c5842206aaea
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22113
diff
changeset
|
195 |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
196 outstr = [publish_comment, latex_preamble, listings_option, latex_head]; |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
197 |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
198 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
199 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
200 function outstr = do_footer (m_source_str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
201 outstr = ["\n\n" '\end{document}' "\n"]; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
202 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
203 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
204 function outstr = do_code (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
205 outstr = ['\begin{lstlisting}' "\n", str, "\n" '\end{lstlisting}' "\n"]; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
206 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
207 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
208 function outstr = do_code_output (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
209 outstr = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
210 '\begin{lstlisting}[language={},xleftmargin=5pt,frame=none]', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
211 str, |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
212 '\end{lstlisting}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
213 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
214 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
215 function outstr = do_section (str) |
31548
c8ad083a5802
maint: Clean up m-files before Octave 8.1 release.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
216 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
217 outstr = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
218 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
219 "", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
220 '\phantomsection', |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
221 ['\addcontentsline{toc}{section}{' str '}'], |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
222 ['\subsection*{' str '}'], |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
223 ""); |
31548
c8ad083a5802
maint: Clean up m-files before Octave 8.1 release.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
224 |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
225 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
226 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
227 function outstr = do_preformatted_code (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
228 outstr = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
229 '\begin{lstlisting}', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
230 str, |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
231 '\end{lstlisting}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
232 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
233 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
234 function outstr = do_preformatted_text (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
235 outstr = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
236 '\begin{lstlisting}[language={}]', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
237 str, |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
238 '\end{lstlisting}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
239 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
240 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
241 function outstr = do_bulleted_list (cstr) |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
242 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
243 outstr = ["\n" '\begin{itemize}' "\n"]; |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
244 for i = 1:numel (cstr) |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
245 outstr = [outstr, '\item ' cstr{i} "\n"]; |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
246 endfor |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
247 outstr = [outstr, '\end{itemize}' "\n"]; |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
248 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
249 endfunction |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
250 |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
251 function outstr = do_numbered_list (cstr) |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
252 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
253 outstr = ["\n" '\begin{enumerate}' "\n"]; |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
254 for i = 1:numel (cstr) |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
255 outstr = [outstr, '\item ' cstr{i} "\n"]; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
256 endfor |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
257 outstr = [outstr, "\\end{enumerate}\n"]; |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
258 |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
259 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
260 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
261 function outstr = do_graphic (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
262 outstr = sprintf ("%s\n", |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
263 '\begin{figure}[!ht]', |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
264 ['\includegraphics[width=\textwidth]{' str '}'], |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
265 '\end{figure}'); |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
266 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
267 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
268 function outstr = do_html (str) |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
269 outstr = ""; |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
270 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
271 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
272 function outstr = do_latex (str) |
23926
58b76c741c3d
publish: improve detecion of block markup (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23923
diff
changeset
|
273 outstr = ["\n" str "\n"]; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
274 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
275 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
276 function outstr = do_link (url_str, str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
277 outstr = ['\href{' url_str '}{' str '}']; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
278 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
279 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
280 function outstr = do_text (str) |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
281 outstr = ["\n\n" str "\n\n"]; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
282 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
283 |
23923
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
284 function outstr = do_blockmath (str) |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
285 outstr = ["$$" str "$$"]; |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
286 endfunction |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
287 |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
288 function outstr = do_inlinemath (str) |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
289 outstr = ["$" str "$"]; |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
290 endfunction |
62dc81691d73
publish: improve detection of inline markup and fix MathJax usage.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23565
diff
changeset
|
291 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
292 function outstr = do_bold (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
293 outstr = ['\textbf{' str '}']; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
294 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
295 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
296 function outstr = do_italic (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
297 outstr = ['\textit{' str '}']; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
298 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
299 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
300 function outstr = do_monospaced (str) |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
301 outstr = ['\texttt{' str '}']; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
302 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
303 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
304 function outstr = do_TM () |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
305 outstr = '\texttrademark '; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
306 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
307 |
22705
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
308 function outstr = do_R () |
e9a0aa0a49ed
Overhaul publish function and it's private helper functions.
Rik <rik@octave.org>
parents:
22384
diff
changeset
|
309 outstr = '\textregistered '; |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
310 endfunction |
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
311 |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
312 function str = do_escape_special_chars (str) |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
313 |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
314 ## Escape \, {, }, &, %, #, _, ~, ^, <, > |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
315 str = regexprep (str, '\\', "\\ensuremath{\\backslash}"); |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
316 str = regexprep (str, '(?<!\\)(\{|\}|&|%|#|_)', '\\$1'); |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
317 ## Revert accidental {} replacements for backslashes |
23964
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
318 str = strrep (str, '\ensuremath\{\backslash\}', '\ensuremath{\backslash}'); |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
319 str = regexprep (str, '(?<!\\)~', "\\ensuremath{\\tilde{\\;}}"); |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
320 str = regexprep (str, '(?<!\\)\^', "\\^{}"); |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
321 str = regexprep (str, '(?<!\\)<', "\\ensuremath{<}"); |
1a0cbb573a67
publish: Improve escaping of special characters in output (bug #51782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
23926
diff
changeset
|
322 str = regexprep (str, '(?<!\\)>', "\\ensuremath{>}"); |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30242
diff
changeset
|
323 |
22113
b6f482e29afd
New functions publish.m and grabcode.m (patch #9048).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
diff
changeset
|
324 endfunction |