hakyll-contrib-csv: Generate Html tables from Csv files

[ bsd3, library, web ] [ Propose Tags ]

A Hakyll extension for incorporating Csv data into your static site.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2
Dependencies base (>=4.8 && <5), blaze-html (>=0.5 && <0.9), bytestring (>=0.9 && <0.11), cassava (>=0.4 && <0.5), hakyll (>=4.7 && <4.9), vector (>=0.11 && <0.12) [details]
License BSD-3-Clause
Copyright 2016 Erik Stevenson
Author Erik Stevenson
Maintainer eriknstevenson@gmail.com
Category Web
Home page https://github.com/narrative/hakyll-contrib-csv#readme
Bug tracker https://github.com/narrative/hakyll-contrib-csv/issues
Uploaded by narrative at 2016-05-19T19:43:41Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1887 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-05-19 [all 1 reports]

Readme for hakyll-contrib-csv-0.1.0.2

[back to package description]

Csv to Html table generator for Hakyll

Turns this

Year,Make,Model,Description,Price
1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""","",4900.00
1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",4799.00

Into this

<table>
    <thead>
        <tr>
            <td>Year</td>
            <td>Make</td>
            <td>Model</td>
            <td>Description</td>
            <td>Price</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1997</td>
            <td>Ford</td>
            <td>E350</td>
            <td>ac, abs, moon</td>
            <td>3000.00</td>
        </tr>
        <tr>
            <td>1999</td>
            <td>Chevy</td>
            <td>Venture &quot;Extended Edition&quot;</td>
            <td></td>
            <td>4900.00</td>
        </tr>
        <tr>
            <td>1999</td>
            <td>Chevy</td>
            <td>Venture &quot;Extended Edition, Very Large&quot;</td>
            <td></td>
            <td>5000.00</td>
        </tr>
        <tr>
            <td>1996</td>
            <td>Jeep</td>
            <td>Grand Cherokee</td>
            <td>MUST SELL! air, moon roof, loaded</td>
            <td>4799.00</td>
        </tr>
    </tbody>
</table>

Usage

{-# LANGUAGE OverloadedStrings #-}

import Hakyll
import Hakyll.Contrib.Csv

main :: IO ()
main = hakyll $ do

  match "csv/*.csv" $ do
    route $ setExtension "html" `composeRoutes` gsubRoute "csv/" (const "")
    compile $
      csvTable
      >>= loadAndApplyTemplate "templates/layout.html" defaultContext
      >>= relativizeUrls

  match "templates/*" $ compile templateCompiler