1
1
mirror of https://github.com/srid/rib.git synced 2024-11-27 01:12:09 +03:00
Commit Graph

225 Commits

Author SHA1 Message Date
Sridhar Ratnakumar
0a2ec4c34d Fix README example 2020-01-01 17:19:58 -05:00
Sridhar Ratnakumar
bb17c2bd30
buildHtml* API changes (#73)
Add outfile argument to buildHtml*
Make parser the first argument in buildHtml*
Add buildHtml_ that discards its results
2020-01-01 14:13:27 -05:00
Sridhar Ratnakumar
36670e03a4 Fix README example 2019-12-31 21:39:34 -05:00
Sridhar Ratnakumar
e9a326fd79
Merge pull request #71 from srid/build-html-single
Add singular version of buildHtmlMulti
2019-12-31 21:33:09 -05:00
Sridhar Ratnakumar
7ec05a94af Add singular version of buildHtmlMulti
buildHtml was incorrectly named; it should have actually been called
writeHtml. This commit also actually implements buildHtml, which is like
buildHtmlMulti but operating on a single file.
2019-12-31 21:25:29 -05:00
Sridhar Ratnakumar
916f671b3a
Merge pull request #70 from srid/shake-dont-crash
Don't crash on Shake errors
2019-12-31 21:24:58 -05:00
Sridhar Ratnakumar
3fa3943559 Add to changelog 2019-12-31 20:15:42 -05:00
Sridhar Ratnakumar
1ef7941ad5 Don't crash on Shake errors
During the initial full generation we are not handing exceptions from
Shake (which can happen due to parser errors from user code). This
change handles it.
2019-12-31 20:13:52 -05:00
Sridhar Ratnakumar
e82ca00c7c
Merge pull request #69 from srid/source-reader-action
Make SourceReader a Shake Action
2019-12-31 20:12:12 -05:00
Sridhar Ratnakumar
a1409e4963 readSource: handle errors internally
So the user does not have to.
2019-12-31 19:40:25 -05:00
Sridhar Ratnakumar
ece3101f89 Simplify and expose readSource
Useful in user code when wanting to read a single source file, as
opposed to a pattern of them. The other difference to buildHtmlMulti is
that readSource merely parses the source, but does not write HTML of it.

Example:

```haskell
  blurb <- Rib.readSource MMark.parse [relfile|fragments/index.md|] >>= \case
    Left e -> fail $ toString e
    Right v -> pure v
```
2019-12-31 19:35:09 -05:00
Sridhar Ratnakumar
2203052ceb parseIO -> parse
Because it is not simply an IO action anymore.
2019-12-31 13:11:20 -05:00
Sridhar Ratnakumar
5e82a20762 Make SourceReader a Shake Action
This will allow us to do Shake-y things in our readers. For example,
parsing our Dhall files may require `need`'ing its dependent .dhall
files, doing which ensures that when those files change rib will
re-generate our site accordingly.

Code example:

```haskell
parseIO :: FromDhall a => Path b File -> Action (Either Text a)
parseIO (toFilePath -> f) = do
  inputDir <- ribInputDir
  let dhallDeps =
        [ [relfile|Entry.dhall|],
          [relfile|Metric.dhall|]
        ]
  need $ fmap (toFilePath . (inputDir </>)) dhallDeps
  s <- toText <$> readFile' f
  e <-
    liftIO $ withCurrentDirectory (toFilePath inputDir) $
      input auto s
  pure $ Right e

```
2019-12-31 12:00:48 -05:00
Sridhar Ratnakumar
eadcdfd4cc
Add macOS to CI matrix (#68)
Also, re-enable fsatrace in default.nix but only on Linux.
2019-12-31 10:53:06 -05:00
Sridhar Ratnakumar
11a9f5d6f4 Remove fsatrace
Not supported on macOS
2019-12-31 09:49:24 -05:00
Sridhar Ratnakumar
054acd260d Use + here 2019-12-30 19:25:44 -05:00
Sridhar Ratnakumar
6867cd9a12 Expose getDirectoryFiles' 2019-12-30 19:20:11 -05:00
Sridhar Ratnakumar
0095d7c49a Resurrect the simpler SourceReader type 2019-12-30 17:16:45 -05:00
Sridhar Ratnakumar
0f9593e7fb
Implement shake caching (#66)
* Add fsatrace to nix
* Use cacheActionWith to prevent rebuilds
* Log whenever a HTML file is written
* Change the type signature of `SourceReader` accordingly
2019-12-30 16:52:50 -05:00
Sridhar Ratnakumar
bbec436401 Refactor 2019-12-30 12:43:52 -05:00
Sridhar Ratnakumar
ced10adaae
Add zulip chat link 2019-12-29 21:12:11 -05:00
Sridhar Ratnakumar
dd64cc5a33
Merge pull request #65 from srid/custom-markup
Vastly simplify API, so users can use custom parsers
2019-12-29 20:51:21 -05:00
Sridhar Ratnakumar
c001688e22 Update README, and final cleanups 2019-12-29 20:50:49 -05:00
Sridhar Ratnakumar
23222b5be2 Rib.Markup -> Rib.Source 2019-12-29 20:14:31 -05:00
Sridhar Ratnakumar
2d17ed6835 Document => Source 2019-12-29 19:01:57 -05:00
Sridhar Ratnakumar
8b0e3d2cec Remove unused code 2019-12-29 18:51:24 -05:00
Sridhar Ratnakumar
276ed5b449 Flip arguments 2019-12-29 18:43:39 -05:00
Sridhar Ratnakumar
89f4843676 Remove type class
Not needed anymore.
2019-12-29 18:37:45 -05:00
Sridhar Ratnakumar
d71d7f83f3 Remove named arguments from type class
Not useful anymore
2019-12-29 17:47:34 -05:00
Sridhar Ratnakumar
521a396531 Remove extractMeta from type class 2019-12-29 13:57:39 -05:00
Sridhar Ratnakumar
84bc8f830f Introduce SubMarkup type
To specify the sub markup type to use in parser.

This is useful for Pandoc, but useless for most other types (so we use `()`)
2019-12-29 13:56:55 -05:00
Sridhar Ratnakumar
fedc95d099 Remove rendering from IsMarkup and Document 2019-12-29 12:42:17 -05:00
Sridhar Ratnakumar
3dfcf20b5f Update ChangeLog 2019-12-29 12:21:02 -05:00
Sridhar Ratnakumar
0bd444c4ca Expose IsMarkup 2019-12-29 12:18:28 -05:00
Sridhar Ratnakumar
d3d86746b8 Derive functor for Document
This is needed so the user can use Some on the repr field
2019-12-29 12:17:38 -05:00
Sridhar Ratnakumar
d92388a3e5 Eliminate Some/Proxy, reverting to simplest API
Some and Proxy can be something the user can use on their code to
multiplex between documents using disparate markup types.
2019-12-29 12:16:51 -05:00
Sridhar Ratnakumar
4f42517abb Remove Markup type in favour of Some and Proxy
Drop dependent-sum as well.
2019-12-28 20:59:14 -05:00
Sridhar Ratnakumar
7def29e4f1 Note about nixpkgs 2019-12-28 20:56:35 -05:00
Sridhar Ratnakumar
9ef7cd159e Add dhall as a depedency; advance shake to 0.18.4 2019-12-28 20:29:28 -05:00
Sridhar Ratnakumar
f638bb13b9 Expose ribInputDir and ribOutputDir 2019-12-28 20:15:24 -05:00
Sridhar Ratnakumar
54e0b66789 Fix #63: create intermediate directories 2019-12-28 12:06:32 -05:00
Sridhar Ratnakumar
5b699a1851 Update README example 2019-12-20 13:45:16 -05:00
Sridhar Ratnakumar
eb0134a4d7
Indicate unreleased 2019-12-19 12:12:48 -05:00
Sridhar Ratnakumar
c43b422328
Multi-parser support (#58)
* WIP, try to move away from type class

Use a Map of patterns to parser type, so as to select the parser
explicitly without using type applications (which unifies it for all
files)

* Use dependent-sum

* Rename to IsMarkup

* Use Data.Some for polymorphic lists

* Refactor out withSomeMarkupDoc

* Move MarkupDoc to Markup module

* Rename

* ChangeLog and import cleanup

* Update README for this PR
2019-12-14 19:42:39 -05:00
Pablo
ef198cc292 Add version constraint on path library 2019-12-14 16:00:08 -05:00
Sridhar Ratnakumar
c8f92833f2 Release 0.5.0.0 2019-12-01 19:13:56 -05:00
Sridhar Ratnakumar
a59175a46f Don't expose Rib.Server
Not used anymore.
2019-12-01 19:11:00 -05:00
Sridhar Ratnakumar
ad25e41416 Refactor ExceptT 2019-11-29 16:09:32 -05:00
Sridhar Ratnakumar
1454481dc0
Add CI configuration (#55) 2019-11-27 12:42:43 -05:00
Sridhar Ratnakumar
f8c1efb8c1 Cleanup TODOs 2019-11-27 10:32:18 -05:00