diff --git a/TODO.md b/TODO.md index e67b23b..1ba5609 100644 --- a/TODO.md +++ b/TODO.md @@ -9,7 +9,7 @@ once they are fixed or otherwise invalidated. points to a URI that is not part of the forest. I can proceed further by removing this assertion, but that is no doubt hiding a bug. -- [ ] Static renderer: when there are contributor attributions but no author +- [x] Static renderer: when there are contributor attributions but no author attribution, there is a spurious comma before "with contributions from". - [ ] Static renderer: In References/bibliography section, "Reference" taxon diff --git a/lib/frontend/Html_client.ml b/lib/frontend/Html_client.ml index 58615a4..bddea3c 100644 --- a/lib/frontend/Html_client.ml +++ b/lib/frontend/Html_client.ml @@ -388,9 +388,13 @@ and render_authors ~env (frontmatter : T.(content frontmatter)) = List_util.intersperse (P.txt ", ") @@ List.map (fun author -> render_attribution_vertex ~env author) authors in + let leading_comma = + if List.length authors > 0 && List.length contributors > 0 then P.txt ", " + else H.null [] + in let contributors = if List.length contributors >= 1 then - P.txt ", with contributions from " + P.txt "with contributions from " :: (List_util.intersperse (P.txt ", ") @@ List.map (fun contributor -> render_attribution_vertex ~env contributor) @@ -399,7 +403,7 @@ and render_authors ~env (frontmatter : T.(content frontmatter)) = in H.li [H.class_ "meta-item"] - [H.address [H.class_ "author"] (authors @ contributors)] + [H.address [H.class_ "author"] (authors @ (leading_comma :: contributors))] and render_position ~env frontmatter = default_meta_item ~env frontmatter "position" diff --git a/test/assets.t b/test/assets.t index 8fc0864..d2604dc 100644 --- a/test/assets.t +++ b/test/assets.t @@ -49,7 +49,8 @@
diff --git a/test/contributors.t b/test/contributors.t new file mode 100644 index 0000000..0fe78dd --- /dev/null +++ b/test/contributors.t @@ -0,0 +1,55 @@ + $ forester init + note: Created directory trees + note: Created directory assets + note: Created file forest.toml + note: Created file .gitignore + note: Created file assets/.gitkeep + note: Created file trees/index.tree + note: Initialized forest, try editing `trees/index.tree` and running `forester build`. Afterwards, you can open `output/index.html` in your browser to view your forest. + + $ cat > trees/index.tree << EOF + > \contributor/literal{foo} + > EOF + + $ forester build + Success! + + $ cat output/index/index.html + + + + + + + + +