Modify ↓
Opened 14 years ago
Closed 13 years ago
#7721 closed enhancement (fixed)
List entire bibliography
Reported by: | Owned by: | Roman Mohr | |
---|---|---|---|
Priority: | normal | Component: | TracBibPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
A new macro: [[BibList]]
, which renders the entire contents of a bibtex file.
-
tracbib/tracbib.py
298 298 tags.append(ol) 299 299 300 300 return tag.div(id='References')(*tags) 301 302 class BibListMacro(WikiMacroBase): 303 implements(IWikiMacroProvider) 304 305 def render_macro(self, request,name,content): 306 return self.expand_macro(request,name,content) 307 308 def expand_macro(self,formatter,name,content): 309 310 bibdb = getattr(formatter, BIBDB,{}) 311 312 page = WikiPage(self.env,'BibTex') 313 if page.exists: 314 if '{{{' in page.text and '}}}' in page.text: 315 tmp = re.compile('{{{|}}}',2).split(page.text) 316 bibdb.update(extract_entries(tmp[1])) 317 setattr(formatter,BIBDB,bibdb) 318 319 l = [] 320 for k in bibdb: 321 print k 322 content = '' 323 for bibkey in BIBTEX_KEYS: 324 if bibdb[k].has_key(bibkey): 325 content +=bibdb[k][bibkey] + ', ' 326 if bibdb[k].has_key('url') == False: 327 l.append(tag.li(tag.a(name=k), tag.a(href='#cite_%s' % k)('^') ,content)) 328 else: 329 url = k['url'] 330 l.append(tag.li(tag.a(name=k), tag.a(href='#cite_%s' % k)('^') ,content, tag.br(),tag.a(href=url)(url))) 331 332 ol = tag.ol(*l) 333 tags = [] 334 tags.append(tag.h1(id='Bibliography')('Bibliography')) 335 tags.append(ol) 336 337 return tag.div(id='Bibliography')(*tags)
Attachments (0)
Change History (2)
comment:1 Changed 14 years ago by
Type: | defect → enhancement |
---|
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Since r11553, there exists the macro
Thanks for sharing all of your code.