亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

GitBook 制作電子書(shū)詳細(xì)教程

 更新時(shí)間:2016年07月11日 15:11:56   投稿:lqh  
本文主要介紹GitBook如何制作電子書(shū),在使用過(guò)程中經(jīng)常出現(xiàn)的問(wèn)題以及解決辦法,希望能幫助到有需要的同學(xué)

gitbook安裝:

 https://nodejs.org/#download 

下載node.js源代碼(點(diǎn)擊綠色的INSTALL),

解壓

./configure
make
make install 

成功執(zhí)行后,npm就被安裝好了。

2. gitbook 安裝命令

npm install -g gitbook-cli


gitbook -V 

查看gitbook是否安裝成功。

ref

===

1. wanqingwong.com/gitbook-zh/index.html

gitbook使用

===========

1. 根據(jù)目錄生成圖書(shū)結(jié)構(gòu)

1.1 README.md 與 SUMMARY編寫(xiě)

README.md

這個(gè)文件相當(dāng)于一本Gitbook的簡(jiǎn)介。

$ mkdir test_gitbook
$ touch README.md

SUMMARY.md

這個(gè)文件是一本書(shū)的目錄結(jié)構(gòu),使用Markdown語(yǔ)法,

如我們這本書(shū)的SUMMARY.md:

$ touch SUMMARY.md
$ vim SUMMARY.md

輸入

* [簡(jiǎn)介](README.md)
* [第一章](chapter1/README.md)
 - [第一節(jié)](chapter1/section1.md)
 - [第二節(jié)](chapter1/section2.md)
* [第二章](chapter2/README.md)
 - [第一節(jié)](chapter2/section1.md)
 - [第二節(jié)](chapter2/section2.md)
* [結(jié)束](end/README.md)

1.2 生成圖書(shū)結(jié)構(gòu)

當(dāng)這個(gè)目錄文件創(chuàng)建好之后,我們可以使用Gitbook

的命令行工具將這個(gè)目錄結(jié)構(gòu)生成相應(yīng)的目錄及文件:

$ gitbook init
$ tree . #查看建立的目錄和文件

├── chapter1
│   ├── README.md
│   ├── section1.md
│   └── section2.md
├── chapter2
│   ├── README.md
│   ├── section1.md
│   └── section2.md
├── end
│   └── README.md
├── README.md
└── SUMMARY.md

我們可以看到,gitbook給我們生成了與SUMMARY.md所
對(duì)應(yīng)的目錄及文件。

每個(gè)目錄中,都有一個(gè)README.md文件,相當(dāng)于一章的說(shuō)明。

2. 生成圖書(shū)

2.1 輸出為靜態(tài)網(wǎng)站

你有兩種方式輸出一個(gè)靜態(tài)網(wǎng)站:

2.1.1 本地預(yù)覽時(shí)自動(dòng)生成

當(dāng)你在自己的電腦上編輯好圖書(shū)之后,你可以使用Gitbook
的命令行進(jìn)行本地預(yù)覽:

$ gitbook serve .

然后瀏覽器中輸入:

 http://localhost:4000 

這樣就可以預(yù)覽生
成的以網(wǎng)頁(yè)形式組織的書(shū)籍。

這里你會(huì)發(fā)現(xiàn),你在你的圖書(shū)項(xiàng)目的目錄中多了一個(gè)名為
_book的文件目錄,而這個(gè)目錄中的文件,即是生成的靜態(tài)
網(wǎng)站內(nèi)容。

使用build參數(shù)生成到指定目錄

與直接預(yù)覽生成的靜態(tài)網(wǎng)站文件不一樣的是,使用這個(gè)命令,
你可以將內(nèi)容輸入到你所想要的目錄中去:

$ mkdir /tmp/gitbook
$ gitbook build --output=/tmp/gitbook

2.2 輸出PDF

輸入為PDF文件,需要先使用NPM安裝上gitbook pdf:

$ sudo npm install gitbook-pdf -g

我在執(zhí)行上面這條命令的時(shí)候出現(xiàn)了下面的錯(cuò)誤:

