/[drupal]/contributions/modules/drutex/drutex_latex.inc
ViewVC logotype

Contents of /contributions/modules/drutex/drutex_latex.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download) (as text)
Wed Sep 6 02:25:41 2006 UTC (3 years, 2 months ago) by dfg
Branch: MAIN
CVS Tags: DRUPAL-4-7--1-0, DRUPAL-5--1-1, DRUPAL-5--1-0, DRUPAL-5--1-3, DRUPAL-5--1-2, HEAD
Branch point for: DRUPAL-5--2, DRUPAL-5, DRUPAL-4-7, DRUPAL-6--1
Changes since 1.10: +3 -1 lines
File MIME type: text/x-php
Added sorting of submodules by weight.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Provide the LaTeX-to-HTML transformation rules.
7 */
8
9 /**
10 * Implementation of subhook_info().
11 */
12 function drutex_latex_info($format = -1) {
13 return (object) array(
14 'title' => t('LaTeX to HTML'),
15 'description' => t('Converts many LaTeX commands and environments to plain HTML.'),
16 'toggle' => true,
17 'weight' => 4
18 );
19 }
20
21 /**
22 * Implementation of subhook_defaults().
23 */
24 function drutex_latex_defaults() {
25 $D['drutex_latex_active'] = false;
26 return $D;
27 }
28
29 /**
30 * Implementation of subhook_node2html().
31 */
32 function drutex_latex_node2html() {
33 $E = array();
34
35 $E[] = (object) array(
36 'type' => 'latex-command',
37 'pattern' => 'section',
38 'replacement' => '<h2 class="section">$1</h2>'
39 );
40
41 $E[] = (object) array(
42 'type' => 'latex-command',
43 'pattern' => 'subsection',
44 'replacement' => '<h3 class="subsection">$1</h3>'
45 );
46
47 $E[] = (object) array(
48 'type' => 'latex-command',
49 'pattern' => 'minisection',
50 'replacement' => '<h3 class="minisection">$1</h3>'
51 );
52
53 $E[] = (object) array(
54 'type' => 'latex-command',
55 'pattern' => 'paragraph',
56 'replacement' => '<h4 class="paragraph">$1</h4>'
57 );
58
59 $E[] = (object) array(
60 'type' => 'latex-command',
61 'pattern' => 'textbf',
62 'replacement' => '<b>$1</b>'
63 );
64
65 $E[] = (object) array(
66 'type' => 'latex-command',
67 'pattern' => 'textit',
68 'replacement' => '<i>$1</i>'
69 );
70
71 $E[] = (object) array(
72 'type' => 'latex-command',
73 'pattern' => 'emph',
74 'replacement' => '<em>$1</em>'
75 );
76
77
78 /*
79 regex hacks for:
80 enumeration aka ordered list
81 itemize aka unordered list
82 */
83
84 $E[] = (object) array(
85 'pattern' => '@\\\\begin\{enumerate\}@s',
86 'replacement' => '<ol class="enumerate">',
87 'weight' => 100
88 );
89
90 $E[] = (object) array(
91 'pattern' => '@\\\\begin\{itemize\}@s',
92 'replacement' => '<ul class="itemize">',
93 'weight' => 100
94 );
95
96 $E[] = (object) array(
97 'pattern' => '@\\\\item(.*?)(?=\\\\item|\\\\end\{enumerate\}|\\\\end\{itemize\})@s',
98 'replacement' => "<li>$1</li>",
99 'weight' => 101
100 );
101
102 $E[] = (object) array(
103 'pattern' => '@\\\\end\{enumerate\}@s',
104 'replacement' => "</ol>",
105 'weight' => 102
106 );
107
108 $E[] = (object) array(
109 'pattern' => '@\\\\end\{itemize\}@s',
110 'replacement' => "</ul>",
111 'weight' => 102
112 );
113
114 return $E;
115 }

  ViewVC Help
Powered by ViewVC 1.1.2