/usr/share/doc/libghc-hakyll-doc/html/Hakyll-Core-Routes.html is in libghc-hakyll-doc 4.9.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Hakyll.Core.Routes</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Hakyll-Core-Routes.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Hakyll-Core-Routes.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hakyll-4.9.2.0: A static website compiler library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Hakyll.Core.Routes</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Once a target is compiled, the user usually wants to save it to the disk.
This is where the <code><a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></code> type comes in; it determines where a certain
target should be written.</p><p>Suppose we have an item <code>foo/bar.markdown</code>. We can render this to
<code>foo/bar.html</code> using:</p><pre>route "foo/bar.markdown" (setExtension ".html")</pre><p>If we do not want to change the extension, we can use <code><a href="Hakyll-Core-Routes.html#v:idRoute">idRoute</a></code>, the simplest
route available:</p><pre>route "foo/bar.markdown" idRoute</pre><p>That will route <code>foo/bar.markdown</code> to <code>foo/bar.markdown</code>.</p><p>Note that the extension says nothing about the content! If you set the
extension to <code>.html</code>, it is your own responsibility to ensure that the
content is indeed HTML.</p><p>Finally, some special cases:</p><ul><li>If there is no route for an item, this item will not be routed, so it will
not appear in your site directory.</li><li>If an item matches multiple routes, the first rule will be chosen.</li></ul></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">type</span> <a href="#t:UsedMetadata">UsedMetadata</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Routes">Routes</a></li><li class="src short"><a href="#v:runRoutes">runRoutes</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> Provider -> <a href="Hakyll-Core-Identifier.html#t:Identifier">Identifier</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="Hakyll-Core-Routes.html#t:UsedMetadata">UsedMetadata</a>)</li><li class="src short"><a href="#v:idRoute">idRoute</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:setExtension">setExtension</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:matchRoute">matchRoute</a> :: <a href="Hakyll-Core-Identifier-Pattern.html#t:Pattern">Pattern</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:customRoute">customRoute</a> :: (<a href="Hakyll-Core-Identifier.html#t:Identifier">Identifier</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a>) -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:constRoute">constRoute</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:gsubRoute">gsubRoute</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>) -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:metadataRoute">metadataRoute</a> :: (<a href="Hakyll-Core-Metadata.html#t:Metadata">Metadata</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a>) -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li><li class="src short"><a href="#v:composeRoutes">composeRoutes</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:UsedMetadata" class="def">UsedMetadata</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Hakyll-Core-Routes.html#UsedMetadata" class="link">Source</a> <a href="#t:UsedMetadata" class="selflink">#</a></p><div class="doc"><p>When you ran a route, it's useful to know whether or not this used
metadata. This allows us to do more granular dependency analysis.</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Routes" class="def">Routes</a> <a href="src/Hakyll-Core-Routes.html#Routes" class="link">Source</a> <a href="#t:Routes" class="selflink">#</a></p><div class="doc"><p>Type used for a route</p></div><div class="subs instances"><p id="control.i:Routes" class="caption collapser" onclick="toggleSection('i:Routes')">Instances</p><div id="section.i:Routes" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Routes:Monoid:1" class="instance expander" onclick="toggleSection('i:id:Routes:Monoid:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></span> <a href="src/Hakyll-Core-Routes.html#line-77" class="link">Source</a> <a href="#t:Routes" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Routes:Monoid:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:mempty">mempty</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="#v:mempty" class="selflink">#</a></p><p class="src"><a href="#v:mappend">mappend</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="#v:mappend" class="selflink">#</a></p><p class="src"><a href="#v:mconcat">mconcat</a> :: [<a href="Hakyll-Core-Routes.html#t:Routes">Routes</a>] -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="#v:mconcat" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:runRoutes" class="def">runRoutes</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> Provider -> <a href="Hakyll-Core-Identifier.html#t:Identifier">Identifier</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a>, <a href="Hakyll-Core-Routes.html#t:UsedMetadata">UsedMetadata</a>) <a href="src/Hakyll-Core-Routes.html#runRoutes" class="link">Source</a> <a href="#v:runRoutes" class="selflink">#</a></p><div class="doc"><p>Apply a route to an identifier</p></div></div><div class="top"><p class="src"><a id="v:idRoute" class="def">idRoute</a> :: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#idRoute" class="link">Source</a> <a href="#v:idRoute" class="selflink">#</a></p><div class="doc"><p>A route that uses the identifier as filepath. For example, the target with
ID <code>foo/bar</code> will be written to the file <code>foo/bar</code>.</p></div></div><div class="top"><p class="src"><a id="v:setExtension" class="def">setExtension</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#setExtension" class="link">Source</a> <a href="#v:setExtension" class="selflink">#</a></p><div class="doc"><p>Set (or replace) the extension of a route.</p><p>Example:</p><pre>runRoutes (setExtension "html") "foo/bar"</pre><p>Result:</p><pre>Just "foo/bar.html"</pre><p>Example:</p><pre>runRoutes (setExtension "html") "posts/the-art-of-trolling.markdown"</pre><p>Result:</p><pre>Just "posts/the-art-of-trolling.html"</pre></div></div><div class="top"><p class="src"><a id="v:matchRoute" class="def">matchRoute</a> :: <a href="Hakyll-Core-Identifier-Pattern.html#t:Pattern">Pattern</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#matchRoute" class="link">Source</a> <a href="#v:matchRoute" class="selflink">#</a></p><div class="doc"><p>Apply the route if the identifier matches the given pattern, fail
otherwise</p></div></div><div class="top"><p class="src"><a id="v:customRoute" class="def">customRoute</a> :: (<a href="Hakyll-Core-Identifier.html#t:Identifier">Identifier</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a>) -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#customRoute" class="link">Source</a> <a href="#v:customRoute" class="selflink">#</a></p><div class="doc"><p>Create a custom route. This should almost always be used with
<code><a href="Hakyll-Core-Routes.html#v:matchRoute">matchRoute</a></code></p></div></div><div class="top"><p class="src"><a id="v:constRoute" class="def">constRoute</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#constRoute" class="link">Source</a> <a href="#v:constRoute" class="selflink">#</a></p><div class="doc"><p>A route that always gives the same result. Obviously, you should only use
this for a single compilation rule.</p></div></div><div class="top"><p class="src"><a id="v:gsubRoute" class="def">gsubRoute</a> <a href="src/Hakyll-Core-Routes.html#gsubRoute" class="link">Source</a> <a href="#v:gsubRoute" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Pattern</p></td></tr><tr><td class="src">-> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Replacement</p></td></tr><tr><td class="src">-> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></td><td class="doc"><p>Resulting route</p></td></tr></table></div><div class="doc"><p>Create a gsub route</p><p>Example:</p><pre>runRoutes (gsubRoute "rss/" (const "")) "tags/rss/bar.xml"</pre><p>Result:</p><pre>Just "tags/bar.xml"</pre></div></div><div class="top"><p class="src"><a id="v:metadataRoute" class="def">metadataRoute</a> :: (<a href="Hakyll-Core-Metadata.html#t:Metadata">Metadata</a> -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a>) -> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a> <a href="src/Hakyll-Core-Routes.html#metadataRoute" class="link">Source</a> <a href="#v:metadataRoute" class="selflink">#</a></p><div class="doc"><p>Get access to the metadata in order to determine the route</p></div></div><div class="top"><p class="src"><a id="v:composeRoutes" class="def">composeRoutes</a> <a href="src/Hakyll-Core-Routes.html#composeRoutes" class="link">Source</a> <a href="#v:composeRoutes" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></td><td class="doc"><p>First route to apply</p></td></tr><tr><td class="src">-> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></td><td class="doc"><p>Second route to apply</p></td></tr><tr><td class="src">-> <a href="Hakyll-Core-Routes.html#t:Routes">Routes</a></td><td class="doc"><p>Resulting route</p></td></tr></table></div><div class="doc"><p>Compose routes so that <code>f `composeRoutes` g</code> is more or less equivalent
with <code>g . f</code>.</p><p>Example:</p><pre>let routes = gsubRoute "rss/" (const "") `composeRoutes` setExtension "xml"
in runRoutes routes "tags/rss/bar"</pre><p>Result:</p><pre>Just "tags/bar.xml"</pre><p>If the first route given fails, Hakyll will not apply the second route.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>
|