Skip to content

Commit

Permalink
feat: add tests and edit docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gcushen committed Nov 26, 2023
1 parent 3bfd3cf commit 5259b97
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: gcushen
custom: https://wowchemy.com/sponsor/
custom: https://hugoblox.com/sponsor/
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ lint:
poetry run flake8

test:
poetry run pytest
poetry run pytest -v

type:
poetry run pyright

publish:
poetry publish --build --dry-run
poetry publish --build
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[**中文**](./README.zh.md)

# [Bibtex to Markdown Converter](https://github.com/wowchemy/bibtex-to-markdown)
# [Academic File Converter](https://github.com/GetRD/academic-file-converter)

[![Download from PyPI](https://img.shields.io/pypi/v/academic.svg?style=for-the-badge)](https://pypi.python.org/pypi/academic)
[![Discord](https://img.shields.io/discord/722225264733716590?style=for-the-badge)](https://discord.com/channels/722225264733716590/742892432458252370/742895548159492138)
Expand All @@ -15,23 +15,28 @@

**Features**

* Import Bibtex publications (such as **books, conference proceedings and journals**) from your reference manager to your Markdown-formatted website or book
* **Import Jupyter notebooks** as blog posts or book chapters
* **Import publications** (such as **books, conference proceedings, and journals**) from your reference manager to your Markdown-formatted website or book
* Simply export a BibTeX file from your reference manager, such as [Zotero](https://www.zotero.org), and provide this as the input to the converter tool
* Compatible with all static website generators such as Next, Astro, Gatsby, Hugo, etc.
* **Compatible with all static website generators** such as Next, Astro, Gatsby, Hugo, etc.
* **Easy to use** - 100% Python, no dependency on complex software such as Pandoc
* **Automate** file conversions using a [GitHub Action](https://github.com/HugoBlox/hugo-blox-builder/blob/main/starters/blog/.github/workflows/import-notebooks.yml)

**Community**

- 📚 [View the **documentation**](https://wowchemy.com/docs/content/publications/#import-from-bibtex) and usage guide below
- 💬 [Chat with the **community**](https://discord.gg/z8wNYzb)
- 🐦 Twitter: [@wowchemy](https://twitter.com/wowchemy) [@GeorgeCushen](https://twitter.com/GeorgeCushen) [#MadeWithAcademic](https://twitter.com/search?q=(%23MadeWithWowchemy%20OR%20%23MadeWithAcademic)&src=typed_query)
- 📚 [View the **documentation** below](#installation)
- 💬 [Chat live with the **community** on Discord](https://discord.gg/z8wNYzb)
- 🐦 Twitter: [@GetResearchDev](https://twitter.com/GetResearchDev) [@GeorgeCushen](https://twitter.com/GeorgeCushen) [#MadeWithAcademic](https://twitter.com/search?q=%23MadeWithAcademic&src=typed_query)

**❤️ Support this open-source software**
## ❤️ Support Open Research & Open Source

To help us develop this converter tool and the associated Wowchemy open source software sustainably under the MIT license, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship and contributing.
We are on a mission to foster **open research** by developing **open source** tools like this.

Support this open science movement:
To help us develop this open source software sustainably under the MIT license, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship and contributing.

- ⭐️ [**Star** this project on GitHub](https://github.com/wowchemy/bibtex-to-markdown)
Support the open research movement:

- ⭐️ [**Star** this project on GitHub](https://github.com/GetRD/academic-file-converter)
- ❤️ [Become a **GitHub Sponsor** and **unlock perks**](https://github.com/sponsors/gcushen)
- ☕️ [**Donate a coffee**](https://github.com/sponsors/gcushen?frequency=one-time)
- 👩‍💻 [**Contribute**](#contribute)
Expand All @@ -56,14 +61,14 @@ Pipx will **automatically install the required Python version for you** in a ded

## Usage

Download references from your reference manager, such as Zotero, in the Bibtex format.

Use the `cd` command to navigate to the folder containing your Bibtex file:
Open your Command Line or Terminal app and use the `cd` command to navigate to the folder containing the files you wish to convert, for example:

cd <MY_BIBTEX_FOLDER>
cd ~/Documents/my_website

### Import publications

Download references from your reference manager, such as Zotero, in the Bibtex format.

Say we downloaded our publications to a file named `my_publications.bib` within the website folder, let's import them into the `content/publication/` folder:

academic import my_publications.bib content/publication/ --compact
Expand All @@ -84,7 +89,7 @@ After importing publications, we suggest you:
- Add an image named `featured` to each publication's folder to visually represent your publication on the page and for sharing on social media
- Add the publication PDF to each publication folder (for open access publications), to enable your website visitors to download your publication

[Learn more in the Wowchemy Docs](https://university.wowchemy.com).
[Learn more in the Hugo Blox Docs](https://docs.hugoblox.com/reference/content-types/).

### Import blog posts from Jupyter Notebooks

Expand All @@ -100,16 +105,16 @@ Optional arguments:

## Contribute

Interested in contributing to **open source** and **open science**?
Interested in contributing to **open source** and **open research**?

Learn [how to contribute code on Github](https://codeburst.io/a-step-by-step-guide-to-making-your-first-github-contribution-5302260a2940).

Check out the [open issues](https://github.com/wowchemy/bibtex-to-markdown/issues) and contribute a [Pull Request](https://github.com/wowchemy/bibtex-to-markdown/pulls).
Check out the [open issues](https://github.com/GetRD/academic-file-converter/issues) and contribute a [Pull Request](https://github.com/GetRD/academic-file-converter/pulls).

For local development, clone this repository and use Poetry to install and run the converter using the following commands:

git clone https://github.com/wowchemy/bibtex-to-markdown.git
cd bibtex-to-markdown
git clone https://github.com/GetRD/academic-file-converter.git
cd academic-file-converter
poetry install
poetry run academic import tests/data/article.bib output/publication/ --overwrite --compact
poetry run academic import 'tests/data/**/*.ipynb' output/post/ --overwrite --verbose
Expand All @@ -125,13 +130,13 @@ When preparing a contribution, run the following checks and ensure that they all

You can help test the latest development version by installing the latest `main` branch from GitHub:

pip3 install -U git+https://github.com/wowchemy/bibtex-to-markdown.git
pip3 install -U git+https://github.com/GetRD/academic-file-converter.git

## License

Copyright 2018-present [George Cushen](https://georgecushen.com).

Licensed under the [MIT License](https://github.com/wowchemy/bibtex-to-markdown/blob/main/LICENSE.md).
Licensed under the [MIT License](https://github.com/GetRD/academic-file-converter/blob/main/LICENSE.md).

![PyPI - Downloads](https://img.shields.io/pypi/dm/academic?label=PyPi%20Downloads&style=for-the-badge)
[![License](https://img.shields.io/pypi/l/academic.svg?style=for-the-badge)](https://github.com/wowchemy/bibtex-to-markdown/blob/main/LICENSE.md)
[![License](https://img.shields.io/pypi/l/academic.svg?style=for-the-badge)](https://github.com/GetRD/academic-file-converter/blob/main/LICENSE.md)
134 changes: 76 additions & 58 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,140 @@
[**English**](./README.md)

# [Bibtex 转 Markdown 转换器](https://github.com/wowchemy/bibtex-to-markdown)
# [学术文件转换器](https://github.com/GetRD/academic-file-converter)

[![从PyPI下载](https://img.shields.io/pypi/v/academic.svg?style=for-the-badge)](https://pypi.python.org/pypi/academic)
[![Discord](https://img.shields.io/discord/722225264733716590?style=for-the-badge)](https://discord.com/channels/722225264733716590/742892432458252370/742895548159492138)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/gcushen?label=%E2%9D%A4%EF%B8%8F%20赞助&style=for-the-badge)](https://github.com/sponsors/gcushen)
[![Twitter Follow](https://img.shields.io/twitter/follow/georgecushen?label=在%20Twitter%20上关注&style=for-the-badge)](https://twitter.com/GeorgeCushen)
[![GitHub followers](https://img.shields.io/github/followers/gcushen?label=在%20GitHub%20上关注&style=for-the-badge)](https://github.com/gcushen)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/gcushen?label=%E2%9D%A4%EF%B8%8F%20sponsor&style=for-the-badge)](https://github.com/sponsors/gcushen)
[![Twitter Follow](https://img.shields.io/twitter/follow/georgecushen?label=Follow%20on%20Twitter&style=for-the-badge)](https://twitter.com/GeorgeCushen)
[![GitHub followers](https://img.shields.io/github/followers/gcushen?label=Follow%20on%20GH&style=for-the-badge)](https://github.com/gcushen)


### 📚 轻松地将您的参考经理中的出版物导入到您的 Markdown 格式的网站或书籍中
### 📚 将出版物和Jupyter笔记本轻松导入到您的Markdown格式的网站或书籍中

![](.github/media/demo.gif)

**特征**
**特性**

* 将 Bibtex 出版物(如**书籍,会议记录和期刊**)从您的参考管理器导入到您的 Markdown 格式的网站或书籍
- 只需从您的参考管理器(如 [Zotero](https://www.zotero.org))中导出一个 BibTeX 文件,并将其作为转换器工具的输入
* 兼容所有静态网站生成器,如 Next, Astro, Gatsby, Hugo 等。
***Jupyter笔记本**导入为博客文章或书籍章节
* 将出版物(如**书籍、会议论文集和期刊**)从您的参考文献管理器导入到您的Markdown格式的网站或书籍中
* 只需从参考文献管理器(例如[Zotero](https://www.zotero.org))导出BibTeX文件,并将此文件作为转换工具的输入
* **兼容所有静态网站生成器**,如Next、Astro、Gatsby、Hugo等
* **易于使用** - 100% Python,无需依赖Pandoc等复杂软件
* 使用[GitHub Action](https://github.com/HugoBlox/hugo-blox-builder/blob/main/starters/blog/.github/workflows/import-notebooks.yml) **自动化** 文件转换

**社区**

- 📚 [查看**文件**](https://wowchemy.com/docs/content/publications/#import-from-bibtex) 和下面的使用指南
- 💬 [**社区**交谈](https://discord.gg/z8wNYzb)
- 🐦 Twitter: [@wowchemy](https://twitter.com/wowchemy) [@GeorgeCushen](https://twitter.com/GeorgeCushen) [#MadeWithAcademic](https://twitter.com/search?q=(%23MadeWithWowchemy%20OR%20%23MadeWithAcademic)&src=typed_query)
- 📚 [查看以下的**文档**](#安装)
- 💬 [在Discord上与**社区**实时聊天](https://discord.gg/z8wNYzb)
- 🐦 推特:[@GetResearchDev](https://twitter.com/GetResearchDev) [@GeorgeCushen](https://twitter.com/GeorgeCushen) [#MadeWithAcademic](https://twitter.com/search?q=%23MadeWithAcademic&src=typed_query)

**❤️ 支持这个开源软件**
## ❤️ 支持开放研究和开源软件

为了帮助我们在 MIT 许可下可持续地开发这个转换器工具和相关的 Wowchemy 开源软件,我们要求所有使用它的个人和企业通过赞助和贡献来帮助支持其持续的维护和开发
我们的使命是通过开发像这样的**开源**工具来促进**开放研究**

支持这个开放科学运动:
为了帮助我们根据MIT许可证在可持续地进行这个开源软件的开发,我们请求所有使用它的个人和企业支持它的维护和发展,通过赞助和贡献来实现。

- ⭐️ [在 GitHub 上为这个项目打****](https://github.com/wowchemy/bibtex-to-markdown)
- ❤️ [成为一名**GitHub 赞助者****解锁特权**](https://github.com/sponsors/gcushen)
支持开放研究运动:

- ⭐️ [在GitHub上给这个项目**加星标**](https://github.com/GetRD/academic-file-converter)
- ❤️ [成为**GitHub赞助商****解锁特权**](https://github.com/sponsors/gcushen)
- ☕️ [**捐赠一杯咖啡**](https://github.com/sponsors/gcushen?frequency=one-time)
- 👩‍💻 [**贡献**](#贡献)
- 👩‍💻 [**贡献**](#contribute)

## 安装

打开您的**终端****命令提示符**应用程序,并输入以下安装命令之一
打开您的**终端****命令提示符**应用程序并输入以下的安装命令之一

### 使用 Pipx
### 使用Pipx

对于**最简单**的安装,可使用 [Pipx](https://pypa.github.io/pipx/) 安装:
对于**最简单**的安装,使用[Pipx](https://pypa.github.io/pipx/)进行安装:

pipx install academic

Pipx 将**自动在专用环境中为您安装所需的 Python 版本**
Pipx将会**自动在一个专用环境中为您安装所需的Python版本**

### 使用 Pip
### 使用Pip

要使用 Python 的 Pip 工具进行安装,请确保已安装 [Python 3.11+](https://realpython.com/installing-python/),然后运行:
使用Python的Pip工具进行安装,请确保您已安装[Python 3.11+](https://realpython.com/installing-python/),然后运行:

pip3 install -U academic

## 使用

请以 Bibtex 格式从您的参考管理器(如 Zotero)中下载引用。
## 使用方式

使用 `cd` 命令导航到包含您的 Bibtex 文件的文件夹
打开您的命令行或终端应用程序,使用`cd`命令导航至包含您希望转换的文件的文件夹,例如

cd <MY_BIBTEX_FOLDER>
cd ~/Documents/my_website

### 导入出版物

假设我们将出版物下载到网站文件夹中名为 `my_publications.bib` 的文件中,让我们将它们导入到 `content/publication/` 文件夹中:
从您的参考文献管理器中(例如Zotero)下载参考文献,使用Bibtex格式。

假设我们将我们的出版物下载到了网站文件夹内名为`my_publications.bib`的文件中,让我们将它们导入到 `content/publication/`文件夹中:

academic import my_publications.bib content/publication/ --compact

可选参数:

* `--compact` 生成没有评论或空键的最小 markdown
* `--compact` 生成没有注释或空键的最小化markdown
* `--overwrite` 覆盖输出文件夹中的任何现有出版物
* `--normalize` 通过将它们转换为小写并大写第一个字母来规范标签(例如 "sciEnCE" -> "Science")
* `--featured` 将这些出版物标记为*精选*(将在您的网站的*精选出版物*部分出现
* `--verbose``-v` 显示详细消息
* `--normalize` 标准化标签,将其转换为小写并将第一个字母大写(例如 "sciEnCE" -> "Science")
* `--featured` 将这些出版物标记为*特色出版物*(以便在您的网站的*特色出版物*部分显示
* `--verbose``-v`显示详细消息
* `--help` 帮助

### 导入全文和封面图像

导入出版物后,我们建议您:
- 编辑每个出版物的 Markdown 正文以将全文直接添加到页面(如果出版物是开放获取的),或其他方式,为每个出版物添加补充笔记
- 将名为 `featured` 的图像添加到每个出版物的文件夹中,以在页面上直观地表示您的出版物并在社交媒体上分享
- 将出版物 PDF 添加到每个出版物文件夹(对于开放获取的出版物),以便您的网站访问者下载您的出版物
- 编辑每个出版物的Markdown正文,直接在页面上添加全文(如果出版物是开放访问的),或者添加每个出版物的补充笔记
- 将名为`featured`的图像添加到每个出版物的文件夹中,以在页面上可视化地代表您的出版物,并用于在社交媒体上分享
- 将出版物的PDF添加到每个出版物的文件夹中(对于开放访问的出版物),以便您的网站访问者可以下载您的出版物

[在Hugo Blox文档中学习更多知识](https://docs.hugoblox.com/reference/content-types/).

[在 Wowchemy 文档中了解更多](https://university.wowchemy.com)
### 从Jupyter笔记本中导入博客文章

## 贡献
设想我们有一个笔记本在网站文件夹中的`notebooks`文件夹中,让我们将它们导入到`content/post/`文件夹中:

academic import 'notebooks/*.ipynb' content/post/ --verbose

对贡献**开源****开放科学**感兴趣?
可选参数:

学习 [如何在 Github 上贡献代码](https://codeburst.io/a-step-by-step-guide-to-making-your-first-github-contribution-5302260a2940)
* `--overwrite` 覆盖输出文件夹中的任何现有博客文章
* `--verbose``-v` 显示详细消息
* `--help` 帮助

## 贡献

对贡献**开源****开放研究**感兴趣吗?

查看 [开放问题](https://github.com/wowchemy/bibtex-to-markdown/issues) 和贡献 [拉取请求](https://github.com/wowchemy/bibtex-to-markdown/pulls)
了解[Github上如何贡献代码](https://codeburst.io/a-step-by-step-guide-to-making-your-first-github-contribution-5302260a2940)

要进行本地开发,请克隆此存储库并使用 Poetry 使用以下命令安装并运行转换器:
查看[开放的问题](https://github.com/GetRD/academic-file-converter/issues),并贡献一个[Pull Request](https://github.com/GetRD/academic-file-converter/pulls)

git clone https://github.com/wowchemy/bibtex-to-markdown.git
cd bibtex-to-markdown
对于本地开发,克隆此存储库并使用诗(Poetry)安装和运行转换器,使用以下命令: git clone https://github.com/GetRD/academic-file-converter.git
cd academic-file-converter
poetry install
poetry run academic import tests/data/article.bib output/ --overwrite --compact
poetry run academic import tests/data/article.bib output/publication/ --overwrite --compact
poetry run academic import 'tests/data/**/*.ipynb' output/post/ --overwrite --verbose

在准备投稿时,请运行以下检查并确保所有检查都通过:

准备贡献时,运行以下检查并确保都已通过:
- Lint:`make lint`
- Format:`make format`
- Test:`make test`
- Type check:`make type`

- Lint: `make lint`
- Format: `make format`
- Test: `make test`
- 类型检查: `make type`
### 帮助测试开发者版本

### 帮助测试开发版本
您可以通过安装GitHub上的最新`main`分支来帮助测试最新的开发版本:

您可以通过安装来自 GitHub 的最新 `main` 分支来帮助测试最新的开发版本:
pip3 install -U git+https://github.com/GetRD/academic-file-converter.git

pip3 install -U git+https://github.com/wowchemy/bibtex-to-markdown.git
## 许可证

## 许可
版权所有2018-至今 [George Cushen](https://georgecushen.com)

Copyright 2018-present [George Cushen](https://georgecushen.com).根据[MIT许可证](https://github.com/wowchemy/bibtex-to-markdown/blob/main/LICENSE.md)许可
根据[MIT许可证](https://github.com/GetRD/academic-file-converter/blob/main/LICENSE.md)授权

![PyPI - Downloads](https://img.shields.io/pypi/dm/academic?label=PyPi%20Downloads&style=for-the-badge)
[![License](https://img.shields.io/pypi/l/academic.svg?style=for-the-badge)](https://github.com/wowchemy/bibtex-to-markdown/blob/main/LICENSE.md)
![PyPI - 下载次数](https://img.shields.io/pypi/dm/academic?label=PyPi%20Downloads&style=for-the-badge)
[![许可证](https://img.shields.io/pypi/l/academic.svg?style=for-the-badge)](https://github.com/GetRD/academic-file-converter/blob/main/LICENSE.md)
Loading

0 comments on commit 5259b97

Please sign in to comment.