1 |
|
# |
2 |
|
# Copyright (c) 2002, Asko Soukka, Benja Fallenstein |
3 |
|
# |
4 |
|
# You may use and distribute under the terms of either the GNU Lesser |
5 |
|
# General Public License, either version 2 of the license or, |
6 |
|
# at your choice, any later version. Alternatively, you may use and |
7 |
|
# distribute under the terms of the XPL. |
8 |
|
# |
9 |
|
# See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of |
10 |
|
# the licenses. |
11 |
|
# |
12 |
|
# This software is distributed in the hope that it will be useful, |
13 |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README |
15 |
|
# file for more details. |
16 |
|
# |
17 |
|
|
18 |
|
import docutils |
19 |
from latex2e import Writer |
from latex2e import Writer |
20 |
|
from docutils import nodes, utils |
21 |
|
from docutils.parsers.rst import directives |
22 |
|
from docutils.parsers.rst.directives import images |
23 |
|
|
24 |
|
align_values = ('top', 'middle', 'bottom', 'left', 'center', 'right') |
25 |
|
|
26 |
|
def align(argument): |
27 |
|
return directives.choice(argument, align_values) |
28 |
|
|
29 |
|
def bibliography_directive(name, arguments, options, content, lineno, |
30 |
|
content_offset, block_text, state, state_machine): |
31 |
|
return [docutils.nodes.raw( |
32 |
|
text='\n\\bibliographystyle{abbrv}\n\\bibliography{%s}\n' % ','.join(arguments), |
33 |
|
format='latex')] |
34 |
|
|
35 |
|
bibliography_directive.arguments = (1, 100, 0) |
36 |
|
bibliography_directive.options = {} |
37 |
|
bibliography_directive.content = 0 |
38 |
|
directives._directives['bibliography'] = bibliography_directive |
39 |
|
|
40 |
|
#Some additional options and changes for latex2e.py |
41 |
|
images.image.options['height'] = directives.unchanged; |
42 |
|
images.image.options['width'] = directives.unchanged; |
43 |
|
images.image.options['label'] = directives.unchanged; |
44 |
|
images.image.options['option'] = directives.unchanged; |