从不同git和其他云服务中的内容创建图书。
cyberaide-bookmanager的Python项目详细描述
图书管理员
bookmanager是从 互联网。创建自定义的书籍、课堂讲稿或 施舍。内容最好以降价格式集成,因为它可以很快地 产生输出。目前我们只生产epub,但很容易 同时创建pdf、html、work、odt等。当我们使用pandoc时,我们可以支持 它支持的格式。
实现的功能:
- 可以通过yaml指定具有缩进级别的目录
- yaml文件中定义的元素的特殊变量替换
- 文档是从github获取的
- 将检查文档并获取其中的图像 (我们假设图像与文档相关,不会修改http链接)
- 自动生成封面页
- 输出在dest目录中生成
计划的增强功能:
- 通过pandoc citeref整合参考资料
- 通过pandoc crossref集成节、表、图像参考
如果你想帮助联系格雷戈尔冯拉泽夫斯基 laszewski@gmail.com
$ pip install cyberaide-bookmanager
用法
bookmanager -- a helper to create books from markdown files in a yaml TOC.
Usage:
bookmanager version
bookmanager YAML cover
bookmanager YAML get [--format=FORMAT] [--force]
bookmanager YAML download
bookmanager YAML level
bookmanager YAML epub [--force]
bookmanager YAML pdf
bookmanager YAML html
bookmanager YAML docx
bookmanager YAML check [--format=FORMAT]
bookmanager YAML urls [--format=FORMAT]
bookmanager YAML list [--format=FORMAT] [--details]
Arguments:
YAML the yaml file
Options:
-h --help
-f, --format=FORMAT [default: markdown]
-d, --details [default: False]
Description:
In principal you only need one command at this time. All other commands are
available for test purposes.
You can create an epub with
bookmanager YAML get [--format=FORMAT]
The command searches for all images within the markdown document and fetches
them so the document can be created locally with the images. We assume all
images in the md document are for now not specified via http locations but
via relative locations.
To view the document use your favourite ePub Reader
Other commands include:
bookmanager YAML download [--format=FORMAT]
downloads the urls into the ./dest directory for local processing
bookmanager YAML check [--format=FORMAT]
checks if the urls in the yaml file exist
bookmanager YAML urls [--format=FORMAT]
lists all urls of the yaml file
bookmanager YAML list [--format=FORMAT]
lists the yaml file
Not implemented are the following features:
1) pdf: bookmanager pdf book.yml
YAML Table of Contents format:
The table of contents for the book can be controlled with a simple yaml
file that has some specific contextual enhancements. THis include the
creation of a BOOK section that has the sections outlined in hierarchical
form, and contains chapter and section headers without links that are
automatically generated.
Here is an example of a simple TOC yaml file:
* https://github.com/cyberaide/bookmanager/blob/master/tests/python.yml
Bugs and enhancement suggestions:
* https://github.com/cyberaide/bookmanager/issues
封面页
图书管理员可以为您创建一个简单的封面页。
示例见
示例创建
$ git clone https://github.com/cyberaide/bookmanager.git
$ cd bookmanager
$ pip install -e .
$ bookmanager tests/python.yaml get
$ open dest/book.epub
参考文献
- 示例yamle文件:https://github.com/cyberaide/bookmanager/blob/master/tests/python.yml
- 主页:https://github.com/cyberaide/bookmanager
要求
图书管理者需要一些CyrdMyMyAML文件的存在,在将来的版本中我们打算删除它们。 简单地做
$ mkdir -p ~/.cloudmesh $ wget -P ~/.cloudmesh https://raw.githubusercontent.com/cloudmesh/cloudmesh-configuration/master/cloudmesh/configuration/etc/cloudmesh.yaml
此外,我们需要一个最新版本的pandoc。请咨询 关于如何做到这一点的pandoc文档。不幸的是,这些版本 用ubuntu已经过时了。在ubuntu上你可以说:
wget -q https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb sudo dpkg -i pandoc-2.7.2-1-amd64.deb pandoc --version
我们推荐Pandoc版本2.7.2。
示例yaml文件
下面是可以使用的目录yaml文件的示例 将来自不同存储库的内容聚合在一起。
---
metadata:
image: "cover.png"
title: "Introduction to Python"
subtitle: "for Cloud Computing"
author: 'Gregor von Laszewski'
subauthor: "Editor"
email: "laszewski@gmail.com"
url: "https://github.com/cyberaide/bookmanager"
description: "Book creator"
abstract: "my abstract"
keywords: "pandoc"
stylesheet: "epub.css"
dest: "./dest/book"
filename: "vonLaszewski-python.epub"
git:
"book": "https://raw.githubusercontent.com/cloudmesh-community/book/master/chapters"
"credit": "https://raw.githubusercontent.com/cyberaide/bookmanager/master/bookmanager/template"
BOOK:
- PREFACE:
- "{git.credit}/disclaimer.md"
- INTRODUCTION:
- "{git.book}/prg/SECTION-PYTHON.md"
- "{git.book}/prg/python/python-intro.md"
- "{git.book}/prg/python/python-install.md"
- "{git.book}/prg/python/python-interactive.md"
- "{git.book}/prg/python/python-editor.md"
- "{git.book}/prg/python/python.md"
- LIBRARIES:
- "{git.book}/prg/python/python-libraries.md"
- "{git.book}/prg/python/python-data.md"
- "{git.book}/prg/python/python-matplotlib.md"
- "{git.book}/prg/python/python-docopts.md"
- "{git.book}/prg/python/python-cmd5.md"
- "{git.book}/prg/python/python-cmd.md"
- "{git.book}/prg/python/opencv/opencv.md"
- "{git.book}/prg/python/opencv/secchi.md"
- DATA:
- "{git.book}/SECTION/SECTION-DATA.md"
- "{git.book}/data/formats.md"
- MONGO:
- "{git.book}/data/mongodb.md"
- "{git.book}/data/mongoengine.md"
- OTHER:
- "{git.book}/prg/python/python-wordcount.md"
- "{git.book}/prg/python/numpy/numpy.md"
- "{git.book}/prg/python/scipy/scipy.md"
- "{git.book}/prg/python/scikit-learn/scikit-learn.md"
- "{git.book}/prg/python/random-forest/random-forest.md"
- "{git.book}/prg/python/python-parallel.md"
- "{git.book}/prg/python/dask/dask.md"
- APPLICATIONS:
- "{git.book}/prg/python/fingerprint/fingerprint.md"
- "{git.book}/prg/python/facedetection/facedetection.md"
如果您有本地文件,可以使用file://
添加它们。
假设您将所有文件都存储在一个章节目录中, 您可以使用以下yaml文件。
---
metadata:
image: "cover.png"
title: "Introduction to Python"
subtitle: "for Cloud Computing"
author: 'Gregor von Laszewski'
subauthor: "Editor"
email: "laszewski@gmail.com"
url: "https://github.com/cyberaide/bookmanager"
description: "Book creator"
abstract: "my abstract"
keywords: "pandoc"
stylesheet: "epub.css"
dest: "./dest/book"
filename: "vonLaszewski-python.epub"
git:
"book": "https://raw.githubusercontent.com/cloudmesh-community/book/master/chapters"
"book": "https://raw.githubusercontent.com/cloudmesh-community/book/master/chapters"
"credit": "https://raw.githubusercontent.com/cyberaide/bookmanager/master/bookmanager/template"
file:
"chapter": "file://../chapters"
BOOK:
- PREFACE:
- "{git.credit}/disclaimer.md"
- INTRODUCTION:
- "{file.chapter}/prg/SECTION-PYTHON.md"
- "{file.chapter}/prg/python/python-intro.md"
- "{file.chapter}/prg/python/python-install.md"
- "{file.chapter}/prg/python/python-interactive.md"
- "{file.chapter}/prg/python/python-editor.md"
- "{file.chapter}/prg/python/python.md"
- LIBRARIES:
- "{file.chapter}/prg/python/python-libraries.md"
- "{file.chapter}/prg/python/python-data.md"
- "{file.chapter}/prg/python/python-matplotlib.md"
- "{file.chapter}/prg/python/python-docopts.md"
- "{file.chapter}/prg/python/python-cmd5.md"
- "{file.chapter}/prg/python/python-cmd.md"
- "{file.chapter}/prg/python/opencv/opencv.md"
- "{file.chapter}/prg/python/opencv/secchi.md"
- DATA:
- "{file.chapter}/SECTION/SECTION-DATA.md"
- "{file.chapter}/data/formats.md"
- MONGO:
- "{file.chapter}/data/mongodb.md"
- "{file.chapter}/data/mongoengine.md"
- OTHER:
- "{file.chapter}/prg/python/python-wordcount.md"
- "{file.chapter}/prg/python/numpy/numpy.md"
- "{file.chapter}/prg/python/scipy/scipy.md"
- "{file.chapter}/prg/python/scikit-learn/scikit-learn.md"
- "{file.chapter}/prg/python/random-forest/random-forest.md"
- "{file.chapter}/prg/python/python-parallel.md"
- "{file.chapter}/prg/python/dask/dask.md"
- APPLICATIONS:
- "{file.chapter}/prg/python/fingerprint/fingerprint.md"
- "{file.chapter}/prg/python/facedetection/facedetection.md"
自动GitHub链接
可以替换将添加到 带有指向github存储库的链接的文件。现在这只是 支持同一存储库中的文档。
如果您的本地文件在
../chapter
。在base
中指定时。这个变量
指定指向源的链接。变量github将用于
用指向github存储库的链接替换基础。
file:
"github": "https://github.com/cloudmesh-community/book/blob/master/chapters"
"base": "../chapters"