~ubuntu-branches/ubuntu/wily/dblatex/wily

« back to all changes in this revision

Viewing changes to lib/dbtexmf/dblatex/grubber/bibtopic.py

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Hoenen
  • Date: 2008-08-11 20:28:56 UTC
  • mfrom: (4.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080811202856-d2qjg24ut53mgufx
Tags: 0.2.9-3
* Improve CJK (Chinese/Japanese/Korean) support:
  + Let XSL configuration parameter cjk.font default to gkai (instead of the
    cyberbit font not included in Debian).
  + Add Suggests dependency on latex-cjk-all for the gkai fonts.
  + Fix the db2latex style not to collide with the CJKutf8.sty file.
  Thanks to W. Martin Borgert for reporting and hints.
  Closes: #482857, #492350
* Fix a name clash with TeXLive for spanish documents in native style.
  Thanks to W. Martin Borgert for reporting.  Closes: #492304
* Support underscore characters in xreflabel attributes.  Thanks to
  Sébastien Villemot for reporting.  Closes: #492959

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
from plugins import TexModule
 
3
from bibtex import BibTex
 
4
 
 
5
 
 
6
class BibSect(BibTex):
 
7
    def __init__(self, doc, bibaux, bibfiles, bibstyle):
 
8
        self.bibfiles = bibfiles.split(",")
 
9
        self.bibstyle = bibstyle
 
10
        self.bibaux = bibaux
 
11
        BibTex.__init__(self, doc, {}, bibaux)
 
12
        for bib in self.bibfiles:
 
13
            self.add_db(bib)
 
14
        if self.bibstyle:
 
15
            self.set_style(self.bibstyle)
 
16
 
 
17
class BibNull(BibSect):
 
18
    """
 
19
    Null biblio section having no bibfile
 
20
    """
 
21
    def __init__(self, doc, bibaux):
 
22
        pass
 
23
 
 
24
    def pre_compile(self):
 
25
        return 0
 
26
 
 
27
    def post_compile(self):
 
28
        return 0
 
29
        
 
30
 
 
31
class Bibtopic(TexModule):
 
32
    def __init__(self, doc, dict):
 
33
        self.doc = doc
 
34
        self.btsects = []
 
35
        doc.parser.add_hook("begin{btSect}", self.add_sect)
 
36
 
 
37
        # If loaded from a sect, register this sect too
 
38
        if dict["name"] == "begin{btSect}":
 
39
            self.add_sect(dict)
 
40
 
 
41
    def add_sect(self, dict):
 
42
        bibaux = "%s%d" % (self.doc.src_base, len(self.btsects) + 1)
 
43
        if dict["arg"]:
 
44
            btsect = BibSect(self.doc, bibaux, dict["arg"], dict["opt"])
 
45
        else:
 
46
            btsect = BibNull(self.doc, bibaux)
 
47
        self.btsects.append(btsect)
 
48
 
 
49
    def pre_compile(self):
 
50
        rc = 0
 
51
        for bib in self.btsects:
 
52
            rc += bib.pre_compile()
 
53
        return rc
 
54
 
 
55
    def post_compile(self):
 
56
        rc = 0
 
57
        for bib in self.btsects:
 
58
            rc += bib.post_compile()
 
59
        return rc
 
60
 
 
61
 
 
62
class Module(Bibtopic):
 
63
    """
 
64
    Module to load to handle bibtopic
 
65
    """
 
66