author | František Kučera <franta-hg@frantovo.cz> |
Fri, 10 May 2024 00:10:08 +0200 | |
branch | v_0 |
changeset 82 | a11239f9f9e7 |
parent 81 | 47717a4ed4bb |
permissions | -rw-r--r-- |
51
21dfb69028a0
name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents:
49
diff
changeset
|
1 |
# Sane software manifesto helper tools |
82
a11239f9f9e7
EPUB: move Preamble to the same level as other chapters
František Kučera <franta-hg@frantovo.cz>
parents:
81
diff
changeset
|
2 |
# Copyright © 2019-2024 František Kučera (Frantovo.cz, GlobalCode.info) |
15
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
# |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
# This program is free software: you can redistribute it and/or modify |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
# it under the terms of the GNU General Public License as published by |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
# the Free Software Foundation, version 3. |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
# |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
# This program is distributed in the hope that it will be useful, |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
# GNU General Public License for more details. |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
# |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
# You should have received a copy of the GNU General Public License |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
|
51
21dfb69028a0
name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents:
49
diff
changeset
|
16 |
VERSION_PARAMS := $(shell hg log -r '.' --template '--stringparam versionTag {latesttag} --stringparam versionDistance {latesttagdistance} --stringparam versionHash {node|short}') "--stringparam" "versionChangedFiles" $(shell hg status | wc -l) |
49
1dc027689f93
print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents:
47
diff
changeset
|
17 |
|
81
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
18 |
all: validate xhtml txt pdf build/ssm.en.epub logo-png statistics |
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
19 |
|
15
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
validate: |
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
21 |
xmllint --noout --schema schema/ssm.xsd text/ssm.en.xml |
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
22 |
|
81
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
23 |
xhtml: text/ssm.en.xml templates/cmunrm.woff templates/cmunbx.woff |
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
24 |
mkdir -p build |
49
1dc027689f93
print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents:
47
diff
changeset
|
25 |
xsltproc $(VERSION_PARAMS) --output build/index.xhtml --nonet templates/ssm.xhtml.xsl text/ssm.en.xml |
81
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
26 |
cp --reflink=auto templates/*.css build |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
27 |
cp --reflink=auto templates/*.woff build |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
28 |
|
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
29 |
build/ssm.en.epub: text/ssm.en.xml templates/ssm.xhtml.xsl templates/cmunrm.woff templates/cmunbx.woff |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
30 |
mkdir -p "build/epub/META-INF" |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
31 |
mkdir -p "build/epub/OEBPS" |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
32 |
echo -n "application/epub+zip" > "build/epub/mimetype" |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
33 |
xsltproc \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
34 |
--nonet \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
35 |
--xinclude \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
36 |
$(VERSION_PARAMS) \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
37 |
--output "build/epub/" \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
38 |
"templates/ssm.epub.xsl" \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
39 |
$(<) |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
40 |
cp --reflink=auto templates/*.css "build/epub/OEBPS/" |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
41 |
cp --reflink=auto templates/*.woff "build/epub/OEBPS/" |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
42 |
cd "build/epub/"; zip -r ../../$(@) \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
43 |
-X \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
44 |
--suffixes mimetype:jpg:jpeg:png:gif \ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
45 |
mimetype "META-INF/" "OEBPS/" |
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
46 |
|
67
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
47 |
templates/cmunrm.ttf: |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
48 |
cd templates/; ln -s /usr/share/fonts/truetype/cmu/cmunrm.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
49 |
|
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
50 |
templates/cmunbx.ttf: |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
51 |
cd templates/; ln -s /usr/share/fonts/truetype/cmu/cmunbx.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
52 |
|
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
53 |
templates/cmunrm.woff: templates/cmunrm.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
54 |
cd templates/; sfnt2woff cmunrm.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
55 |
|
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
56 |
templates/cmunbx.woff: templates/cmunbx.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
57 |
cd templates/; sfnt2woff cmunbx.ttf |
78eca0b3ab5f
style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents:
54
diff
changeset
|
58 |
|
36
9e5c3383ba50
add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
59 |
pdf: |
9e5c3383ba50
add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
60 |
mkdir -p build |
49
1dc027689f93
print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents:
47
diff
changeset
|
61 |
xsltproc $(VERSION_PARAMS) --output build/ssm.en.fodt --nonet templates/ssm.odt.xsl text/ssm.en.xml |
36
9e5c3383ba50
add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
62 |
libreoffice --convert-to pdf --outdir build build/ssm.en.fodt |
9e5c3383ba50
add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
63 |
|
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
64 |
# TODO: better line wrapping |
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
65 |
txt: |
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
66 |
mkdir -p build |
49
1dc027689f93
print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents:
47
diff
changeset
|
67 |
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 |
15
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
68 |
|
33
d6cb9fe26aed
logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
69 |
logo-png: |
d6cb9fe26aed
logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
70 |
mkdir -p build |
77
07cd1e608525
new inkscape CLI argument syntax
František Kučera <franta-hg@frantovo.cz>
parents:
71
diff
changeset
|
71 |
inkscape --export-filename=build/sane-software-logo-circle.png logo/sane-software-logo-circle.svg |
07cd1e608525
new inkscape CLI argument syntax
František Kučera <franta-hg@frantovo.cz>
parents:
71
diff
changeset
|
72 |
inkscape --export-filename=build/sane-software-logo-rectangle.png logo/sane-software-logo-rectangle.svg |
33
d6cb9fe26aed
logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
73 |
|
15
96fc2f42b1e1
conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
74 |
clean: |
25
8da11cce2c98
add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents:
20
diff
changeset
|
75 |
rm -rf build |
18 | 76 |
|
77 |
publish: |
|
81
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
78 |
scp build/*.* globalcode.info:/var/www/sane-software.globalcode.info/v_0/ |
47717a4ed4bb
add EPUB (eBook) output
František Kučera <franta-hg@frantovo.cz>
parents:
77
diff
changeset
|
79 |
scp license/*.* globalcode.info:/var/www/sane-software.globalcode.info/license/ |
20
fb939d9baaf4
make: statistics (just for fun)
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
80 |
|
fb939d9baaf4
make: statistics (just for fun)
František Kučera <franta-hg@frantovo.cz>
parents:
18
diff
changeset
|
81 |
|
54
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
82 |
# Described at: https://relational-pipes.globalcode.info/v_0/examples-in-xmltable-ssm-gui.xhtml |
47
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
83 |
build/statistics.rp: text/ssm.en.xml |
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
84 |
mkdir -p build |
27
413a00a9cde7
merge two sections into Semantic versioning and upgrades
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
85 |
cat text/ssm.en.xml \ |
54
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
86 |
| relpipe-in-xmltable \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
87 |
--namespace "m" "tag:globalcode.info,2019:sane-software/manifesto" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
88 |
--relation "chapter" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
89 |
--records "//m:chapter" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
90 |
--attribute "name" string "m:name" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
91 |
--attribute "requirements" integer "count(descendant::m:item[m:type='requirement'])" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
92 |
--attribute "recommendations" integer "count(descendant::m:item[m:type='recommendation'])" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
93 |
--attribute "informations" integer "count(descendant::m:item[m:type='information'])" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
94 |
--attribute "items_total" integer "count(descendant::m:item)" \ |
9f5de01bfd30
fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents:
51
diff
changeset
|
95 |
> build/statistics.rp |
47
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
96 |
|
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
97 |
# Prints a table with number of items in particular chapters: |
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
98 |
statistics: build/statistics.rp |
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
99 |
cat build/statistics.rp | relpipe-out-tabular |
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
100 |
|
7e665331bc32
item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
101 |
statistics-chart: build/statistics.rp |
71
cfd08606258a
Makefile: new relpipe-tr-cut syntax
František Kučera <franta-hg@frantovo.cz>
parents:
67
diff
changeset
|
102 |
cat build/statistics.rp | relpipe-tr-cut --relation ".*" --attribute "(name|.*s)" | relpipe-out-gui -title "Sane software manifesto – chart of rule types" |