Skip to content

Commit 0f628ca

Browse files
committed
Refactored build scripts and schema to be in the website distribution. Revised manual structure. Some docs fixes.
Old code to be recycled.
1 parent b541ad3 commit 0f628ca

File tree

17 files changed

+205
-141
lines changed

17 files changed

+205
-141
lines changed

Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Default prefix; override with command line, e.g. "make install PREFIX=/usr"
2+
PREFIX ?= /usr/local
3+
4+
# Build directory for Meson
5+
BUILD_DIR ?= build
6+
7+
# Meson command, use muon if possible
8+
MESON ?= $(shell command -v muon >/dev/null 2>&1 && echo muon || echo meson)
9+
10+
BUILDTYPE ?= release
11+
12+
TOOLCHAIN ?= platforms/gcc.ini
13+
14+
.PHONY: all configure build install dist test clean docs
15+
16+
# Run all steps by default.
17+
all: configure build install docs
18+
19+
# Configure step.
20+
configure:
21+
@echo "Configuring project with $(MESON) (build type: $(BUILDTYPE))..."
22+
$(MESON) setup $(BUILD_DIR) -Db_lto=true -Db_thinlto_cache=true -Db_lto_mode=thin --reconfigure --prefix=$(PREFIX) --buildtype=$(BUILDTYPE) --native-file $(TOOLCHAIN)
23+
24+
# Build step depends on configuration.
25+
build: configure
26+
@echo "Building project with $(MESON)..."
27+
$(MESON) compile -C $(BUILD_DIR)
28+
29+
# Install step depends on building.
30+
install: build
31+
@echo "Installing project with $(MESON)..."
32+
$(MESON) install -C $(BUILD_DIR)
33+
34+
test: build
35+
$(MESON) test -C $(BUILD_DIR)
36+
37+
# Dist target: Create a distribution tarball.
38+
dist: install
39+
@echo "Creating tarball of the project via $(MESON)..."
40+
$(MESON) dist -C $(BUILD_DIR)
41+
42+
docs:
43+
doxygen ./dist/configs/Doxyfile
44+
mkdocs build -f ./dist/configs/mkdocs.yml
45+
46+
# Clean up the build directory.
47+
clean:
48+
@echo "Cleaning up build directory..."
49+
rm -rf $(BUILD_DIR)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,13 @@ bun run ./vs.templ.js [...]
8787

8888
## Installation
8989

90-
Check the [helper script](./scripts/build.sh). It will work out of the box on most systems.
91-
Still, to ensure expected behaviour, I highly suggest a dry run by setting `DESTDIR` somewhere safe.
90+
Check the [Makefile](./Makefile). It will work out of the box on most systems.
91+
There are some flags you can configure without having to touch Meson directly in there.
9292

9393
## Projects using `vs.templ`
9494

