Beispiel #1
0
def load_triggers(filename):
    p = read_ini(filename)
    result = {}
    for s in p.sections():
        cls, lab = s.split(', ', 1)
        triggers = p.get(s, 'triggers').strip().splitlines()
        if not triggers:  # hhtype, unknown
            continue
        result[(cls, lab)] = [parse_conjunctions(t) for t in triggers]
    return result
Beispiel #2
0
def load_hhtypes(filename=HHTYPE):
    p = read_ini(filename)
    result = {}
    for s in p.sections():
        _, _, expl = s.partition(', ')
        hht = p.get(s, 'id')
        rank = p.getint(s, 'rank')
        abbv = p.get(s, 'abbv')
        bibabbv = p.get(s, 'bibabbv')
        result[hht] = (rank, expl, abbv, bibabbv)
    return result
Beispiel #3
0
 def _bibfiles(cls, directory):
     """Read the INI-file, yield bibfile instances for sections."""
     cfg = read_ini(directory.parent.joinpath('BIBFILES.ini'))
     for s in cfg.sections():
         if not s.endswith('.bib'):
             continue
         filepath = directory.joinpath(s)
         assert filepath.exists()
         sortkey = cfg.get(s, 'sortkey')
         if sortkey.lower() == 'none':
             sortkey = None
         yield BibFile(
             filepath=filepath,
             encoding=cfg.get(s, 'encoding'), sortkey=sortkey,
             priority=cfg.getint(s, 'priority'),
             name=cfg.get(s, 'name'), title=cfg.get(s, 'title'),
             description=cfg.get(s, 'description'),
             abbr=cfg.get(s, 'abbr'))
Beispiel #4
0
 def _bibfiles(cls, directory):
     """Read the INI-file, yield bibfile instances for sections."""
     cfg = read_ini(directory.parent.joinpath('BIBFILES.ini'))
     for s in cfg.sections():
         if not s.endswith('.bib'):
             continue
         filepath = directory.joinpath(s)
         assert filepath.exists()
         sortkey = cfg.get(s, 'sortkey')
         if sortkey.lower() == 'none':
             sortkey = None
         yield BibFile(filepath=filepath,
                       encoding=cfg.get(s, 'encoding'),
                       sortkey=sortkey,
                       priority=cfg.getint(s, 'priority'),
                       name=cfg.get(s, 'name'),
                       title=cfg.get(s, 'title'),
                       description=cfg.get(s, 'description'),
                       abbr=cfg.get(s, 'abbr'))
Beispiel #5
0
 def __init__(self, repos=None):
     ini = read_ini(references_path('hhtype.ini', repos=repos))
     self._types = sorted([HHType(s, ini) for s in ini.sections()],
                          reverse=True)
     self._type_by_id = {t.id: t for t in self._types}
Beispiel #6
0
 def __init__(self, repos=None):
     ini = read_ini(references_path("hhtype.ini", repos=repos))
     self._types = sorted([HHType(s, ini) for s in ini.sections()], reverse=True)
     self._type_by_id = {t.id: t for t in self._types}