从不同git和其他云服务中的内容创建图书。

cyberaide-bookmanager的Python项目详细描述


图书管理员

DOIVersionLicensePythonFormatStatusTravis

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

封面页

图书管理员可以为您创建一个简单的封面页。

示例见

Cover Page

示例创建

$ git clone https://github.com/cyberaide/bookmanager.git
$ cd bookmanager
$ pip install -e .
$ bookmanager tests/python.yaml get
$ open dest/book.epub

参考文献

要求

图书管理者需要一些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"

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android:在ListView上使用setOnItemClickListener   使用Netbeans 7.0连接到SQL Server的java正在挂起   java Spring3依赖项注入不适用于mule   java Flink SQL结果字段与LocalDateTime上请求的类型错误不匹配   java找不到文件的结尾   考虑到NamingStrategy,java有没有办法将字符串转换为JsonNode?   使用Netbeans/ant部署java(命令行)应用程序   java如何修复Spring引导多部分上载中的“所需请求部分不存在”   java在应用程序启动时通过引用获取映射未知目标实体属性异常   java形状旋转问题Java2d   Weblogic服务器上的java ExecuteAndWaitInterceptor问题   JavaSpringBoot:project将图像保存在错误的路径中,并且在使用IDEIntellji打开时不显示图像   类向java接口添加方法   Swing组件上的Java 7泛型   sql server如何从java获取用户名。sql。联系   java如何检查该行是否与正则表达式(regex)冲突?   java如何在spring引导安全中为计数失败登录设置验证登录为false   图像如何在Java中使PNG的白色透明?