💾 Archived View for lists.flounder.online › patches › threads › 20210318221336.7101-3-johann@qwertqw… captured on 2022-07-16 at 16:25:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-04-28)
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Thu, 18 Mar 2021 23:13:35 +0100
Message-Id: 20210318221336.7101-3-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
In-Reply-To: 20210318221336.7101-1-johann@qwertqwefsday.eu
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
From: Johann150 <johann@qwertqwefsday.eu>
Do not render a space as that would be included when copying.
Use a CSS margin instead. Also replace the spaces in the line number by
styling the line number with CSS.
---
src/main.rs | 4 ++--
templates/static/style.css | 13 +++++++------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 7d51a11..26ba66a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -393,8 +393,8 @@ async fn repo_file(req: Request<()>) -> tide::Result {
for (n, line) in syntect::util::LinesWithEndings::from(file_string).enumerate() {
let regions = highlighter.highlight(line, &syntax_set);
output.push_str(&format!(
- "<a href='#L{0}' id='L{0}' class='line'>{0:>6}</a> ",
- n
+ "<a href='#L{0}' id='L{0}' class='line'>{0}</a>",
+ n + 1
));
syntect::html::append_highlighted_html_for_styled_line(
®ions[..],
diff --git a/templates/static/style.css b/templates/static/style.css
index d860821..8e9f1be 100644
--- a/templates/static/style.css
+++ b/templates/static/style.css
@@ -27,13 +27,17 @@ body {
}
.line {
+ display: inline-block;
+ width: 6em;
+ margin-right: .5em;
+ text-align: right;
text-decoration: none;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
- user-select: none; /* Non-prefixed version, currently
+ user-select: none; /* Non-prefixed version, currently */
}
.clone-url {
@@ -49,10 +53,7 @@ hr.thin {
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
-h1 {
- margin: 0px;
-}
-h2 {
+h1, h2 {
margin: 0px;
}
@@ -76,7 +77,7 @@ td {
table td {
padding: 0 0.1em;
- }
+}
table.core {
width: 100%;
--
2.20.1