将doi:10.xxxxx/xxxx转换为nice书目元数据
markdown-doi的Python项目详细描述
#文档对象标识符和python和markdown一起!
键入日志文章dois,并自动将其转换为漂亮的参考书目。
[![特拉维斯](https://travis ci.org/bcaller/markdown-doi.svg)(https://travis ci.org/bcaller/markdown-doi)
[![PYPI版本](https://badge.fury.io/py/markdown-doi.svg)(https://badge.fury.io/py/markdown-doi)
一个标记扩展,它可以在文本中查找诸如“doi:10.1234/j.banana.5678”之类的内容,
在crossref api上查找元数据,并根据您的要求输出文本
markdown.convert('doi:10.1016/j.applanim.2010.02.004')
```
输出
``html
<;p>;<;span class="doi"><a href="http://dx.doi.org/10.1016/j.applanim.2010.02.004">Are cows more likely to lie down the longer they stand?</a> <span class="doi-year">(2010)</span></span></p>
``
>如果您使用鹈鹕并不断重新生成相同的文件,则可以启用缓存;markdown=markdown(extensions=['markdown-doi(cache-file=.doi-cache)'
````
模板函数从[JSON API响应](https://api.crossref.org/works/10.1016/j.applanim.2010.02.004)的
消息键获取元数据dict并返回一个“markdown.util.etree.elementtree”。请参见默认的“template_title_link_year”函数。
``python
从markdown_doi import makeextension as makedoiextension
def templater(元数据,doi_模式:
el=markdown.util.etree.element(“SPAN”)
el.text='%(给定)s%(系列)s%metadata['author'][0]
return el
ext=makedoiextension(templater=templater)
md=markdown.markdown(extensions=[ext])
html=md.convert('hello 10.1016/j.applanim.2010.02.004')
assert html=='hello<;p>;<;span>;lt;lt;span>;lt;lt;p>;'
`````
<
<
选项类型默认描述
一个元素树
缓存文件str'''文件名,可以存储一个查找到的doi的缓存
cache dict dict none;相反,您可以将一个映射从doi传递到元数据dict作为缓存,而不是一个文件名;
<
>;从github:
`````
``````` `
git-github.com/bcaller/markdown doi.git.git
```
>;来自pypi:
```
pip install markdown\u doi
```
键入日志文章dois,并自动将其转换为漂亮的参考书目。
[![特拉维斯](https://travis ci.org/bcaller/markdown-doi.svg)(https://travis ci.org/bcaller/markdown-doi)
[![PYPI版本](https://badge.fury.io/py/markdown-doi.svg)(https://badge.fury.io/py/markdown-doi)
一个标记扩展,它可以在文本中查找诸如“doi:10.1234/j.banana.5678”之类的内容,
在crossref api上查找元数据,并根据您的要求输出文本
markdown.convert('doi:10.1016/j.applanim.2010.02.004')
```
输出
``html
<;p>;<;span class="doi"><a href="http://dx.doi.org/10.1016/j.applanim.2010.02.004">Are cows more likely to lie down the longer they stand?</a> <span class="doi-year">(2010)</span></span></p>
``
>如果您使用鹈鹕并不断重新生成相同的文件,则可以启用缓存;markdown=markdown(extensions=['markdown-doi(cache-file=.doi-cache)'
````
模板函数从[JSON API响应](https://api.crossref.org/works/10.1016/j.applanim.2010.02.004)的
消息键获取元数据dict并返回一个“markdown.util.etree.elementtree”。请参见默认的“template_title_link_year”函数。
``python
从markdown_doi import makeextension as makedoiextension
def templater(元数据,doi_模式:
el=markdown.util.etree.element(“SPAN”)
el.text='%(给定)s%(系列)s%metadata['author'][0]
return el
ext=makedoiextension(templater=templater)
md=markdown.markdown(extensions=[ext])
html=md.convert('hello 10.1016/j.applanim.2010.02.004')
assert html=='hello<;p>;<;span>;lt;lt;span>;lt;lt;p>;'
`````
<
<
选项类型默认描述
一个元素树
缓存文件str'''文件名,可以存储一个查找到的doi的缓存
cache dict dict none;相反,您可以将一个映射从doi传递到元数据dict作为缓存,而不是一个文件名;
<
>;从github:
`````
``````` `
git-github.com/bcaller/markdown doi.git.git
```
>;来自pypi:
```
pip install markdown\u doi
```