From 8ed94108b5bf45afa070acfa394950017a0d74fe Mon Sep 17 00:00:00 2001
From: Jonathan Wakely
Date: Sat, 27 Jan 2024 11:06:58 +0000
Subject: [PATCH] Generate HTML5 instead of HTML 4.01
- Use HTML5 DOCTYPE.
- Use CSS to style tables instead of obsolete HTML attributes.
- Use `id` attributes instead of `name`. Sanitize the values of all such
attributes (and corresponding URLs using them) so that they don't
contain spaces.
- Do not create duplicate `id` attributes in index pages that aren't
sorted by section.
- Postprocess issues to replace obsolete `` elements with ``.
There are validation errors for some of the issues themselves, due to
the use of `` as a paragraph break, which is not correct HTML5.
Paragraphs should start with `` and end with `
`, not just be
started implictly and then separated by ``.
Wrong:
This is paragraph one.
This is paragraph two.
Also wrong:
This is paragraph one.
This is paragraph two.
Right:
This is paragraph one.
This is paragraph two.
---
bin/issues_to_be_moved.sh | 5 +-
src/issues.cpp | 7 +++
src/report_generator.cpp | 104 +++++++++++++++++++++++---------------
xml/lwg-issues.xml | 10 ++--
4 files changed, 78 insertions(+), 48 deletions(-)
diff --git a/bin/issues_to_be_moved.sh b/bin/issues_to_be_moved.sh
index 095e8669ef..40c2a0c99e 100755
--- a/bin/issues_to_be_moved.sh
+++ b/bin/issues_to_be_moved.sh
@@ -123,9 +123,8 @@ dump_issues()
}
cat <
-
+
+
C++ Standard Library Issues to be moved in $meeting
diff --git a/src/issues.cpp b/src/issues.cpp
index 5f4f996b4a..e4c98ddee0 100644
--- a/src/issues.cpp
+++ b/src/issues.cpp
@@ -158,6 +158,13 @@ auto lwg::parse_issue_from_file(std::string tx, std::string const & filename,
p += code.size();
}
+ // is obsolete in HTML5, replace with :
+ for (auto p = tx.find("' || tx.at(p+3) == ' ')
+ tx.replace(p, 3, ""); p != tx.npos; p = tx.find("
", p+7))
+ tx.replace(p, 5, "
");
+
issue is;
// Get issue number
diff --git a/src/report_generator.cpp b/src/report_generator.cpp
index bd90fb4f69..86be644c73 100644
--- a/src/report_generator.cpp
+++ b/src/report_generator.cpp
@@ -125,6 +125,13 @@ struct order_by_priority {
std::reference_wrapper section_db;
};
+// Replace spaces to make a string usable as an 'id' attribute,
+// or as an URL fragment (#foo) that links to an 'id' attribute.
+inline std::string spaces_to_underscores(std::string s) {
+ std::replace(s.begin(), s.end(), ' ', '_');
+ return s;
+}
+
auto major_section(lwg::section_num const & sn) -> std::string {
std::string const prefix{sn.prefix};
@@ -162,13 +169,12 @@ void print_list(std::ostream & out, Container const & source, char const * separ
void print_file_header(std::ostream& out, std::string const & title) {
out <<
-R"(
-
+R"(
+
)" << title << R"(
-