<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Netz - Rettung - Recht (Artikel mit Tag nanoc)</title>
    <link>https://netz-rettung-recht.de/</link>
    <description>Netzleben, Rettungs- und Rechtswesen</description>
    <dc:language>de</dc:language>
    <generator>Serendipity 2.5.0 - http://www.s9y.org/</generator>
    <pubDate>Sat, 11 May 2019 08:43:40 GMT</pubDate>

    <image>
    <url>https://netz-rettung-recht.de/templates/2k11/img/s9y_banner_small.png</url>
    <title>RSS: Netz - Rettung - Recht - Netzleben, Rettungs- und Rechtswesen</title>
    <link>https://netz-rettung-recht.de/</link>
    <width>100</width>
    <height>21</height>
</image>

<item>
    <title>FLOSS'n'net - Aktivitäten im 4. Quartal 2018</title>
    <link>https://netz-rettung-recht.de/archives/2139-FLOSSnnet-Aktivitaeten-im-4.-Quartal-2018.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/2139-FLOSSnnet-Aktivitaeten-im-4.-Quartal-2018.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=2139</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=2139</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;In den letzten drei Monaten des Jahres 2018 habe ich wieder ein wenig - sehr wenig! - Zeit gefunden, mich mit dem einen oder anderen Projekt rund um freie Software (&lt;a href=&quot;https://de.wikipedia.org/wiki/Free/Libre_Open_Source_Software&quot; title=&quot;&quot;&gt;FLOSS&lt;/a&gt;) oder das Netz zu beschäftigen. Dabei habe ich folgendes beigetragen:&lt;/p&gt;

&lt;h3 id=&quot;serendipity-s9y-&quot;&gt;Serendipity (&lt;em&gt;s9y&lt;/em&gt;)&lt;/h3&gt;

&lt;p&gt;Das Blogsystem &lt;a href=&quot;https://docs.s9y.org/&quot; title=&quot;Serendipity -  A reliable, secure and extensible PHP blog | Serendipity Blog System&quot;&gt;&lt;em&gt;Serendipity&lt;/em&gt;&lt;/a&gt; werkelt auch hinter diesem Blog.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bei dem &lt;em&gt;s9y&lt;/em&gt;-Plugin &lt;em&gt;serendipity_event_markdown&lt;/em&gt; habe ich die damit ausgelieferten Bibliotheken &lt;em&gt;Markdown&lt;/em&gt; und &lt;em&gt;SmartyPants&lt;/em&gt; aktualisiert.&lt;br /&gt;
&lt;a href=&quot;https://github.com/s9y/additional_plugins/pull/89&quot; title=&quot;[markdown] Upgrade Markdown Lib and SmartyPants Lib. by th-h · Pull Request #89 · s9y/additional_plugins · GitHub&quot;&gt;&lt;em&gt;Upgrade Markdown Lib and SmartyPants Lib.&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;nanoc&quot;&gt;Nanoc&lt;/h3&gt;

&lt;p&gt;U.a. meine Webseiten generiere ich mit &lt;a href=&quot;https://nanoc.ws/&quot; title=&quot;&quot;&gt;&lt;em&gt;Nanoc&lt;/em&gt;&lt;/a&gt;, einem Generator für statische Seiten.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Die im &lt;em&gt;blogging helper&lt;/em&gt; enthaltene Funktion &lt;code&gt;atom_feed()&lt;/code&gt; zur Generierung, nun ja, eines Atom-Feeds habe ich um die Möglichkeit ergänzt, die Titel der automatisch erzeugten Einträge anzupassen, wie dies auch schon für den Inhalt bzw. das Exzerpt der einzelnen Einträge möglich war.&lt;br /&gt;
&lt;a href=&quot;https://github.com/nanoc/nanoc/pull/1362&quot; title=&quot;Add title_proc parameter to blogging helper. by th-h · Pull Request #1362 · nanoc/nanoc · GitHub&quot;&gt;&lt;em&gt;Add title_proc parameter to blogging helper.&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Zwei Beiträge in drei Monaten ist &amp;#8230; nicht viel. Vielleicht finde ich 2019 wieder mehr Zeit.&lt;/p&gt;

&lt;p&gt;Vorherige Aktivitäten-Übersicht: &lt;a href=&quot;https://netz-rettung-recht.de/archives/2115-FLOSSnnet-Aktivitaeten-092018.html&quot; title=&quot;&quot;&gt;09/2018&lt;/a&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 30 Dec 2018 16:35:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/2139-guid.html</guid>
    <category>flossnet</category>
<category>nanoc</category>
<category>s9y</category>

</item>
<item>
    <title>Zeitstempel von Dateien unter Versionsverwaltung</title>
    <link>https://netz-rettung-recht.de/archives/2052-Zeitstempel-von-Dateien-unter-Versionsverwaltung.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/2052-Zeitstempel-von-Dateien-unter-Versionsverwaltung.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=2052</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=2052</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Die Verwaltung von Dateien in einem Versionskontrollsystem (VCS) wie &lt;em&gt;git&lt;/em&gt; hat einen Nachteil: der Zeitstempel im Dateisystem gibt nicht mehr den Zeitpunkt der letzten Änderung an dieser Datei wieder, sondern den Zeitpunkt, zu dem sie zuletzt (ggf. mit vielen anderen Dateien) ausgecheckt wurde.&lt;/p&gt;

&lt;p&gt;Für Webseiten bedeutet das, dass man für die Ausgabe des Datums der letzten Änderung nicht mehr auf den Zeitstempel der entsprechenden Datei zurückgreifen kann. Das macht mir nichts aus, denn zum einen verwende ich mittlerweile weitgehend statische Webseiten, bei denen das ohnehin nicht ohne weiteres möglich wäre, und zum anderen bringt dieser Ansatz zwar den Vorteil der Automatisierung mit sich, aber zugleich den - aus meiner Sicht überwiegenden - Nachteil, dass jeder verbesserte Tippfehler, jede unsichtbare Änderung am Seitengerüst als &amp;#8220;Update&amp;#8221; vermerkt wird, obwohl der Inhalt möglicherweise weiterhin völlig veraltet ist. Ich ziehe es daher vor, selbst zu entscheiden, was als &amp;#8220;Änderung&amp;#8221; gilt, und dann das Datum der letzten Änderung selbst zu setzen.&lt;/p&gt;

&lt;p&gt;So weit, so gut - aber wie sieht das mit Downloaddateien aus?&lt;/p&gt;

&lt;h3 id=&quot;zeitstempel-von-downloadangeboten-passend-setzen&quot;&gt;Zeitstempel von Downloadangeboten passend setzen&lt;/h3&gt;

&lt;p&gt;Jedenfalls dann, wenn man Downloadangebote nicht nur verlinkt, sondern den Downloadbereich auch als Dateiübersicht zugänglich macht - wie ich es &lt;a href=&quot;https://th-h.de/archives/&quot; title=&quot;Index of /archives&quot;&gt;auf meinen Webseiten&lt;/a&gt; tue -, ist es für den Nutzer gelinde gesagt verwirrend, wenn der angezeigte Zeitstempel der Dateien nichts mit der letzten Änderung derselben zu tun hat.&lt;/p&gt;

&lt;p&gt;Dafür gibt es natürlich verschiedene einfache Lösungen: Zum einen könnte ich darauf verzichten, einen Downloadbereich in diesem Sinne anzuzeigen, und die Dateien einfach nur verlinken. Tatsächlich sind die meisten Downloadangebote irgendwo auf meinen Seiten verlinkt, und ich speichere für sie auch Metadaten wie bspw. das Datum der letzten Änderung, das bei dem Link angezeigt wird, wie bspw. bei meinen &lt;a href=&quot;https://th-h.de/rescue/#downloads&quot; title=&quot;Rund um das Rettungswesen | th-h.de&quot;&gt;Downloads aus dem Bereich des Rettungswesens&lt;/a&gt;. Ich schätze es aber gerade, dass man in den Downloadangeboten auch &amp;#8220;einfach so&amp;#8221; stöbern kann. - Zum anderen könnte ich darauf verzichten, Downloads unter Versionskontrolle zu stellen, und sie in einem gesonderten Archiv speichern. Gerade für Software-Releases - und auch meine FAQs - wäre das vernünftig; beide werden ohnehin in gesonderten &lt;em&gt;git&lt;/em&gt;-Repositories versioniert, so dass es nicht erforderlich ist, einzelne Releases nochmal im Repository meiner Webseiten zu speichern. Andererseits gibt es aber Downloads, die nicht selbst unter Versionskontrolle stehen, und - mir viel wichtiger - eine getrennte Speicherung der Downloadangebote würde bedeuten, dass ich meine Webseiten nicht &amp;#8220;aus einem Guss&amp;#8221; aus dem &lt;em&gt;git&lt;/em&gt;-Repository erzeugen bzw. wiederherstellen kann; ich müsste dann den Downloadbereich getrennt sichern und einspielen.&lt;/p&gt;

&lt;p&gt;Trotz allem denke ich regelmäßig darüber nach, die Downloadangebote aus der Versionskontrolle herauszunehmen (das ist ja ein wenig auch eine Frage der Größe des Repositories). Bis dahin wollte ich aber eine andere Lösung für das Problem der &amp;#8220;falschen&amp;#8221; Zeitstempel im Directory-Listing - und eigentlich kann das so schwierig ja nicht sein: immerhin &lt;em&gt;habe&lt;/em&gt; ich Metadaten, aus denen sich für jede einzelne Datei im Downloadbereich das Datum der letzten (inhaltlichen) Änderung ergibt. Wie schwer kann es sein, den Zeitstempel - also das Datum der letzten Änderung der Datei im Dateisystem, die sog. &lt;em&gt;modification time&lt;/em&gt; oder kurz &lt;em&gt;mtime&lt;/em&gt; - passend zu setzen?&lt;/p&gt;

&lt;p&gt;Wie sich herausstellt: nicht sehr schwer. Es genügt, ein paar Zeilen als &lt;code&gt;postprocess&lt;/code&gt;-Block in der &lt;em&gt;Nanoc&lt;/em&gt;-Konfiguration hinzuzufügen:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;postprocess &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# iterate over all items starting with /archives/ or /net/usenet/faqs/ with kind &amp;amp;#8220;file&amp;amp;#8221; or &amp;amp;#8220;faq&amp;amp;#8221; that have &amp;amp;#8220;updated_at&amp;amp;#8221; set&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; items.&lt;span style=&quot;color:#CC0066; font-weight:bold;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;%&lt;/span&gt;r&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;lt;^&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;archives&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;net&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;usenet&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;faqs&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&amp;gt;&lt;/span&gt; =~ item.&lt;span style=&quot;color:#9900CC;&quot;&gt;identifier&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;amp;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;amp; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;file&amp;amp;#8217;, &amp;amp;#8216;faq&amp;amp;#8217; ].include?(item[:kind]) &amp;amp;amp;&amp;amp;amp;&amp;amp;#160;!item[:updated_at].nil? }.each do |item|&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# prefer the &amp;amp;#8220;text&amp;amp;#8221; representation, if available (for FAQs)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;unless&lt;/span&gt; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;reps&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:text&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#0000FF; font-weight:bold;&quot;&gt;nil&lt;/span&gt;?&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; path = item.&lt;span style=&quot;color:#9900CC;&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;rep: &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:text&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; path = item.&lt;span style=&quot;color:#9900CC;&quot;&gt;path&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# use the output files, not the source&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; path = &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@config&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:output_dir&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; path&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# change the mtime to &amp;amp;#8220;updated_at&amp;amp;#8221;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# &amp;amp;#8220;updated_at&amp;amp;#8221; is part Date (when set to 2017-10-01), part String (when set to &amp;amp;#8216;2017-10-01&amp;amp;#8217;),&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# so it has to be converted to strings and parsed (instead of using .to_time)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#CC00FF; font-weight:bold;&quot;&gt;FileUtils&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;touch&lt;/span&gt; path, &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:mtime&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#CC00FF; font-weight:bold;&quot;&gt;Time&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:updated_at&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;to_s&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Gut, die Zeitstempel sind jetzt immer noch auffällig, weil ich natürlich nur das Datum der letzten Änderung mitführe, nicht die Uhrzeit, und die Dateien daher scheinbar alle um Mitternacht erzeugt werden, aber damit lässt sich leben. Einziger Nachteil: Die unerwartet &amp;#8220;alten&amp;#8221; Dateien im Downloadbereich bringen das Dependency-Tracking von &lt;em&gt;Nanoc&lt;/em&gt; durcheinander und werden daher bei jedem Durchlauf neu erzeugt, weil die Ausgabedateien (mit einem Zeitstempel von vor einigen Monaten oder Jahren) scheinbar älter sind als die Quelldateien (die frisch aus der Versionskontrolle ausgecheckt wurden und daher einen aktuellen Zeitstempel haben), aber damit lässt sich leben.&lt;/p&gt;

&lt;h3 id=&quot;symlinks-erzeugen&quot;&gt;Symlinks erzeugen&lt;/h3&gt;

&lt;p&gt;Außerdem konnte ich so ein weiteres Problem lösen:&lt;/p&gt;

&lt;p&gt;Die Downloads meiner Scripts (und anderer Software) tragen die Versionsnummer im Dateinamen, bspw. &lt;code&gt;checkmail-0-6-1.tar.gz&lt;/code&gt; für die Version 0.6.1 von &lt;code&gt;checkmail&lt;/code&gt;. Ich möchte aber zugleich immer die aktuellste Version unter dem generischen Namen &lt;code&gt;checkmail.tar.gz&lt;/code&gt; anbieten. Nichts einfacher als das: &lt;code&gt;checkmail.tar.gz&lt;/code&gt; muss ein Symlink auf den jeweils neuesten &amp;#8220;versionierten&amp;#8221; Dateinamen sein. Das lässt sich so auch in das &lt;em&gt;gir&lt;/em&gt;-Repository einchecken &amp;#8230; nur bearbeite ich meine Webseiten unter Windows - und da ist das Konzept von &lt;em&gt;symbolic links&lt;/em&gt; eher nicht so bekannt. Dieses Problem hatte ich vorübergehend &amp;#8220;gelöst&amp;#8221;, indem ich einfach zwei identische Dateien gespeichert habe - aber das ist natürlich ein nerviger Hack, der doppelt Platz braucht und einfach nicht elegant ist.&lt;/p&gt;

