Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 128 lines (113 sloc) 4.643 kb
89817fe @hxw [guten] Old gutenberg + non-working BookIndex.py
hxw authored
1 diff --git a/Makefile b/Makefile
2 index 0f1a9b1..3e2856f 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -27,6 +27,8 @@
6 #
7 # XML_FILES list of files to process
8 #
9 +# EBOOK_FILES directory of ebook files to process
10 +#
11 # WIKI_LANGUAGE Language code [en]
12 #
13 # WIKI_LANGUAGE_VARIANT Variant Language code []
14 @@ -431,6 +433,9 @@ $(call STD_BASE, offline-renderer, ${HOST_TOOLS}/offline-renderer)
15 # wikis
16 XML_FILES_PATH = $(realpath ${XML_FILES})
17
18 +# Gutenberg
19 +EBOOK_FILES_PATH := $(realpath ${EBOOK_FILES})
20 +
21 # default for simgle machine
22 RENDER_BLOCK ?= 0
23
24 @@ -467,6 +472,17 @@ createdirs:
25 ${MKDIR} "${TEMPDIR_PATH}/${WIKI_LANGUAGE}${WIKI_DIR_SUFFIX}"
26
27
28 +.PHONY: bindex
29 +bindex: validate-destdir
30 + cd ${HOST_TOOLS}/offline-renderer && ${MAKE} bindex \
31 + WIKI_LANGUAGE="${WIKI_LANGUAGE}" \
32 + WIKI_LANGUAGE_VARIANT="${WIKI_LANGUAGE_VARIANT}" \
33 + WIKI_FILE_PREFIX="${WIKI_FILE_PREFIX}" \
34 + WIKI_DIR_SUFFIX="${WIKI_DIR_SUFFIX}" \
35 + EBOOK_FILES="${EBOOK_FILES_PATH}" \
36 + RENDER_BLOCK="${RENDER_BLOCK}" \
37 + WORKDIR="${WORKDIR_PATH}" DESTDIR="${DESTDIR_PATH}"
38 +
39 .PHONY: index
40 index: validate-destdir
41 ${MAKE} -C "${HOST_TOOLS}/offline-renderer" index \
42 @@ -525,6 +541,10 @@ combine: validate-destdir
43 .PHONY: iprc
44 iprc: index parse render combine
45
46 +# ebooks all stages
47 +.PHONY: brc
48 +brc: bindex render combine
49 +
50
51 # Build database using multiple machines
52 # ======================================
53 @@ -770,7 +790,7 @@ nls-install: validate-destdir
54 ( while read dir ; \
55 do \
56 d=$$(basename "$${dir}") ; \
57 - for suffix in books dict pedia quote starw trav ; \
58 + for suffix in books dict guten pedia quote starw trav ; \
59 do \
60 language="$${d%$${suffix}}" ; \
61 if [ X"$${language}" != X"$${d}" ] ; \
62 diff --git a/host-tools/offline-renderer/Makefile b/host-tools/offline-renderer/Makefile
63 index 819fce2..6db887b 100644
64 --- a/host-tools/offline-renderer/Makefile
65 +++ b/host-tools/offline-renderer/Makefile
66 @@ -47,6 +47,7 @@ WIKI_FILE_PREFIX ?= wiki
67 WIKI_LANGUAGE ?= en
68 WIKI_DIR_SUFFIX ?= pedia
69 WIKI_VERSION ?= $(shell date '+%Y%m%d')
70 +COLL_NUMBER ?= 0
71
72 ENABLE_LANGUAGES_LINKS ?= YES
73 ENABLE_IMAGES ?= YES
74 @@ -61,12 +62,12 @@ TEMPDIR_PATH := $(shell ${RESOLVEPATH} ${TEMPDIR}/${WIKI_LANGUAGE}${WIKI_DIR_SUF
75
76 DATA_PREFIX := $(shell ${RESOLVEPATH} ${DESTDIR}/${WIKI_LANGUAGE}${WIKI_DIR_SUFFIX}/${WIKI_FILE_PREFIX})
77 INDEX_PREFIX := $(shell ${RESOLVEPATH} ${WORKDIR}/${WIKI_LANGUAGE}${WIKI_DIR_SUFFIX}/${WIKI_FILE_PREFIX})
78 -ARTICLES := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/articles.db)
79 -COUNTS_FILE := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/counts.text)
80 -TEMPLATE_FILE := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/templates.db)
81 -OFFSETS := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/offsets.db)
82 +ARTICLES := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/articles${COLL_NUMBER}.db)
83 +COUNTS_FILE := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/counts${COLL_NUMBER}.text)
84 +TEMPLATE_FILE := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/templates${COLL_NUMBER}.db)
85 +OFFSETS := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/offsets${COLL_NUMBER}.db)
86 HTML_ARTICLES_PREFIX := $(shell ${RESOLVEPATH} ${WORKDIR_PATH}/articles-)
87 -HTML_ARTICLES := $(shell ${RESOLVEPATH} ${HTML_ARTICLES_PREFIX}${RENDER_BLOCK}.html)
88 +HTML_ARTICLES := $(shell ${RESOLVEPATH} ${HTML_ARTICLES_PREFIX}${COLL_NUMBER}-${RENDER_BLOCK}.html)
89
90 VERSION_FILE := ${DATA_PREFIX}.ftr
91
92 @@ -122,6 +123,10 @@ all: ${TARGETS}
93 check-xml:
94 @if [ -z "${XML_FILES}" ] ; then echo XML_FILES is not set ; exit 1; fi
95
96 +.PHONY: check-ebook
97 +check-ebook:
98 + @if [ -z "${EBOOK_FILES}" ] ; then echo EBOOK_FILES is not set ; exit 1; fi
99 +
100 .PHONY: check-dirs
101 check-dirs:
102 @if [ ! -d "${DESTDIR}" ] ; then echo DESTDIR: "'"${DESTDIR}"'" is not a directory ; exit 1; fi
103 @@ -138,6 +143,15 @@ check-html:
104 @if [ -z "${HTML_ARTICLES}" ] ; then echo HTML_ARTICLES is not set ; exit 1; fi
105
106
107 +.PHONY: bindex
108 +bindex: check-dirs check-ebook
109 + ./BookIndex.py ${VERBOSE_ARG} \
110 + --article-index="${ARTICLES}" \
111 + --prefix="${DATA_PREFIX}" \
112 + --coll-number="${COLL_NUMBER}" \
113 + --xhtml="${HTML_ARTICLES}" \
114 + --workdir="${WORKDIR_PATH}/books" ${EBOOK_FILES}
115 +
116 .PHONY: index
117 index: check-dirs check-xml stamp-RedirectedTo.py stamp-PinyinTable.py stamp-user.dic ${IGNORED_TEMPLATES}
118 ./ArticleIndex.py ${VERBOSE_ARG} \
119 @@ -174,6 +188,8 @@ render: check-dirs check-fonts check-html stamp-PinyinTable.py stamp-user.dic
120 --block-size="${ARTICLE_BLOCK_SIZE}" \
121 --max-article-length="${MAX_ARTICLE_LENGTH}" \
122 "${HTML_ARTICLES}"
123 +# --coll-number="${COLL_NUMBER}"
124 +# --dat-number="${COLL_NUMBER}"
125
126 .PHONY: combine
127 combine: check-dirs
Something went wrong with that request. Please try again.