コード例 #1
0
def test_to_latex_dict():
    bibgloss = BibGlossDB()
    bibgloss.load_bib(text_str=dedent(bib_str), ignore_nongloss_types=True)
    latex_dict = bibgloss.to_latex_dict()
    print(latex_dict)
    assert latex_dict == {
        ("glsacronym", "akey1"): [
            ("\\newacronym[description={a description}]{" "akey1}{ABRV}{Abbreviation}")
        ],
        ("glsacronym", "akey2"): [
            ("\\newacronym[plural={OTHERs}]{" "akey2}{OTHER}{Abbrev of other}")
        ],
        ("glsterm", "gtkey1"): [
            "\\newglossaryentry{gtkey1}{",
            "    description={the description},",
            "    name={name}",
            "}",
        ],
        ("glsterm", "gtkey2"): [
            "\\newglossaryentry{gtkey2}{",
            "    description={the description of other},",
            "    name={other name}",
            "}",
        ],
        ("glssymbol", "skey1"): [
            "\\newglossaryentry{skey1}{",
            "    description={the description of symbol},",
            "    name={\\pi},",
            "    type={symbols}",
            "}",
        ],
    }
コード例 #2
0
def test_to_latex_dict():
    bibgloss = BibGlossDB()
    bibgloss.load_bib(text_str=dedent(bib_str), ignore_nongloss_types=True)
    latex_dict = bibgloss.to_latex_dict()
    print(latex_dict)
    assert latex_dict == {
        ('glsacronym', 'akey1'): [('\\newacronym[description={a description}]{'
                                   'akey1}{ABRV}{Abbreviation}')],
        ('glsacronym', 'akey2'): [('\\newacronym[plural={OTHERs}]{'
                                   'akey2}{OTHER}{Abbrev of other}')],
        ('glsterm', 'gtkey1'): [
            '\\newglossaryentry{gtkey1}{',
            '    description={the description},', '    name={name}', '}'
        ],
        ('glsterm', 'gtkey2'): [
            '\\newglossaryentry{gtkey2}{',
            '    description={the description of other},',
            '    name={other name}', '}'
        ],
        ('glssymbol', 'skey1'): [
            '\\newglossaryentry{skey1}{',
            '    description={the description of symbol},', '    name={\\pi},',
            '    type={symbols}', '}'
        ]
    }