Skip to content

Commit 7577edb

Browse files
committed
Separate revnumber from author list
Update the CSS to make the `revnumber` visually distinct from the list of authors. Unfortunately removing '.' after the last author isn't possible using a pure CSS solution so some additional javascript has been also added. Closes gh-52
1 parent 9838db6 commit 7577edb

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

src/main/css/asciidoctor.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,22 @@
6363
display: none;
6464
}
6565

66-
.doc #header .details span.author:after {
66+
.doc #header .details span.author:not(:last-of-type)::after {
6767
content: "\2022";
6868
font-weight: 400;
6969
margin: 0.4em;
7070
color: var(--asciidoctor-author-separator-color);
7171
}
7272

73-
#header .details span.author:nth-last-child(2):after {
74-
content: "";
73+
.doc #header .details span.last-author::after {
74+
display: none;
75+
}
76+
77+
.doc #header .details #revnumber {
78+
flex-basis: 100%;
79+
margin-top: 0.5rem;
80+
text-transform: capitalize;
81+
font-weight: 200;
7582
}
7683

7784
/* Section setup */

src/main/js/site/author.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the 'License');
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an 'AS IS' BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
(function () {
18+
"use strict";
19+
20+
markLastAuthor();
21+
22+
function markLastAuthor() {
23+
let candidate = document.getElementById("author");
24+
let lastAuthorElement = candidate;
25+
while (candidate) {
26+
if (candidate.classList.contains("author")) {
27+
lastAuthorElement = candidate;
28+
}
29+
candidate = candidate.nextElementSibling;
30+
}
31+
if (lastAuthorElement) {
32+
lastAuthorElement.classList.add("last-author");
33+
}
34+
}
35+
})();

src/test/asciidoc/spring.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[[spring]]
22
= Asciidoctor Spring Extensions Document
33
Andy Wilkinson; Phillip Webb
4+
v1.23
45
:description: Asciidoctor using Spring extensions
56
:toc: left
67
:toc-levels: 4

0 commit comments

Comments
 (0)