|
@@ 587-616 (lines=30) @@
|
| 584 |
|
|
| 585 |
|
return getDefaultLevels.value[category] |
| 586 |
|
|
| 587 |
|
def getClasses(category, meta): |
| 588 |
|
if not hasattr(getClasses, 'value'): |
| 589 |
|
|
| 590 |
|
getClasses.value = {} |
| 591 |
|
|
| 592 |
|
if 'pandoc-numbering' in meta and meta['pandoc-numbering']['t'] == 'MetaList': |
| 593 |
|
|
| 594 |
|
# Loop on all listings definition |
| 595 |
|
for definition in meta['pandoc-numbering']['c']: |
| 596 |
|
|
| 597 |
|
if definition['t'] == 'MetaMap' and\ |
| 598 |
|
'category' in definition['c'] and\ |
| 599 |
|
definition['c']['category']['t'] == 'MetaInlines' and\ |
| 600 |
|
len(definition['c']['category']['c']) == 1 and\ |
| 601 |
|
definition['c']['category']['c'][0]['t'] == 'Str': |
| 602 |
|
|
| 603 |
|
if 'classes' in definition['c'] and definition['c']['classes']['t'] == 'MetaList': |
| 604 |
|
|
| 605 |
|
classes = [] |
| 606 |
|
|
| 607 |
|
for elt in definition['c']['classes']['c']: |
| 608 |
|
classes.append(stringify(elt)) |
| 609 |
|
|
| 610 |
|
getClasses.value[definition['c']['category']['c'][0]['c']] = classes |
| 611 |
|
|
| 612 |
|
if not category in getClasses.value: |
| 613 |
|
|
| 614 |
|
getClasses.value[category] = [category] |
| 615 |
|
|
| 616 |
|
return getClasses.value[category] |
| 617 |
|
|
| 618 |
|
def pandocVersion(): |
| 619 |
|
if not hasattr(pandocVersion, 'value'): |
|
@@ 508-531 (lines=24) @@
|
| 505 |
|
|
| 506 |
|
return getFormat.value[category] |
| 507 |
|
|
| 508 |
|
def getCiteShortCut(category, meta): |
| 509 |
|
if not hasattr(getCiteShortCut, 'value'): |
| 510 |
|
getCiteShortCut.value = {} |
| 511 |
|
|
| 512 |
|
if 'pandoc-numbering' in meta and meta['pandoc-numbering']['t'] == 'MetaList': |
| 513 |
|
|
| 514 |
|
# Loop on all listings definition |
| 515 |
|
for definition in meta['pandoc-numbering']['c']: |
| 516 |
|
|
| 517 |
|
if definition['t'] == 'MetaMap' and\ |
| 518 |
|
'cite-shortcut' in definition['c'] and\ |
| 519 |
|
'category' in definition['c'] and\ |
| 520 |
|
definition['c']['category']['t'] == 'MetaInlines' and\ |
| 521 |
|
len(definition['c']['category']['c']) == 1 and\ |
| 522 |
|
definition['c']['category']['c'][0]['t'] == 'Str' and\ |
| 523 |
|
definition['c']['cite-shortcut']['t'] == 'MetaBool': |
| 524 |
|
|
| 525 |
|
getCiteShortCut.value[definition['c']['category']['c'][0]['c']] = definition['c']['cite-shortcut']['c'] |
| 526 |
|
|
| 527 |
|
if not category in getCiteShortCut.value: |
| 528 |
|
|
| 529 |
|
getCiteShortCut.value[category] = False |
| 530 |
|
|
| 531 |
|
return getCiteShortCut.value[category] |
| 532 |
|
|
| 533 |
|
def getDefaultLevels(category, meta): |
| 534 |
|
if not hasattr(getDefaultLevels, 'value'): |
|
@@ 483-506 (lines=24) @@
|
| 480 |
|
# Add listings to the document |
| 481 |
|
doc[1] = listings + doc[1] |
| 482 |
|
|
| 483 |
|
def getFormat(category, meta): |
| 484 |
|
if not hasattr(getFormat, 'value'): |
| 485 |
|
getFormat.value = {} |
| 486 |
|
|
| 487 |
|
if 'pandoc-numbering' in meta and meta['pandoc-numbering']['t'] == 'MetaList': |
| 488 |
|
|
| 489 |
|
# Loop on all listings definition |
| 490 |
|
for definition in meta['pandoc-numbering']['c']: |
| 491 |
|
|
| 492 |
|
if definition['t'] == 'MetaMap' and\ |
| 493 |
|
'format' in definition['c'] and\ |
| 494 |
|
'category' in definition['c'] and\ |
| 495 |
|
definition['c']['category']['t'] == 'MetaInlines' and\ |
| 496 |
|
len(definition['c']['category']['c']) == 1 and\ |
| 497 |
|
definition['c']['category']['c'][0]['t'] == 'Str' and\ |
| 498 |
|
definition['c']['format']['t'] == 'MetaBool': |
| 499 |
|
|
| 500 |
|
getFormat.value[definition['c']['category']['c'][0]['c']] = definition['c']['format']['c'] |
| 501 |
|
|
| 502 |
|
if not category in getFormat.value: |
| 503 |
|
|
| 504 |
|
getFormat.value[category] = True |
| 505 |
|
|
| 506 |
|
return getFormat.value[category] |
| 507 |
|
|
| 508 |
|
def getCiteShortCut(category, meta): |
| 509 |
|
if not hasattr(getCiteShortCut, 'value'): |