9595
- [vs](https://github.com/KaruroChori/vs-fltk) the parent project from which `vs.templ` derived.
96+
- [enance-amamento](https://github.com/KaruroChori/enance-amamento) as templating engine for the imported XML files.
9697
- [vs.http](https://github.com/lazy-eggplant/vs.http) an HTTP server built around `vs.templ`.
9798

9899
## Why?

RELEASE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
## v0.4.9
2+
3+
- [x] Refactored build scripts to make them more usable.
4+
- [x] Refactored schema, to make it available for distribution
5+
- [ ] Allow well-known URI alongside `vs.templ` as token to match namespace
6+
- [ ] Complete handling of `dst-children` in `for` which is only half-baked for now.
7+
- [ ] Revised manual, with explicit man pages for the binary, library and file format.

benchmark/meson.build

Whitespace-only changes.

dist/website/schema.rng

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<!-- TODO: Not ready yet! -->
2+
<!-- I need to learn this syntax :( -->
3+
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
4+
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
5+
<start>
6+
<ref name="anyElement" />
7+
</start>
8+
<define name="anyElement">
9+
<element>
10+
<anyName><except><nsName ns="vs-templ"></nsName></except></anyName>
11+
<ref name="both-attr"/>
12+
<mixed>
13+
<zeroOrMore>
14+
<ref name="both"/>
15+
</zeroOrMore>
16+
</mixed>
17+
</element>
18+
</define>
19+
20+
<define name="anyAttributes">
21+
<zeroOrMore>
22+
<attribute>
23+
<anyName><except><nsName ns="vs-templ"></nsName></except></anyName>
24+
</attribute>
25+
</zeroOrMore>
26+
</define>
27+
28+
<define name="static-attr" ns="vs-templ"> <!--why I need it here for tags but local for props?-->
29+
<zeroOrMore>
30+
<choice>
31+
<attribute name="eee" ns="vs-templ"></attribute>
32+
</choice>
33+
</zeroOrMore>
34+
</define>
35+
36+
<!--Put all definitions s:tag in here-->
37+
<define name="static" ns="vs-templ">
38+
<choice>
39+
<element name="for-range">
40+
<optional><attribute name="from"/></optional>
41+
<optional><attribute name="to"/></optional>
42+
<optional><attribute name="step"/></optional>
43+
<mixed>
44+
<zeroOrMore>
45+
<ref name="both"></ref>
46+
</zeroOrMore>
47+
</mixed>
48+
</element>
49+
<element name="for">
50+
<optional><attribute name="tag"/></optional>
51+
<choice><attribute name="in"/><attribute name="src"/></choice>
52+
<optional><attribute name="filter-by"/></optional>
53+
<optional><attribute name="sort-by"/></optional>
54+
<optional><attribute name="order-by"/></optional>
55+
<mixed>
56+
<zeroOrMore>
57+
<choice>
58+
<element name="header">
59+
<mixed>
60+
<zeroOrMore>
61+
<ref name="both"></ref>
62+
</zeroOrMore>
63+
</mixed>
64+
</element>
65+
<element name="footer">
66+
<mixed>
67+
<zeroOrMore>
68+
<ref name="both"></ref>
69+
</zeroOrMore>
70+
</mixed>
71+
</element>
72+
<element name="item">
73+
<mixed>
74+
<zeroOrMore>
75+
<ref name="both"></ref>
76+
</zeroOrMore>
77+
</mixed>
78+
</element>
79+
<element name="error">
80+
<mixed>
81+
<zeroOrMore>
82+
<ref name="both"></ref>
83+
</zeroOrMore>
84+
</mixed>
85+
</element>
86+
<element name="empty">
87+
<mixed>
88+
<zeroOrMore>
89+
<ref name="both"></ref>
90+
</zeroOrMore>
91+
</mixed>
92+
</element>
93+
</choice>
94+
</zeroOrMore>
95+
</mixed>
96+
</element>
97+
<!--<element name="for-prop"></element>-->
98+
<element name="element">
99+
<mixed>
100+
<zeroOrMore>
101+
<ref name="both"></ref>
102+
</zeroOrMore>
103+
</mixed>
104+
</element>
105+
<element name="value">
106+
<mixed>
107+
<zeroOrMore>
108+
<ref name="both"></ref>
109+
</zeroOrMore>
110+
</mixed>
111+
</element>
112+
<element name="calc">
113+
<mixed>
114+
<zeroOrMore>
115+
<ref name="both"></ref>
116+
</zeroOrMore>
117+
</mixed>
118+
</element>
119+
</choice>
120+
</define>
121+
122+
<!--Element collection to allow both s:tags and the rest within the same document-->
123+
<define name="both">
124+
<choice>
125+
<ref name="static"/>
126+
<ref name="anyElement"/>
127+
</choice>
128+
</define>
129+
130+
<define name="both-attr">
131+
<choice>
132+
<ref name="static-attr"/>
133+
<ref name="anyAttributes"/>
134+
</choice>
135+
</define>
136+
</grammar>

examples/advanced/tree-rewrite/templ.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<doc>
1+
<doc xmlns:s="vs.templ">
22
<s:for in="{$}/root" sort-by="~field-a" order-by=".desc" src-children="$" dst-children="item">
33
<s:item>
44
<item s:prop.0="~field-a|~!txt"/>

man/vs.templ.1

Whitespace-only changes.

man/vs.templ.3

Whitespace-only changes.

man/vs.templ.5

Whitespace-only changes.

old/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Material for deprecation, it will be removed before next release.

0 commit comments

Comments
 (0)