greghendershott / frog Goto Github PK
View Code? Open in Web Editor NEWFrog is a static blog generator implemented in Racket, targeting Bootstrap and able to use Pygments.
Frog is a static blog generator implemented in Racket, targeting Bootstrap and able to use Pygments.
Currently it's hardcoded to show Home and About.html.
Support a _src/navbar.md
file that allows defining the navbar. Since it's Markdown, this could simply be a list of links. For example:
- [Home](/index.html)
- [Products](/Products/index.html)
- [Hot Product A](/Products/HotA.html)
- [Hot Product b](/Products/HotB.html)
- [Support](/Support.html)
- [About](/About.html)
That gets translated into Bootstrap nav menu bar.
For post pages, should take the tags and put them in meta keywords for the generated page.
Racket:
`(meta ([name "keywords"][content ,post-tags]))
HTML:
<meta name="keywords" content=",foo,bar,baz">
Note that non post pages don't have any meta-data. Hmmm, maybe they should (or optionally could) have it. The
Title:
andTags:
would be usable (if not necessarilyDate:
). But this would be a separate feature issue.
Currently the Atom feeds show only the portion of the post above the <!-- more -->
marker (if any) with a "Continue reading..." link. Make this configurable to allow the option of including the full posts.
Relative to commit a4c39d9
The introduction of new match
rules breaks existing markdown "post" files.
Prior to that commit, a post file would look something like this:
Title: The Y Combinator in Six Easy Steps
Date: 2013-05-09T12:43:11
Tags: scheme, racket, lisp, programming
Blah Blah Blah
But the new match
rules, in frog.rkt can't properly match it, thus raising the error.
This might be hard, but it'd be awesome to support automatic smart quotes.
There should be some link, just extremely brief: Title, date, tags.
As pointed out by @dherman
Shelling out to Pygments for each code block takes some non-trivial amount of time. Another approach would be better (although at this point I think it would be more of a nice-to-have than a must-have -- the performance isn't that bad).
It's been interesting to watch pygments.rb (used by GitHub) deal with similar. Originally they shelled out like we're doing now. Then they used a Python embedded in Ruby. Then they switched to keeping Pygments running and piping to it. I imagine the last approach would be the way to go -- if we actually need to be much faster.
For starters, use the first h1 header in the markdown, such as # I am a heading
as the page title.
For the future, consider adding "front matter" indented code block like that used for post pages:
Title: The Page Title
Although for non-post pages it would be optional.
EDIT The original bug report was resolved by getting latest sources. In the discussion it turned out there was another bug, that Frog wasn't handling absence of Pygments. I'm editing the title of the bug so it makes sense when I close it. -- Greg
After pulling the latest changes, then running frog -w
, I noticed that the link to Home is now gone, and instead replaced on the right with the text /index.html &active-uri-path
. An example is shown here.
Piwik seems like an alternative for people who want an open-source, self-hosted alternative to Google Analytics. It would be nice to have a template widget for this (see widgets.rkt
).
If a line starts with with two stars (heavy emphasis), it becomes a bullet instead.
This issue may or may not be posted to the markdown parser, instead.
This way, people migrating from an existing blog don't need to 301 redirect everything.
See for example: http://jekyllrb.com/docs/permalinks/
Requested by @dherman, who at a minimum would like the Octopress default style, which IIUC is /blog/YYYY/MM/DD/filename-without-md-extension/
. (Note: This actually means /blog/YYYY/MM/DD/filename-without-md-extension/index.html
-- every post is an index.html
file alone its own directory -- and, any links we create should be to that /blog/YYYY/MM/DD/filename-without-md-extension/
directory, not to the index.html
file. Also, note the extra blog
directory below the site root.)
+---------------+
| navbar
+---------------+
| header.md
+---------------+
| post 1
| post 2
| ...
| post N
+---------------+
The main area I'd expect any problems is path names. It's possible that converting from local file system paths to URI will result in \
instead of /
in the URI paths.
This should be localized in the abs->rel/www
function. Although not rocket science, it's probably not quite as simple as that. Just need time, and dust off my Windows laptop. If anyone else wants to take a crack at this, first, a pull request would be welcome.
Currently the responsive?
parameter (which selects alternative Bootstrap CSS and JS files, and uses "fluid" container and row classes) is hardcoded to #f
and not loaded from .frogrc
.
The reason why: When it's #t
, the browser acts like it can't find the CSS file at all.
I had this working before with a hand-coded version of my site. It's probably some stupid little bug.
It would be good to get it working, because the responsive grid and fluid elements smartly reflow for smaller screens including tablets and phones. Although not the only reason for using Bootstrap, it's one of the major ones.
According to http://mathiasbynens.be/notes/rel-shortcut-icon and https://twitter.com/mathias/status/332539625375682560 it's best practice not to use rel="shortcut icon"
but rather rel="icon"
since only IE requires the "shortcut" but it only supports .ico files anyway. IOW for anyone who wants to offer alternate favicon image types, they should still provide a default /favicon.ico for IE, and use <link rel="icon" href="favicon.png">
for all other browsers.
For example if an item in navbar.md
is:
- <a href="/index.html" class="brand">My _Awesome_ Blog</a>
Our match
fails two ways:
a
element will only have an href
attribute.a
element is a single element (one string).Make it more flexible in matching and preserving the attributes and elements.
@dherman reports that a file like "2013-06-09-hello-world.md" is creating a file like "-hello-world.html".
As suggested by @samth. A particularly good idea when close to another release of Racket (as now).
Preferably use a nightly build (so that this doesn't become a Travis CI test of building Racket, too). For example:
http://www.cs.utah.edu/plt/snapshots/current/installers/racket-5.90.0.9-x86_64-linux-precise.sh
Only hitch is that the version number -- in this case 5.90.0.9 -- is embedded in the URL. In other words AFIK there is no URL meaning "the latest nightly build". In that case I'd have to keep updating .travis.yml
, which would bite.
Currently the index pages show only the portion of the post above the <!-- more -->
marker (if any) with a "Continue reading..." link. Make this configurable to allow the option of including the full posts.
Index pages currently show all posts in one page. Add ability to paginate to N per page, with older/newer navigation.
The following is what I get when I run frog -b
:
Frog 0.7
Using configuration /home/rmm/tmp/.frogrc
meta-data: A post must have Title/Date/Tags meta-data
Modern web generation tools (like SASS, less, CoffeeScript, Octopress, etc) usually offer some sort of "directory watching" functionality, where you can run the generator in an active mode that automatically detects file changes and regenerates the site. It'd also be great for this to work in conjunction with Issue #26 to only regenerate the changed pages.
It'd be great to avoid regenerating files when their dependencies haven't changed. For each markdown file source, this would probably need to be based on something like:
max({ lastmodified(file) | file in JS, CSS, { source } })
as compared with the generated HTML file.
Issue 25 added smart quotes in post bodies but not in post titles.
Thanks,
Dave
Running mac osx Mavericks and Racket 5.3.6 raco frog -bp generates the following error:
list->string: contract violation
expected: (listof char?)
given: '((# #
#`) #\newline)
any help would be gratefully received. A Racket newbie!
While using Scribble files, instead of Markdown, I noticed that text using @codeblock
does not correctly used fixed-width fonts. I tried that, too, with the sample file included and I get the same behavior.
The procedure preview
uses "sensible-browser", presumably to run the web browser. This works quite well on Debian and Debian-based systems. However, it is not universal -- some systems do not use that convention.
Currently it's extremely verbose. Replace the eprintf
calls with two or three levels of verbosity.
How exactly does frog determine the existence of pygments? I read in pygments.rkt
, under the procedure start-pygments-process
, that it does something to determine the availability of pygments.
Running frog, yields the following:
...
Pygments not installed. Using plain `pre` blocks.
...
The date+tags
variable is handy if you like it preformatted that way. But also supply separate date
and tags
vars. Probably date
should be the date string (as Frog stores it anyway), but tags
should be a (listof string?)
, to make it easier for people to do as they like.
Specifically requested by @dherman
I know you are fond of Pygments, but a way to render code blocks with Scribble would be nice.
This example is from http://blog.racket-lang.org/2012/04/scribble-your-blogs.html :
I don't care about the colors as such, but I miss links from the code to the documentation.
I would like to generate a site that includes a blog, rather then a site that is a blog. So I would like to have full control over the top level index page, and then have the blog or "all posts" index page at a different url, like /blog/index.html
I think the change would mean a new configuration option in .frogrc,
Default to index.html to keep the existing behavior
all-posts-index = index.html
and then use the setting in frog.rkt around line 641.
Great job BTW.
I noticed that as of my latest pull, the first two posts does not display the text before the marker, nor does it display any body of the text. It only shows the title of the post.
I was able to confirm this with my own posts, and with the included example
directory.
I believe frog is hard-coded to require favicon.ico, but favicons can use other image types like .png. It'd be great to make this configurable in .frogrc.
It might be tempting to use Frog for an ordered collection of pages that aren't blog posts. Example applications:
If you're tempted to try, it's a kludgy mess. Sure you could create each slide or page as a blog post. But to order them, you have to give them "dates" ... and in reverse order. Meh.
Also, you probably prefer to have just one .md
source file for the whole series of pages. (I think this is certainly true for the presentation use-case, and probably true for the others.)
Create a .md
(or .scrbl
) file anywhere under _src
.
Although non-post pages don't have meta-data (a.k.a. front matter), now they optionally could:
Title: title
Date: date
Multi-page:
Note that Tags
is N/A for non-postpages. The key is the Multi-page
item, which means to process it into multiple pages. Let's say the file is foo.md
.
foo/
. So, foo/1.html
, foo/2.html
, and so on. Better: Slug the title of each one. So, foo/slug-of-page-1-title.html
, and so on.<-- page -->
. (precedent: <-- more -->
).foo.html
is generated at the same level as foo.md
. It's a little index file with TOC or whatever. Perhaps it's everything up to the first page directive. Details, details.Although the original motivation was non-blog-post pages, I suppose that's orthogonal. Such a file could be a blog post (under _src/posts
). The post page would be the index page with TOC and a little content. The prev/next at that top level would still be among other blog posts. The only difference from a single-page blog post is that most of the content would be spread among the sub-pages. Of course those sub-pages would prev/next among themselves.
In this case the Multi-page:
flag would be an optional extension to the existing meta-data (Title, Date, Tags).
Scribble already knows how to create multiple HTML pages from a single .scrbl
source. If a Multi:
field is added to metadata for .md
sources, probably we should try to honor that .scrbl
sources, too. This would mean running Scribble once to get at the metadata, and (possibly) re-running it if a Multi
field is found. But, so what.
When no items are found in the directory _src/posts/
, without the tag DRAFT
, Frog halts the build process, then displays the message below. That means, at the moment, it becomes mandatory to have a least one "post" page, than can be built, whether it will be used, or not.
drop: index is too large for list
index: 1
list: '()
...
I'm not sure how much it matters in practice for frog's included JS, which is written by Google and Twitter and probably runs quickly, but it's best practice to put scripts at the bottom of a page body:
http://stevesouders.com/examples/rule-js-bottom.php
Not sure if it works to include boostrap's JS at the bottom (I had trouble finding anything about it from Googling), but I'm pretty sure you can put the Google Analytics script at the bottom.
This:
<img src="img/yunocoros.jpg"/> The topic of coroutines (or
fibers, or continuations) for JavaScript comes up from time to time
does not preserve the <img src="/img/yunocoros.jpg"/>
as HTML, instead it becomes plain text.
Reported by @dherman
max-index-items
and max-post-items
aren't being read from .frogrc
.
Links to and from footnotes don't work in feeds (neither Atom nor RSS).
I need to think about it more to understand if this even could work satisfactorily.
If not--or in the meantime--two obvious options:
@shriphani reports: https://gist.github.com/shriphani/7590361
output: don't know how to render value: #<procedure:date>
context...:
/Applications/Racket/collects/scribble/text/output.rkt:125:2: loop
/Applications/Racket/collects/scribble/text/output.rkt:119:6: for-loop
/Applications/Racket/collects/scribble/text/output.rkt:113:2: output-block
/Applications/Racket/collects/scribble/text/output.rkt:37:0: output4
/Applications/Racket/collects/racket/port.rkt:125:0: with-output-to-string
/Users/shriphani/Library/Racket/5.3.6/pkgs/installed/frog/frog/frog.rkt:168:0: write-post-page
/Users/shriphani/Library/Racket/5.3.6/pkgs/installed/frog/frog/frog.rkt:611:0: build
/Applications/Racket/collects/racket/cmdline.rkt:462:12: loop
/Users/shriphani/Library/Racket/5.3.6/pkgs/installed/frog/frog/frog.rkt: [running body]
/Applications/Racket/collects/raco/raco.rkt: [running body]
/Applications/Racket/collects/raco/main.rkt: [running body]
However I can't reproduce: https://gist.github.com/greghendershott/7591917
In the process of building his blog I did see and fix two other issues:
But I can't repo this issue. I did try this: 2449f9b but @shriphani reported it didn't resolve the issue.
Make sure the generated HTML uses ARIA roles for accessibility.
While the hood is open: Also look for any HTML5 semantic elements that could be used, e.g. <main>
for the main content div
.
@dherman reports that λ isn't being rendered by Pygments; he's using Pygments 1.6 in case that matters.
I can't repro this myself (at least not with Pygments 1.5).
In markdown like this:
Here is a lambda: λ.
Here is a lambda: `λ`.
And here:
(λ () #t)
And here:
```racket
(λ () #t)
```
And here:
```scheme
(λ () #t)
```
I get the λ in every case in the HTML output.
![screen shot 2013-11-11 at 01 45 05](https://f.cloud.github.com/assets/132011/1509172/5296c198-4a38-11e3-8534-ab1acc1cb220.png)
Am I doing it wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.