mirror of
https://gitlab.com/parroquia-san-leandro/cancionero-web.git
synced 2025-04-26 15:16:19 +02:00
songbook generator
This commit is contained in:
parent
c084ca2d89
commit
6535d4d7dd
5 changed files with 158 additions and 4 deletions
55
res/static/misa/editor.html
Normal file
55
res/static/misa/editor.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Editor</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<style>
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
ul li:before {
|
||||
content: '- \0000a0';
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var inputs = []
|
||||
|
||||
function changed() {
|
||||
var lastNum = document.getElementById("lastNum")
|
||||
if (lastNum.value) {
|
||||
inputs.push(lastNum)
|
||||
lastNum.name = "song[]"
|
||||
lastNum.onchange =
|
||||
lastNum.removeAttribute("onchange")
|
||||
lastNum.removeAttribute("onkeyup")
|
||||
lastNum.removeAttribute("id")
|
||||
|
||||
var newNum = document.createElement("INPUT")
|
||||
newNum.type = "number"
|
||||
newNum.id = "lastNum"
|
||||
newNum.max = 500
|
||||
newNum.min = 1
|
||||
newNum.onchange = newNum.onkeyup = () => changed()
|
||||
var li = document.createElement("LI")
|
||||
li.appendChild(newNum)
|
||||
document.getElementById("list").appendChild(li)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Editor</h1>
|
||||
</header>
|
||||
<main>
|
||||
<form action="generar.php" method="post">
|
||||
<ul id="list">
|
||||
<li><input id="lastNum" type="number" max="500" min="1" onkeyup="changed()" onchange="changed()"></li>
|
||||
</ul>
|
||||
<button type="submit">Enviar</button>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
21
res/static/misa/generar.php
Normal file
21
res/static/misa/generar.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
$song_list = "";
|
||||
foreach ($_POST["song"] as $i)
|
||||
if ($i) $song_list .= "$i ";
|
||||
|
||||
$cmd = "python3 ../../cancionero-web-python/src/latex_scanner.py";
|
||||
$cmd .= " --latex ../../cancionero-web-python/latex/cancionero.tex";
|
||||
$cmd .= " --other-latex ../../cancionero-web-python/latex/canciones/";
|
||||
$cmd .= " --other-index 400";
|
||||
$cmd .= " --output-dir .";
|
||||
$cmd .= " --output-file index.html";
|
||||
$cmd .= " --songs $song_list";
|
||||
exec($cmd, $output, $return_code);
|
||||
|
||||
foreach ($output as $line) echo "$line\n";
|
||||
|
||||
if ($return_code)
|
||||
echo "The return code was $return_code\n";
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue