Display count and number of story entry
This commit is contained in:
parent
d397c7e98b
commit
43f1b0b3a8
29
src/main.rs
29
src/main.rs
@ -384,9 +384,6 @@ fn handle_relative_connection(
|
|||||||
.rsplit_once('/')
|
.rsplit_once('/')
|
||||||
.map(|(_, title)| title)
|
.map(|(_, title)| title)
|
||||||
.unwrap_or(relative_path);
|
.unwrap_or(relative_path);
|
||||||
if !title.is_empty() {
|
|
||||||
let _ = writeln!(stream, "<h1>{title}</h1>");
|
|
||||||
}
|
|
||||||
|
|
||||||
let handle_entry = |mut entry: &str, output: &mut TcpStream, level: usize| {
|
let handle_entry = |mut entry: &str, output: &mut TcpStream, level: usize| {
|
||||||
let level = level + 1;
|
let level = level + 1;
|
||||||
@ -440,6 +437,19 @@ fn handle_relative_connection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for line in lines.clone() {
|
||||||
|
let empty = line.trim().is_empty();
|
||||||
|
if empty == last_empty {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if empty {
|
||||||
|
block += 1;
|
||||||
|
}
|
||||||
|
last_empty = empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = writeln!(stream, "<h1>{title} ({}/{})</h1>", i + 1, block);
|
||||||
|
|
||||||
let _ = writeln!(
|
let _ = writeln!(
|
||||||
stream,
|
stream,
|
||||||
"<a href=\"/{relative_path}\">< Stop ></a><br><br>"
|
"<a href=\"/{relative_path}\">< Stop ></a><br><br>"
|
||||||
@ -451,16 +461,6 @@ fn handle_relative_connection(
|
|||||||
let _ = writeln!(stream, "<font color=\"gray\">< Prev</font>");
|
let _ = writeln!(stream, "<font color=\"gray\">< Prev</font>");
|
||||||
}
|
}
|
||||||
|
|
||||||
for line in lines.clone() {
|
|
||||||
let empty = line.trim().is_empty();
|
|
||||||
if empty == last_empty {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if empty {
|
|
||||||
block += 1;
|
|
||||||
}
|
|
||||||
last_empty = empty;
|
|
||||||
}
|
|
||||||
if i + 1 < block {
|
if i + 1 < block {
|
||||||
let next = i + 1;
|
let next = i + 1;
|
||||||
let _ = writeln!(stream, "<a href=\"/{relative_path}={next}\">Next ></a>");
|
let _ = writeln!(stream, "<a href=\"/{relative_path}={next}\">Next ></a>");
|
||||||
@ -488,6 +488,9 @@ fn handle_relative_connection(
|
|||||||
.with_use_textboxes(true),
|
.with_use_textboxes(true),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
if !title.is_empty() {
|
||||||
|
let _ = writeln!(stream, "<h1>{title}</h1>");
|
||||||
|
}
|
||||||
let _ = writeln!(stream, "<a href=\"/{relative_path}=0\">< Play ></a>");
|
let _ = writeln!(stream, "<a href=\"/{relative_path}=0\">< Play ></a>");
|
||||||
convert_extended(
|
convert_extended(
|
||||||
lines.map(|line| line.unwrap_or_default()),
|
lines.map(|line| line.unwrap_or_default()),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user