Esempio n. 1
0
    def test_pmid_to_url(self):
        # Test data
        entry_first = {
            'title': 'First',
            'id': 'aaa'}
        entry_second = {
            'title': 'Second',
            'id': 'pmid24685317'}
        entry_third = {
            'title': 'Third',
            'id': 'pmid24685317',
            'URL': 'http://www.google.com/'}
        entries = [entry_first, entry_second, entry_third]

        result = utils.pmid_to_url(entries)

        self.assertFalse('URL' in result[0])
        self.assertEqual(result[1]['URL'],
                        'http://www.ncbi.nlm.nih.gov/pubmed/24685317')
        self.assertEqual(result[2]['URL'], entry_third['URL'])
Esempio n. 2
0
def main(bibtex_file, html_file):
    """Load BibTeX file and export to WordPress HTML file"""
    entries = load_bibtex_file(bibtex_file)
    entries = pmid_to_url(entries)
    entries = sort_by_date(entries, reverse=True)
    export_wordpress(html_file, entries)