Comments (6)
Yes, Rib should already do this. In a private project of mine I have a/2019/12/25.md
=> b/2019/12/25.html
which is done by this code:
entries <-
Rib.buildHtmlMulti M.parse [[relfile|*/*/*.md|]] $ renderPage . Target_Page
Does it not already work for you? If so, could you show your code?
from rib.
Rib uses Development.Shake.FilePattern
, which also supports **
(double star) to match an arbitrary number of path components. You can see that Rib already uses this to copy over static files:
Rib.buildStaticFiles [[relfile|static/**|]]
from rib.
When using the Rib sample pattern, like this:
generateSite = do
-- Copy over the static files
Rib.buildStaticFiles [[relfile|static/**|]]
-- Build individual markup sources, generating .html for each.
docs <- Rib.buildHtmlMulti patterns $ renderPage . Page_Doc
-- Build an index.html linking to the aforementioned files.
Rib.buildHtml [relfile|index.html|] $ renderPage $ Page_Index docs
-- File patterns to build, using the associated markup parser
patterns = Map.fromList [ ([relfile|**/*.md|], Some Rib.Markup_MMark)]
It throws the error:
* Raised the exception:
dist/about/index.html: openFile: does not exist (No such file or directory)
...which is unusual, because of course it doesn't exist yetβit hasn't built it yet. I get the same error when I use */*.md
as the pattern.
from rib.
The site I'm trying to build is here. It has pages like about/index.md
and texts/index.md
. Maybe there could be a rule in Shake that would allow for pretty URLs? That is, rendering /about.md
as /about/index.html
as in Jekyll.
from rib.
The site I'm trying to build is here.
This is most useful to share; thanks!
dist/about/index.html: openFile: does not exist (No such file or directory)
This was bug #63 that got fixed recently. Advancing rib in default.nix should resolve it; I opened a PR here: open-editions/open-editions.org#3
It has pages like about/index.md and texts/index.md. Maybe there could be a rule in Shake that would allow for pretty URLs? That is, rendering /about.md as /about/index.html as in Jekyll.
This is certainly doable. Rib assumes that /foo/bar.md will map to /foo/bar.html. buildHtmlMulti
is defined in a handful of lines like this:
buildHtmlMulti parser pats r = do
input <- ribInputDir
fs <- getDirectoryFiles' input pats
forP fs $ \k -> do
outfile <- liftIO $ replaceExtension ".html" k
buildHtml parser outfile k r
Note that outfile
is same as source path, except for file extension. You can basically copy paste this function in your Main.hs and customize it however you want. I gave it a go here: open-editions/open-editions.org#5
I suppose buildHtmlMulti
can be customized to take a function FilePath -> FilePath
that determines this outfile. Or, better FilePath -> Slug
using the slug type (basically a newtype over FilePath) proposed by @joelmccracken in Rib chat room at Zulip.
from rib.
Thanks for the PR! This is great.
from rib.
Related Issues (20)
- Support for websites located in subdirectories HOT 5
- Simplify rib CLI commands
- Document custom CLI arguments
- Document Syntax highlighting
- Allow customizing server host
- Display build errors in HTTP interface HOT 1
- watchIgnore should not resolve symlinks
- Clean stale generated files automatically
- Add `routeUri`
- Split into two packages
- Chokes on integers as title -- eg: 2020 HOT 2
- Use shake-dhall
- Version bounds on relude and dhall are very strict HOT 2
- Please, give a new release HOT 2
- Rib hangs when building site that imports additional modules HOT 4
- Allow query arguments in route Url
- Turn symlinks into redirect files HOT 6
- Use external templating system (like EDE) + need of a function to relativize urls HOT 2
- aeson upper bound is out of date
- Recommend Ema once it is released
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rib.