name: Sane software manifesto (lower case)
+ move common strings (title, url, author, license) from templates to the XML
+ fix changed files count
+ link to own license file
# Sane software manifesto helper tools
# Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
VERSION_PARAMS := $(shell hg log -r '.' --template '--stringparam versionTag {latesttag} --stringparam versionDistance {latesttagdistance} --stringparam versionHash {node|short}') "--stringparam" "versionChangedFiles" $(shell hg status | wc -l)
all: validate xhtml txt pdf logo-png statistics
validate:
xmllint --noout --schema schema/ssm.xsd text/ssm.en.xml
xhtml:
mkdir -p build
xsltproc $(VERSION_PARAMS) --output build/index.xhtml --nonet templates/ssm.xhtml.xsl text/ssm.en.xml
cp templates/*.css build
cp templates/*.woff build
pdf:
mkdir -p build
xsltproc $(VERSION_PARAMS) --output build/ssm.en.fodt --nonet templates/ssm.odt.xsl text/ssm.en.xml
libreoffice --convert-to pdf --outdir build build/ssm.en.fodt
# TODO: better line wrapping
txt:
mkdir -p build
xsltproc $(VERSION_PARAMS) --nonet templates/ssm.txt.xsl text/ssm.en.xml | fmt -w 74 -s | sed -E 's/( +)([^- ])/\1 \2/g' > build/ssm.en.txt
logo-png:
mkdir -p build
inkscape -z -e build/sane-software-logo-circle.png logo/sane-software-logo-circle.svg
inkscape -z -e build/sane-software-logo-rectangle.png logo/sane-software-logo-rectangle.svg
clean:
rm -rf build
publish:
scp build/* globalcode.info:/var/www/sane-software.globalcode.info/v_0/
scp license/* globalcode.info:/var/www/sane-software.globalcode.info/license/
build/statistics.rp: text/ssm.en.xml
mkdir -p build
cat text/ssm.en.xml \
| relpipe-in-xmltable \
--namespace "m" "tag:globalcode.info,2019:sane-software/manifesto" \
--relation "chapter" \
--records "//m:chapter" \
--attribute "name" string "m:name" \
--attribute "requirements" integer "count(descendant::m:item[m:type='requirement'])" \
--attribute "recommendations" integer "count(descendant::m:item[m:type='recommendation'])" \
--attribute "informations" integer "count(descendant::m:item[m:type='information'])" \
--attribute "items_total" integer "count(descendant::m:item)" \
> build/statistics.rp
# Prints a table with number of items in particular chapters:
statistics: build/statistics.rp
cat build/statistics.rp | relpipe-out-tabular
statistics-chart: build/statistics.rp
cat build/statistics.rp | relpipe-tr-cut ".*" "(name|.*s)" | relpipe-out-gui -title "Sane software manifesto – chart of rule types"