| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Some predefined rules for the DruTeX/html-2-LaTeX conversion.
|
| 7 |
*/
|
| 8 |
|
| 9 |
function drutex_pdf_drutex2latex(&$node) {
|
| 10 |
$E = array();
|
| 11 |
|
| 12 |
/*
|
| 13 |
tag2command entities
|
| 14 |
*/
|
| 15 |
|
| 16 |
$E[] = (object) array(
|
| 17 |
'type' => 'tag2command',
|
| 18 |
'pattern' => 'b',
|
| 19 |
'replacement' => 'textbf'
|
| 20 |
);
|
| 21 |
|
| 22 |
$E[] = (object) array(
|
| 23 |
'type' => 'tag2command',
|
| 24 |
'pattern' => 'i',
|
| 25 |
'replacement' => 'textit'
|
| 26 |
);
|
| 27 |
|
| 28 |
$E[] = (object) array(
|
| 29 |
'type' => 'tag2command',
|
| 30 |
'pattern' => 'em',
|
| 31 |
'replacement' => 'emph'
|
| 32 |
);
|
| 33 |
|
| 34 |
$E[] = (object) array(
|
| 35 |
'type' => 'tag2command',
|
| 36 |
'pattern' => 'p',
|
| 37 |
'replacement' => 'par'
|
| 38 |
);
|
| 39 |
|
| 40 |
$E[] = (object) array(
|
| 41 |
'type' => 'tag2command',
|
| 42 |
'pattern' => 'li',
|
| 43 |
'replacement' => 'item'
|
| 44 |
);
|
| 45 |
|
| 46 |
|
| 47 |
/*
|
| 48 |
tag entities
|
| 49 |
*/
|
| 50 |
|
| 51 |
$E[] = (object) array(
|
| 52 |
'type' => 'tag',
|
| 53 |
'pattern' => 'tex',
|
| 54 |
'replacement' => '$2'
|
| 55 |
);
|
| 56 |
|
| 57 |
$E[] = (object) array(
|
| 58 |
'type' => 'tag',
|
| 59 |
'pattern' => 'equation',
|
| 60 |
'replacement' => '\[ $2 \]'
|
| 61 |
);
|
| 62 |
|
| 63 |
$E[] = (object) array(
|
| 64 |
'type' => 'tag',
|
| 65 |
'pattern' => 'equations',
|
| 66 |
'replacement' => '\begin{align*} $2 \end{align*}'
|
| 67 |
);
|
| 68 |
|
| 69 |
$E[] = (object) array(
|
| 70 |
'type' => 'tag',
|
| 71 |
'pattern' => 'ul',
|
| 72 |
'replacement' => '\begin{itemize} $2 \end{itemize}'
|
| 73 |
);
|
| 74 |
|
| 75 |
$E[] = (object) array(
|
| 76 |
'type' => 'tag',
|
| 77 |
'pattern' => 'ol',
|
| 78 |
'replacement' => '\begin{enumerate} $2 \end{enumerate}'
|
| 79 |
);
|
| 80 |
|
| 81 |
|
| 82 |
/*
|
| 83 |
regex entities
|
| 84 |
*/
|
| 85 |
|
| 86 |
$E[] = (object) array(
|
| 87 |
'type' => 'regex',
|
| 88 |
'pattern' => '@<!--break-->@s',
|
| 89 |
'replacement' => ''
|
| 90 |
);
|
| 91 |
|
| 92 |
$E[] = (object) array(
|
| 93 |
'type' => 'regex',
|
| 94 |
'pattern' => '@<br ?/>@s',
|
| 95 |
'replacement' => '\newline{}'
|
| 96 |
);
|
| 97 |
|
| 98 |
return $E;
|
| 99 |
}
|
| 100 |
|