diff --git a/.env b/.env index 82ed52766..b9c04061c 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -VERSION="geklojban-1.2.1" -TITLE=The Complete GekLojban Languag +VERSION="geklojban-1.3.0" +TITLE=The Complete GekLojban Language PUBLISHER=An Illogical Language Group Publication diff --git a/.gitignore b/.gitignore index 4e6e945b8..a421fac9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .#* scripts/chapter-list* build/ +node_modules/ fontconfig/ xml/docbook-xsl-1.78.1/ xml/docbook-xsl-1.78.1.zip diff --git a/Dockerfile b/Dockerfile index 3bb38bc00..9c46b3c9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN dnf -y install vim sudo tmux zsh moreutils make moreutils sudo \ initscripts openssh man-db ncurses-compat-libs wget curl \ libcurl-devel pcre-devel bzip2-devel rsync zlib-devel \ pkgconfig w3m openssl-devel gcc rubygem-rake fpaste \ - zip unzip psmisc lsof python yum-plugin-ovl glibc-all-langpacks + zip unzip psmisc lsof python yum-plugin-ovl glibc-all-langpacks nodejs # Specifically needed packages, with versions where the package is # important. @@ -40,6 +40,9 @@ RUN bundle install RUN cd /usr/src ; wget https://www.princexml.com/download/prince-12.5-1.centos7.x86_64.rpm RUN dnf -y install /usr/src/prince-12.5-1.centos7.x86_64.rpm +# Install Nodejs scripts +RUN cd /srv/cll ; npm i + # Stuff to do on "boot" COPY container_init.sh /tmp/container_init.sh RUN sudo dos2unix /tmp/container_init.sh diff --git a/VERSION b/VERSION deleted file mode 100644 index 0bf2836c7..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -GekLojban-1.2.1 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..8b4731361 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "cll", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "htmldiff-js": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/htmldiff-js/-/htmldiff-js-1.0.5.tgz", + "integrity": "sha512-rmow9353OK0elkub15Sbze8Nj7BYfduqoJJw4yEvHHjOcHeCazNPk0PoUbjE8SvxKgjymeRIFU/OnS8jtitRtA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..ec8902165 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "cll", + "version": "1.0.0", + "description": "Node.js scripts", + "main": "scripts/diff.js", + "dependencies": { + "htmldiff-js": "^1.0.5" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/lojban/cll.git" + }, + "bugs": { + "url": "https://github.com/lojban/cll/issues" + }, + "homepage": "https://github.com/lojban/cll#readme" +} diff --git a/scripts/diff.js b/scripts/diff.js new file mode 100644 index 000000000..88f7f7575 --- /dev/null +++ b/scripts/diff.js @@ -0,0 +1,57 @@ +const HtmlDiff = require("htmldiff-js").default; +const fs = require("fs"), + path = require("path"); + +const oldFileName = "../build/cll_diffs/diff_old_xhtml_no_chunks/index.html"; +const newFileName = "../build/cll_diffs/diff_new_xhtml_no_chunks/index.html"; +const diffFileName = + "../build/cll_diffs/diff_new_xhtml_no_chunks/difference.html"; +const diffPrefixedFileName = + "../build/cll_diffs/diff_new_xhtml_no_chunks/difference_prefixed.html"; + +function getFileContent(pathTo) { + return fs.readFileSync(path.resolve(__dirname, pathTo), { + encoding: "utf8" + }); +} +try { + let result = HtmlDiff.execute( + getFileContent(oldFileName), + getFileContent(newFileName) + ).replace( + "
", + ` + + `); + let result_with_prefixes = result.replace("",``); + fs.writeFileSync(path.resolve(__dirname, diffFileName), result, { + encoding: "utf8" + }); + fs.writeFileSync(path.resolve(__dirname, diffPrefixedFileName), result_with_prefixes, { + encoding: "utf8" + }); +} catch (error) {} diff --git a/scripts/diff_official b/scripts/diff_official index e637b46d8..63b13a8f5 100755 --- a/scripts/diff_official +++ b/scripts/diff_official @@ -1,6 +1,6 @@ #!/bin/bash -tempdir=/tmp/cll_diffs +tempdir=./build/cll_diffs rm -rf $tempdir mkdir -p $tempdir @@ -123,6 +123,12 @@ do echo "Diffs found; stopping to let you examine them. If you want to show all diffs instead, run with -c" exit fi + if [[ $type == 'xhtml?no?chunks' ]] + then + echo "Preparing a visual HTML diff file ..." + node $PWD/scripts/diff + echo "A visual HTML diff is placed in $tempdir/diff_new_xhtml_no_chunks/difference.html and $tempdir/diff_new_xhtml_no_chunks/difference_prefixed.html files." + fi done echo diff --git a/scripts/update_jbovlaste_xml.sh b/scripts/update_jbovlaste_xml.sh index fc4fb307c..8d1c61e00 100755 --- a/scripts/update_jbovlaste_xml.sh +++ b/scripts/update_jbovlaste_xml.sh @@ -42,7 +42,7 @@ size="$(stat -c %s $builddir/jbovlaste.xml || echo 0)" if [ ! -f "$builddir/jbovlaste.xml" -o ! "$size" -o "$size" -lt 100 ] then echo - echo "old jbovlaste build file is bad; replacing" + echo "old jbovlaste build file is bad or doesn't exist; replacing" echo mv "$builddir/jbovlaste.xml.new" "$builddir/jbovlaste.xml" else