| Crates.io | veha |
| lib.rs | veha |
| version | 5.1.0 |
| created_at | 2025-02-15 10:26:24.059698+00 |
| updated_at | 2025-05-18 20:16:15.940856+00 |
| description | an open source utility that automates merging of written raw content and xml structures into web pages. |
| homepage | https://veha.techne.schloosser.com |
| repository | https://git.schloosser.net/veha/veha-rs |
| max_upload_size | |
| id | 1556653 |
| size | 208,551 |
veha-rs is an open source utility that automates merging of written raw content and xml structures into web pages.
You can think of veha-rs as LaTex for content rich web pages, or as an incremental evolution to PHP, combined with component-based approaches in modern HTML.
Veha is a set of standards to extend existing HTML [and XHTML] standard to work with raw. veha-rs is a pilot test of these standards in Rust to be used in server side rendering.
At its core, you can think of veha-rs as a production line which takes
and merges the data into the structure and forms a new XHTML file as output.
Additionally, as server side rendering enginge, you can supply a map of structure and output paths, and have veha-rs produce an entire website.
Supported data formats:
Future support planned: all open source SQL platforms [such as MySQL, Maria SQL, etc], LaTex, etc [to suggest a new input format open an issue or contact the author via email please].
CLI-program which takes XHTML documents and populates it with:
The German name for our code-base can be translated to: "Melter for Extendible Hypertext Markup Language" (Verschmelzer erweiterbare Hypertext-Auszeichnungssprache).
If you have Rust can Cargo installed, you can simply execute the following command:
cargo install veha
First clone the repository, then install the third-party packages via carge and finally run code-base via cargo
git clone https://git.schloosser.net/veha/veha-rs.git
cargo install
cargo run -- <input_file> <template_diretory> <output_file>
After installing the program, you can execute its functionality via the following two subcommands:
Please, keep in mind that your input file need to include the tags introduced by veha standard. A quick overview of said tags is available in the next section.
pageThe page subcommand processes a single XHTML page using the provided template and input file.
veha page <template> <input> <output> [--language <language_code>]
de, en, fr).siteThe site subcommand processes multiple XHTML pages using a mapping file that specifies input and output paths for each page.
veha site <template> <map> [--language <language_code>]
de, en, fr).Veha introduces a set of tags to empower including external raw data within a (X)HTML page.
The following observations can be made regarding these tags:
<md></md> to include a markdown file, which usually has the extension .md.src for providing a relative path to the data.name for providing the name of the tage which will be used to wrap the data within and replace the tag.multilingual="" to your data tag. [How it works read next segment].Warning (for veha-rs implementation): if you're coming from familiarity with HTML, please do not close tags within the same line; for example <tag /> will have strange and unexpected behaviors.
MultilingualWhen the attribute multilingual is set on a data tag, and veha-rs is provided with a --lang fr, for example, then the following files have to be present:
<md src="./post.md" multilingual=""></md>
This tag will be replaced with the content of ./post.fr.md when input --lang fr was supplied to veha-rs.
otherwise if no input language is provided, the default file name will be read. In this case ./post.md.
In the input file, you need to wrap all you wish to be included in your output file within a <template> tag:
<template src="./relative-path-to-template.xhtml">
<...>
</template>
and within your template directory, you need to include an empty <slot> tag which will be replaced with the content between the pervious tags.
Below is an example of a typical template file for a webpage:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<slot></slot>
</body>
</html>
If you are familiar with Tera, you can use the toml tag to read and replace data from a Toml file;
Since it is possible to use the tera tag multiple times, you can optionally supply a name attribute:
<toml src="./relative-path/to/config.toml" name="optional"></toml>
In order to have your markdown file automatically parsed into HTML and wrapped within a specified tag and included in the output file, you can use the following XML-format:
<md src="./relative-path-to-markdown-file.md" tag="div" class="md text whatever-you-like"></md>
as you can see above, aside from src and tag attributes of the <md> tag, any other attribute will be carried out to the final tag.
In the above example the final tag will look something like this:
<div class="md text whatever-you-like">...</div>
If you are unfamiliar with CSV files, the following might appear a bit of a strange behavior, and we are option to suggestion for change, but at the moment here is how the norm for our CSV-tag behaves:
<csv src="test">
<...>
<row src="row.xhtml" tag="div" class="wonderful">
</row>
<...>
</csv>
As you might have guessed by now, within this component file, you can use a predefined XML-tag <column> which accepts the attribute tag;
Additionally, you have supply the content attribute for the programm to determine which column you are referring;
optionally, you could supply an attribute attribute, which will tell the program to insert the content instead of the text content of the specified tag, as an attribute to the specified tag.
A typical example will look like this:
<column tag="div" class="header" content="title"></column>
A typical usecase for this optional attribute is when you would like the content of a particular column to be used as the href attribute for a link:
<column tag="a" class="title" content="link" attribute="href"></column>
Putting it all together, you can look at the below CSV example and the corresponding row.xhtml component:
acronym,description,link
CSV,comma seperated value,https://b-greve.gitbook.io/beginners-guide-to-clean-data/common-csv-problems/untitled
MD,markdown,https://hackernoon.com/a-beginners-guide-to-markdown-everything-you-need-to-know-to-get-started
XHTML,extensible hypertext markup langauge,https://www.nayuki.io/page/practical-guide-to-xhtml
<div class="row">
<column tag="a" class="title" content="link" attribute="href">
<column tag="div" class="short" content="acronym">
</column>
<column tag="div" class="long" content="description">
</column>
</column>
<footer>The link provided here is the result of a preliminary on web search engines; we take no responsibility for their content!</footer>
</div>
Notice: as you can see in this example, it is possible to use other HTML [and of course XHTML] tags within this component file; They will be repeated for each row of the CSV file.
For a quick example of what this tool is capable of, please look in the beispiel directory of this repository:
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
I'm looking forward to find collaborators who are eager and passionate to bring this idea into a full-fledged web framework ...
Alternative motors:
For my soulmate without whose love I could not afford my volunteer work!
The effort to translating veha standards into a server side rendering enginge started alongside the time I was trying to experiment with A.I.
The main credit for starting this project goes to Qwen, also because they released a coding assistant open-source which could be run locally, which ran with acceptable speed in previous gen CPU and integrated GPU!
Copyright (C) 2025 Hossein Rezaei (pen name: Isaak Engineer)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.