sphinx-web/src/api/document.py
2022-08-13 12:38:25 +02:00

23 lines
506 B
Python

from flask import Blueprint, request
from markupsafe import escape
from web_utils.get_arg import get_arg
from data.document import Document
bp = Blueprint('document', __name__, url_prefix='/api/doc')
@bp.route('/build')
def build():
doc_name = get_arg('doc')
branch = get_arg('branch', 'master')
doc = Document(doc_name, branch)
output = ""
output += "\n# Pulling source...\n"
output += doc.pull()
output += "\n# Compiling...\n"
output += doc.build()
return output.replace('\n', '<br/>')