diff --git a/doc/user_guide.md b/doc/user_guide.md index 290d4f8..1d80811 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -24,6 +24,15 @@ custom build operations as well. Rscons is written in Ruby, and is inspired by [SCons](https://scons.org/) and [waf](https://waf.io/). +${remove} +WARNING: This user guide is meant to be preprocessed and rendered by a custom +script. +The markdown source file is not intended to be viewed directly and will not +include all intended content. +Visit [https://holtrop.github.io/rscons/index.html](https://holtrop.github.io/rscons/index.html) +to view the properly rendered version. +${/remove} + ## Design Principles ### Build Correctness diff --git a/rb/gen_user_guide.rb b/rb/gen_user_guide.rb index 5f7c7d8..42f335e 100644 --- a/rb/gen_user_guide.rb +++ b/rb/gen_user_guide.rb @@ -59,6 +59,8 @@ class Generator line = @lines.slice!(0) if line =~ /^```(.*)$/ @sections.last.append(gather_code_section($1)) + elsif line.chomp == "${remove}" + remove_section elsif line =~ /^(#+)(>)?\s*(.*)$/ level_text, new_page_text, title_text = $1, $2, $3 level = $1.size @@ -196,6 +198,15 @@ class Generator end end + def remove_section + loop do + line = @lines.slice!(0) + if line.chomp == "${/remove}" + break + end + end + end + def get_next_section_number(level) if @current_section_number.size == level - 1 @current_section_number << 1