&lt;p&gt;Nachdem ich jetzt ohnehin die Dateien im Downloadbereich nach ihrer Generierung nachbehandle, lassen sich dabei auch direkt die &lt;em&gt;Symlinks&lt;/em&gt; erzeugen - zwar immer noch aus einer Platzhalterdatei, aber dafür genügt dann eine leere Datei, die nur den passenden Namen trägt. Mein Ansatz dafür ist folgender (eingefügt in den oben bereits gezeigten Block):&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;postprocess &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8230;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# use the output files, not the source&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; path = &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@config&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:output_dir&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; path&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# generate symlinks&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;if&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:kind&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; == &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;file&amp;amp;#8217; &amp;amp;amp;&amp;amp;amp; item[:current]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# remove placeholder and symlink generic name (&amp;amp;#8216;myprog.tar.gz&amp;amp;#8217;)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# to current file (&amp;amp;#8216;myprog-1-2-17.tar.gz&amp;amp;#8217;)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#CC00FF; font-weight:bold;&quot;&gt;FileUtils&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;rm&lt;/span&gt; path&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#CC00FF; font-weight:bold;&quot;&gt;FileUtils&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;ln_s&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:current&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;, path&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# mtime shall be changed for the current file&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; path = &lt;span style=&quot;color:#CC00FF; font-weight:bold;&quot;&gt;File&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;dirname&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;path&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;/&amp;amp;#8217; + item[:current]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# change the mtime to &amp;amp;#8220;updated_at&amp;amp;#8221;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8230;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Insgesamt fühlt sich das immer noch wie ein Hack an, aber immerhin nicht mehr ganz so krude. &lt;img src=&quot;https://netz-rettung-recht.de/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/6b60e9cfe777446d9c4d57b097010356&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Mon, 15 Jan 2018 06:15:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/2052-guid.html</guid>
    <category>git</category>
<category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>Nanoc: Upgrade von 3.x auf 4.x</title>
    <link>https://netz-rettung-recht.de/archives/2022-Nanoc-Upgrade-von-3.x-auf-4.x.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/2022-Nanoc-Upgrade-von-3.x-auf-4.x.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=2022</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=2022</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;https://nanoc.ws/&quot; title=&quot;&quot;&gt;&lt;em&gt;Nanoc&lt;/em&gt;&lt;/a&gt; nutze ich schon mehr als drei Jahre zur Erzeugung verschiedener Websites; aber wie das so ist bei verschiedenen und zudem historisch gewachsenen Installationen, je mehr und je komplexer man ein Werkzeug einsetzt, desto größer ist der Angang bei notwendigen Änderungen. Und so habe ich das Upgrade auf &lt;em&gt;Nanoc 4&lt;/em&gt; - über dessen &lt;a href=&quot;https://netz-rettung-recht.de/archives/1855-nanoc-4.0.0-beta-1.html&quot; title=&quot;&quot;&gt;Beta&lt;/a&gt; ich damals bereits berichtete - dann auch gut zwei Jahre vor mir hergeschoben.&lt;/p&gt;

&lt;p&gt;Nunmehr werden aber endlich alle meine Präsenzen mit &lt;em&gt;Nanoc 4&lt;/em&gt; erzeugt.&lt;/p&gt;

&lt;p&gt;Es empfiehlt sich, den Umstieg anhand des &lt;a href=&quot;https://nanoc.ws/doc/nanoc-4-upgrade-guide/&quot; title=&quot;&quot;&gt;Upgrade-Guides&lt;/a&gt; vorzunehmen. Ich habe mich entschlossen, das Pattern-Matching auf &lt;em&gt;glob patterns&lt;/em&gt; umzustellen, aber bei &lt;em&gt;legacy identifiers&lt;/em&gt; zu bleiben, um den Umstellungsaufwand überschaubar zu halten. Außerdem verwende ich häufig Eltern-Kind-Relationen zwischen verschiedenen &lt;em&gt;Items&lt;/em&gt; (Seiten), die aber mit den &lt;em&gt;full identifiers&lt;/em&gt; (&amp;#8220;identifiers with extensions&amp;#8221;) nicht mehr unzweideutig bestehen (und, um überhaupt zu funktionieren, einen Rückgriff auf einen &lt;em&gt;Helper&lt;/em&gt; benötigen).&lt;/p&gt;

&lt;p&gt;An folgenden Stellen der Konfiguration ist daher Hand anzulegen (oder war &lt;em&gt;bei mir&lt;/em&gt; Hand anzulegen):&lt;/p&gt;

&lt;h3 id=&quot;datenquellen&quot;&gt;Datenquellen&lt;/h3&gt;

