Commit graph

20 commits

Author SHA1 Message Date
pho4cexa
3833395a2c handle markdown parser errors, (some) binary files
also don't attempt to render (some) binary files

we need to figure out a better heuristic for detecting what's a viewable
file and what's not. git has something built-in for diffs but i don't
know where it lives to trigger it. .gitattributes lets you configure it
but there are also built-in rules it has as well.

there's other mechanisms to detect filetype like file(1) that we could
call out to. maybe there's an egg for it but i haven't found it
2022-12-07 21:10:57 -05:00
pho4cexa
cbb8b3e606 fix a type check that only csc catches 2022-12-07 21:10:39 -05:00
pho4cexa
31f8ab2d0f whoops typo'd the path to the directory to create 2022-12-07 21:10:35 -05:00
pho4cexa
66f1105deb don't call (main) twice when running uncompiled
this set of patches gets repo2html working for me running as cli, both compiled
and not, for fa! there was one markdown file in fa that lowdown throws an error
about, i haven't investigated further. but i catch the error and render as
plaintext instead.

i haven't re-tested running as githook for pushing to fa and other repos yet.
2022-12-07 21:10:07 -05:00
m455
a67a26548f Fixed environment variables and removed WEB-DIRECTORY environment variable 2022-12-07 15:34:12 -05:00
pho4cexa
50bbb3686d massive changes incl. support for images, markdown
i started this off by trying to learn more about how scheme does file
i/o. it seems like many of its functions just expect you'll want them to
write to (current-output-port) instead of returning a string. so i
thought, i wonder what it would look like if i tweak these content
generator functions to just (display) their stuff, and
call (with-output-to-file) and apply the html template each time i call
them?

and whew it kindof got away from me

i totally understand if you feel like this is an unpleasant overhaul of
your whole project and don't want to merge this change!

anyway let's see if i can summarize the changes:

- image support!!
- svg image support!! it shows both the svg and its source code!
- markdown support; we now render all .md files instead of showing source
- using string->goodHTML instead of clean-html. turns out, it's a little
  annoying, in that it only returns a string if it makes no changes, but
  if it does, it returns a list of strings. it expects to be passed to
  one of the other functions in the sxml library, so that's what i do.
- moved "wrap the template" outside of various "generate content"
  functions
- simple command line use: from any git work-tree OR bare repo, run
  repo2html /path/to/www/output/repo-foo-bar and it will create that
  directory and use "repo-foo-bar" as the repo name.
- made our example post-receive a bit more robust
  - changed env var names to have REPO2HTML_ prefix
  - better repo name detection and automatic caching of it in git config
  - moved the post-receive-specific logic to avoid generating if we're
    not updating HEAD into the post-receive hook itself, along with some
    status messages
  - checked directory permissions in the hook so it doesn't even attempt
    to run repo2html and avoids a crash
2022-12-07 14:51:23 -05:00
pho4cexa
1a3b8b1aa1 undo logic specific to use as git hook, for now
i've got a more complete fix in stash but it's taking too long to
complete and i want your cli to work again! this should do it.
2022-12-06 11:41:16 -05:00
pho4cexa
42d1fab665 move common line outside conditional for d.r.y. 2022-12-04 23:00:24 -05:00
pho4cexa
c69fe335e3 generate a simple contributors file
i very much don't know quite what i'm doing with scheme's ports and
capturing output to write to files. this arrangement seems to work but i
suspect some of my changes are unnecessary or redundant and there must
be a much more elegant way to write it
2022-12-04 22:59:46 -05:00
pho4cexa
f09f679ad3 mark main.scm executable for use without compile 2022-12-04 20:57:13 -05:00
pho4cexa
b3719a005d build html only when HEAD branch changes; cleanup:
post-receive commit hooks receive on standard input lines of the form:

old-commit new-commit ref
old-commit new-commit ref
old-commit new-commit ref

so we can inspect those lines to determine whether or not the current
branch (aka HEAD) has been changed. because there's no reason to rebuild
the html representation of other branches.

in future we might even use the git tree-diff between old-commit and
new-commit to determine the set of files that have been added, removed,
or changed, and regenerate the html representation for only those files,
instead of deleting and rebuilding all files every time.
2022-12-04 20:57:07 -05:00
pho4cexa
aac42ed7b2 simplify redundant (if COND #t #f) 2022-12-04 20:57:02 -05:00
pho4cexa
58bd6a150d add shebang line so we can use without compilation 2022-12-04 20:56:25 -05:00
m455
b9c3c29162 made inline code pink as well 2022-12-03 00:47:48 -05:00
m455
76b127175c renamed some functions
- renamed generate-readme-file to generate-readme-page
- renamed generate-files-file to generate-files-page
2022-12-02 23:53:53 -05:00
m455
0216eacef6 cleaned up main.scm
- removed old comments
- moved todos and nice-to-haves into the README.md's todos and hopes
- changed gobally mutated variables to be global constants. originally
  these were mutated because the code was structured differently, and
  allowed an option argument, specifying which bare git repo to use, but
  i removed that, and forgot to remove and change the cruft
2022-12-02 23:31:54 -05:00
pho4cexa
1165ba3342 html templating using ml string w/expressions
http://wiki.call-cc.org/man/5/Extensions%20to%20the%20standard#multiline-string-constant-with-embedded-expressions
2022-12-02 22:39:51 -05:00
pho4cexa
663be9e77c simplify capture of env vars with defaults 2022-12-02 22:39:32 -05:00
Jesse Laprade
57859b31fa lightened shade of the default pink 2022-12-02 16:47:20 -05:00
Jesse Laprade
32c540a903 first commit 2022-12-02 16:41:55 -05:00