Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e40b7202

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID e40b72029aba6fccad525c69e8af00c057fa5b1b
  • Vorgänger 277178ad
  • Nachfolger 8b85c428

KiviLatex-Plugin: Dokumentation ergänzt

Unterschiede anzeigen:

SL/Template/Plugin/KiviLatex.pm
81 81
}
82 82

  
83 83
return 'SL::Template::Plugin::KiviLatex';
84
__END__
85

  
86
=pod
87

  
88
=encoding utf8
89

  
90
=head1 NAME
91

  
92
SL::Template::Plugin::KiviLatex - Template::Toolkit plugin for
93
escaping text for use in LaTeX templates
94

  
95
=head1 SYNOPSIS
96

  
97
From within a LaTeX template. Activate both Template::Toolkit in
98
general and this plugin in particular; must be located before
99
C<\begin{document}>:
100

  
101
  % config: use-template-toolkit=1
102
  % config: tag-style=$( )$
103
  $( USE KiviLatex )$
104

  
105
Later escape some text:
106

  
107
  $( KiviLatex.format(longdescription) )$
108

  
109
=head1 FUNCTIONS
110

  
111
=over 4
112

  
113
=item C<filter $text>
114

  
115
Escapes characters in C<$text> with the appropriate LaTeX
116
constructs. Expects normal text without any markup (no HTML, no XML
117
etc). Returns the whole escaped text.
118

  
119
=item C<filter_html $html>
120

  
121
Converts HTML markup in C<$html> to the appropriate LaTeX
122
constructs. Only the following HTML elements are supported:
123

  
124
=over 2
125

  
126
=item * C<b>, C<strong> – bold text
127

  
128
=item * C<it>, C<em> – italic text
129

  
130
=item * C<ul> – underlined text
131

  
132
=item * C<s> – striked out text
133

  
134
=item * C<sub>, C<sup> – subscripted and superscripted text
135

  
136
=item * C<ul>, C<ol>, C<li> – unordered lists (converted to an itemized
137
list), ordered lists (converted to enumerated lists) and their list
138
items
139

  
140
=item * C<p>, C<br> – Paragraph markers and line breaks
141

  
142
=back
143

  
144
This function is tailored for working on the input of CKEditor, not on
145
arbitrary HTML content. It works nicely in tandem with the
146
Rose::DB::Object helper functions C<…_as_restricted_html> (see
147
L<SL::DB::Helper::AttrHTML/attr_html>).
148

  
149
Attributes are silently removed and ignored. All other markup and the
150
normal text are escaped the same as in L</filter>.
151

  
152
=item C<init>
153

  
154
=item C<new>
155

  
156
Initializes the plugin. Automatically called by Template::Toolkit when
157
the plugin is loaded.
158

  
159
=item C<required_packages_for_html>
160

  
161
Returns LaTeX code loading packages that are required for the
162
formatting done with L</filter_html>. This function must be called and
163
its output inserted before the C<\begin{document}> line if that
164
function is used within the document.
165

  
166
It is not required for normal text escaping with L</filter>.
167

  
168
=back
169

  
170
=head1 BUGS
171

  
172
Nothing here yet.
173

  
174
=head1 AUTHOR
175

  
176
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
177

  
178
=cut

Auch abrufbar als: Unified diff