***************************************************

Downloading http://cdn.bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
Saving to /usr/local/lib/node_modules/gitbook-pdf/node_modules/phantomjs/phantomjs/phantomjs-1.9.7-linux-i686.tar.bz2
Error: connect ETIMEDOUT
  at exports._errnoException (util.js:746:11)
  at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
npm ERR! Linux 3.2.0-4-686-pae
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gitbook-pdf" "-g"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE


npm ERR! phantomjs@1.9.7-5 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs@1.9.7-5 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!   node install.js
npm ERR! You can get their info via:
npm ERR!   npm owner ls phantomjs
npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:
npm ERR!   /home/wangxq/repository/phantomjs/npm-debug.log

***************************************************

 由錯(cuò)誤報(bào)告內(nèi)容的第一行可以知道,發(fā)生錯(cuò)誤的原因是下載

 phantomjs發(fā)生了錯(cuò)誤,因此我們需要手動(dòng)下載和安裝。

 解決方法:[1]

$ git clone git://github.com/ariya/phantomjs.git
$ sudo apt-get install build-essential g++ flex bison gperf ruby perl \
 libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \
 libpng-dev libjpeg-dev python libx11-dev libxext-dev    #安裝編譯需要的工具和依賴(lài)
$ cd phantomjs
$ git checkout 1.9.7 #注意:這里的1.9.7是phantom的版本號(hào),可以由錯(cuò)誤報(bào)告的第一行找出 
$ ./build.sh --jobs 4
$ sudo cp bin/phantomjs /bin/
$ sudo npm install gitbook-pdf -g #重新進(jìn)行安裝

 然后,使用下面的命令,要PDF文件,首先安裝依賴(lài)庫(kù):

$ sudo apt-get install calibre 
$ gitbook -v 2.1.0 pdf .

 發(fā)生錯(cuò)誤:

*****************************************************

info: start conversion to pdf ....ERROR


Error: Command failed: /bin/sh -c ebook-convert /tmp/tmp-29384ctltwbk/SUMMARY.html /tmp/tmp-29384ctltwbk/index.pdf --title="" --comments="這本書(shū)是gitbook的一個(gè)例子" --language="en" --book-producer="GitBook" --publisher="GitBook" --chapter="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]" --chapter-mark="pagebreak" --page-breaks-before="/" --level1-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-1 ')]" --level2-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-2 ')]" --level3-toc="descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]" --no-chapters-in-toc --max-levels="1" --breadth-first --margin-left="62" --margin-right="62" --margin-top="56" --margin-bottom="56" --pdf-default-font-size="12" --pdf-mono-font-size="12" --paper-size="a4" --pdf-header-template="<p class='header'><span></span></p>" --pdf-footer-template="<p class='footer'><span>_SECTION_</span> <span style='float:right;'>_PAGENUM_</span></p>"
Usage: ebook-convert input_file output_file [options]


Convert an ebook from one format to another.


input_file is the input and output_file is the output. Both must be specified as the first two arguments to the command.


The output ebook format is guessed from the file extension of output_file. output_file can also be of the special format .EXT where EXT is the output file extension. In this case, the name of the output file is derived the name of the input file. Note that the filenames must not start with a hyphen. Finally, if output_file has no extension, then it is treated as a directory and an "open ebook" (OEB) consisting of HTML files is written to that directory. These files are the files that would normally have been passed to the output plugin.


After specifying the input and output file you can customize the conversion by specifying various options. The available options depend on the input and output file types. To get help on them specify the input and output file and then use the -h option.


For full documentation of the conversion system see
http://manual.calibre-ebook.com/conversion.html


Whenever you pass arguments to ebook-convert that have spaces in them, enclose the arguments in quotation marks.


ebook-convert: error: no such option: --pdf-default-font-size

*****************************************************

解決方法[2]

$ sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"


$ gitbook -v 2.1.0 pdf . # 重新執(zhí)行命令生成pdf,目標(biāo)文件為book.pdf

ref

===

