From 024aa71255f1fdd05c9433e10662e7b79a8ccea1 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 11 May 2022 18:12:40 +0200 Subject: Add products/ --- products/hyde/index.rhtml | 71 ++++++++++++++++++++++++++++++++++++++++ products/hyde/index.rhtml.config | 3 ++ 2 files changed, 74 insertions(+) create mode 100644 products/hyde/index.rhtml create mode 100644 products/hyde/index.rhtml.config diff --git a/products/hyde/index.rhtml b/products/hyde/index.rhtml new file mode 100644 index 0000000..5db1b76 --- /dev/null +++ b/products/hyde/index.rhtml @@ -0,0 +1,71 @@ +

Hyde

+

È un piccolo strumento per generare siti web statici. La sua forza sta nella semplicità di + utilizzo. Non è stata reinventata la ruota; hyde è stato scritto in Ruby e fa uso di template ERB.

+

Il principio di funzionamento è quello di avere una pagina master che definisce il layout del contenuto del + sito web e dei file (per il momento ci si limita ai file HTML) che vengono inglobati. In questo modo è + possibile separare la grafica dal contenuto.

+

Di seguito viene mostrato un piccolo esempio di un sito con due pagine molto semplici. Per prima cosa si definisce + un file master.rhtml che serve da template.

+ +master.rhtml +

+<html>
+  <head>
+    <title><%= @title %></title>
+  </head>
+  <body>
+    <div style="border: 1px solid orange">
+      <%= render @pageFileName %>
+    </div>
+  </body>
+</html>
+
+ +

Le variabili usate sono le seguenti:

+ + +pagina1.rhtml +

+<h1>Pagina uno</h1>
+<p>Contenuto della pagina 1.</p>
+<a href="pagina2.html">Pagina 2 &‍gt;</a>
+
+ +pagina2.rhtml +

+<h1>Pagina due</h1>
+<p>Contenuto della pagina 2.</p>
+<a href="pagina1.html">&‍lt; Pagina 1</a>
+
+ +pagina1.rhtml.config +

+title: Pagina 1
+
+ +pagina2.rhtml.config +

+title: Pagina 2
+
+ +

Dopo aver creato i file, si avrà la seguente situazione:

+

+$ ls -1
+master.rhtml
+pagina1.rhtml
+pagina1.rhtml.config
+pagina2.rhtml
+pagina2.rhtml.config
+
+ +

A questo punto, si eseguono i seguenti comandi:

+

+hyde -f pagina1.rhtml > pagina1.html
+hyde -f pagina2.rhtml > pagina2.html
+
+ +

Aprire i due file HTML (pagina1.html e pagina2.html) sul browser.

diff --git a/products/hyde/index.rhtml.config b/products/hyde/index.rhtml.config new file mode 100644 index 0000000..a7b02ce --- /dev/null +++ b/products/hyde/index.rhtml.config @@ -0,0 +1,3 @@ +title: Hyde +category: products +pageNames: [hyde] \ No newline at end of file -- cgit v1.2.3