Commit 2f8a52e8 authored by Ludan Stoecklé's avatar Ludan Stoecklé

1.14.0

parent e162653b
...@@ -19,7 +19,7 @@ stages: ...@@ -19,7 +19,7 @@ stages:
# variables etc. # variables etc.
variables: variables:
ROSAENLG_VERSION: 1.13.0 ROSAENLG_VERSION: 1.14.0
DOCKER_REGISTRY: registry.gitlab.com/rosaenlg-projects/rosaenlg DOCKER_REGISTRY: registry.gitlab.com/rosaenlg-projects/rosaenlg
DOCKER_CLI_ROOT: ${DOCKER_REGISTRY}/cli DOCKER_CLI_ROOT: ${DOCKER_REGISTRY}/cli
DOCKER_SERVER_ROOT: ${DOCKER_REGISTRY}/server DOCKER_SERVER_ROOT: ${DOCKER_REGISTRY}/server
......
...@@ -13,7 +13,7 @@ console.log(`browser-ide-demo: using RosaeNLG version ${rosaeNlgVersion}`); ...@@ -13,7 +13,7 @@ console.log(`browser-ide-demo: using RosaeNLG version ${rosaeNlgVersion}`);
function init(cb) { function init(cb) {
const folders = ['dist']; const folders = ['dist'];
folders.forEach(dir => { folders.forEach((dir) => {
if (!fs.existsSync(dir)) { if (!fs.existsSync(dir)) {
fs.mkdirSync(dir); fs.mkdirSync(dir);
console.log('📁 folder created:', dir); console.log('📁 folder created:', dir);
...@@ -35,6 +35,7 @@ function copyStaticElts() { ...@@ -35,6 +35,7 @@ function copyStaticElts() {
`../rosaenlg/dist/rollup/rosaenlg_tiny_de_DE_${rosaeNlgVersion}_comp.js`, `../rosaenlg/dist/rollup/rosaenlg_tiny_de_DE_${rosaeNlgVersion}_comp.js`,
`../rosaenlg/dist/rollup/rosaenlg_tiny_it_IT_${rosaeNlgVersion}_comp.js`, `../rosaenlg/dist/rollup/rosaenlg_tiny_it_IT_${rosaeNlgVersion}_comp.js`,
`../rosaenlg/dist/rollup/rosaenlg_tiny_OTHER_${rosaeNlgVersion}_comp.js`, `../rosaenlg/dist/rollup/rosaenlg_tiny_OTHER_${rosaeNlgVersion}_comp.js`,
'../rosaenlg-packager/dist/rosaenlg-packager-bundle.js',
'lib/vue.min.js', 'lib/vue.min.js',
'src/app.css', 'src/app.css',
]).pipe(dest('dist/')); ]).pipe(dest('dist/'));
...@@ -102,7 +103,7 @@ function publishS3() { ...@@ -102,7 +103,7 @@ function publishS3() {
`dist/rosaenlg_tiny_OTHER_${rosaeNlgVersion}_comp.js`, `dist/rosaenlg_tiny_OTHER_${rosaeNlgVersion}_comp.js`,
]) ])
.pipe( .pipe(
rename(function(path) { rename(function (path) {
path.dirname = destFolder + path.dirname; path.dirname = destFolder + path.dirname;
}), }),
) )
...@@ -119,7 +120,7 @@ function publishS3() { ...@@ -119,7 +120,7 @@ function publishS3() {
return merge(gzip, plain) return merge(gzip, plain)
.pipe( .pipe(
rename(function(path) { rename(function (path) {
path.dirname = destFolder + path.dirname; path.dirname = destFolder + path.dirname;
}), }),
) )
......
{ {
"name": "browser-ide-demo", "name": "browser-ide-demo",
"version": "1.13.0", "version": "1.14.0",
"description": "Client side demo of NLG templates compilation and rendering using RosaeNLG", "description": "Client side demo of NLG templates compilation and rendering using RosaeNLG",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
"gulp-inject-string": "^1.1.2", "gulp-inject-string": "^1.1.2",
"gulp-rename": "^2.0.0", "gulp-rename": "^2.0.0",
"merge-stream": "^2.0.0", "merge-stream": "^2.0.0",
"rosaenlg": "1.13.0", "rosaenlg": "1.14.0",
"rosaenlg-packager": "0.1.0",
"vue-codemirror": "^4.0.6" "vue-codemirror": "^4.0.6"
} }
} }
...@@ -103,60 +103,81 @@ window.onload = function () { ...@@ -103,60 +103,81 @@ window.onload = function () {
this.userDownload(`${this.exampleName}.pug`, textFileAsBlob); this.userDownload(`${this.exampleName}.pug`, textFileAsBlob);
}, },
package() { getCleanName() {
// could use some share code like gulp-rosaenlg but is practical like this return this.exampleName.replace(/[^\w]/gi, '');
const name = this.exampleName.replace(/[^\w]/gi, ''); },
packageJson() {
const name = this.getCleanName();
const packaged = { const package = {
templateId: name,
src: { src: {
templateId: name,
entryTemplate: `${name}.pug`, entryTemplate: `${name}.pug`,
templates: {},
compileInfo: { compileInfo: {
activate: false, activate: true,
compileDebug: false, compileDebug: false,
language: language, language: language,
}, },
templates: {},
}, },
}; };
packaged.src.templates[`${name}.pug`] = this.code; package.src.templates[`${name}.pug`] = this.code;
const contentAsBlob = new Blob([JSON.stringify(packaged)], { type: 'application/json' }); rosaenlgPackager.completePackagedTemplateJson(package, this.getFctsHolder());
const contentAsBlob = new Blob([JSON.stringify(package)], { type: 'application/json' });
this.userDownload(`${name}.json`, contentAsBlob); this.userDownload(`${name}.json`, contentAsBlob);
}, },
packageJs() {
const name = this.getCleanName();
const staticFs = {};
staticFs[`${name}.pug`] = this.code;
const compiled = rosaenlgPackager.compileTemplateToJsString(
`${name}.pug`,
language,
staticFs,
this.getFctsHolder(),
);
const contentAsBlob = new Blob([compiled], {
type: 'text/javascript',
});
this.userDownload(`${name}.js`, contentAsBlob);
},
getFctsHolder() {
switch (language) {
case 'fr_FR': {
// eslint-disable-next-line @typescript-eslint/camelcase
return rosaenlg_fr_FR;
}
case 'de_DE': {
// eslint-disable-next-line @typescript-eslint/camelcase
return rosaenlg_de_DE;
}
case 'it_IT': {
// eslint-disable-next-line @typescript-eslint/camelcase
return rosaenlg_it_IT;
}
case 'en_US': {
// eslint-disable-next-line @typescript-eslint/camelcase
return rosaenlg_en_US;
}
case 'OTHER': {
// eslint-disable-next-line @typescript-eslint/camelcase
return rosaenlg_OTHER;
}
}
},
compileRender() { compileRender() {
pugTemplate = this.code; pugTemplate = this.code;
try { try {
let renderFct; const fctsHolder = this.getFctsHolder();
switch (language) { const rendered = fctsHolder.render(pugTemplate, {
case 'fr_FR': {
// eslint-disable-next-line @typescript-eslint/camelcase
renderFct = rosaenlg_fr_FR;
break;
}
case 'de_DE': {
// eslint-disable-next-line @typescript-eslint/camelcase
renderFct = rosaenlg_de_DE;
break;
}
case 'it_IT': {
// eslint-disable-next-line @typescript-eslint/camelcase
renderFct = rosaenlg_it_IT;
break;
}
case 'en_US': {
// eslint-disable-next-line @typescript-eslint/camelcase
renderFct = rosaenlg_en_US;
break;
}
case 'OTHER': {
// eslint-disable-next-line @typescript-eslint/camelcase
renderFct = rosaenlg_OTHER;
break;
}
}
const rendered = renderFct.render(pugTemplate, {
language: language, language: language,
}); });
this.errors = ''; this.errors = '';
......
...@@ -15,9 +15,12 @@ ...@@ -15,9 +15,12 @@
<script src="javascript.js"></script> <script src="javascript.js"></script>
<script> <script>
const language = '$lang$'; const language = '$lang$';
const rosaenlg = rosaenlg_$lang$;
// window.rosaenlg = rosaenlg_$lang$; // rosaenlg-packager needs it; and "const rosaenlg = ..." is not good enough
</script> </script>
<script src="app.min.js"></script> <script src="app.min.js"></script>
<script src="rosaenlg-packager-bundle.js"></script>
<link rel="stylesheet" href="app.css"> <link rel="stylesheet" href="app.css">
...@@ -36,9 +39,11 @@ ...@@ -36,9 +39,11 @@
<div class="block"> <div class="block">
<codemirror v-model="code" :options="cmOption"></codemirror> <codemirror v-model="code" :options="cmOption"></codemirror>
</div> </div>
<button v-on:click="compileRender()">Compile and render</button> <button v-on:click="compileRender()">Compile and render</button>
<br />
<button v-on:click="save()">Save</button> <button v-on:click="save()">Save</button>
<button v-on:click="package()">Package</button> <button v-on:click="packageJson()">Package JSON</button>
<button v-on:click="packageJs()">Package compiled JavaScript</button>
<span id="langlinks"> <span id="langlinks">
<a href="demo_en_US.html">English</a> <a href="demo_en_US.html">English</a>
<a href="demo_fr_FR.html">French</a> <a href="demo_fr_FR.html">French</a>
......
{ {
"name": "english-a-an-list", "name": "english-a-an-list",
"version": "0.5.0", "version": "0.6.0",
"description": "English words and adjectives that are preceded by the indefinite article 'an', based on WordNet", "description": "English words and adjectives that are preceded by the indefinite article 'an', based on WordNet",
"main": "dist/aan.json", "main": "dist/aan.json",
"scripts": { "scripts": {
......
{ {
"name": "english-a-an", "name": "english-a-an",
"version": "0.5.0", "version": "0.6.0",
"description": "English a/an indefinite articles, based on WordNet", "description": "English a/an indefinite articles, based on WordNet",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"url": "[email protected]:rosaenlg-projects/rosaenlg.git" "url": "[email protected]:rosaenlg-projects/rosaenlg.git"
}, },
"devDependencies": { "devDependencies": {
"english-a-an-list": "0.5.0", "english-a-an-list": "0.6.0",
"mocha": "^7.1.1", "mocha": "^7.1.1",
"typescript": "^3.7.2" "typescript": "^3.7.2"
}, },
......
{ {
"name": "english-determiners", "name": "english-determiners",
"version": "2.13.0", "version": "2.14.0",
"description": "English determiners", "description": "English determiners",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
......
{ {
"name": "english-plurals-list", "name": "english-plurals-list",
"version": "0.5.0", "version": "0.6.0",
"description": "English irregular plurals list, based on WordNet", "description": "English irregular plurals list, based on WordNet",
"main": "dist/plurals.json", "main": "dist/plurals.json",
"scripts": { "scripts": {
......
{ {
"name": "english-plurals", "name": "english-plurals",
"version": "0.5.0", "version": "0.6.0",
"description": "English plural of words", "description": "English plural of words",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
} }
}, },
"devDependencies": { "devDependencies": {
"english-plurals-list": "0.5.0", "english-plurals-list": "0.6.0",
"mocha": "^7.1.1", "mocha": "^7.1.1",
"nyc": "^15.0.0", "nyc": "^15.0.0",
"typescript": "^3.7.2" "typescript": "^3.7.2"
......
{ {
"name": "english-verbs-gerunds", "name": "english-verbs-gerunds",
"version": "0.5.0", "version": "0.6.0",
"description": "English irregular gerunds list (-ing), based on WordNet", "description": "English irregular gerunds list (-ing), based on WordNet",
"main": "dist/gerunds.json", "main": "dist/gerunds.json",
"scripts": { "scripts": {
......
{ {
"name": "english-verbs-helper", "name": "english-verbs-helper",
"version": "0.5.0", "version": "0.6.0",
"description": "English verbs conjugation", "description": "English verbs conjugation",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
} }
}, },
"devDependencies": { "devDependencies": {
"english-verbs-gerunds": "0.5.0", "english-verbs-gerunds": "0.6.0",
"english-verbs-irregular": "0.5.0", "english-verbs-irregular": "0.6.0",
"mocha": "^7.1.1", "mocha": "^7.1.1",
"nyc": "^15.0.0", "nyc": "^15.0.0",
"typescript": "^3.7.2" "typescript": "^3.7.2"
......
{ {
"name": "english-verbs-irregular", "name": "english-verbs-irregular",
"version": "0.5.0", "version": "0.6.0",
"description": "English irregular verbs list (JSON)", "description": "English irregular verbs list (JSON)",
"main": "dist/verbs.json", "main": "dist/verbs.json",
"scripts": { "scripts": {
......
{ {
"name": "french-adjectives", "name": "french-adjectives",
"version": "2.13.0", "version": "2.14.0",
"description": "Agreement of adjectives in French", "description": "Agreement of adjectives in French",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
}, },
"dependencies": { "dependencies": {
"debug": "^4.1.1", "debug": "^4.1.1",
"french-h-muet-aspire": "2.13.0" "french-h-muet-aspire": "2.14.0"
}, },
"keywords": [ "keywords": [
"french", "french",
......
{ {
"name": "french-determiners", "name": "french-determiners",
"version": "2.13.0", "version": "2.14.0",
"description": "French determiners", "description": "French determiners",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
......
{ {
"name": "french-h-muet-aspire", "name": "french-h-muet-aspire",
"version": "2.13.0", "version": "2.14.0",
"description": "List of French words that are 'aspiré' (vs. 'muet')", "description": "List of French words that are 'aspiré' (vs. 'muet')",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
......
{ {
"name": "french-ordinals", "name": "french-ordinals",
"version": "2.13.0", "version": "2.14.0",
"description": "Ordinal numbers in French: 12 => douzième", "description": "Ordinal numbers in French: 12 => douzième",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
......
{ {
"name": "french-verbs-intransitive", "name": "french-verbs-intransitive",
"version": "0.6.0", "version": "0.7.0",
"description": "list of intransitive French verbs", "description": "list of intransitive French verbs",
"main": "dist/intransitive.json", "main": "dist/intransitive.json",
"scripts": { "scripts": {
......
{ {
"name": "french-verbs-lefff", "name": "french-verbs-lefff",
"version": "0.6.0", "version": "0.7.0",
"description": "French verbs conjugation data, based on the Lefff content", "description": "French verbs conjugation data, based on the Lefff content",
"main": "dist/conjugations.json", "main": "dist/conjugations.json",
"scripts": { "scripts": {
......
{ {
"name": "french-verbs-transitive", "name": "french-verbs-transitive",
"version": "0.6.0", "version": "0.7.0",
"description": "French transitive verbs, based on Wikipedia", "description": "French transitive verbs, based on Wikipedia",
"main": "dist/transitive.json", "main": "dist/transitive.json",
"scripts": { "scripts": {
......
{ {
"name": "french-verbs", "name": "french-verbs",
"version": "2.13.0", "version": "2.14.0",
"description": "French verbs conjugation", "description": "French verbs conjugation",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
}, },
"dependencies": { "dependencies": {
"debug": "^4.1.1", "debug": "^4.1.1",
"french-h-muet-aspire": "2.13.0", "french-h-muet-aspire": "2.14.0",
"french-verbs-transitive": "0.6.0" "french-verbs-transitive": "0.7.0"
}, },
"devDependencies": { "devDependencies": {
"french-verbs-lefff": "0.6.0", "french-verbs-lefff": "0.7.0",
"mocha": "^7.1.1", "mocha": "^7.1.1",
"nyc": "^15.0.0",