Compare commits
No commits in common. "5f90ed04397905cbd82e20c4b49a4c4eede3e604" and "c3695ad5facff8d9738e38583c08cdbc44d1b06f" have entirely different histories.
5f90ed0439
...
c3695ad5fa
18
Jakefile.js
18
Jakefile.js
@ -2,24 +2,16 @@
|
|||||||
/**
|
/**
|
||||||
* Installer Jake avec npm install -g jake (NodeJs doit être installé préalablement)
|
* Installer Jake avec npm install -g jake (NodeJs doit être installé préalablement)
|
||||||
*
|
*
|
||||||
* Lancer la compilation avec jake build[$version] où $version est le numéro de version.
|
* Lancer la compilation avec jake build[$version] où $version est le numéro de version
|
||||||
*
|
|
||||||
* Si $version commence par v, le répertoire de destination est dist, sinon c'est build.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
, exec = require('child_process').exec;
|
, exec = require('child_process').exec;
|
||||||
|
|
||||||
task('build', function (version) {
|
task('build', function (version) {
|
||||||
var destinationDir = 'build';
|
jake.rmRf('dist');
|
||||||
if (version.startsWith("v")) {
|
jake.mkdirP('dist');
|
||||||
destinationDir = 'dist';
|
compileJs(version, 'html2ods.js');
|
||||||
}
|
|
||||||
jake.rmRf(destinationDir);
|
|
||||||
jake.mkdirP(destinationDir);
|
|
||||||
compileJs(version, destinationDir + '/html2ods.js');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
task('default', ['build']);
|
task('default', ['build']);
|
||||||
@ -50,5 +42,5 @@ function compileJs(version, destination) {
|
|||||||
moduleContent = "/* version: " + version + " */\n" + moduleContent.replace(/\/\*[\s\S]*?\*\//g,'');
|
moduleContent = "/* version: " + version + " */\n" + moduleContent.replace(/\/\*[\s\S]*?\*\//g,'');
|
||||||
moduleContent = moduleContent.replace("//compile target", result);
|
moduleContent = moduleContent.replace("//compile target", result);
|
||||||
|
|
||||||
fs.writeFileSync(destination, moduleContent, 'utf8');
|
fs.writeFileSync('dist/' + destination, moduleContent, 'utf8');
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-left: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
border-width: 1px;
|
|
||||||
border-color: #2e3436;
|
|
||||||
border-style: solid;
|
|
||||||
font-size: small;
|
|
||||||
}
|
|
||||||
th {
|
|
||||||
padding: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small {
|
|
||||||
font-size: smaller;
|
|
||||||
}
|
|
||||||
|
|
||||||
.number {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************
|
|
||||||
* Styles ODS
|
|
||||||
* *************************/
|
|
||||||
|
|
||||||
column.Date {
|
|
||||||
width: 2cm;
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<title>Exemple après compilation dans Dist</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
|
||||||
<link href="dist.css" rel="stylesheet" type="text/css">
|
|
||||||
<script type="text/javascript" src="../dist/html2ods.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function fodsLink() {
|
|
||||||
let link = document.getElementById("link");
|
|
||||||
link.href = URL.createObjectURL(
|
|
||||||
Html2Ods.blob("table")
|
|
||||||
);
|
|
||||||
setTimeout(function () {
|
|
||||||
URL.revokeObjectURL(link.href);
|
|
||||||
}, 4E4); // 40s
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Exemple d'utilisation de jsHtml2Ods</h1>
|
|
||||||
<div>
|
|
||||||
<p><a href="blob:" download="table.fods" id="link" onclick="fodsLink()" id="link">Version ODS</a></p>
|
|
||||||
<table id="table"
|
|
||||||
data-od-sheetname="Tableau des clients"
|
|
||||||
data-od-currency="EUR"
|
|
||||||
data-od-fixed-rows="2"
|
|
||||||
data-od-fixed-columns="1">
|
|
||||||
<colgroup>
|
|
||||||
<col data-od-width="4cm">
|
|
||||||
<col span="2" data-od-style="Date">
|
|
||||||
<col>
|
|
||||||
<col>
|
|
||||||
</colgroup>
|
|
||||||
<colgroup span="2" class="moyennecolonne">
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr data-od-style="Entete">
|
|
||||||
<th rowspan="2">Client</th>
|
|
||||||
<th colspan="2">Dates</th>
|
|
||||||
<th rowspan="2">Nuitées</th>
|
|
||||||
<th rowspan="2">Facture</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th class="small">Départ</th>
|
|
||||||
<th class="small">Arrivée</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Victor Hugo</td>
|
|
||||||
<td data-od-type="date" data-od-text="2020-12-01">01/12/2020</td>
|
|
||||||
<td data-od-type="date" data-od-text="2021-01-11">11/01/2021</td>
|
|
||||||
<td data-od-type="number" class="number">40</td>
|
|
||||||
<td data-od-type="currency" data-od-text="1250" class="number">1 250 €</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
x
Reference in New Issue
Block a user