Commit graph

71 commits

Author SHA1 Message Date
pho4cexa
c943210189 minor improvements to modular compilation
- rename main.scm to repo2html.scm to match binary
- remove unused imports from utils.scm
2023-02-04 22:45:21 -08:00
pho4cexa
936a37bc76 viable first brush at breaking code into modules 2023-02-04 21:40:06 -08:00
m455
758352c8cd adjusted active line highlighting 2023-02-03 23:22:19 -05:00
m455
5c7d1fdf59 implemented numbered lines
with the caveat that things don't overflow:scroll yet :/
2023-02-03 02:16:36 -05:00
pho4cexa
d676745ec7 Merge branch 'main' of git://git.m455.casa/repo2html 2023-02-01 20:32:38 -08:00
m455
0a9518c2e4 Fixed a bug that broke links to files if a readme wasn't present
There was a bug that caused a double "html/html" in front of the link
URLs for each file listed in the "Files" view.

This PR fixes this. It's an ugly fix, because I just replaced "html"
with "" as the function argument, but it works? haha. Feel free to do
this the proper way, if such a way exists!
2023-02-01 23:27:56 -05:00
pho4cexa
c472cc46c1 handle both (@ (src "foo")) and (@ (src ("foo"))) 2023-02-01 17:22:14 -08:00
pho4cexa
db64dfb68f quote source-file so it doesn't break when it has spaces in. tidy issues. 2023-02-01 17:09:45 -08:00
pho4cexa
12790c87e4 ah finally fixed the image prefix for index.html thing 2023-01-16 15:17:58 -08:00
pho4cexa
e6d77be6a5 adjust relative urls for img src too 2023-01-15 11:34:38 -08:00
pho4cexa
0eece2a92e improved template variables for working with ForgeRoot 2023-01-08 09:27:39 -08:00
pho4cexa
838489079e attempt at consistent environment/git config 2023-01-08 00:53:04 -08:00
pho4cexa
6f93a9d3b4 bugfix: apply relative link html/ prefix and .html suffix correctly 2023-01-07 12:03:20 -08:00
pho4cexa
23487309c8 repair bugs in alist-update-in
dang this hurt my brain. need to figure out a better way
2022-12-27 22:04:33 -08:00
pho4cexa
5fe00426b1 whoops! commit f1c42b4 broke the link prefix thing. fixed. 2022-12-26 21:56:09 -08:00
pho4cexa
e411b57c54 oops paren 2022-12-26 10:51:07 -08:00
pho4cexa
57fcccc276 distinguish between repo name and repo path 2022-12-26 10:49:17 -08:00
pho4cexa
f1c42b4a6a move the decision about where to render the filename into the template 2022-12-26 10:38:04 -08:00
pho4cexa
206984b099 pull the relative-link-adjustment rule into a procedure 2022-12-25 23:28:51 -08:00
pho4cexa
31b11de1a6 update-in and ref-in (takes a path of keys) for nested alists 2022-12-25 23:16:07 -08:00
pho4cexa
17ce8565f8 add ¶ markers on hover on titles to make it easier to grab the permalink 2022-12-25 15:40:45 -08:00
pho4cexa
fbc6c6c8f4 today i learned cute/cut (srfi-26, built in to chicken) for sorta-currying 2022-12-25 14:35:31 -08:00
pho4cexa
696ed31f85 whoops, don't prefix links to same-document anchors either 2022-12-22 21:21:11 -08:00
pho4cexa
505192d7be bugfix: only prepend 'html/' to relative links 2022-12-22 21:00:46 -08:00
pho4cexa
afe41bcc01 auto-prepend html/ in links in toplevel readme, remove tag from id of headers
this code is so ugly!! augh!! definitely need to rework it and find a
better way to reach in and manipulate sxml trees
2022-12-22 14:53:13 -08:00
pho4cexa
917788e29f remove some env vars; make output land in html/
CLONE-URL, TITLE, and H1 are no longer processed. instead, the user
should modify the templates/default.html to their liking.

the output used to be structured like this:

target-html-directory/
+-- index.html
+-- files.html
+-- README.md.html
+-- (all the other files)

the output is now structured like this:

target-html-directory/
+-- index.html
+-- html/
    +-- files.html
    +-- README.md.html
    +-- (all the other files...)

this makes it so people who are hosting bare repos for cloning on static
webservers will have only two new directory entries (index.html and
html) in the bare repo directory, reducing the risk of clobbering
something.

finally, i tried something hacky with gitattributes to get an automatic
version idenifier to show up. but it turns out this is not the git hash
of the commit, but instead the hash of the blob for main.scm, which
could remain the same across releases. doesn't hurt, so i'll look for a
better approach in the future.
2022-12-18 10:19:36 -08:00
pho4cexa
bd18246b08 sxml templates baleeted! 2022-12-18 09:56:47 -08: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
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
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
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
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
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
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
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
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