Giter Site home page Giter Site logo

hakyll-ikiwiki's Introduction

Hakyll-IkiWiki

Experimental code for interpreting IkiWiki-format wiki-links and directives in a Hakyll site.

I'm exploring whether/how easily I could migrate from IkiWiki to Hakyll. I'm keen to continue to use the IkiWiki link syntax ([[example]]), as well as some of the features that are obtained via plugins via directives ([[!example label=value]]), and IkiWiki's link-resolving logic.

The wikilink-and-directive finding is implemented as a Parsec parser, that should run prior to the content being passed to Pandoc. This can't easily be achieved with a Pandoc filter (operating on the Pandoc AST) because the tokens we want might be split up across any kind of different text nodes. The approach we use is to substitute, where possible, the link syntax with a HTML link. Pandoc then later will interpret the result. This means that thing will only work if the underlying markup language supports in-line HTML. Markdown does, Textile does, HTML obviously does, restructuredText does not.

I've begun implementing logic for some IkiWiki plugins in the Directive handling. Presently they can generate plain text or updated Metadata. I still need to figure out how to plumb the collated Metadata back into Hakyll.

I want to support IkiWiki's [[!template]], where possible, and plan to see if translating them into Hakyll's template tokens (e.g. $partial("filename.html")$) as inline text works or not.

Example in use

The site.hs is a simple example Hakyll program, derived from the basic template that hakyll-init generates for you. I've trimmed it a little bit and integrated IkiWiki.hs into it. The content in css and images is unchanged; posts has blog posts that demonstrate IkiWiki-style interlinks and directives in use.

hakyll-ikiwiki.cabal and stack.yaml are (for now) specific to this demonstration. You can use either Haskell Stack or Cabal to build the demo site.

hakyll-ikiwiki's People

Contributors

jmtd avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hakyll-ikiwiki's Issues

move integration boilerplate into an exported function

This stuff can probably be hoisted into a utility function

 37         compile $ do
 38             body <- getResourceBody
 39             let (body', md) = handleWikiLinks (itemBody body)
 40             let metadataCtxs =
 41                  map (\(k,v) -> constField k v) (M.toList md)
 42             let ctx = (mconcat metadataCtxs) `mappend` (postCtxWithTags tags)
 43             do
 44                 renderPandoc (itemSetBody body' body)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.