relpipe-data/examples.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 00:43:11 +0100
branchv_0
changeset 329 5bc2bb8b7946
parent 244 d4f401b5f90c
permissions -rw-r--r--
Release v0.18

<stránka
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
	
	<nadpis>Examples</nadpis>
	<perex>Usage examples of Relational pipes tools</perex>
	<pořadí>40</pořadí>

	<text xmlns="http://www.w3.org/1999/xhtml">
		
		
		<p>
			All examples were tested in <a href="https://www.gnu.org/software/bash/">GNU Bash</a>.
			But they should also work in other shells.
		</p>
		
		<m:skript jazyk="bash" výstup="xhtml"><![CDATA[
			echo "<ul>";
			DIR=$(dirname "$XWG_STRANKA_SOUBOR");
			DIR="$DIR/../vstup"
			cd "$DIR";
			# TODO: use XQuery? (but Grep and Bash are everywhere)
			for f in examples-*.xml; do
				grep -oP '(?<=<m:pořadí-příkladu>).*(?=</m:pořadí-příkladu>)' $f | tr \\n ' '
				echo "<li><m:a href=\"${f//\.xml/}\">$(grep -oP '(?<=<nadpis>).*(?=</nadpis>)' $f)</m:a> – $(grep -oP '(?<=<perex>).+(?=</perex>)' $f)</li>";
			done | sort | sed -E 's/^[0-9]+ //'
			echo "</ul>";
		]]></m:skript>
		
	</text>

</stránka>