Merge pull request #10 from wikiti/features/docx

Add support for docx format
This commit is contained in:
Wikiti 2020-02-03 18:49:12 +00:00 committed by GitHub
commit 979d7c95c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 8 deletions

View File

@ -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

View File

@ -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"

View File

@ -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