From 480afc3101edae1a1272d35eae8ab0eb2af36084 Mon Sep 17 00:00:00 2001 From: memdmp Date: Wed, 15 Jan 2025 15:28:50 +0100 Subject: fix: allow block comments for the markdown renderer to skip sections --- README.md | 6 ++++++ markdown-tool/src/main.rs | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37d03ef..e4b570e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + +# Github is bad. + +You should be looking at this repository on [the upstream cgit repository](https://git.estrogen.zone/cgit-oci.git) + + # cgit+caddy+gitolite on alpine in an oci runner this is a fork of [github.com:gregjbs/docker-gitolite-cgit](https://github.com/gregjbs/docker-gitolite-cgit), with [substantial differences to upstream](#comparison-to-upstream) ([patch](https://github.com/gregjbs/docker-gitolite-cgit/compare/main...dmpmem:cgit-oci:master)) diff --git a/markdown-tool/src/main.rs b/markdown-tool/src/main.rs index 5263e0e..e41ff5f 100644 --- a/markdown-tool/src/main.rs +++ b/markdown-tool/src/main.rs @@ -5,10 +5,19 @@ use pulldown_cmark::{html, Options, Parser}; fn main() { let stdin = std::io::stdin(); let mut markdown_input = format!(""); + let mut disabled = false; for line in stdin.lock().lines() { - let line = line.unwrap(); - if !line.contains("") { - markdown_input = format!("{markdown_input}{line}\n") + let mut line = line.unwrap(); + if disabled && line.contains("") { + disabled = false; + line = line.replace("!END-NO-CGIT!", "Removed Block"); + } + if !disabled { + if line.contains("") { + disabled = true + } else if !line.contains("") { + markdown_input = format!("{markdown_input}{line}\n") + } } } -- cgit v1.2.3