|
|
@ -62,18 +62,13 @@ class Document: |
|
|
|
cmd.append(['git', 'pull']) |
|
|
|
cmd.append(['git', 'pull']) |
|
|
|
|
|
|
|
|
|
|
|
# build the HTML version |
|
|
|
# build the HTML version |
|
|
|
cmd.append(['sphinx-build', '-M', 'html', self.doc_path + "/repo/source", self.doc_path + "/build"]) |
|
|
|
cmd.append(['make', 'html', 'BUILDDIR=../build']) |
|
|
|
|
|
|
|
|
|
|
|
# build the PDF version |
|
|
|
# build the PDF version |
|
|
|
cmd.append(['sphinx-build', '-M', 'weasyprint', self.doc_path + '/repo/source', self.doc_path + '/build']) |
|
|
|
cmd.append(['make', 'pdf', 'BUILDDIR=../build']) |
|
|
|
cmd.append(['weasyprint', self.doc_path + '/build/weasyprint/index.html', self.doc_path + '/build/weasyprint/index.pdf', '-s', self.doc_path + '/repo/source/css/print-theme.css']) |
|
|
|
|
|
|
|
cmd.append(['sh', '-c', current_app.config['DATA_ROOT_DIR'] + '/../pdftoc-to-latex "' + self.doc_path + '/build/weasyprint/index.pdf" > "' + self.doc_path + '/build/weasyprint/toc.tex"']) |
|
|
|
|
|
|
|
cmd.append(['sh', '-c', 'pdflatex -interaction nonstopmode -output-directory="' + self.doc_path + '/build/weasyprint" "' + self.doc_path + '/build/weasyprint/toc.tex" || echo OK']) |
|
|
|
|
|
|
|
cmd.append(['pdftk', 'A=' + self.doc_path + '/build/weasyprint/index.pdf', 'B=' + self.doc_path + '/build/weasyprint/toc.pdf', 'cat', 'A1', 'B', 'A2-end', 'output', self.doc_path + '/build/weasyprint/vheliotech.pdf']) |
|
|
|
|
|
|
|
#cmd.append(['rm', self.doc_path + '/build/weasyprint/index.pdf', self.doc_path + '/build/weasyprint/toc.tex', self.doc_path + '/build/weasyprint/toc.pdf', self.doc_path + '/build/weasyprint/GuidedemontageVheliotech.pdf']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copy the generated PDF file to the HTML directory, so that it is accessible for download by users |
|
|
|
# Copy the generated PDF file to the HTML directory, so that it is accessible for download by users |
|
|
|
cmd.append(['cp', self.doc_path + '/build/weasyprint/vheliotech.pdf', self.doc_path + '/build/html/guide-de-montage-vheliotech.pdf']) |
|
|
|
cmd.append(['cp', self.doc_path + '/build/weasyprint/vheliotech.pdf', self.doc_path + '/build/html/' + self.doc_name + '.pdf']) |
|
|
|
|
|
|
|
|
|
|
|
task = ProcessTask(cmd, cwd = self.doc_path + "/repo") |
|
|
|
task = ProcessTask(cmd, cwd = self.doc_path + "/repo") |
|
|
|
task.start() |
|
|
|
task.start() |
|
|
@ -98,6 +93,9 @@ class Document: |
|
|
|
def get_url(self): |
|
|
|
def get_url(self): |
|
|
|
return "/doc/" + self.encoded_origin + "/" + sanitize_name(self.doc_name)+'/'+sanitize_name(self.branch) + "/index.html" |
|
|
|
return "/doc/" + self.encoded_origin + "/" + sanitize_name(self.doc_name)+'/'+sanitize_name(self.branch) + "/index.html" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_pdf_url(self): |
|
|
|
|
|
|
|
return "/doc/" + self.encoded_origin + "/" + sanitize_name(self.doc_name)+'/'+sanitize_name(self.branch) + "/" + self.doc_name + ".pdf" |
|
|
|
|
|
|
|
|
|
|
|
def get_api_key(self): |
|
|
|
def get_api_key(self): |
|
|
|
with open(self.doc_path + "/apikey") as f: |
|
|
|
with open(self.doc_path + "/apikey") as f: |
|
|
|
return f.read().replace('\n', '') |
|
|
|
return f.read().replace('\n', '') |
|
|
@ -151,8 +149,8 @@ class Document: |
|
|
|
cmd = [] |
|
|
|
cmd = [] |
|
|
|
cmd.append(['git', 'init', '--initial-branch=' + branch]) |
|
|
|
cmd.append(['git', 'init', '--initial-branch=' + branch]) |
|
|
|
cmd.append(['git', 'remote', 'add', '-f', 'origin', repo]) |
|
|
|
cmd.append(['git', 'remote', 'add', '-f', 'origin', repo]) |
|
|
|
cmd.append(['git', 'sparse-checkout', 'init']) |
|
|
|
#cmd.append(['git', 'sparse-checkout', 'init']) |
|
|
|
cmd.append(['git', 'sparse-checkout', 'set', source_dir]) |
|
|
|
#cmd.append(['git', 'sparse-checkout', 'set', source_dir]) |
|
|
|
cmd.append(['git', 'pull', 'origin', branch]) |
|
|
|
cmd.append(['git', 'pull', 'origin', branch]) |
|
|
|
cmd.append(['git', 'branch', '--set-upstream-to=origin/' + branch, branch]) |
|
|
|
cmd.append(['git', 'branch', '--set-upstream-to=origin/' + branch, branch]) |
|
|
|
|
|
|
|
|
|
|
|