script pour établir une bdd Ãà partir d'un tsv avec différent format - retour accueil
git clone git://bebou.netlib.re/laradb
Log | Files | Refs |
commit e0362a01309bfd2f183852beabecfb2838073611 parent 0ccf2fdc468ff012d988907717152b02bf9c2dab Auteurice: martlem <contact@martinlemaire.fr> Date: Sat, 9 Nov 2024 11:01:26 +0100 table.sh trad nom des classes + vue en liste Diffstat:
M | src/static/script.js | | | 2 | +- |
M | src/static/style.css | | | 40 | +++++++++++++++++++++++++++++++++------- |
M | src/table.sh | | | 64 | ++++++++++++++++++++++++++++++++++------------------------------ |
3 files changed, 68 insertions(+), 38 deletions(-)
diff --git a/src/static/script.js b/src/static/script.js @@ -1,5 +1,5 @@ -const rows = document.querySelectorAll('table tr'); +const rows = document.querySelectorAll('#TABLEAU tbody tr'); rows.forEach(row => { row.addEventListener('click', () => { diff --git a/src/static/style.css b/src/static/style.css @@ -26,12 +26,43 @@ thead td{text-align:left} background:var(--fond-A); } #TABLEAU td { border-left:1px solid black;padding-left:0px} +#TABLEAU tr {display:flex;flex-wrap:wrap;height:var(--interligne);overflow:hidden; column-gap:0px} +#TABLEAU tr.show {height:auto} +#TABLEAU tr td{width:calc(var(--largeur) * 10)} +#TABLEAU tr td.numeros{width:calc(var(--largeur) * 4)} +#TABLEAU tr td:first-of-type{width:min(calc(var(--largeur) * 30), 100vw);} +#TABLEAU td.start-date, #TABLEAU td.end-date{width:11ch} +#TABLEAU td.number-of-issues {width:5ch} #TABLEAU tr:hover{background:var(--accent) !important} #TABLEAU tr.show {display:flex;flex-direction:column;flex-wrap:wrap;} -#TABLEAU tr.show td:not(:first-of-type){padding-left:var(--indent);width:calc(100% - var(--indent)) !important; border-top:1px solid black} +#TABLEAU tr.show td:not(:first-of-type){margin-left:var(--indent);width:min(100%, 960px) !important; +border-left:none; +border-top:1px solid black} #TABLEAU tr.show td {} -#TABLEAU tr.show td.date::before {content:"Title : "} +tr.show td::before {opacity:.3} +tr.show td.title::before {content:""} +tr.show td.start-date::before {content:"start date : "} +tr.show td.end-date::before {content:"end date : "} +tr.show td.number-of-issues::before {content:"number of issues : "} +tr.show td.city::before {content:"city : "} +tr.show td.country::before {content:"country : "} +tr.show td.language::before {content:"language : "} +tr.show td.full-title::before {content:"full title : "} +tr.show td.type::before {content:"type : "} +tr.show td.format::before {content:"format : "} +tr.show td.frequency::before {content:"frequency : "} +tr.show td.creators::before {content:"creators : "} +tr.show td.editor-in-chief::before {content:"editor in chief : "} +tr.show td.publisher::before {content:"publisher : "} +tr.show td.sources::before {content:"sources : "} +tr.show td.related-works::before {content:"related works : "} +tr.show td.comments::before {content:"comments : "} + + + + + /*tr { display: flex; flex-wrap: wrap; @@ -39,11 +70,6 @@ thead td{text-align:left} */ -#TABLEAU tr {display:flex;flex-wrap:wrap;height:var(--interligne);overflow:hidden; column-gap:0px} -#TABLEAU tr.show {height:auto} -#TABLEAU tr td{width:calc(var(--largeur) * 10)} -#TABLEAU tr td.numeros{width:calc(var(--largeur) * 4)} -#TABLEAU tr td:first-of-type{width:min(calc(var(--largeur) * 30), 100vw);} /* #TABLEAU tr { display: grid; grid-template-columns: repeat(8, 1fr [col-start]); diff --git a/src/table.sh b/src/table.sh @@ -4,15 +4,19 @@ echo Building table.html unsure(){ # Ã revoir, ne capture pas "Grenoble?, Lyon?" par exemple - sed -e '/\?/s/\(.*\?\)\?/<span class=\"unsure\">\1<\/span>/' -e 's/\?//g' $1 + sed -e '/\?/s/\(.*\?\)\?/<span class=\"unsure\">\1<\/span>/' -e 's/\?//g' $1 } format(){ - sed -e 's/\ mm/mm/g' $1 + sed -e 's/\ mm/mm/g' $1 +} + +trim() { + sed "s/^[ \t]*//" } entree(){ #echo "$line" | cut -d"," -f $1 - echo "$line" | tsv-select -f $1 | unsure | format + echo "$line" | tsv-select -f $1 | unsure | format | trim } DIST="dist" @@ -50,23 +54,23 @@ $(while IFS= read -r line; do cat <<- ENTETE <thead> <tr> - <td onclick="sortTable(2)" class="titre">$(entree 2)</td> - <td onclick="sortTable(4)" class="debut">$(entree 5)</td> - <td onclick="sortTable(5)" class="fin">$(entree 6)</td> - <td onclick="sortTable(6)" class="numeros">$(entree 7)</td> - <td onclick="sortTable(8)" class="ville">$(entree 9)</td> - <td onclick="sortTable(9)" class="pays">$(entree 10)</td> - <td onclick="sortTable(9)" class="language">$(entree 11)</td> - <td onclick="sortTable(2)" class="titre-complet">$(entree 3)</td> - <td onclick="sortTable(2)" class="type">$(entree 16)</td> - <td onclick="sortTable(7)" class="format">$(entree 7)</td> - <td onclick="sortTable(3)" class="periodicite">$(entree 4)</td> - <td onclick="sortTable(2)" class="creators">$(entree 14)</td> - <td onclick="sortTable(2)" class="editor-in-chief">$(entree 12)</td> - <td onclick="sortTable(2)" class="publisher">$(entree 17)</td> - <td onclick="sortTable(10)" class="sources">$(entree 13)</td> - <td onclick="sortTable(11)" class="travaux-lies">$(entree 15)</td> - <td onclick="sortTable(11)" class="comments">$(entree 16)</td> + <td onclick="sortTable(1)" class="title">$(entree 2)</td> + <td onclick="sortTable(2)" class="start-date">$(entree 5)</td> + <td onclick="sortTable(3)" class="end-date">$(entree 6)</td> + <td onclick="sortTable(4)" class="number-of-issues"><!--$(entree 7)-->#</td> + <td onclick="sortTable(5)" class="city">$(entree 9)</td> + <td onclick="sortTable(6)" class="country">$(entree 10)</td> + <td onclick="sortTable(7)" class="language">$(entree 11)</td> + <td onclick="sortTable(8)" class="full-title">$(entree 3)</td> + <td onclick="sortTable(9)" class="type">$(entree 16)</td> + <td onclick="sortTable(10)" class="format">$(entree 8)</td> + <td onclick="sortTable(11)" class="frequency">$(entree 4)</td> + <td onclick="sortTable(12)" class="creators">$(entree 14)</td> + <td onclick="sortTable(13)" class="editor-in-chief">$(entree 12)</td> + <td onclick="sortTable(14)" class="publisher">$(entree 17)</td> + <td onclick="sortTable(15)" class="sources">$(entree 13)</td> + <td onclick="sortTable(16)" class="related-works">$(entree 15)</td> + <td onclick="sortTable(17)" class="comments">$(entree 16)</td> </tr> </thead> @@ -75,22 +79,22 @@ ENTETE else cat <<- CORPS <tr> - <td class="titre">$(entree 2)</td> - <td class="debut">$(entree 5)</td> - <td class="fin">$(entree 6)</td> - <td class="numeros">$(entree 7)</td> - <td class="ville" $(entree 9) >$(entree 9 | unsure)</td> - <td class="pays">$(entree 10)</td> + <td class="title">$(entree 2)</td> + <td class="start-date">$(entree 5)</td> + <td class="end-date">$(entree 6)</td> + <td class="number-of-issues">$(entree 7)</td> + <td class="city" $(entree 9) >$(entree 9 | unsure)</td> + <td class="country">$(entree 10)</td> <td class="language">$(entree 11)</td> - <td class="titre-complet">$(entree 3)</td> + <td class="full-title">$(entree 3)</td> <td class="type">$(entree 16)</td> - <td class="format">$(entree 7)</td> - <td class="periodicite">$(entree 4 | unsure)</td> + <td class="format">$(entree 8)</td> + <td class="frequency">$(entree 4 | unsure)</td> <td class="creators">$(entree 14)</td> <td class="editor-in-chief">$(entree 12)</td> <td class="publisher">$(entree 17)</td> <td class="sources">$(entree 13)</td> - <td class="travaux-lies">$(entree 15)</td> + <td class="related-works">$(entree 15)</td> <td class="comments">$(entree 16)</td> </tr>