Merge pull request #10 from wikiti/features/docx
Add support for docx format
This commit is contained in:
commit
979d7c95c5
|
|
@ -34,3 +34,8 @@ jobs:
|
||||||
name: Check if pdf exists
|
name: Check if pdf exists
|
||||||
command:
|
command:
|
||||||
test -s build/pdf/book.pdf
|
test -s build/pdf/book.pdf
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: Check if docx exists
|
||||||
|
command:
|
||||||
|
test -s build/docx/book.docx
|
||||||
|
|
|
||||||
10
Makefile
10
Makefile
|
|
@ -37,6 +37,7 @@ PANDOC_COMMAND = pandoc
|
||||||
EPUB_ARGS = --epub-cover-image=$(COVER_IMAGE)
|
EPUB_ARGS = --epub-cover-image=$(COVER_IMAGE)
|
||||||
HTML_ARGS = --standalone --to=html5
|
HTML_ARGS = --standalone --to=html5
|
||||||
PDF_ARGS = -V geometry:margin=1in -V documentclass=report --pdf-engine=xelatex
|
PDF_ARGS = -V geometry:margin=1in -V documentclass=report --pdf-engine=xelatex
|
||||||
|
DOCX_ARGS =
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Basic actions
|
# Basic actions
|
||||||
|
|
@ -44,7 +45,7 @@ PDF_ARGS = -V geometry:margin=1in -V documentclass=report --pdf-engine=xelatex
|
||||||
|
|
||||||
all: book
|
all: book
|
||||||
|
|
||||||
book: epub html pdf
|
book: epub html pdf docx
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r $(BUILD)
|
rm -r $(BUILD)
|
||||||
|
|
@ -59,6 +60,8 @@ html: $(BUILD)/html/$(OUTPUT_FILENAME).html
|
||||||
|
|
||||||
pdf: $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf
|
pdf: $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf
|
||||||
|
|
||||||
|
docx: $(BUILD)/docx/$(OUTPUT_FILENAME).docx
|
||||||
|
|
||||||
$(BUILD)/epub/$(OUTPUT_FILENAME).epub: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES) \
|
$(BUILD)/epub/$(OUTPUT_FILENAME).epub: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES) \
|
||||||
$(COVER_IMAGE)
|
$(COVER_IMAGE)
|
||||||
mkdir -p $(BUILD)/epub
|
mkdir -p $(BUILD)/epub
|
||||||
|
|
@ -76,3 +79,8 @@ $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_F
|
||||||
mkdir -p $(BUILD)/pdf
|
mkdir -p $(BUILD)/pdf
|
||||||
$(PANDOC_COMMAND) $(ARGS) $(PDF_ARGS) -o $@ $(CHAPTERS)
|
$(PANDOC_COMMAND) $(ARGS) $(PDF_ARGS) -o $@ $(CHAPTERS)
|
||||||
@echo "$@ was built"
|
@echo "$@ was built"
|
||||||
|
|
||||||
|
$(BUILD)/docx/$(OUTPUT_FILENAME).docx: $(MAKEFILE) $(METADATA) $(CHAPTERS) $(CSS_FILE) $(IMAGES)
|
||||||
|
mkdir -p $(BUILD)/docx
|
||||||
|
$(PANDOC_COMMAND) $(ARGS) $(DOCX_ARGS) -o $@ $(CHAPTERS)
|
||||||
|
@echo "$@ was built"
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -278,7 +278,13 @@ util*, we're going to use some *make* commands.
|
||||||
|
|
||||||
#### Export to PDF
|
#### Export to PDF
|
||||||
|
|
||||||
Use this command:
|
Please note that PDF file generation requires some extra dependencies (~ 800 MB):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt-get install texlive-xetex ttf-dejavu
|
||||||
|
```
|
||||||
|
|
||||||
|
After installing the dependencies, use this command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make pdf
|
make pdf
|
||||||
|
|
@ -286,12 +292,6 @@ make pdf
|
||||||
|
|
||||||
The generated file will be placed in *build/pdf*.
|
The generated file will be placed in *build/pdf*.
|
||||||
|
|
||||||
Please, note that PDF file generation requires some extra dependencies (~ 800 MB):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo apt-get install texlive-xetex ttf-dejavu
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Export to EPUB
|
#### Export to EPUB
|
||||||
|
|
||||||
Use this command:
|
Use this command:
|
||||||
|
|
@ -312,6 +312,16 @@ make html
|
||||||
|
|
||||||
The generated file(s) will be placed in *build/html*.
|
The generated file(s) will be placed in *build/html*.
|
||||||
|
|
||||||
|
#### Export to DOCX
|
||||||
|
|
||||||
|
Use this command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make docx
|
||||||
|
```
|
||||||
|
|
||||||
|
The generated file(s) will be placed in *build/docx*.
|
||||||
|
|
||||||
#### Extra configuration
|
#### Extra configuration
|
||||||
|
|
||||||
If you want to configure the output, you'll probably have to look the
|
If you want to configure the output, you'll probably have to look the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue