Commit graph

126 commits

Author SHA1 Message Date
m455
07f30a1356 added ersatz dependency to makefile 2022-12-16 13:39:18 -05:00
pho4cexa
146ce5a05d whoops forgot relative_root in the ersatz template 2022-12-16 13:31:44 -05:00
pho4cexa
35496ee17e enable customizable jinja-like templates via ersatz!
well this was a journey :)

behavior when running `repo2html <output directory>` remains the same;
we apply our internal sxml template as usual.

to use ersatz templates, run like this:

`repo2html <output directory> <template directory>`

the program will look for a "default.html" file in that directory.
2022-12-16 13:31:39 -05:00
pho4cexa
1209725add use chicken-specific extensions for less code
til #!key #!optional and #!rest

http://wiki.call-cc.org/man/5/Module%20scheme#procedures
2022-12-16 13:31:33 -05:00
m455
f433a6b28a Added a ' - <repo-name>' to the title of html documents, so tabs in web browsers have a unique name 2022-12-14 10:25:24 -05:00
pho4cexa
f4f877357a bugfix: only do string transforms on strings not chars
thanks for the report m455!!
2022-12-13 22:24:08 -05:00
pho4cexa
179f3c3e2d bugfix: css selector nav a {} is scss (// nav a) 2022-12-13 22:23:42 -05:00
m455
dc30b1937a added new dependencies to readme and makefile 2022-12-13 17:02:01 -05:00
pho4cexa
6cb6536091 typo 2022-12-13 16:57:01 -05:00
pho4cexa
609d9e1e2e header id-ification improvement and other cleanup
- fixed comment rendering
- simplified pre-post-order rule for unspecified values
- limited length of header id to 40 characters + tag name
2022-12-13 16:56:55 -05:00
pho4cexa
5dbecc4737 add css dep to makefile 2022-12-13 16:56:51 -05:00
pho4cexa
8fb927143f what if we sexp'd the css too
is this good

(also, sorted the imports for no important reason)
2022-12-13 16:56:46 -05:00
pho4cexa
f315cd9237 assign ids to html headers
this code feels like it could be way shorter and prettier

and it's broken for a few edge cases, here's some i can think of:
- it makes no attempt to ensure the ids that it assigns are unique on
  the page
- there might yet be weird characters inappropriate for an id that it
  uses anyway
- it doesn't make an attempt to limit the length of the id

but other than that it pretty much works
2022-12-13 16:56:34 -05:00
m455
f0a0e1ecb0 added new dependency to makefile and readme 2022-12-12 12:37:20 -05:00
pho4cexa
37ef2922e8 add a rule to handle #<unspecified> in sxml trees
this lets us use ,(when ...) when constructing sxml for
optionally-present elements.
2022-12-12 12:35:00 -05:00
pho4cexa
c0fcd0bebc don't output #<unspecified> to html
quick band-aid for this bug... better fix will be to modify the
sxml->html transformation rules... thanks for the report m455!!
2022-12-12 11:45:15 -05:00
pho4cexa
920707f276 implemented (very basic) issues list according to m455 spec 2022-12-12 11:07:32 -05:00
pho4cexa
fa65d5ba49 add some data for issue tracker 2022-12-12 11:07:26 -05:00
pho4cexa
5f03520e0f a little footer 2022-12-12 11:07:10 -05:00
pho4cexa
d59f70c7ca what if we went all-in on sxml?
what would that look like? (it would look like this)

- rewrote the template in sxml
- deleted (first-if) as srfi-1's (find) is the same
- made the template function into a factory, which might go faster?
- rewrote all the special-page-generator functions to emit sxml
2022-12-12 11:07:05 -05:00
pho4cexa
a916af24aa attempt to better conform to m455's styleguide
m455, i lost the advice you gave me previously, detailing conventions
you'd like to conform to when writing documentation for this project. i
tried to make some changes here that conform to what pieces i remember
but probably got some of it wrong. would you mind reiterating your
recommendations in an email or text file for me? thanks!!
2022-12-11 21:03:33 -05:00
pho4cexa
ab241899d4 deduplicate, reorganize some utility functions, inline docs 2022-12-10 20:17:29 -05:00
pho4cexa
75b7406508 implement commit log! also, tabulate contributors 2022-12-10 20:17:20 -05:00
pho4cexa
fecd7af9c3 map e-mail addresses to canonical names! 2022-12-10 20:17:13 -05:00
pho4cexa
d106bf4ca6 detect (er, ask git) if files are text or binary (ty m455 & acdw!)
also remove unused procedure display-readme-html
2022-12-10 20:17:10 -05:00
pho4cexa
a97c673158 simplify main readme by moving "git forge" specifics elsewhere
just a suggestion; don't feel obligated to merge. you know technical
writing and documentation better than i do!
2022-12-09 13:14:09 -05:00
pho4cexa
335a444dc4 fix md formatting for nested uls 2022-12-09 12:55:03 -05:00
pho4cexa
626a84a76e check file existence in source-files-list not cwd
added source-files-list to populate-html-template. kindof dislike having
so many variables passed to a function but i also kindof dislike global
variables; not sure how to make this prettier yet. but this solves the
bug i introduced in my last commit where the nav links were broken when
used as a githook.
2022-12-09 12:54:56 -05:00
pho4cexa
c645880703 feature: license nav link, optional about nav link 2022-12-09 09:51:15 -05:00
m455
b82ee055e6 fixed unclosed inline code character 2022-12-08 21:20:55 -05:00
m455
3f7baebc51 added a quickstart 2022-12-08 21:20:04 -05:00
m455
65f2c7fc7c made todos and hopes types more distinguishable from the proceeding phrase 2022-12-08 21:01:31 -05:00
m455
765d1b944f fixed codeblock rendering 2022-12-08 20:57:56 -05:00
m455
1927685a24 added a kind of end-to-end example of how to set everything up 2022-12-08 20:56:34 -05:00
pho4cexa
f6cd8f38a5 get relative nav links working
this could use some extra thinking and cleanup, got some copy-pasted
code in both populat-html-template and display-source-html. but it's
working in my clone of fa!
2022-12-08 20:09:14 -05:00
m455
363ed994f4 woops 2022-12-07 22:37:06 -05:00
m455
07e73e4083 Changed absolute image paths back to relative paths, since everything else is using a relative path
This works, because when you click a link to view a file source, the
link takes you into the directory where the image is, because
directories are recursively made in the web server directory to mimic
the structure of the git repository, and so files with the same name
don't conflict, because they'll be in a different directory.
2022-12-07 22:31:58 -05:00
m455
4bc524d02c Changed file source image view path to absolute path
- my last fix used to use a relative path to the image, this fix makes
  an absolute path
- i added a parameter to the display-source-html function so i could use
  the repository-name in the format functions that are used there
- changed some of the string template "repo-name"s to "repository-name"s
  to stay consistent with the rest of the main.scm
2022-12-07 21:42:04 -05:00
m455
7dbf2fb3fc Fixed rendering issues
- Image paths: Images worked on the README.md, but as soon as you tried
  to view the images in the files tree, and the images were in a
  subdirectory, the full path was added after the directory name.

  For example, an image at <git-repo-root>/images/screenshot.gif, would be
  generated in the file tree with the following link:
  <git-repo-root>images/images/screenshot.gif
  because it doesn't know that the link to the source file is actually
  also linking to the images directory, because I generate directories for
  all links, as if you were actually traversing them.

  This means we are able to strip the directory from the file path
  completely, because our links already go to the desired directory, to
  get images to show up in the source file view

- Unknown file type issues: I changed the else statement to render the
  unknown filetype, because it cause the source of, for example,
  main.scm to just say "(Unknown file type)". Maybe we can revise this
  in the future to see when we want to use Unknown filetypes!

Thoughts: I think I'm going to try to see if prepending a slash at the
front of image paths will create an absolute path, so we dont have to
get into messy relative paths haha.
2022-12-07 21:35:08 -05:00
pho4cexa
0b86b0022e no-op cleanup 2022-12-07 21:26:11 -05:00
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
85c2515534 don't fail build if build directory exists 2022-12-07 21:10:28 -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
954f411d4e updated description and features 2022-12-07 15:54:03 -05:00
m455
2628ce3ef9 small under-construction notes lol 2022-12-07 15:51:16 -05:00
m455
a67a26548f Fixed environment variables and removed WEB-DIRECTORY environment variable 2022-12-07 15:34:12 -05:00
m455
c4239e4a82 quick notes and updates added to readme, minor makefile changes 2022-12-07 15:18:27 -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