1. http://phantomjs.org/build.html
2. http://calibre-ebook.com/download_linux

問(wèn)題

===

1. 如果輸入gitbook init命令,出現(xiàn)Installing version 2.1.0,

需要耐性等待安裝。

       以上就是我整理的gitbook的安裝與使用資料,謝謝大家支持!

相關(guān)文章

  • Linux查看端口、進(jìn)程情況及kill進(jìn)程的方法

    Linux查看端口、進(jìn)程情況及kill進(jìn)程的方法

    下面小編就為大家?guī)?lái)一篇Linux查看端口、進(jìn)程情況及kill進(jìn)程的方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-05-05
  • 自己常用的一些shell腳本分享

    自己常用的一些shell腳本分享

    這篇文章主要介紹了自己常用的一些shell腳本分享,包含20多個(gè)腳本實(shí)例,需要的朋友可以參考下
    2014-08-08
  • shell腳本中執(zhí)行時(shí)提示“沒(méi)有那個(gè)文件或目錄”的解決辦法

    shell腳本中執(zhí)行時(shí)提示“沒(méi)有那個(gè)文件或目錄”的解決辦法

    故障現(xiàn)象:在終端直接cd /var正常,在shell腳本中執(zhí)行則報(bào)錯(cuò)。原因是腳本是在windows平臺(tái)下寫(xiě)的,換行符與linux不同,造成腳本不能正確執(zhí)行
    2014-04-04
  • Bash腳本內(nèi)置的調(diào)試方法技巧

    Bash腳本內(nèi)置的調(diào)試方法技巧

    這篇文章主要介紹了Bash腳本內(nèi)置的調(diào)試方法技巧,本文介紹了調(diào)試技巧和幾個(gè)調(diào)試技巧,比如輸出行號(hào)的方法、只調(diào)試某段程序的方法,需要的朋友可以參考下
    2015-04-04
  • 學(xué)習(xí)linux常用命令(推薦)

    學(xué)習(xí)linux常用命令(推薦)

    本文給大家分享小編日常整理的有關(guān)linux常用命令,對(duì)大家今后的工作學(xué)習(xí)非常有幫助,對(duì)linux常用命令知識(shí)感興趣的朋友一起學(xué)習(xí)吧
    2016-11-11
  • 根據(jù)公司需求寫(xiě)的一個(gè)linux 巡檢小腳本

    根據(jù)公司需求寫(xiě)的一個(gè)linux 巡檢小腳本

    這篇文章主要介紹了根據(jù)公司需求寫(xiě)的一個(gè)linux 巡檢小腳本,可以用來(lái)檢查服務(wù)器的一些運(yùn)行狀況,需要的朋友可以參考下
    2017-04-04
  • Linux命令之lz4命令使用示例

    Linux命令之lz4命令使用示例

    lz4是一種非常快速的無(wú)損壓縮算法,基于字節(jié)對(duì)齊LZ77系列壓縮方案,它的特點(diǎn)是極快的解碼器,每核速度可達(dá)多GB/s,通常在多核系統(tǒng)上達(dá)到RAM速度限制項(xiàng)目,這篇文章主要介紹了Linux命令之lz4命令,需要的朋友可以參考下
    2023-03-03
  • shell查找符號(hào)鏈接及其指向目標(biāo)的方法介紹

    shell查找符號(hào)鏈接及其指向目標(biāo)的方法介紹

    本文為大家介紹一些處理符號(hào)鏈接的實(shí)踐方法,希望對(duì)大家編寫(xiě)shell腳本時(shí)帶來(lái)一些幫助,有需要的朋友不妨參考下
    2013-02-02
  • Linux重命名文件和文件夾的兩種方法

    Linux重命名文件和文件夾的兩種方法

    這篇文章主要介紹了Linux重命名文件和文件夾的兩種方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-12-12
  • Shell 函數(shù)參數(shù)

    Shell 函數(shù)參數(shù)

    這篇文章主要為大家分享了Shell 函數(shù)參數(shù),方便學(xué)習(xí)shell腳本的朋友
    2014-09-09

最新評(píng)論