&lt;p&gt;In der &lt;code&gt;nanoc.yaml&lt;/code&gt; muss bei den &lt;code&gt;data_sources&lt;/code&gt; (meistens wohl &lt;code&gt;filesystem&lt;/code&gt;) ein &lt;code&gt;identifier_type: legacy&lt;/code&gt; eingefügt werden (Punkt 3 im &amp;#8220;quick upgrade guide&amp;#8221;).&lt;/p&gt;

&lt;p&gt;Was dort nicht steht: Die Datenquelle muss diese Konfiguration selbst umsetzen. Insbesondere für &lt;a href=&quot;https://netz-rettung-recht.de/archives/2005-Externe-Datenquellen-fuer-nanoc.html&quot; title=&quot;&quot;&gt;eigene Datenquellen&lt;/a&gt; genügt es also nicht, dort einfach &lt;code&gt;identifier_type: legacy&lt;/code&gt; einzufügen. Das festzustellen hat mich einige Zeit gekostet.&lt;/p&gt;

&lt;p&gt;Anzusetzten ist daher bei der Erzeugung von &lt;em&gt;Items&lt;/em&gt; in der Datenquelle. Dort ist ohnehin der Aufruf &lt;code&gt;Nanoc::Item.new&lt;/code&gt; durch &lt;code&gt;new_item&lt;/code&gt; zu ersetzen (Punkt 7 im &amp;#8220;quick guide&amp;#8221;). Das genügt aber nicht; der dritte Parameter dieses Funktionsaufrufs erwartet nämlich entweder einen String (der zu einem Identifier konvertiert wird) oder eine Instanz des Objekts &lt;code&gt;Nanoc::Identifier&lt;/code&gt;. Was ich nun in der Dokumentation nicht gefunden habe, ist folgendes: ein String wird immer zu einem &lt;em&gt;full identifier&lt;/em&gt; konvertiert! Will man &lt;em&gt;Items&lt;/em&gt; mit &lt;em&gt;legacy identifier&lt;/em&gt; erzeugen, muss man zwingend &lt;code&gt;Nanoc::Identifier&lt;/code&gt; instanziieren. Aus &lt;code&gt;&quot;/user/#{user[:id]}/&quot;&lt;/code&gt; wird also bspw. &lt;code&gt;Nanoc::Identifier.new(&quot;/user/#{user[:id]}/&quot;, type: :legacy)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Auf &lt;a href=&quot;https://github.com/nanoc/nanoc.ws/issues/202&quot; title=&quot;&quot;&gt;meinen Hinweis&lt;/a&gt; hin ist das nun der neue Punkt 8 im &amp;#8220;quick guide&amp;#8221;.)&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;rules&quot;&gt;Rules&lt;/h3&gt;

&lt;p&gt;Hat man - wie ich - auf &lt;em&gt;glob patterns&lt;/em&gt; gesetzt (sonst genügt ein &lt;code&gt;string_pattern_type: legacy&lt;/code&gt; in der &lt;code&gt;nanoc.yaml&lt;/code&gt;), müssen die &lt;code&gt;Rules&lt;/code&gt; angepasst werden. Ich verweise insoweit auf den Abschnitt &lt;a href=&quot;https://nanoc.ws/doc/nanoc-4-upgrade-guide/#enabling-glob-patterns&quot; title=&quot;&quot;&gt;&lt;em&gt;Enabling glob patterns&lt;/em&gt;&lt;/a&gt; im &lt;em&gt;Extended upgrade guide&lt;/em&gt; und die Dokumentation zu &lt;a href=&quot;https://nanoc.ws/doc/identifiers-and-patterns/&quot; title=&quot;&quot;&gt;&lt;em&gt;Identifiers and patterns&lt;/em&gt;&lt;/a&gt;, die man ohnehin einmal studieren sollte.&lt;/p&gt;

&lt;p&gt;Wichtig - und im Upgrade-Guide dann doch eher versteckt am Ende dargestellt - ist zudem, dass &lt;em&gt;Identifier&lt;/em&gt; keine Strings mehr sind, so dass String-Funktionen auf &lt;code&gt;item.identifier&lt;/code&gt; nicht mehr ohne weiteres angewandt werden können (bspw. &lt;code&gt;item.identifier.split&lt;/code&gt;). Bei jedem dieser Aufrufe muss daher zuvor eine Konvertierung in einen String erfolgen, alos &lt;code&gt;.to_s&lt;/code&gt; eingefügt werden: &lt;code&gt;item.identifier.to_s.split&lt;/code&gt; geht. Das gilt auch für &lt;em&gt;Helper&lt;/em&gt;-Funktionen u.ä., wo sich solche Aufrufe finden können. (Das hat in meinem Fall am meisten Zeit gekostet; auf die Lösung kam ich erst nach Lektüre der Beiträge der letzten Jahre in der &lt;em&gt;Nanoc&lt;/em&gt;-Mailingliste).&lt;/p&gt;

&lt;p&gt;Weitere Änderungen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In &lt;em&gt;compile&lt;/em&gt;-Regeln entfällt bei &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;layout&lt;/code&gt; und &lt;code&gt;snapshot&lt;/code&gt; ein ggf. vorangestelltes &lt;code&gt;rep.&lt;/code&gt; (&amp;#8220;quick guide&amp;#8221;, Punkt 5).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Falls jemand im &lt;em&gt;preprocess&lt;/em&gt;-Block &lt;em&gt;Items&lt;/em&gt; erzeugt, sollte er statt &lt;code&gt;Nanoc::Item.new&lt;/code&gt; jetzt &lt;code&gt;@items.create&lt;/code&gt; verwenden (&amp;#8220;quick guide&amp;#8221;, Punkt 6).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Überall, wo auf &lt;code&gt;reps[0]&lt;/code&gt; zugegriffen wird, muss stattdessen &lt;code&gt;.reps[:default]&lt;/code&gt; stehen (&amp;#8220;quick guide&amp;#8221;, jetzt Punkt 9).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Entsprechend muss &lt;code&gt;.rep_named(:something)&lt;/code&gt; durch &lt;code&gt;.reps[:somethink]&lt;/code&gt; ersetzt werden (&amp;#8220;quick guide&amp;#8221;, jetzt Punkt 10).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Zudem muss man nicht mehr zwischen &lt;em&gt;compile&lt;/em&gt;- und &lt;em&gt;routing&lt;/em&gt;-Regeln differenzieren: die &lt;code&gt;write&lt;/code&gt;-Anweisung erlaubt es, in einer &lt;em&gt;compile&lt;/em&gt;-Regel direkt auch festzulegen, wo das &lt;em&gt;Item&lt;/em&gt; ausgegeben werden soll. Das erscheint mir zwar praktisch, allerdings (ebenso wie die &lt;em&gt;full identifiers&lt;/em&gt;) eher etwas für neue Projekte oder eine Komplettüberarbeitung.&lt;/p&gt;

&lt;h3 id=&quot;funktionen-helper-und-filter-&quot;&gt;Funktionen, &lt;em&gt;Helper&lt;/em&gt; und &lt;em&gt;Filter&lt;/em&gt;&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Generell ist &lt;code&gt;Nanoc3&lt;/code&gt; durch &lt;code&gt;Nanoc&lt;/code&gt; zu ersetzen, bspw. bei Einbinden der mitgelieferten &lt;em&gt;Helper&lt;/em&gt;: aus &lt;code&gt;include Nanoc3::Helpers::Blogging&lt;/code&gt; wird &lt;code&gt;include Nanoc::Helpers::Blogging&lt;/code&gt; usw. (&amp;#8220;quick guide&amp;#8221;, Punkt 1).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Überall, wo auf &lt;code&gt;@site.config&lt;/code&gt; zugegriffen wird, gehört jetzt &lt;code&gt;@config&lt;/code&gt; hin (&amp;#8220;quick guide&amp;#8221;, Punkt 2).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alle Hinweise aus den vorstehenden Abschnitten gelten entsprechend auch für &lt;em&gt;Helper&lt;/em&gt; und &lt;em&gt;Filter&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An &lt;em&gt;Filter&lt;/em&gt; übergebene Parameter sind jetzt ebenfalls &lt;em&gt;immutable&lt;/em&gt;; man kann sie also nicht mehr verändern. Auch die Zuweisung an eine Variable hilft nicht. Man kann aber ggf. den Inhalt in eine Variable kopieren: &lt;code&gt;params_mutable = filterparams.dup&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;fazit&quot;&gt;Fazit&lt;/h3&gt;

&lt;p&gt;Der Upgrade-Guide ist gut, deckt aber nicht (unmittelbar) alle Fußangeln und Fallen ab; man sollte etwas Zeit für &lt;em&gt;trial and error&lt;/em&gt; einkalkulieren, insbesondere für größere, komplexere Projekte.&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/84812b6e2285419c97849e794b911273&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Fri, 01 Sep 2017 06:55:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/2022-guid.html</guid>
    <category>nanoc</category>

</item>
<item>
    <title>nanoc-dejure 1.2 released</title>
    <link>https://netz-rettung-recht.de/archives/2017-nanoc-dejure-1.2-released.html</link>
            <category>Bits'n'Bytes</category>
            <category>Releases</category>
    
    <comments>https://netz-rettung-recht.de/archives/2017-nanoc-dejure-1.2-released.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=2017</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=2017</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Mein &lt;a href=&quot;https://th-h.de/net/software/nanoc-dejure/&quot; title=&quot;Nanoc-Filter für dejure.org-Rechtsvernetzung | th-h.de&quot;&gt;&lt;em&gt;Nanoc&lt;/em&gt;-Filter&lt;/a&gt; für die juristische Vernetzungsfunktion von &lt;em&gt;dejure.org&lt;/em&gt; steht nun in der Version 1.2 zur Verfügung und ist damit - endlich - auch mit der aktuellen &lt;em&gt;Nanoc&lt;/em&gt;-Version 4.x kompatibel.&lt;/p&gt;

&lt;p&gt;Dazu gehören folgende Neuerungen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Die automatische Verlinkung kann für Überschriften (die HTML-Elemente &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; bis &lt;code&gt;&amp;lt;hx&amp;gt;&lt;/code&gt;) deaktiviert werden&lt;sup id=&quot;fnref:2017_1&quot;&gt;&lt;a href=&quot;#fn:2017_1&quot; class=&quot;footnote-ref&quot; role=&quot;doc-noteref&quot; title=&quot;&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verlinkungen erfolgen mit HTTPS als Protokoll&lt;sup id=&quot;fnref:2017_2&quot;&gt;&lt;a href=&quot;#fn:2017_2&quot; class=&quot;footnote-ref&quot; role=&quot;doc-noteref&quot; title=&quot;&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kompatibilität mit &lt;em&gt;Nanoc 4&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id=&quot;fn:2017_1&quot; role=&quot;doc-endnote&quot;&gt;
&lt;p&gt;Beides ist implementiert, scheint aber bei Tests noch nicht richtig zu funktionieren. Ich hoffe, dafür noch eine Lösung finden zu können, bin bislang aber ratlos, nachdem im Wesentlichen dieselbe Implementation für das &lt;em&gt;Serendipity&lt;/em&gt;-Plugin, das auch hier im Blog läuft, probemlos funktioniert.&amp;#160;&lt;a href=&quot;#fnref:2017_1&quot; class=&quot;footnote-backref&quot; role=&quot;doc-backlink&quot; title=&quot;&quot;&gt;&amp;#8617;&amp;#xFE0E;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li id=&quot;fn:2017_2&quot; role=&quot;doc-endnote&quot;&gt;
&lt;p&gt;Siehe Fußnote 1.&amp;#160;&lt;a href=&quot;#fnref:2017_2&quot; class=&quot;footnote-backref&quot; role=&quot;doc-backlink&quot; title=&quot;&quot;&gt;&amp;#8617;&amp;#xFE0E;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
 
    </content:encoded>

    <pubDate>Mon, 21 Aug 2017 09:00:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/2017-guid.html</guid>
    <category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>Externe Datenquellen für nanoc</title>
    <link>https://netz-rettung-recht.de/archives/2005-Externe-Datenquellen-fuer-nanoc.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/2005-Externe-Datenquellen-fuer-nanoc.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=2005</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=2005</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Bereits vor gut zwei Jahren hatte ich &lt;a href=&quot;https://netz-rettung-recht.de/archives/1850-nanoc-und-MySQL.html&quot; title=&quot;&quot;&gt;berichtet&lt;/a&gt;, wie man &lt;em&gt;nanoc&lt;/em&gt; mit einer (MySQL-)Datenbank als Datenquelle betreiben kann, und auf die entsprechende &lt;a href=&quot;https://nanoc.ws/doc/guides/using-external-sources/&quot; title=&quot;&quot;&gt;Dokumentation&lt;/a&gt; verwiesen. Schon damals hatte ich angemerkt, dass sich in dem dort gezeigten Weg möglicherweise ein Zwischenschritt einsparen lässt. Dies habe ich dann mittlerweile auch erfolgreich getestet.&lt;/p&gt;

&lt;h3 id=&quot;das-beispiel-aus-der-nanoc-dokumentation&quot;&gt;Das Beispiel aus der &lt;em&gt;nanoc&lt;/em&gt;-Dokumentation&lt;/h3&gt;

&lt;p&gt;Das in der &lt;em&gt;nanoc&lt;/em&gt;-Dokumentation gezeigte Beispiel generiert aus jedem Datensatz in der Datenbank ein &lt;em&gt;Item&lt;/em&gt; (also im Prinzip ein Dokument), das keinen Inhalt hat, aber die einzelnen Datenbankfelder als Attribute enthält, und erzeugt diese &amp;#8220;leeren&amp;#8221; Seiten unter &lt;code&gt;/external/hr/employees/&lt;/code&gt;. Das ergibt sich aus dem Zusammenwirken des Prefixes &lt;code&gt;items_root: /external/hr&lt;/code&gt; in der &lt;code&gt;nanoc.yaml&lt;/code&gt; einerseits und der Funktion zum Erzeugen von &lt;em&gt;Items&lt;/em&gt; in der Definition der Datenquelle andererseits:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;def&lt;/span&gt; items&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@db&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:employees&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;map&lt;/span&gt; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;employee&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; new_item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8221;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; employee,&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;/employees/#{employee[:id]}&amp;amp;#8221;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Für jeden Datensatz wird ein &lt;em&gt;Item&lt;/em&gt; &lt;code&gt;/employees/ID/&lt;/code&gt; (also für den Datensatz mit dem Feld &lt;code&gt;id: 1&lt;/code&gt; ein &lt;em&gt;Item&lt;/em&gt; &lt;code&gt;/employees/1/&lt;/code&gt;) erzeugt, dem der Pfad &lt;code&gt;/external/hr&lt;/code&gt; vorangestellt wird (also im Beispiel &lt;code&gt;/external/hr/employees/1/&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Alle diese Seiten dort sind leer, weshalb ihre Erzeugung im Beispiel auch unterdrückt wird. Von ihnen werden nur die Attribute (&amp;#8220;Metadaten&amp;#8221;) benötigt, um ein Verzeichnis mit allen Mitarbeitern zu erstellen.&lt;/p&gt;

&lt;h3 id=&quot;meine-anwendung-f-r-d-e-n-net-&quot;&gt;Meine Anwendung für &lt;em&gt;d-e-n.net&lt;/em&gt;&lt;/h3&gt;

&lt;p&gt;Diese Lösung hatte ich für die &amp;#8220;&lt;a href=&quot;http://d-e-n.net/user/&quot; title=&quot;302 Found&quot;&gt;Schreiberliste von &lt;em&gt;de.etc.notfallrettung&lt;/em&gt;&lt;/a&gt;&amp;#8221; übernommen.&lt;/p&gt;

&lt;p&gt;Da ich dort aber nicht nur eine Liste der Nutzer, sondern für jeden auch eine Profilseite benötige, war ich zweischrittig vorgegangen: in einem ersten Schritt wurden - wie im Beispiel - die Daten eingelesen und leere Seiten (unter &lt;code&gt;/_external/db/users/ID&lt;/code&gt;) erzeugt und in einem zweiten Schritt aus den Attributen dieser leeren Seiten entsprechende Profilseiten erstellt, indem im &lt;code&gt;preprocess&lt;/code&gt;-Block der &lt;code&gt;Rules&lt;/code&gt; eine entsprechende Funktion aufgerufen wurde.&lt;/p&gt;

&lt;p&gt;Schon damals fand ich das recht ineffizient: einmal &amp;#8220;leere&amp;#8221; Seiten nur mit Attributen erstellen, deren Ausgabe unterdrücken und dann für jedes dieser &amp;#8220;virtuellen&amp;#8221; &lt;em&gt;Items&lt;/em&gt; noch einmal eine Seite erzeugen, die dann ausgegeben wird? Warum nicht den ersten Schritt entfallen lassen und direkt die Profilseiten erstellen?&lt;/p&gt;

&lt;p&gt;Gesagt, (zwei Jahre später) getan: es genügt, &lt;code&gt;new_item()&lt;/code&gt; statt des &amp;#8220;leeren&amp;#8221; Inhalts den passenden Seiteninhalt zu übergeben (und ggf. die notwendigen Zusatzattribute hinzuzufügen):&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;def&lt;/span&gt; items&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@db&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:employees&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;map&lt;/span&gt; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;employee&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; new_item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;= render &amp;amp;#8216;profile&amp;amp;#8217;&amp;amp;#8221;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt;:updated_at &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; employee&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:changedate&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;, &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:title&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; employee&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:name&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:description&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;Profile of #{employee[:name]}&amp;amp;#8221;}.merge(employee),&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;/employees/#{employee[:id]}&amp;amp;#8221;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Dann musste nur noch - neben einigen Anpassungsarbeiten im Code - in der &lt;code&gt;nanoc.yaml&lt;/code&gt; entsprechend &lt;code&gt;items_root:&lt;/code&gt; auf &lt;code&gt;/&lt;/code&gt; gesetzt werden, damit die Daten auch unter &lt;code&gt;/user/ID&lt;/code&gt; aufscheinen, und schon war der unnötige Zwischenschritt entfallen.&lt;/p&gt;

&lt;h3 id=&quot;der-konkrete-code&quot;&gt;Der konkrete Code&lt;/h3&gt;

&lt;p&gt;Die Datenquelle wird dabei bei mir wie folgt in der &lt;code&gt;nanoc.yaml&lt;/code&gt; eingebunden:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;data_sources:&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;-&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# The type is the identifier of the data source. By default, this will be&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# &amp;lt;code&amp;gt;filesystem_unified&amp;lt;/code&amp;gt;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; type: filesystem_unified&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8230;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;-&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# Add mysql database (lib/data_sources/user_db)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; type: &amp;#160; &amp;#160; &amp;#160; &amp;#160; userdb&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; items_root: &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Definiert wird die Datenquelle dann in &lt;code&gt;lib/data_sources/user_db.rb&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# taken from http://nanoc.ws/docs/guides/using-external-sources/&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:#CC0066; font-weight:bold;&quot;&gt;require&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;sequel&amp;amp;#8217;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;class&lt;/span&gt; UserDataSource &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;lt; ::&lt;span style=&quot;color:#6666ff; font-weight:bold;&quot;&gt;Nanoc::DataSource&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; identifier &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:userdb&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;def&lt;/span&gt; up&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@db&lt;/span&gt; = Sequel.&lt;span style=&quot;color:#9900CC;&quot;&gt;mysql2&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:host&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8217;HOSTNAME&amp;amp;#8217;, :user=&amp;gt;&amp;amp;#8217;USER&amp;amp;#8217;, :password=&amp;gt;&amp;amp;#8217;PASS&amp;amp;#8217;, :database=&amp;gt;&amp;amp;#8217;DATABASE&amp;amp;#8217;)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; end&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;def&lt;/span&gt; items&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#0066ff; font-weight:bold;&quot;&gt;@db&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:users&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;map&lt;/span&gt; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;user&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;|&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; fullname = &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;user&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:vorname&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;,user&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:name&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;join&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8217; &amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# create profile page&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#6666ff; font-weight:bold;&quot;&gt;Nanoc::Item&lt;/span&gt;.&lt;span style=&quot;color:#9900CC;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;= render &amp;amp;#8216;profile&amp;amp;#8217;&amp;amp;#8221;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt;:author &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; fullname, &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:created_at&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;2002-11-14&amp;amp;#8217;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:updated_at&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; user&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:changedate&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;, &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:title&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;Profil von #{fullname}&amp;amp;#8221;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:short&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;#{fullname}&amp;amp;#8221;, :template =&amp;gt; &amp;amp;#8216;page-container&amp;amp;#8217;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:description&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;Profil des Autors #{fullname} in der Newsgroup de.etc.notfallrettung&amp;amp;#8221;}.merge(user),&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8220;/user/#{user[:id]}/&amp;amp;#8221;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; end&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Ich arbeite derzeit noch mit dem alten &lt;em&gt;nanoc&lt;/em&gt; 3.x, weshalb dort statt &lt;code&gt;new_item()&lt;/code&gt; noch &lt;code&gt;Nanoc::Item.new()&lt;/code&gt; verwendet wird.&lt;/p&gt;

&lt;p&gt;Mit der dargestellten Funktion in der Definition der Datenquelle wird für jeden Datensatz eine Seite (ein &lt;em&gt;Item&lt;/em&gt;) erzeugt, die (das) als einzigen Inhalt &lt;code&gt;= render &#039;profile&#039;&lt;/code&gt; enthält. Da in den &lt;code&gt;Rules&lt;/code&gt; angegeben ist, dass die Seiten unterhalb von &lt;code&gt;/user/&lt;/code&gt; einen &lt;em&gt;HAML&lt;/em&gt;-Filter durchlaufen, wird mithin der Inhalt der Datei &lt;code&gt;profile&lt;/code&gt; im Verzeichnis &lt;code&gt;/layouts/&lt;/code&gt; eingefügt - das Template für alle Profilseiten. Mit dem &lt;em&gt;ERB&lt;/em&gt;-Filter wäre entsprechend &lt;code&gt;&amp;lt;%= render &#039;profile&#039; %&amp;gt;&lt;/code&gt; einzufügen. Die erzeugte Seite bzw. das erzeugte &lt;em&gt;Item&lt;/em&gt; erhält überdies alle Felder aus dem Datensatz als Attribute übergeben, verbunden mit weiteren, zusätzlichen Attributen wie &lt;code&gt;:author&lt;/code&gt; oder &lt;code&gt;:title&lt;/code&gt;. Am Schluss bekommt die Seite / das &lt;em&gt;Item&lt;/em&gt; einen Identifier unter Nutzung des Datensatzfeldes &lt;code&gt;id&lt;/code&gt;, für &lt;code&gt;id: 1&lt;/code&gt; also dementsprechend &lt;code&gt;/user/1/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Fertig!&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/8381fb6728d94c49ad72dbb9ddb70695&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Mon, 24 Jul 2017 05:30:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/2005-guid.html</guid>
    <category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>Release-Prozess für FAQs</title>
    <link>https://netz-rettung-recht.de/archives/1999-Release-Prozess-fuer-FAQs.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1999-Release-Prozess-fuer-FAQs.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1999</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1999</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Die Überschrift klingt etwas bombastischer, als der Inhalt es ist &amp;#8230;&lt;/p&gt;

&lt;p&gt;Seit etlichen Jahren nutze ich &lt;em&gt;git&lt;/em&gt; zur Verwaltung sowohl meiner Software als auch für die von mir betreuten FAQs. Da lag es nahe, auch die Veröffentlichung neuer Fassungen derselben (&amp;#8220;Releases&amp;#8221;) nach Möglichkeit zu automatisieren. Für Software bedeutet das, die einzelnen Bestandteile in einen &lt;em&gt;Tarball&lt;/em&gt; zu packen, vielleicht Readme-Dateien zu erstellen, usw.; für FAQs ist ggf. zur reinen Textfassung eine HTML-Fassung zu erstellen, was sich insbesondere anbietet, wenn die Textfassung bereits aus &lt;em&gt;Markdown&lt;/em&gt; besteht. &lt;img src=&quot;https://netz-rettung-recht.de/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Für meine alten Webseiten hatte ich einige entsprechende Scripts geschrieben - eine Textdatei (FAQ) aus einem &lt;em&gt;Git&lt;/em&gt;-Repository zu holen und daraus ggf. noch eine HTML-Datei zu erstellen ist ja nun kein Hexenwerk. Bisher geschah das einfach &amp;#8220;live&amp;#8221; auf dem Webserver. Für meine neue Homepage war es mir aber wichtig, die gesamte Webpräsenz jederzeit neu generieren zu können, und das wiederum erforderte, dass sich die &amp;#8220;fertige&amp;#8221; FAQ (Text und HTML) dann auch im Repository für die Webseiten findet - oder von &lt;em&gt;nanoc&lt;/em&gt; aus diesem erzeugt werden kann.&lt;/p&gt;

&lt;h3 id=&quot;derzeitiger-stand&quot;&gt;Derzeitiger Stand&lt;/h3&gt;

&lt;p&gt;Daher gibt es jetzt ein &lt;a href=&quot;https://netz-rettung-recht.de/archives/1996-nanoc-commands.html&quot; title=&quot;&quot;&gt;&lt;em&gt;nanoc&lt;/em&gt;-Kommando&lt;/a&gt;, das diese Aufgaben wahrnimmt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Optional wird als erstes das Webseiten-Repository frisch ausgescheckt (d.h. dis bisherige Fassung gelöscht und durch eine komplett neue ersetzt).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dann wird die betreffende FAQ ausgecheckt, entweder als Textdatei gleichen Namens wie das Repository, oder als Textdatei aus meinem Repository für &lt;a href=&quot;http://code.th-h.de/?p=faqs/misc.git&quot; title=&quot;301 Moved Permanently&quot;&gt;vermischte kleine FAQs&lt;/a&gt;. In jedem Fall erhält sie die Endung &lt;code&gt;.md&lt;/code&gt; für &lt;em&gt;Markdown&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Die Metadaten für die FAQ - die vor dem ersten Checkout angelegt sein müssen - werden aktualisiert, insbesondere Änderungsdatum und Version, soweit vorhanden.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Danach werden die Änderungen ins Repository committed und können dann entweder nochmals geprüft oder direkt &amp;#8220;in einem Rutsch&amp;#8221; in das Webseiten-Repository gepushed werden.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;nanoc&lt;/em&gt; selbst wiederum erzeugt aus jeder FAQ eine Textfassung - so wie sie im Repository liegt - und, wenn dies nicht unterdrückt wird, auch eine HTML-Fassung, die dann in die Navigation eingebunden wird. Dabei werden die &amp;#8220;Pseudo-Header&amp;#8221; am Anfang einer FAQ (&lt;em&gt;Posting-frequency&lt;/em&gt; oder &lt;em&gt;Last-modified&lt;/em&gt;) entfernt. Die Veröffentlichung einer HTML-Fassung erfolgt derzeit aber nur, wenn die Textfassung auch wirklich &lt;em&gt;Markdown&lt;/em&gt; ist - das gilt bisher noch nicht für alle FAQs.&lt;/p&gt;

&lt;p&gt;Die notwendigen Metadaten stecken in einer gleichnamigen &lt;code&gt;.yaml&lt;/code&gt;-Datei, die für &lt;em&gt;nanoc&lt;/em&gt; Teil der FAQ ist. Ebenso habe ich das im übrigen auch für alle Downloads (PDF-Dateien, &lt;em&gt;Tarballs&lt;/em&gt; o.ä.) gelöst: es gibt immer eine gleichnamige Datei mit der Endung &lt;code&gt;.yaml&lt;/code&gt;, die Informationen über den Bearbeitungsstand, die Versionsnummer oder (bei Software) auch das Repository und den Bugtracker enthält. Mit diesen Metadaten können dann Download-Links und Infokästen erzeugt werden.&lt;/p&gt;

&lt;h3 id=&quot;-berlegungen-f-r-die-zukunft&quot;&gt;Überlegungen für die Zukunft&lt;/h3&gt;

&lt;p&gt;Zukünftig würde ich gerne auch HTML-Fassungen der anderen FAQs erzeugen, möglicherweise dann nicht aus einer Textfassung, die aus &lt;em&gt;Markdown&lt;/em&gt; besteht, sondern aus einem übergeordneten Format (Asciidoc?), aus dem sich HTML und eine etwas ansehnlichere Textfassung als Markdown mit komplexen Formatierungen erzeugen lassen.&lt;/p&gt;

&lt;p&gt;Und der deutlich aufwendigere zweite Teil des &amp;#8220;Release-Managements&amp;#8221; wird dann die Erzeugung von Software-Releases sein, nach Möglichkeit mit einem generischen Script. Dazu gehört nicht nur das Erzeugen eines &lt;em&gt;Tarballs&lt;/em&gt; (ggf. nur mit den Dateien, die auch zum Release gehören), sondern auch das Umkopieren älterer Fassungen und das Aktualisieren der Metadaten. Letzteres wird sich grundsätzlich wie bei FAQs lösen lassen, erfordert aber das Auslesen der Daten, die sich bei einer FAQ in den Pseudo-Headern finden, namentlich der Version und des Release-Datums. In einem weiteren Schritt wäre es dann auch schon, wenn aus README-Dateien automatisch Webseiten als Bestandteil meiner Webpräsenz erzeugt würden. Theoretisch ist das alles denkbar, praktisch werde ich darüber auch tatsächlich noch einige Zeit nachdenken müssen. &lt;img src=&quot;https://netz-rettung-recht.de/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Insoweit ist es vielleicht ganz gut, dass ich derzeit gar keine Zeit habe, irgendwelche Programme zu schreiben &amp;#8230;&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/28884a4546f24eb6ac6dae4bef1778b4&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Mon, 29 May 2017 05:30:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1999-guid.html</guid>
    <category>nanoc</category>

</item>
<item>
    <title>nanoc-dejure 1.0 released</title>
    <link>https://netz-rettung-recht.de/archives/1997-nanoc-dejure-1.0-released.html</link>
            <category>Bits'n'Bytes</category>
            <category>Releases</category>
    
    <comments>https://netz-rettung-recht.de/archives/1997-nanoc-dejure-1.0-released.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1997</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1997</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Drei Wochen nach der &lt;a href=&quot;https://netz-rettung-recht.de/archives/1992-Vernetzungsfunktion-von-dejure.org-als-nanoc-Filter.html&quot; title=&quot;&quot;&gt;ersten Fassung&lt;/a&gt; meines &lt;a href=&quot;http://th-h.de/net/software/nanoc-dejure/&quot; title=&quot;302 Found&quot;&gt;&lt;i&gt;nanoc&lt;/i&gt;-Filters&lt;/a&gt; für die juristische Vernetzungsfunktion von &lt;i&gt;dejure.org&lt;/i&gt; kann ich nun die Version &lt;strong&gt;1.0&lt;/strong&gt; präsentieren.&lt;/p&gt;

&lt;p&gt;Neben einem &lt;em&gt;Changelog&lt;/em&gt; und einer (englischsprachigen) &lt;em&gt;Readme&lt;/em&gt;-Datei gibt es folgende Neuerungen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Das Cache-Verzeichnis wird jetzt auch dann korrekt erzeugt, wenn das übergeordnete &lt;code&gt;tmp&lt;/code&gt;-Verzeichnis noch fehlt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Die Gültigkeitsdauer des Caches beträgt künftig standardmäßig sieben (und nicht nur vier) Tage. Sie ist außerdem konfigurierbar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dokumente ohne irgendwelche hinzuzufügenden Links werden platzsparender gecached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Der Aufruf der API erfolgt nunmehr über HTTPS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Einzelne Dokumente können durch Hinzufügen des Textes &lt;code&gt;&amp;lt;!-- no-dejure --&amp;gt;&lt;/code&gt; irgendwo auf der Seite von der Bearbeitung durch den Filter ausgenommen werden.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
 
    </content:encoded>

    <pubDate>Fri, 26 May 2017 05:10:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1997-guid.html</guid>
    <category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>nanoc commands</title>
    <link>https://netz-rettung-recht.de/archives/1996-nanoc-commands.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1996-nanoc-commands.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1996</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1996</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Vergangene Woche schrieb ich über &lt;a href=&quot;https://netz-rettung-recht.de/archives/1995-Git-Aliases.html&quot; title=&quot;&quot;&gt;Aliase für &lt;em&gt;Git&lt;/em&gt;&lt;/a&gt; - und heute möchte ich etwas ähnliches für &lt;em&gt;nanoc&lt;/em&gt; vorstellen.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;nanoc&lt;/em&gt; ermöglicht es nämlich, eigene Kommandos in Form von Ruby-Scripts zu definieren, die dann in &lt;code&gt;commands/&lt;/code&gt; gespeichert werden und - bspw. als &lt;code&gt;commands/COMMAND.rb&lt;/code&gt; - mit &lt;code&gt;nanoc COMMAND&lt;/code&gt; ausgeführt werden. Die Dokumentation hat unter der Überschrift &amp;#8220;&lt;a href=&quot;https://nanoc.ws/doc/cli/#writing-commands&quot; title=&quot;&quot;&gt;Writing commands&lt;/a&gt;&amp;#8221; ein Beispiel dazu und verweist ansonsten auf die Dokumentation von &lt;a href=&quot;http://www.rubydoc.info/gems/cri&quot; title=&quot;&quot;&gt;&lt;em&gt;Cri&lt;/em&gt;&lt;/a&gt;, dem dafür verwendeten Framework.&lt;/p&gt;

&lt;p&gt;Die Anwendungsmöglichkeiten dafür sind vielfältig:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Der &lt;a href=&quot;https://www.cccs.de/&quot; title=&quot;CCC Stuttgart - Startseite&quot;&gt;CCCS&lt;/a&gt; hat ein &lt;a href=&quot;https://github.com/cccs/cccs-website/blob/master/commands/create-flyer.rb&quot; title=&quot;cccs-website/commands/create-flyer.rb at master · cccs/cccs-website · GitHub&quot;&gt;Script&lt;/a&gt;, mit dem sich aus einem &lt;a href=&quot;https://github.com/cccs/cccs-website/blob/master/content/_data/aushang.svg&quot; title=&quot;cccs-website/content/_data/aushang.svg at master · cccs/cccs-website · GitHub&quot;&gt;Template&lt;/a&gt; Flyer für die Ankündigung von Vorträgen erzeugen lassen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Teilweise gebe ich RSS-Feeds als Bestandteil meiner Webseiten aus. Diese Feeds müssen natürlich regelmäßig ausgelesen werden, gefolgt von einem Rebuild der Webseite. Das entsprechende, per Cronjob aufgerufene Script hat, als &lt;em&gt;nanoc&lt;/em&gt;-Kommando implementiert, den Vorteil, jederzeit auch so aufgerufen werden zu können und im selben Repository zu stecken wie der Rest der Website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Die meisten meiner Webseiten haben ein Kommando, mit dem sich die Quelldateien komplett durch einen frischen Checkout ersetzen lassen, wenn bspw. einige Dateien gelöscht worden sind (was sonst bei meinem &lt;a href=&quot;https://netz-rettung-recht.de/archives/1994-Workflow-fuer-die-Erstellung-und-Pflege-von-Webseiten.html&quot; title=&quot;&quot;&gt;Workflow&lt;/a&gt; dazu führt, dass die Dateien weiter vorhanden bleiben). Im Prinzip wird dabei das Quellverzeichnis komplett geleert, dann ein frischer &lt;em&gt;Git&lt;/em&gt;-Checkout vorgenommen, &lt;code&gt;nanoc prune&lt;/code&gt; entfernt überzählige compilierte Dateien aus dem Ausgabeverzeichnis, und ggf. werden vor dem Compilieren noch RSS-Feeds ausgelesen oder andere notwendige Operationen vorgenommen, damit alle erforderlichen Daten für den Aufbau der Website zur Verfügung stehen.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Andere Beispiele:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://jakoblaegdsmand.com/en/blog/creating-screenshots-with-nanoc-command/&quot; title=&quot;Creating screenshots with nanoc command | Jakob Lægdsmand - Freelance web architect &amp;amp; developer&quot;&gt;Creating screenshots with nanoc command&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;a href=&quot;http://blog.arkency.com/2015/03/extract-a-service-object-in-any-framework/#before&quot; title=&quot;&quot;&gt;create-post&lt;/a&gt; command&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verwendet ihr auch &lt;em&gt;nanoc&lt;/em&gt;-Kommandos?&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 22 May 2017 04:05:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1996-guid.html</guid>
    <category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>Workflow für die Erstellung und Pflege von Webseiten</title>
    <link>https://netz-rettung-recht.de/archives/1994-Workflow-fuer-die-Erstellung-und-Pflege-von-Webseiten.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1994-Workflow-fuer-die-Erstellung-und-Pflege-von-Webseiten.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1994</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1994</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Ich stelle die von mir betriebenen Webseiten, die nicht auf interaktive Funktionen angewiesen sind, Stück für Stück auf statisch generierte Seiten um, zuletzt meine &lt;a href=&quot;https://netz-rettung-recht.de/archives/1987-Relaunch-von-th-h.de.html&quot; title=&quot;&quot;&gt;Homepage&lt;/a&gt;. Dabei setze ich auf einen Workflow, der &lt;em&gt;nanoc&lt;/em&gt; als &lt;em&gt;static site generator&lt;/em&gt; und &lt;em&gt;git&lt;/em&gt; als Versionsverwaltungssystem umfasst und dafür sorgt, dass Änderungen der Seiten automatisch eingespielt werden.&lt;/p&gt;

&lt;h3 id=&quot;entwicklung-test-und-ver-ffentlichung&quot;&gt;Entwicklung, Test und Veröffentlichung&lt;/h3&gt;

&lt;p&gt;Bei Verwendung eines &lt;em&gt;static site generators&lt;/em&gt; werden die Webseiten zunächst aus Quelldateien erzeugt und müssen dann veröffentlicht, d.h. in das passende Verzeichnis des Webservers befördert werden, der sie anzeigen soll. Darüber hinaus ist es generell sinnvoll, &amp;#8220;Code&amp;#8221; im weitesten Sinne - und dazu gehören dann auch HTML- und CSS-Dateien bzw. die Quellen, aus denen diese erzeugt werden - in einem Versionsverwaltungssystem zu speichern, in dem Änderungen nachverfolgbar sind und wo jederzeit auf ältere Versionen zurückgegriffen werden kann. Nimmt man dies zusammen, unterscheiden sich Webseiten damit letztlich kaum mehr von Webapplikationen oder anderer Software: es gibt den Quellcode und das Kompilat (die fertigen Seiten, das ablauffähige Programm), Quellcode muss verwaltet und das Ergebnis getestet und schließlich veröffentlicht (deployed) werden.&lt;/p&gt;

&lt;p&gt;Für die drei Schritte - entwickeln, testen, veröffentlichen - werden zumeist mehrere Rechner (Systeme, Umgebungen) benötigt, die unterschiedlichen Zwecken dienen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Entwicklungsumgebung&lt;br /&gt;
Der Rechner, auf dem die Seiten entworfen, bearbeitet und ggf. auch getestet werden.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Git&lt;/em&gt;-Server&lt;br /&gt;
&lt;em&gt;Git&lt;/em&gt; ist zwar ein verteiltes Versionsverwaltungssystem, aber es ist generell sinnvoll, das Repository nicht nur auf dem eigenen Arbeitsrechner vorzuhalten, sondern auch auf (mindestens) einem Server. Das schafft Redundanz und ermöglicht es, auf verschiedenen Rechner zu arbeiten und die Ergebnisse jeweils zu synchronisieren.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testumgebung&lt;br /&gt;
Es ist sinnvoll, ein Testsystem vorzuhalten, dass dem Echtsystem weitgehend entspricht, um testen zu können, ob die Webseiten auch wirklich so aussehen und &amp;#8220;funktionieren&amp;#8221;, wie man sich das vorstellt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Echtumgebung&lt;br /&gt;
Am Ende des Tages sollen die Webseiten auf einem Rechner im Netz liegen, der sie mithilfe eines Webservers weltweit abrufbar macht.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Grundsätzlich kann man das alles auf ein- und demselben Gerät betreiben: eine im Netz verfügbare Maschine, auf der man sich einloggt und entwickelt, auf der &lt;em&gt;Git&lt;/em&gt; verfügbar ist und die zugleich Test- und Echtumgebung darstellt. Meistens wird man aber doch auf dem heimischen Desktoprechner oder dem Laptop arbeiten wollen und einen Webserver (oder auch nur Webspace) irgendwo angemietet haben. Letzteres gilt auch für mich.&lt;/p&gt;

&lt;h3 id=&quot;mein-workflow&quot;&gt;Mein Workflow&lt;/h3&gt;

&lt;p&gt;Ich &lt;strong&gt;bearbeite&lt;/strong&gt; die Quelldateien (den Sourcecode) meiner Webseiten auf meinem Desktoprechner oder dem Laptop unter Windows, zumeist mit &lt;a href=&quot;http://www.sublimetext.com/&quot; title=&quot;Sublime Text - Text Editing, Done Right&quot;&gt;&lt;em&gt;Sublime Text&lt;/em&gt;&lt;/a&gt;, reine Markdown-Dateien manchmal auch mit &lt;a href=&quot;http://markdownpad.com/&quot; title=&quot;MarkdownPad - The Markdown Editor for Windows&quot;&gt;&lt;em&gt;MarkdownPad&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;nanoc&lt;/em&gt; unterstützt einen sehr bequemen &lt;strong&gt;Test&lt;/strong&gt;modus mit eingebautem Webserver: nach dem Compilieren mit &lt;code&gt;nanoc&lt;/code&gt; genügt ein &lt;code&gt;nanoc view&lt;/code&gt;, um einen Webserver zu starten, der dann unter &lt;code&gt;http://localhost:3000/&lt;/code&gt; die Website zur Ansicht bereitstellt. Leider funktioniert das für mich noch nicht, denn zwar lässt sich &lt;em&gt;nanoc&lt;/em&gt; grundsätzlich auch &lt;a href=&quot;https://netz-rettung-recht.de/archives/1824-Installation-von-nanoc-unter-Windwows-7.html&quot; title=&quot;&quot;&gt;unter Windows installieren&lt;/a&gt; und betreiben, aber das für den &lt;em&gt;LESS&lt;/em&gt;-Filter erforderliche Ruby-Gem leider nicht - jedenfalls ist mir das nicht gelungen. Daher arbeite ich weiterhin &amp;#8220;nach alter Väter Sitte&amp;#8221; und lade die geänderten Dateien per &lt;em&gt;SCP&lt;/em&gt; bzw. &lt;em&gt;SFTP&lt;/em&gt; entweder auf einen lokalen Linux-Server oder direkt auf den externen Webserver hoch bzw. sorge für eine &lt;a href=&quot;https://netz-rettung-recht.de/archives/1841-WinSCP-und-die-automatische-Synchronisierung.html&quot; title=&quot;&quot;&gt;automatische Synchronisierung mit &lt;em&gt;WinSCP&lt;/em&gt;&lt;/a&gt;. Dort wird dann compiliert und im Browser das Ergebnis angeschaut.&lt;/p&gt;

&lt;p&gt;Auch das &lt;strong&gt;Veröffentlichen&lt;/strong&gt; der Seiten unterstützt &lt;em&gt;nanoc&lt;/em&gt; mit dem Kommando &lt;code&gt;nanoc deploy&lt;/code&gt;, das ein Deployment per &lt;em&gt;git&lt;/em&gt;, per &lt;em&gt;rsync&lt;/em&gt; oder mittels &lt;a href=&quot;http://fog.io/&quot; title=&quot;302 Found&quot;&gt;&lt;em&gt;fog&lt;/em&gt;&lt;/a&gt; unterstützt. Das ist sicherlich sehr nützlich, wenn man die Webseiten auf dem Entwicklungsrechner testet und dann von dort auf den Webserver überspielt; nachdem &lt;em&gt;nanoc&lt;/em&gt; aber auf meinen Windows-Rechnern nicht läuft, gehe ich einen anderen Weg und compiliere direkt auf dem Webserver. Ich lade also den Quellcode hoch, lasse &lt;em&gt;nanoc&lt;/em&gt; auf dem Server laufen und das Ergebnis dann unmittelbar in das Webserver-Verzeichnis ausgeben (in der Regel durch ein passend gesetztes &lt;code&gt;output_dir&lt;/code&gt; in der &lt;code&gt;nanoc.yaml&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Ich halte regelmäßig neben der aktuellen Fassung meiner Webseiten auch eine Testfassung vor, die ich über eine passwortgeschützte URL aufrufen kann. Das hat den Vorteil, dass ich von überallher testen kann und zudem die Testumgebung und die Echtumgebung identisch sind, weil sie auf demselben Server (in zwei unterschiedlichen &lt;em&gt;virtual hosts&lt;/em&gt;) laufen.&lt;/p&gt;

&lt;p&gt;Das jeweilige &lt;strong&gt;&lt;em&gt;Git&lt;/em&gt;-Repository&lt;/strong&gt; für eine Website hat daher immer mindestens den &lt;em&gt;master&lt;/em&gt;- und einen &lt;em&gt;staging&lt;/em&gt;-Zweig; im letzteren wird getestet, der erstere enthält die aktuelle Echtversion. Wenn ich einen dieser Zweige per &lt;code&gt;git push&lt;/code&gt; auf meinen &lt;em&gt;Git&lt;/em&gt;-Server schiebe, wird er automatisch auf den Webserver kopiert (in das Quellverzeichnis für die Echtfassung oder dasjenige für die Testversion der Website), dort compiliert und bereitgestellt. Auch für dieses &amp;#8220;Kopieren&amp;#8221; oder generell das Aktualisieren einer Website über &lt;em&gt;git&lt;/em&gt; gibt es eine Reihe von Möglichkeiten: man kann bspw. einfach das &lt;em&gt;Git&lt;/em&gt;-Repository auf dem Webserver auschecken, oder aber man checkt via &lt;code&gt;git archive&lt;/code&gt; wirklich nur den Inhalt des Repositorys aus. Ich habe mich für letzteres entschieden; einziger Nachteil ist, das aus dem Repository entfernte Dateien nicht automatisch gelöscht werden, ggf. also &amp;#8220;Leichen&amp;#8221; verbleiben. Dafür habe ich nicht das komplette Repository mit der ganzen History herumliegen.&lt;/p&gt;

&lt;h3 id=&quot;ein-beispiel&quot;&gt;Ein Beispiel&lt;/h3&gt;

&lt;p&gt;In der Praxis sieht das dann ungefähr so aus:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ich aktualisiere mein lokales &lt;em&gt;Git&lt;/em&gt;-Repository auf dem jeweiligen Arbeitsrechner, damit es auf dem aktuellen Stand ist.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ich verändere oder ergänze meine Webseiten, indem ich die entsprechenden Dateien auf dem Arbeitsrechner bearbeite.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wenn umfangreichere Tests erforderlich sind, lade ich die geänderten Dateien auf meinen Webserver in das Quellverzeichnis für die Test-Instanz der jeweiligen Website hoch und führe - auf dem Server - &lt;em&gt;nanoc&lt;/em&gt; aus, so dass die Testinstanz der jeweiligen Webseiten aktualisiert wird. Im Browser kann ich dann die geänderten Seiten durch Aufruf von &lt;code&gt;http://test.meine-website.example/&lt;/code&gt; ansehen. Alternativ kann ich natürlich auch auf einem anderen Rechner im lokalen Netz testen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wenn ich mit dem Ergebnis zufrieden bin, aktualisiere ich den &lt;em&gt;test&lt;/em&gt;-Zweig meines lokalen &lt;em&gt;Git&lt;/em&gt;-Repositorys und schiebe ihn per &lt;code&gt;git push&lt;/code&gt; auf den externen &lt;em&gt;Git&lt;/em&gt;-Server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dort wird ein &lt;code&gt;post-receive&lt;/code&gt;-Hook ausgeführt, der auf dem richtigen Webserver ein PHP-Script mit den passenden Paramtern aufruft. Das Script sorgt dann dafür, dass die Dateien aus dem &lt;em&gt;Git&lt;/em&gt;-Repository ausgecheckt werden, und führt danach &lt;em&gt;nanoc&lt;/em&gt; aus. Für den &lt;code&gt;test&lt;/code&gt;-Zweig des Repositories &lt;code&gt;websites/meine-website&lt;/code&gt; auf dem Server &lt;code&gt;git.server.example&lt;/code&gt; mit dem Zielverzeichnis &lt;code&gt;/var/www/sources/meine-website/&lt;/code&gt; auf dem Webserver sähe das dann so aus:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ git archive --format=tar --remote=ssh://git@git.server.example/websites/meine-website test | tar -C /var/www/sources/test.meine-website.example/ -xf -
$ cd /var/www/sources/test.meine-website.example/
$ nanoc
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;nanoc&lt;/em&gt; hat dann als &lt;code&gt;output_dir&lt;/code&gt; bspw. &lt;code&gt;/var/www/html/test.meine-website.example/&lt;/code&gt; konfiguriert, was zugleich das &lt;code&gt;DocumentRoot&lt;/code&gt; für den &lt;em&gt;virtual host&lt;/em&gt; &lt;code&gt;http://test.meine-website.example/&lt;/code&gt; ist.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Will ich später die gesammelten Änderungen aus der Testinstanz auf die Echtinstanz übernehmen, geht das ebenfalls ganz einfach: ich bringe sie in den &lt;em&gt;master&lt;/em&gt;-zweig meines Repositorys und veröffentliche diesen: &lt;code&gt;git checkout master; git merge test; git push; git checkout test&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Der &lt;code&gt;post-receive&lt;/code&gt;-Hook wird das Deployment-Script mit anderen Parametern aufrufen, so dass nicht der &lt;em&gt;test&lt;/em&gt;-Zweig, sondern der &lt;em&gt;master&lt;/em&gt;-Zweig ausgecheckt und nicht nach &lt;code&gt;/var/www/sources/test.meine-website.example/&lt;/code&gt;, sondern nach &lt;code&gt;/var/www/sources/www.meine-website.example/&lt;/code&gt; kopiert wird. Und das ist dementsprechend das &lt;code&gt;DocumentRoot&lt;/code&gt; für  &lt;code&gt;http://www.meine-website.example/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Die &lt;em&gt;nanoc&lt;/em&gt;-Ausgaben gibt das Deployment-Script aus, so dass der &lt;em&gt;Git&lt;/em&gt;-Server sie an den &lt;em&gt;Git&lt;/em&gt;-Client übermittelt; sollte &lt;em&gt;nanoc&lt;/em&gt; die Compilation also mit einer Fehlermeldung abbrechen, ist das erkennbar und ermöglicht ein manuelles Eingreifen. Ansonsten sind manuelle Eingriffe nur noch erforderlich, wenn eine bereits deployte Datei gelöscht werden muss; es liegt in der Natur der Sache, dass der gewählte Weg über &lt;code&gt;git archive&lt;/code&gt; neue und geänderte Dateien (und Verzeichnisse) anlegt, alte Dateien aber nicht löscht.&lt;/p&gt;

&lt;h3 id=&quot;conclusio&quot;&gt;Conclusio&lt;/h3&gt;

&lt;p&gt;Viele Wege führen nach Rom; dies ist meiner.&lt;/p&gt;

&lt;p&gt;Er lässt sich fraglos vereinfachen; ein Hemmschuh ist insbesondere die Entwicklung unter Windows, die den Workflow erschwert.&lt;/p&gt;

&lt;p&gt;Kommentare und Kritik nehme ich gerne entgegen, ebenso wie andere Wege zum selben Ziel. &lt;img src=&quot;https://netz-rettung-recht.de/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/ad21ecfbf841470584fc58c8c5a75c2f&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Wed, 17 May 2017 05:20:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1994-guid.html</guid>
    <category>git</category>
<category>nanoc</category>
<category>webdesign</category>

</item>
<item>
    <title>Vernetzungsfunktion von dejure.org als nanoc-Filter</title>
    <link>https://netz-rettung-recht.de/archives/1992-Vernetzungsfunktion-von-dejure.org-als-nanoc-Filter.html</link>
            <category>Bits'n'Bytes</category>
            <category>Releases</category>
    
    <comments>https://netz-rettung-recht.de/archives/1992-Vernetzungsfunktion-von-dejure.org-als-nanoc-Filter.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1992</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1992</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Das - kostenlose - juristische Informationsportal &lt;a href=&quot;https://dejure.org/&quot; title=&quot;d e j u r e . o r g - Gesetze und Rechtsprechung&quot;&gt;&lt;i&gt;dejure.org&lt;/i&gt;&lt;/a&gt; bietet nach eigenen Angaben 90% der am häufigsten zitierten deutschen (Bundes-)Gesetze, insgesamt rund 300 an der Zahl, und dazu vor allem eine umfassende Literaturdatenbank mit Urteilen, Anmerkungen und Querverweisen an. Ist ein Gesetz nicht verfügbar, wird der Nutzer auf den entsprechenden Eintrag in der umfassenden Sammlung des deutschen Bundesrechts bei &lt;i&gt;buzer.de&lt;/i&gt; - einem weiteren kostenlosen juristischen Informationsdienst - weitergeleitet.&lt;/p&gt;

&lt;p&gt;Außerdem stellt &lt;i&gt;dejure.org&lt;/i&gt; mit seiner &lt;a href=&quot;https://dejure.org/vernetzung.html&quot; title=&quot;Juristische Vernetzungsfunktion - dejure.org&quot;&gt;juristischen Vernetzungsfunktion&lt;/a&gt; eine Möglichkeit zur &amp;#8220;automatischen Verlinkung von Gesetzes- und Rechtsprechungszitaten über eine einfache Schnittstelle&amp;#8221; zur Verfügung. Jeder Paragraph eines bei &lt;i&gt;dejure.org&lt;/i&gt; (oder &lt;i&gt;buzer.de&lt;/i&gt;) erfassten Gesetzes, jede Urteilsfundstelle wird auf Wunsch mit einem passenden Link auf &lt;i&gt;dejure.org&lt;/i&gt; hinterlegt. Für eine Vielzahl von Webapplikationen (Blogs, CMS, Foren, Wikis), darunter &lt;i&gt;Wordpress&lt;/i&gt;, &lt;i&gt;Serendipity&lt;/i&gt; und &lt;i&gt;Dokuwiki&lt;/i&gt;, sind Plugins verfügbar; außerdem wird eine Beispiel-Implementierung in PHP bereitgestellt, die sich als Vorlage für eigene Plugins verwenden lässt.&lt;/p&gt;

&lt;p&gt;In diesem Blog verwende ich die Vernetzungsfunktion bereits seit vielen Jahren; gerne hätte ich eine solche Funktion auch für meine privaten Webseiten gehabt. Nach deren Relaunch war ich dann motiviert genug, mir diese Möglichkeit zu schaffen. Theoretisch sollte das nicht schwer sein: &lt;i&gt;nanoc&lt;/i&gt;, mein &lt;em&gt;static site generator&lt;/em&gt;, unterstützt das Konzept von Filtern, die (bspw.) aus &lt;i&gt;Markdown&lt;/i&gt; HTML machen. In gleicher Weise lässt sich die Vernetzungsfunktion einbinden. Einziges Problem: die Beispiel-Implementierung ist in PHP gehalten, Varianten in Perl und ASP werden angeboten, aber ich bräuchte Ruby &amp;#8230; und das &amp;#8220;spreche&amp;#8221; ich dazu noch kaum. Dennoch: einen Versuch erschien es mir wert.&lt;/p&gt;

&lt;p&gt;Und zu meiner Überraschung war es dann gar nicht so schwierig, das PHP-Beispiel in Ruby als &lt;i&gt;nanoc&lt;/i&gt;-Filter nachzubauen: erst nur die Grundfunktion, dann - aufgrund der stark ansteigenden Compile-Zeiten - auch den optionalen Cache. Und schon habe ich einen Prototypen in Betrieb, der auf meiner Homepage alle Gesetzes- und Rechtsprechungszitate mit &lt;i&gt;dejure.org&lt;/i&gt; verlinkt!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interessenten können sich den Filter auf meiner &lt;a href=&quot;http://th-h.de/net/software/nanoc-dejure/&quot; title=&quot;302 Found&quot;&gt;Homepage&lt;/a&gt; herunterladen.&lt;/em&gt;&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/721032a30b6f496a8408b518ce82e861&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Wed, 10 May 2017 05:40:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1992-guid.html</guid>
    <category>nanoc</category>
<category>ruby</category>

</item>
<item>
    <title>Bootstrap mit nanoc</title>
    <link>https://netz-rettung-recht.de/archives/1991-Bootstrap-mit-nanoc.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1991-Bootstrap-mit-nanoc.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1991</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1991</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Unter anderem für den Relaunch meiner Homepage habe ich mich damit beschäftigt, wie ich das CSS-Framework &lt;a href=&quot;https://getbootstrap.com/&quot; title=&quot;&quot;&gt;&lt;i&gt;Bootstrap&lt;/i&gt;&lt;/a&gt; am besten mit &lt;a href=&quot;https://nanoc.ws/&quot; title=&quot;&quot;&gt;&lt;i&gt;nanoc&lt;/i&gt;&lt;/a&gt;, meinem bevorzugten &lt;em&gt;static site generator&lt;/em&gt;, zur Anwendung bringen kann.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Bootstrap&lt;/i&gt; bringt einen ganzen Haufen CSS, etwas Javascript und &lt;i&gt;Glyphicon Halflings&lt;/i&gt; als Webfont mit. Webfont und Javascript können unverändert bleiben, das CSS hingegen sollte aus den LESS-Dateien kompiliert werden, um so mit wenigen Anpassungen in &lt;code&gt;variables.less&lt;/code&gt; das Aussehen der Website zu personalisieren.&lt;/p&gt;

&lt;p&gt;Meine &lt;i&gt;nanoc&lt;/i&gt;-Quelldateien habe ich dementsprechend folgendermaßen strukturiert:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;content/
 :
 :--bootstrap/
 :   :
 :   :--js/
 :   :
 :   :--fonts/
 :   :
 :   :--less/
 :    
 :--res/
     :
     :--css/
     :
     :--fonts/
     :
     :--js/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In &lt;code&gt;content/bootstrap/js/&lt;/code&gt; landet das Javascript aus &lt;i&gt;Bootstraps&lt;/i&gt; &lt;code&gt;dist/js/&lt;/code&gt;, in &lt;code&gt;content/bootstrap/fonts/&lt;/code&gt; die Schriften aus &lt;code&gt;dist/fonts/&lt;/code&gt;, und die Dateien aus &lt;code&gt;less/&lt;/code&gt; kommen nach &lt;code&gt;content/bootstrap/less/&lt;/code&gt;. Dabei müssen jedenfalls in meiner alten Version 3 von &lt;i&gt;nanoc&lt;/i&gt; noch einige Dateien umbenannt werden, weil sich nur in der Endung unterscheiende Dateien unzulässig sind: aus &lt;code&gt;bootstrap.min.js&lt;/code&gt; wird so &lt;code&gt;bootstrap-min.js&lt;/code&gt;, bei den Schriftdateien wird die Endung auch in den Dateinamen übernomme, so dass aus &lt;code&gt;glyphicons-halflings-regular.ttf&lt;/code&gt; dann &lt;code&gt;glyphicons-halflings-regular-ttf.ttf&lt;/code&gt; wird.&lt;/p&gt;

&lt;p&gt;Der Inhalt von &lt;code&gt;content/bootstrap/js/&lt;/code&gt; landet dann beim Kompilieren in &lt;code&gt;content/res/js/&lt;/code&gt;, derjenige von &lt;code&gt;content/bootstrap/fonts/&lt;/code&gt; unter Entfernung der &amp;#8220;doppelten&amp;#8221; Endungen in &lt;code&gt;content/res/fonts/&lt;/code&gt;, und aus &lt;code&gt;content/bootstrap/less/bootstrap.less&lt;/code&gt; wird (unter Einbindung aller anderen LESS-Dateien) &lt;code&gt;content/res/css/bootstrap.css&lt;/code&gt; kompiliert.&lt;/p&gt;

&lt;p&gt;Fertig.&lt;/p&gt;

&lt;p&gt;In den &lt;code&gt;Rules&lt;/code&gt; sieht das dann ungefähr so aus:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby

#########################
### compilation rules ###
#########################

# compile Bootstrap CSS (only) from bootstrap.less
compile &#039;/bootstrap/less/bootstrap&#039; do
  filter :less
end
compile &#039;/bootstrap/*&#039; do
  nil
end

# main rule
compile &#039;*&#039; do
  [...]
end

#####################
### routing rules ###
#####################

# copy font files and move last -XXX to extension
route &#039;/res/fonts/*/&#039; do
  # /bootstrap/fonts/foo-eot/ -&amp;gt; /res/fonts/foo.eot
  item.identifier.sub(&#039;/bootstrap/less/&#039;,&#039;/res/css/&#039;).sub(/-[^-]+\/$/, &#039;&#039;) + &#039;.&#039; + item[:extension]
end

# copy bootstrap files
route &#039;/bootstrap/less/bootstrap&#039; do
  item.identifier.sub(&#039;/bootstrap/less/&#039;,&#039;/res/css/&#039;).chop + &#039;.css&#039;
end
route &#039;/bootstrap/less/*&#039; do
  nil
end
route &#039;/bootstrap/*/&#039; do
  item.identifier.sub(&#039;/bootstrap/&#039;,&#039;/res/&#039;).chop + &#039;.&#039; + item[:extension]
end

# main rule
route &#039;*&#039; do
  [...]
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Es geht sicherlich einfacher und weniger komplex, aber so geht es jedenfalls auch. &lt;img src=&quot;https://netz-rettung-recht.de/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Wenn man in seinem &lt;i&gt;Git&lt;/I&gt;-Repository auch direkt einen &lt;code&gt;bootstrap&lt;/code&gt;-Branch anlegt, kann man &lt;i&gt;Bootstrap&lt;/i&gt;-Updates dort einspielen und in der Regel durch ein einfaches &lt;code&gt;git checkout master; git merge bootstrap&lt;/code&gt; für die eigenen Seiten übernehmen.&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/8916b18ed9d6465cbe3b6addf4f87938&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Fri, 05 May 2017 15:15:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1991-guid.html</guid>
    <category>bootstrap</category>
<category>nanoc</category>
<category>webdesign</category>

</item>
<item>
    <title>nanoc 4.0.0 beta 1</title>
    <link>https://netz-rettung-recht.de/archives/1855-nanoc-4.0.0-beta-1.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1855-nanoc-4.0.0-beta-1.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1855</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1855</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Bereits mehrfach hatte ich über &lt;em&gt;&lt;a href=&quot;http://nanoc.ws/&quot; title=&quot;&quot;&gt;nanoc&lt;/a&gt;&lt;/em&gt; &lt;a href=&quot;http://netz-rettung-recht.de/plugin/tag/nanoc&quot; title=&quot;302 Found&quot;&gt;berichtet&lt;/a&gt;, dessen Entwicklung nunmehr wieder mit Elan fortschreitet.&lt;/p&gt;

&lt;p&gt;Seit einigen Tagen gibt es die erste &lt;a href=&quot;https://github.com/nanoc/nanoc/releases/tag/4.0.0b1&quot; title=&quot;Release 4.0.0 beta 1 · nanoc/nanoc · GitHub&quot;&gt;Beta-Version&lt;/a&gt; von &lt;em&gt;nanoc 4.0&lt;/em&gt; mit bereits teilweise &lt;a href=&quot;http://v4.nanoc.ws/&quot; title=&quot;&quot;&gt;angepasster Dokumentation&lt;/a&gt; - und obwohl dieses Release eigentlich keine neuen Features enthalten, sondern nur den Code für zukünftige Veränderungen vorbereiten soll, gibt es einige Neuigkeiten zu vermelden:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In den &lt;code&gt;Rules&lt;/code&gt; können nunmehr erweiterte Platzhalterzeichen (&lt;em&gt;Globs&lt;/em&gt;) verwendet werden. Gab es bisher nur die Möglichkeit, &lt;code&gt;*&lt;/code&gt; und &lt;code&gt;+&lt;/code&gt; zu verwenden, bspw. in der Form &lt;code&gt;/projects/*/&lt;/code&gt;, gibt es in &lt;em&gt;nanoc 4.0&lt;/em&gt; &lt;a href=&quot;http://v4.nanoc.ws/docs/reference/identifiers-and-patterns/#patterns&quot; title=&quot;&quot;&gt;neue Möglichkeiten&lt;/a&gt; wie &lt;code&gt;*&lt;/code&gt; contra &lt;code&gt;**&lt;/code&gt; oder Zeichensätze wie &lt;code&gt;[abcdefg]&lt;/code&gt; oder auch Auswahllisten wie &lt;code&gt;{foo,bar}&lt;/code&gt;. Vermutlich wird das der neue Default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Von manchem lange erwartet gibt es in der neuen Version zwei verschiedene &lt;a href=&quot;http://v4.nanoc.ws/docs/reference/identifiers-and-patterns/#identifiers&quot; title=&quot;&quot;&gt;Formate&lt;/a&gt; für &lt;em&gt;Items&lt;/em&gt;, also einzelne Quelltextdateien: &lt;em&gt;full format&lt;/em&gt; (neu) und &lt;em&gt;stripped format&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traditionell wurden Quelltext-Dateien in &lt;em&gt;nanoc&lt;/em&gt; durch ihren Namen ohne Erweiterung identifiziert, die Datei &lt;code&gt;/projekte/2015/arche.md&lt;/code&gt; im Verzeichnis &lt;code&gt;content&lt;/code&gt; konnte mithin als &lt;code&gt;/projekte/2015/arche/&lt;/code&gt; angesprochen werden. Da &lt;em&gt;nanoc&lt;/em&gt; - ohne Änderungen an den &lt;code&gt;Rules&lt;/code&gt; - standardmäßig aus jeder Quelltext-Datei ein Verzeichnis deren Namen und einer &lt;code&gt;index.html&lt;/code&gt; erzeugte, also aus dem Quelltext &lt;code&gt;/projekte/2015/arche.md&lt;/code&gt; die Datei &lt;code&gt;/projekte/2015/arche/index.html&lt;/code&gt; wurde, die als &lt;code&gt;http://example.com/projekte/2015/arche/&lt;/code&gt; aufgerufen werden kann und soll, war das durchaus konsequent. Es verlangte vom Neubenutzer aber einiges an Eingewöhnungsaufwand und hatte vor allem den Nachteil, dass es keine Quell-Dateien geben durfte, die sich nur in der Erweiterung unterscheiden: die Dateien &lt;code&gt;glyphicons-halflings-regular.ttf&lt;/code&gt; und &lt;code&gt;glyphicons-halflings-regular.svg&lt;/code&gt;, um mal ein Beispiel aus der Praxis zu wählen, durfte es nicht nebeneinander im selben Verzeichnis geben.&lt;/p&gt;

&lt;p&gt;Nunmehr gibt es stattdessen auch die Möglichkeit, &lt;em&gt;Identifier&lt;/em&gt; für &lt;em&gt;Items&lt;/em&gt; in ungekürzter Form zu erzeugen. Die Datei &lt;code&gt;/projekte/2015/arche.md&lt;/code&gt; hat für &lt;em&gt;nanoc&lt;/em&gt; dann nicht mehr den &lt;em&gt;Identifier&lt;/em&gt; &lt;code&gt;/projekte/2015/arche/&lt;/code&gt;, sondern &lt;code&gt;/projekte/2015/arche.md&lt;/code&gt;. Das hat mehrere Vorteile: es ist einfacher zu verstehen, in &lt;code&gt;Rules&lt;/code&gt; können nunmehr ohne Verrenkungen Dateien mit bestimmten Endungen referenziert werden, und es dürfen Dateien mit identischen Namen, aber unterschiedlichen Endungen vorkommen. Bei der Generierung von Zieldateien mit anderer Endung (meistens ja &lt;code&gt;.html&lt;/code&gt;) hilft dann die neue Methode &lt;code&gt;@item.identifier.without_ext&lt;/code&gt;, die für &lt;code&gt;/projekte/2015/arche.md&lt;/code&gt; entsprechend &lt;code&gt;/projekte/2015/arche&lt;/code&gt; zurückliefert, also wie gewohnt, nur ohne abschließenden &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Benötigt(e) man mit dem &lt;em&gt;stripped format&lt;/em&gt; zur Umwandlung von Markdown-Quelltexten in HTML ein Konstrukt wie&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;compile &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;*&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;if&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:extension&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; == &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;md&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; filter &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:kramdown&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;genügt nunmehr mit dem neuen &lt;em&gt;full format&lt;/em&gt; ein einfaches&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;compile &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;/**/*.md&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; filter &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:kramdown&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Einen - mehr oder weniger großen - Nachteil hat das &lt;em&gt;full format&lt;/em&gt; aber: es kann bei den &lt;em&gt;Items&lt;/em&gt; - prinzipbedingt - das Konzept von &amp;#8220;Eltern&amp;#8221; und &amp;#8220;Kindern&amp;#8221; nicht mehr geben. Mit dem &lt;em&gt;stripped format&lt;/em&gt; war klar, dass das Element &lt;code&gt;/projekte/2015/arche/&lt;/code&gt; ein Kind von &lt;code&gt;/projekte/2015/&lt;/code&gt; ist, und dieses wiederum ein Kind von &lt;code&gt;/projekte/&lt;/code&gt;. Mit dem &lt;em&gt;full format&lt;/em&gt; können aber &amp;#8220;oberhalb&amp;#8221; von &lt;code&gt;/projekte/2015/arche/&lt;/code&gt; die Dateien &lt;code&gt;/projekte/2015.md&lt;/code&gt; und &lt;code&gt;/projekte/2015.css&lt;/code&gt; nebeneinander existieren, so dass die Frage nach dem &amp;#8220;Eltern&amp;#8221;-Element sich nicht mehr eindeutig beantworten lässt. Es gibt also keine Baumstruktur der Elemente mehr - das kann u.a. die Erzeugung einer Navigation auf die bisher übliche Weise unmöglich machen.&lt;/p&gt;

&lt;p&gt;Insgesamt bin ich aber auf &lt;em&gt;nanoc 4.0&lt;/em&gt; und vor allem dann die folgenden Versionen sehr gespannt!&lt;/p&gt;

&lt;p&gt;(Für das Upgrade von &lt;em&gt;nanoc 3.x&lt;/em&gt; auf &lt;em&gt;nanoc 4.0&lt;/em&gt; gibt es natürlich einen &lt;a href=&quot;http://v4.nanoc.ws/docs/nanoc-4-upgrade-guide/&quot; title=&quot;&quot;&gt;Upgrade Guide&lt;/a&gt;.)&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/92929fc7e92a45bc800d5815329decc0&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Mon, 18 May 2015 05:37:02 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1855-guid.html</guid>
    <category>nanoc</category>

</item>
<item>
    <title>nanoc und MySQL</title>
    <link>https://netz-rettung-recht.de/archives/1850-nanoc-und-MySQL.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1850-nanoc-und-MySQL.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1850</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1850</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Ein &lt;em&gt;static site generator&lt;/em&gt; wie bspw. &lt;em&gt;&lt;a href=&quot;https://netz-rettung-recht.de/plugin/tag/nanoc&quot; title=&quot;&quot;&gt;nanoc&lt;/a&gt;&lt;/em&gt; erzeugt, wie der Name schon sagt, im wesentlichen statische Seiten ohne - zumindest serverseitige - dynamische Elemente, oder schlicht: HTML-Dateien. Dennoch ist es möglich, solchen Webpräsenzen eine begrenze &amp;#8220;Dynamik&amp;#8221; zu verleihen, und dies nicht nur durch Einbindung von Drittanbieter-Diensten wie bspw. der Kommentar- und Diskussionsplattform &lt;em&gt;&lt;a href=&quot;&quot;&gt;Disqus&lt;/a&gt;&lt;/em&gt; - soll sich der Inhalt einer oder mehrerer Seiten ändern, müssen sie eben neu generiert werden.&lt;/p&gt;

&lt;p&gt;Üblicherweise wird die Neugenerierung immer dann (manuell) veranlasst, wenn eine neue Seite oder ein neuer Beitrag (in einem statisch generierten Blog) verfasst oder ein bestehendes Quelldokument verändert worden ist. Jedoch kann eine Neugenerierung der Seiten auch angestoßen durch externe Ereignisse erfolgen. Man könnte bspw. immer dann, wenn ein neuer Beitrag eines bestimmten Accounts auf &lt;em&gt;Twitter&lt;/em&gt; veröffentlicht wird, diesen Tweet in die Webseiten einbinden und dann die dadurch veränderten Seiten neu generieren - oder, bspw., einen RSS-Feed regelmäßig (täglich, stündlich, &amp;#8230;) auslesen und bei einer Änderung die betreffenden Seiten der (eigentlich statischen) Webpräsenz neu generieren und auf diese Weise einen Newsticker einbinden, der allerdings nicht in Echtzeit &amp;#8220;tickt&amp;#8221;. Sehr häufig ist eine solche Echtzeit-Aktualisierung aber auch gar nicht nötig, weil sich Änderungen ohnehin nur in größeren Zeitabständen ergeben und es unschädlich ist, wenn sie mit einer gewissen Verzögerung angezeigt werden. So bindet bspw. der &lt;em&gt;CCCS&lt;/em&gt; in seinen durch &lt;em&gt;nanoc&lt;/em&gt; erzeugten &lt;a href=&quot;https://github.com/cccs/cccs-website/&quot; title=&quot;GitHub - cccs/cccs-website: nanoc sources of www.cccs.de · GitHub&quot;&gt;Webseiten&lt;/a&gt; die Tweets des Accounts @cccs ebenso ein wie eine Übersicht der Blogbeiträge von Aktiven des Vereins. Die entsprechenden Daten werden in regelmäßigen Abständen ausgelesen, danach werden dann - wenn erforderlich - die betreffenden Webseiten neu erzeugt.&lt;/p&gt;

&lt;p&gt;Die Dynamik lässt sich aber noch deutlich weiter treiben.&lt;/p&gt;

&lt;p&gt;Dynamische Seiten sind regelmäßig mit einer Datenbank verknüpft. Blogsysteme und CMS beispielsweise speichern Beiträge, Metadaten, Kommentare usw. in einer Datenbank und erzeugen beim Aufruf des Blogs oder der Website daraus bedarfsgerecht HTML-Seiten, die dann angezeigt (und ggf. gecached) werden. Seiteninhalte, Blogeinträge oder Kommentare werden in der Datenbank gespeichert und (ggf. nach Prüfung) beim nächsten Aufruf der Website oder des Blogs dann angezeigt.&lt;/p&gt;

&lt;p&gt;Auch &lt;em&gt;nanoc&lt;/em&gt; lässt sich mit einer Datenbank als Datenquelle betreiben. Bei jedem Durchlauf von &lt;code&gt;nanoc compile&lt;/code&gt; wird dann nicht nur geprüft, ob sich die Quelldateien der Webpräsenz verändert haben, sondern auch, ob sich die Inhalte der Datenbank geändert haben; in beiden Fällen werden dann, wenn sich diese Änderungen auf die anzuzeigenden Inhalte auswirken, die entsprechenden statischen Webseiten neu erzeugt. So ist es bspw. durchaus denkbar, ein Webinterface zu schreiben, mit dem Seiteninhalte und Templates erzeugt und bearbeitet werden können, aus denen dann &lt;em&gt;nanoc&lt;/em&gt; fertige Webseiten erzeugt - quasi ein CMS. Oder man erzeugt seine Blogbeiträge nicht als einzelne Quelldateien in HTML, Markdown oder anderweitig, sondern schreibt sie über ein - beliebig komfortabel gestaltetes - Webinterface in eine Datenbank und lässt &lt;em&gt;nanoc&lt;/em&gt; dann daraus das fertige Blog gestalten. In ähnlicher Weise könnten so Informationen über Mitarbeiter (Rufnummer, Erreichbarkeit, Zuordnung zu Arbeitsbereichen) für eine Firmenwebsite oder Profile von Mitgliedern einer Gruppe oder eines sozialen Netzwerks in einer Datenbank gehalten und die - statische - Website bei Änderungen neu erzeugt werden.&lt;/p&gt;

&lt;p&gt;Diese Vorgehensweise kann immer dann sinnvoll sein, wenn die Inhalte größtenteils statisch sind und/oder sich in eher größeren Abständen ändern. Werden in einem Blog in der Woche ein oder zwei Beiträge verfasst, wäre es überhaupt kein Problem, zwei- oder dreimal pro Woche eine ansonsten statische Website neu zu erzeugen; und Daten von Mitarbeitern oder Mitgliedern oder auch die einzelnen Seiten einer größeren Webpräsenz ändern sich zumeist eher seltener. Erforderlich ist letztendlich nur, dass entweder in regelmäßigen Abständen - per &lt;code&gt;cron&lt;/code&gt; - geprüft wird, ob sich Änderungen an den Inhalten in der Datenbank ergeben haben, so dass die Website neu erzeugt werden muss, oder mit dem Speichern (oder der Freigabe) einer Änderungen automatisch einen Rebuild anzustoßen und die Website dann auch in die Echtumgebung zu übertragen (&amp;#8220;Deployment&amp;#8221;).&lt;/p&gt;

&lt;p&gt;Die eigentliche Anbindung der Datenbank als Datenquelle an &lt;em&gt;nanoc&lt;/em&gt; ist recht einfach gelöst und in der Dokumentation in Form eines nachvollziehbaren Beispiels bzw. Tutorials - mit &lt;em&gt;sqlite&lt;/em&gt;, aber die Anpassung an MySQL ist trivial - unter der Überschrift &amp;#8220;&lt;a href=&quot;http://nanoc.ws/docs/guides/using-external-sources/&quot; title=&quot;&quot;&gt;Using external sources&lt;/a&gt;&amp;#8221; dargestellt. Einige kleinere Lücken der Darstellung, die einer 1:1-Umsetzung des Beispiels per copy &amp;amp; paste entgegenstanden, habe ich demletzt &lt;a href=&quot;https://github.com/nanoc/nanoc.ws/pull/86&quot; title=&quot;&quot;&gt;geschlossen&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In diesem Beispiel wird aus jedem Datensatz (&lt;em&gt;Row&lt;/em&gt;) in der Datenbank(tabelle) ein &lt;em&gt;Item&lt;/em&gt; in &lt;em&gt;nanoc&lt;/em&gt; erzeugt, bei dem (nur) die Felder des Datensatzes (&lt;em&gt;Columns&lt;/em&gt;) und deren Inhalte als Attribute übergeben werden - vergleichbar einer Quellcodedatei, die nur Metadaten in YAML enthält. Stattdessen könnte man natürlich auch direkt anzeigbare Seiten (im Beispiel Informationsseiten für jeden Mitarbeiter) erzeugen, indem ein Template mit den Daten befüllt wird; oder man übernimmt einen Feldinhalt aus der Datenbank als Seiteninhalt, bspw. für einen Blogpost. Die Möglichkeiten sind fast unbegrenzt. Die Datenbankinhalte lassen sich dann über ein anderes, geeignetes Interface - bspw. eine Webanwendung in PHP oder anderen Sprache - bearbeiten.&lt;/p&gt;

&lt;p&gt;Ich habe bei der &lt;a href=&quot;https://netz-rettung-recht.de/archives/1842-d-e-n.net-die-Webseiten-fuer-de.etc.notfallrettung.html&quot; title=&quot;&quot;&gt;Erstellung&lt;/a&gt; von &lt;em&gt;d-e-n.net&lt;/em&gt; auf diese Weise für die &amp;#8220;&lt;a href=&quot;http://d-e-n.net/user/&quot; title=&quot;302 Found&quot;&gt;Schreiberliste&lt;/a&gt;&amp;#8221; die ohnehin schon in Form einer MySQL-Datenbank vorhandenen Inhalte der Profile der einzelnen Teilnehmer ausgelesen und erzeuge - derzeit in einem zweiten Schritte - daraus dann die Profilseiten, und natürlich die Übersicht der eingetragenen Teilnehmer. Ich bin aber sicher, dass sich die Profilseiten auch unmittelbar beim Auslesen der Datenbank erzeugen lassen, ohne den Umweg über (nicht compilierte, weil bis auf Metadaten leere) &lt;em&gt;Items&lt;/em&gt; unter &lt;code&gt;/_external/db/*&lt;/code&gt; zu gehen.&lt;/p&gt;

&lt;p&gt;Das werde ich bei Gelegenheit dann einmal ausprobieren.&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/903e4052978446fb82182f5f3274b639&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Thu, 30 Apr 2015 06:26:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1850-guid.html</guid>
    <category>nanoc</category>

</item>
<item>
    <title>nanoc: Auswahl des Templates via YAML</title>
    <link>https://netz-rettung-recht.de/archives/1845-nanoc-Auswahl-des-Templates-via-YAML.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1845-nanoc-Auswahl-des-Templates-via-YAML.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1845</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1845</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Nicht selten lassen sich die meisten Seiten einer Webpräsenz aus demselben Template erzeugen, wohingegen einige Ausnahmefälle einer Sonderbehandlung bedürfen - bspw. die Startseite oder &lt;em&gt;landing page&lt;/em&gt;, die oft anders gestaltet ist als der Rest der Webseiten, und sei es nur, dass sie keine oder andere Navigations-Elemente aufweist oder mehrspaltig statt einspaltig (oder umgekehrt) dargestellt werden soll.&lt;/p&gt;

&lt;p&gt;Mag es bei der Verwendung von &lt;em&gt;nanoc&lt;/em&gt; für eine singuläre Ausnahme noch sinnvoll sein, sie explizit in die - &lt;a href=&quot;https://netz-rettung-recht.de/archives/1844-nanoc-Rules-passthrough-und-ignore.html&quot; title=&quot;&quot;&gt;bereits erläuterte&lt;/a&gt; - &lt;code&gt;Rules&lt;/code&gt;-Datei aufzunehmen, gibt es für diese Aufgabenstellung eine sehr einfache Lösung: ein abweichendes Template kann nämlich im &lt;em&gt;YAML&lt;/em&gt;-Metadatenblock jeder Seite angegeben werden.&lt;/p&gt;

&lt;p&gt;Sollen nun die Webseiten einer Präsenz normalerweise das Template namens &lt;em&gt;default&lt;/em&gt; verwenden, die Startseite aber das Template &lt;em&gt;startpage&lt;/em&gt;, so erhält die Quellcode-Datei der Startseite einen entsprechenden Eintrag in ihre &lt;em&gt;YAML&lt;/em&gt;-Metadaten, bspw. &lt;code&gt;template: startpage&lt;/code&gt;, und die &lt;code&gt;Rules&lt;/code&gt;-Datei erhält dann im &lt;code&gt;compile&lt;/code&gt;-Block an der passenden Stelle - statt &lt;code&gt;layout &#039;default&#039;&lt;/code&gt; - die Anweisung &lt;code&gt;layout item[:template] || &#039;default&#039;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Man kann auch - wie es der &lt;em&gt;CCCS&lt;/em&gt; &lt;a href=&quot;https://github.com/cccs/cccs-website/blob/master/Rules&quot; title=&quot;cccs-website/Rules at master · cccs/cccs-website · GitHub&quot;&gt;tut&lt;/a&gt; - die Variante &amp;#8220;gar kein Template&amp;#8221; direkt mit aufnehmen:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if item[:template]!=&#039;none&#039;
  layout item[:template] || &#039;default&#039;
end
&lt;/code&gt;&lt;/pre&gt;
 
    </content:encoded>

    <pubDate>Wed, 29 Apr 2015 05:26:00 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1845-guid.html</guid>
    <category>anleitung</category>
<category>nanoc</category>

</item>
<item>
    <title>nanoc-Rules &quot;passthrough&quot; und &quot;ignore&quot;</title>
    <link>https://netz-rettung-recht.de/archives/1844-nanoc-Rules-passthrough-und-ignore.html</link>
            <category>Bits'n'Bytes</category>
    
    <comments>https://netz-rettung-recht.de/archives/1844-nanoc-Rules-passthrough-und-ignore.html#comments</comments>
    <wfw:comment>https://netz-rettung-recht.de/wfwcomment.php?cid=1844</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>https://netz-rettung-recht.de/rss.php?version=2.0&amp;type=comments&amp;cid=1844</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Hochstein)</author>
    <content:encoded>
    &lt;p&gt;Ich nutze mittlerweile für eine ganze Reihe (meist eher einfacher) Webpräsenzen den &lt;em&gt;static site generator&lt;/em&gt; &lt;strong&gt;&lt;a href=&quot;http://nanoc.ws/&quot; title=&quot;&quot;&gt;nanoc&lt;/a&gt;&lt;/strong&gt;. &lt;em&gt;nanoc&lt;/em&gt;, geschrieben in &lt;em&gt;Ruby&lt;/em&gt;, erzeugt anhand vorgegebener Regeln aus einer Verzeichnisstruktur mit Quellcode-Dateien in verschiedenen denkbaren Formaten und Seiten-Templates unter Anwendung von Filtern und ggf. ergänzenden (in &lt;em&gt;Ruby&lt;/em&gt; geschriebenen) Modulen eine (grundsätzlich) statische, d.h. aus einzelnen HTML-Dateien bestehende, Website. Man kann sich das beispielsweise an den Webseiten des &lt;em&gt;&lt;a href=&quot;http://www.cccs.de/&quot; title=&quot;&quot;&gt;CCCS&lt;/a&gt;&lt;/em&gt; &lt;a href=&quot;https://github.com/cccs/cccs-website&quot; title=&quot;GitHub - cccs/cccs-website: nanoc sources of www.cccs.de · GitHub&quot;&gt;ansehen&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;regeln-in-der-rules-datei&quot;&gt;Regeln in der &lt;code&gt;Rules&lt;/code&gt;-Datei&lt;/h3&gt;

&lt;p&gt;Die Datei &lt;code&gt;Rules&lt;/code&gt; enthält dabei die Regelsätze, nach denen die fertigen Webseiten erzeugt werden. Dabei gibt es verschiedene Arten von Regeln, die der Reihe nach von oben nach unten abgearbeitet werden; die Einzelheiten finden sich in der &lt;em&gt;nanoc&lt;/em&gt;-Dokumentation unter &lt;em&gt;&lt;a href=&quot;http://nanoc.ws/docs/basics/#rules&quot; title=&quot;&quot;&gt;Basics&lt;/a&gt;&lt;/em&gt; zusammengefasst.&lt;/p&gt;

&lt;h4 id=&quot;-preprocess-block&quot;&gt;&lt;code&gt;preprocess&lt;/code&gt;-Block&lt;/h4&gt;

&lt;p&gt;Zunächst kann ein optionaler &lt;code&gt;preprocess&lt;/code&gt;-Block definiert werden, in dem Funktionen zusammengestellt werden können, die vor der Bearbeitung der einzelnen Quellcode-Dateien ausgeführt werden sollen. Dieser Block wird - als Code - ausgeführt, sobald die Datenstrukturen geladen wurden.&lt;/p&gt;

&lt;h4 id=&quot;-compile-regeln&quot;&gt;&lt;code&gt;compile&lt;/code&gt;-Regeln&lt;/h4&gt;

&lt;p&gt;Danach folgen &lt;code&gt;compile&lt;/code&gt;-Regeln, die jeweils definieren, welche Filter auf welche Quellcode-Dateien (oder allgemeiner: &lt;em&gt;Items&lt;/em&gt;) angewendet werden sollen und in welches Template sie eingefügt gehören. So kann bspw. &lt;em&gt;Markdown&lt;/em&gt; &lt;em&gt;AsciiDoc&lt;/em&gt; in HTML umgewandelt werden, &lt;em&gt;LESS&lt;/em&gt; oder &lt;em&gt;SASS&lt;/em&gt; compiliert werden usw. usf. Zu Beginn jedes Regelsatzes ist definiert, auf welche &lt;em&gt;Items&lt;/em&gt; er angewendet werden soll; am Ende steht normalerweise eine Default-Regel, die alle nicht gesondert definierten Fälle &amp;#8220;erschlägt&amp;#8221;. Die Regeln werden der Reihe nach abgearbeitet und die erste zutreffende Regel wird ausgeführt.&lt;/p&gt;

&lt;p&gt;Die bei der Erzeugung einer neuen &lt;em&gt;Site&lt;/em&gt; erstellte Beispiel-&lt;code&gt;Rules&lt;/code&gt; sehen insoweit folgendermaßen aus:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;compile &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;*&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;if&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:extension&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; == &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;css&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# don’t filter stylesheets&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;elsif&lt;/span&gt; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;binary&lt;/span&gt;?&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# don’t filter binary items&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; filter &lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:erb&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; layout &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;default&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.css&lt;/code&gt;-Dateien und binäre Dateien werden also gar nicht verarbeitet, alle anderen Dateien werden als HTML mit &lt;em&gt;embedded Ruby&lt;/em&gt; aufgefasst und mit dem Default-Template versehen.&lt;/p&gt;

&lt;h4 id=&quot;-routing-regeln&quot;&gt;&lt;code&gt;routing&lt;/code&gt;-Regeln&lt;/h4&gt;

&lt;p&gt;Nach der Erzeugung der &lt;em&gt;Items&lt;/em&gt; entscheiden die &lt;code&gt;routing&lt;/code&gt;-Regeln, wo die erzeugten Dateien gespeichert werden. Standardmäßig wird aus jeder Quelldatei ein Verzeichnis mit einer entsprechenden &lt;code&gt;index.html&lt;/code&gt; erzeugt; so wird aus dem &lt;em&gt;Markdown&lt;/em&gt;-Quellcode &lt;code&gt;.../faqs/usenet/zitieren.md&lt;/code&gt; die fertige HTML-Datei  &lt;code&gt;.../faqs/usenet/zitieren/index.html&lt;/code&gt;, so dass die Webseite dann unter &lt;code&gt;http://domain.example/faqs/usenet/zitieren/&lt;/code&gt; aufrufbar ist. Das kann so natürlich nicht für &lt;code&gt;.css&lt;/code&gt;-Dateien oder Downloads gelten.&lt;/p&gt;

&lt;p&gt;Die Beispiel-&lt;code&gt;Rules&lt;/code&gt; sehen hier dementsprechend so aus:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;route &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;*&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;if&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:extension&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt; == &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;css&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# Write item with identifier /foo/ to /foo.css&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;identifier&lt;/span&gt;.&lt;span style=&quot;color:#CC0066; font-weight:bold;&quot;&gt;chop&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;.css&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;elsif&lt;/span&gt; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;binary&lt;/span&gt;?&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# Write item with identifier /foo/ to /foo.ext&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;identifier&lt;/span&gt;.&lt;span style=&quot;color:#CC0066; font-weight:bold;&quot;&gt;chop&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;.&amp;amp;#8217; + item[:extension]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;# Write item with identifier /foo/ to /foo/index.html&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;identifier&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;index.html&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;h4 id=&quot;-layout-regeln&quot;&gt;&lt;code&gt;layout&lt;/code&gt;-Regeln&lt;/h4&gt;

&lt;p&gt;Auch die Templates selbst müssen oft noch compiliert werden, bestehen sie doch nicht aus reinem HTML, sondern regelmäßig aus einer Template-Sprache. Welches Template wie bearbeitet wird, regeln - nun ja - die &lt;code&gt;layout&lt;/code&gt;-Regeln.&lt;/p&gt;

&lt;p&gt;Standardmäßig sind &lt;em&gt;embedded Ruby&lt;/em&gt;-Templates vorgesehen:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;layout &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;*&amp;amp;#8217;, :erb&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;h3 id=&quot;-rules-dokumentation&quot;&gt;&lt;code&gt;Rules&lt;/code&gt;-Dokumentation&lt;/h3&gt;

&lt;p&gt;Die Einzelheiten zu &lt;code&gt;compile&lt;/code&gt;-, &lt;code&gt;routing&lt;/code&gt;- und &lt;code&gt;layout&lt;/code&gt;-Regeln lassen sich der &lt;em&gt;nanoc&lt;/em&gt;-Dokumentation im Abschnitt &amp;#8220;&lt;a href=&quot;http://nanoc.ws/docs/reference/rules/&quot; title=&quot;&quot;&gt;Rules&lt;/a&gt;&amp;#8221; entnehmen.&lt;/p&gt;

&lt;p&gt;Nicht dort benannt, aber an mancherlei anderen Stellen der Dokumentation angesprochen sind der &lt;code&gt;preprocess&lt;/code&gt;-Block, aber auch die &lt;code&gt;passthrough&lt;/code&gt;-Regeln. Die gleichfalls durch &lt;em&gt;nanoc&lt;/em&gt; unterstützten &lt;code&gt;ignore&lt;/code&gt;-Regeln finden  außerhalb der Code- bzw. API-Dokumentation gar keine Erwähnung.&lt;/p&gt;

&lt;h3 id=&quot;-passthrough-und-ignore-regeln&quot;&gt;&lt;code&gt;passthrough&lt;/code&gt;- und &lt;code&gt;ignore&lt;/code&gt;-Regeln&lt;/h3&gt;

&lt;p&gt;Das ist schade, denn beide stellen eine praktische Abkürzung dar, wenn ein bestimmtes &lt;em&gt;Item&lt;/em&gt; entweder ungefiltert und ohne Veränderung an seinem Namen und Pfad, also &amp;#8220;as is&amp;#8221;, durchgereicht werden oder wenn es gar nicht bearbeitet werden, sondern ignoriert werden soll.&lt;/p&gt;

&lt;h4 id=&quot;-passthrough-&quot;&gt;&lt;code&gt;passthrough&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;passthrough&lt;/code&gt;-Regeln finden in der Dokumentation unter der Überschrift &amp;#8220;&lt;a href=&quot;http://nanoc.ws/docs/troubleshooting/#pass-through-an-item&quot; title=&quot;&quot;&gt;Troubleshooting&lt;/a&gt;&amp;#8221; Erwähnung. Hat man alle seine &lt;code&gt;.css&lt;/code&gt;-Dateien in einem bestimmten Verzeichnis gesammelt, bspw. in &lt;code&gt;/assets/css&lt;/code&gt;, und will sie auch genau dort wiederfinden, kann man sie entweder von der Kompilation ausnehmen und unverändert routen, wie das (nur eben für Dateien mit der Endung &lt;code&gt;.css&lt;/code&gt; statt Dateien in einem bestimmten Verzeichnis) bereits in den obigen Beispielen erfolgt:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;route &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;/assets/css/*/&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; item.&lt;span style=&quot;color:#9900CC;&quot;&gt;identifier&lt;/span&gt;.&lt;span style=&quot;color:#CC0066; font-weight:bold;&quot;&gt;chop&lt;/span&gt; &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;+&lt;/span&gt; item&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color:#ff3333; font-weight:bold;&quot;&gt;:extension&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;end&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;compile &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;/assets/css/*/&amp;amp;#8217; do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#0000FF; font-weight:bold;&quot;&gt;nil&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Einfacher und kürzer geht es aber auch schlicht so:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;passthrough &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color:#008000; font-style:italic;&quot;&gt;#8216;/assets/css/*/&amp;amp;#8217;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Das kopiert alle Dateien im Quellcode-Verzeichnis &lt;code&gt;/assets/css/&lt;/code&gt; unverändert in das Ausgabeverzeichnis &amp;#8216;/assets/css/`.&lt;/p&gt;

&lt;h4 id=&quot;-ignore-&quot;&gt;&lt;code&gt;ignore&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;ignore&lt;/code&gt;-Regeln wurden leider auch bei der Erstellung der Dokumentation ignoriert; dabei sind sie durchaus praktisch, kann man doch auf diese Weise Quellcode-Dateien von jeder Bearbeitung ausschließen und komplett ignorieren. Das ist insbesondere - und eigentlich nur - dann sinnvoll, wenn es sich um Dateien handelt, die ausschließlich Metadaten in Form von &lt;em&gt;YAML front matter&lt;/em&gt; enthalten und daher nicht angezeigt werden sollen. Das Repository der &lt;em&gt;CCCS&lt;/em&gt;-Webseiten enthält bspw. ein Verzeichnis &lt;code&gt;_data&lt;/code&gt; mit &lt;code&gt;.yaml&lt;/code&gt;-Dateien, in denen Termine pp. definiert werden, oder mit Templates zur Erzeugung von Aushängen oder Pressetexten (mit Hilfe von eigenen &lt;em&gt;nanoc&lt;/em&gt;-Kommandos).&lt;/p&gt;

&lt;p&gt;Will man also alle Dateien oder Verzeichnisse von einer Bearbeitung ausnehmen, die mit einem Unterstrich beginnen (und so bspw. auch Quellcode-Dateien temporär durch eine Umbenennung &amp;#8220;ausblenden&amp;#8221; können, ohne sie zu löschen), kann man entweder entsprechende &lt;code&gt;compile&lt;/code&gt;- und &lt;code&gt;routing&lt;/code&gt;-Regeln erzeugen:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;compile &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;%&lt;/span&gt;r&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;_&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#0000FF; font-weight:bold;&quot;&gt;nil&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;end&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;gt;&lt;/span&gt;route &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;%&lt;/span&gt;r&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;_&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &lt;span style=&quot;color:#0000FF; font-weight:bold;&quot;&gt;nil&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color:#9966CC; font-weight:bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Oder man fasst sich kürzer und das in einer Regel zusammen, was nicht zuletzt auch der Übersichtlichkeit dient:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;ruby geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;ignore &lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;%&lt;/span&gt;r&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;/&lt;/span&gt;_&lt;span style=&quot;color:#006600; font-weight:bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;
&lt;img src=&quot;https://ssl-vg03.met.vgwort.de/na/5f3fbba6c5f94dff8335c50c74b5a0f4&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;&gt; 
    </content:encoded>

    <pubDate>Fri, 24 Apr 2015 05:12:17 +0000</pubDate>
    <guid isPermaLink="false">https://netz-rettung-recht.de/archives/1844-guid.html</guid>
    <category>nanoc</category>

</item>

</channel>
</rss>
