Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/athanclark/markup
Generic interface to markup languages
https://github.com/athanclark/markup
deployment-schemes generic-interface haskell monad urlpath
Last synced: 6 days ago
JSON representation
Generic interface to markup languages
- Host: GitHub
- URL: https://github.com/athanclark/markup
- Owner: athanclark
- License: mit
- Created: 2014-12-10T14:54:09.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-12-29T22:00:16.000Z (about 5 years ago)
- Last Synced: 2024-04-26T01:02:04.363Z (8 months ago)
- Topics: deployment-schemes, generic-interface, haskell, monad, urlpath
- Language: Haskell
- Size: 5.18 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![MIT License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](https://tldrlegal.com/license/mit-license)
[![Hackage](http://img.shields.io/badge/hackage-0.0.3-brightgreen.svg)](https://hackage.haskell.org/package/markup)
[![Stories in Ready](https://badge.waffle.io/athanclark/markup.png?label=ready&title=Ready)](https://waffle.io/athanclark/markup)markup
======> **WARNING**: This project is in it's infancy, please don't expect it to work.
> Thank you :)A generic interface to chunks of markup.
In this library, we try to ambiguate _types_ of markup via data types, namely
`Image` and `JavaScript` as examples. From here, we can issue a call to
`renderMarkup` on these abstract labels, which will return some markup wrapped
in a monad - in our case, we've made a few monad readers to represent the
different ways a single idea can be deployed as markup.We have three different deployment schemes - inline, hosted, and local. Inline
markup simply tries to take the information in question and insert it inside the
markup. Hosted markup simply takes the idea and expects it to be somewhere else,
possibly hosted in a CDN. Local markup tries to utilize
[urlpath](https://github.com/athanclark/urlpath) as the means of representing a
local link (absolute, relative, and grounded methods are in another monad -
inside the `HtmlT m ()` of lucid, in this case. Urlpath isn't supported for
Blaze-html.)## Installation
```bash
cabal install markup
```## Usage
It's a little awkward at the moment:
```haskell
image' = renderMarkup Image :: Monad m => HostedMarkupT m T.Text (Html ())image = runHostedMarkupT image' "foo.png"
λ> renderText image
```We could also overload the `run*` monad transformer actions of each deployment
scheme, allowing for the decision to be made just with a type coersion. Maybe in
v0.0.2 :)Here is the same example, going relative instead:
```haskell
image' = renderMarkup Image :: (Monad m, Url UrlString AbsoluteUrl) => LocalMarkupT UrlString m (HtmlT AbsoluteUrl ())λ> (runUrlReader $ renderTextT $ runIdentity $ runLocalMarkupT image' $
"foo.png" > ("key","bar")
) "example.com"""
```## How to run tests
```
cabal configure --enable-tests && cabal build && cabal test
```## Contributing
Fork, PR, repeat.