Código

bastardo_frag_regex ='\d+\*\*'

 

 

                                frag_regex=bastardo_frag_regex)

 

bastardo_nu = FarabeufProcesser(location='data/Bastardo-Nudo.docx',

 

                                frag_regex=bastardo_frag_regex)

 

bastardo_de = FarabeufProcesser(location='data/Bastardo-Descenlace.docx',

 

                                frag_regex=bastardo_frag_regex)

 

@app.route('/', methods=['GET'])

 

def index():

 

    return render_template('index.html'), 200

 

@@ -42,7 +50,7 @@ def iterate():

 

    else:

 

        try:

 

            option = request.form['user_selection']

 

            fp, title = options[option]

 

            fp, title = farabeuf_options[option]

 

            fp.shuffle_indices()

 

            header = '''

 

            <!doctype html>

 

@@ -67,5 +75,33 @@ def iterate():

 

        except:

 

            return 'L\'erreur', 400

 

@app.route('/bastardo', methods=['GET'])

 

def bastardo():

 

    try:

 

        bastardo_pl.shuffle_indices()

 

        bastardo_nu.shuffle_indices()

 

        bastardo_de.shuffle_indices()

 

        header = '''

 

        <!doctype html>

 

        <meta name="viewport" content="width=device-width, initial-scale=1.0">

 

        <h1><i>Bastardo</i></h1>

 

        <i>David Núñez</i>

 

        <p>

 

        '''

 

        header += '''

 

        <button onclick="myFunction()">Iterar de nuevo</button>

 

        <script>

 

        function myFunction() {

 

        location.reload();

 

        }

 

        </script>

 

        '''

 

        output = bastardo_pl.join_doc(header=header)

 

        output = bastardo_nu.join_doc(header=output)

 

        output = bastardo_de.join_doc(header=output)

 

        return output, 200

 

    except:

 

        return 'L\'erreur', 400

   
 

if __name__ == '__main__':

 

    app.run(debug=True, host='0.0.0.0', port=8000)