` with line numbers.
+/// Render one text file body: escaped `` with line numbers, wrapped in
+/// a horizontal-scroll container so long lines never break the 360px layout.
fn render_text_pre(display: &str) -> String {
- let mut out = String::from("\n");
+ let mut out = String::from("\n");
out
}
@@ -381,20 +382,21 @@ pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result{}\n", esc(&name));
+ // index.html header: stacked repo-head (name + clone + meta) so narrow
+ // screens wrap safely; clone/sha break-all via `.clone`/`.repo-meta`.
+ let mut body = format!("{}
\n", esc(&name));
match &description {
Some(d) => body.push_str(&format!("
{}
\n", esc(d))),
None => body.push_str("
No description.
\n"),
}
if let Some(url) = &clone_url {
body.push_str(&format!(
- "
Clone: git clone {}
\n",
+ "
Clone: git clone {}
\n",
esc(url)
));
}
body.push_str(&format!(
- "
Branch {} @ {}
\n",
+ "
Branch {} @ {}
\n",
esc(&branch),
esc(&short_sha)
));
@@ -417,7 +419,9 @@ pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result
repo.tar.gz ({tarball_size} bytes)\n"
));
- body.push_str("Files
\n \n");
+ // Single column on mobile; tree+readme sit side by side only at >=768px.
+ body.push_str("Files
\n\n");
for e in dir_entries.get("").cloned().unwrap_or_default() {
if e.is_dir {
body.push_str(&format!(
@@ -434,9 +438,7 @@ pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result\n");
-
- body.push_str("README
\n");
+ body.push_str("
\n\n
README
\n");
match &readme {
Some((path, blob)) => {
body.push_str(&format!(
@@ -451,6 +453,7 @@ pub fn run_build(repo: &Path, out: &Path, opts: &BuildOptions) -> Result body.push_str("No README found.
\n"),
}
+ body.push_str(" \n");
let index = crate::layout::page(&name, &nav, &body);
std::fs::write(out.join("index.html"), index)
diff --git a/src/commits.rs b/src/commits.rs
index 593c791..a98c017 100644
--- a/src/commits.rs
+++ b/src/commits.rs
@@ -35,7 +35,7 @@ pub fn render_loaded(
if log.is_empty() {
body.push_str("No commits yet.
\n");
} else {
- body.push_str("\n| sha | subject | author | date |
\n\n");
+ body.push_str("\n
\n");
}
let html = page(&format!("commits — {site_name}"), nav, &body);
std::fs::create_dir_all(out).map_err(|e| format!("hu13: create out dir: {e}"))?;
@@ -59,7 +59,7 @@ pub fn render_loaded(
let message = gitx::message(repo, &c.sha).map_err(|e| format!("hu13: {e}"))?;
let diff = gitx::diff(repo, &c.sha).map_err(|e| format!("hu13: {e}"))?;
let detail = format!(
- "commit {}
\n{}
\nAuthor: {}
Date: {}
\nall commits
\nMessage
\n{}\nDiff
\n{}\n",
+ "commit {}
\n{}
\nAuthor: {}
Date: {}
\nall commits
\nMessage
\n\nDiff
\n\n",
esc(short_sha(&c.sha)),
esc(&c.sha),
esc(&c.author),
diff --git a/src/forge.rs b/src/forge.rs
index 9e4e9c5..868449e 100644
--- a/src/forge.rs
+++ b/src/forge.rs
@@ -889,7 +889,10 @@ fn render_pr_page(pr: &Pr, site_name: &str, nav: &str) -> String {
body.push_str("Patch
\n");
match &pr.patch {
Some(patch) if !patch.is_empty() => {
- body.push_str(&format!("{}\n", esc(patch)));
+ body.push_str(&format!(
+ "\n",
+ esc(patch)
+ ));
}
_ => body.push_str("No patch attached.
\n"),
}
@@ -934,7 +937,7 @@ fn render_issues_index(data: &ForgeData, site_name: &str, nav: &str) -> ResultNo issues yet.