From cc3488d75022dc4f03f131ad2e652aa096a8f3df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Feb 2026 02:36:33 +0000 Subject: [PATCH 1/3] Initial plan From 023e33aaef28862e4db3c7f8fc40cef1924b2bfc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Feb 2026 02:44:49 +0000 Subject: [PATCH 2/3] Add proof source link section to slug detail pages Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com> --- html-generators/generate.java | 25 +++++++++++++++++++++++++ html-generators/generate.py | 27 +++++++++++++++++++++++++++ templates/slug-template.html | 2 ++ translations/strings/en.yaml | 2 ++ 4 files changed, 56 insertions(+) diff --git a/html-generators/generate.java b/html-generators/generate.java index edab941..9cf2750 100644 --- a/html-generators/generate.java +++ b/html-generators/generate.java @@ -404,6 +404,30 @@ String renderDocLinks(String tpl, JsonNode docs) { return String.join("\n", links); } +String slugToPascalCase(String slug) { + return Arrays.stream(slug.split("-")) + .filter(w -> !w.isEmpty()) + .map(w -> Character.toUpperCase(w.charAt(0)) + w.substring(1)) + .collect(Collectors.joining()); +} + +String renderProofSection(Snippet s, Map strings) { + var pascal = slugToPascalCase(s.slug()); + var proofFile = Path.of("proof", s.category(), pascal + ".java"); + if (!Files.exists(proofFile)) return ""; + var proofUrl = "https://github.com/javaevolved/javaevolved.github.io/blob/main/proof/%s/%s.java" + .formatted(s.category(), pascal); + var label = strings.getOrDefault("sections.proof", "Proof"); + var linkText = strings.getOrDefault("sections.proofLink", "View proof source"); + return """ +
+ + +
""".formatted(label, proofUrl, linkText); +} + String renderRelatedSection(String tpl, Snippet snippet, Map all, String locale, Map strings) { return snippet.related().stream().filter(all::containsKey) .map(p -> renderRelatedCard(tpl, all.get(p), locale, strings)) @@ -469,6 +493,7 @@ String generateHtml(Templates tpl, Snippet s, Map all, Map 'TypeInferenceWithVar'.""" + return "".join(w.capitalize() for w in slug.split("-") if w) + + +def render_proof_section(data, strings): + """Render the proof section linking to the proof source file on GitHub, or empty string if no proof exists.""" + slug = data["slug"] + category = data["category"] + pascal = slug_to_pascal_case(slug) + proof_file = os.path.join("proof", category, f"{pascal}.java") + if not os.path.isfile(proof_file): + return "" + proof_url = f"https://github.com/javaevolved/javaevolved.github.io/blob/main/proof/{category}/{pascal}.java" + label = strings.get("sections.proof", "Proof") + link_text = strings.get("sections.proofLink", "View proof source") + return ( + '
\n' + f' \n' + ' \n' + '
' + ) + + def render_social_share(tpl, slug, title, strings): """Render social share URLs.""" encoded_url = url_encode(f"{BASE_URL}/{slug}.html") @@ -520,6 +546,7 @@ def generate_html(templates, data, all_snippets, extra_tokens, locale): "navArrows": render_nav_arrows(data, locale), "whyCards": render_why_cards(templates["why_card"], data["whyModernWins"]), "docLinks": render_doc_links(templates["doc_link"], data.get("docs", [])), + "proofSection": render_proof_section(data, extra_tokens), "relatedCards": render_related_section( templates["related_card"], data, all_snippets, locale, extra_tokens ), diff --git a/templates/slug-template.html b/templates/slug-template.html index 744e8b0..396d246 100644 --- a/templates/slug-template.html +++ b/templates/slug-template.html @@ -214,6 +214,8 @@

{{title}}

+{{proofSection}} +