From dcc187cc8431ae383d44444321125f0b11b51417 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 5 May 2023 23:33:14 +0200 Subject: [PATCH] tools: (asciidoctor-unicodeconverter) fix up name section with dash MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- tools/asciidoctor-unicodeconverter.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/asciidoctor-unicodeconverter.rb b/tools/asciidoctor-unicodeconverter.rb index acb1c8b805..7435ed5ffa 100644 --- a/tools/asciidoctor-unicodeconverter.rb +++ b/tools/asciidoctor-unicodeconverter.rb @@ -7,13 +7,20 @@ module UnicodeConverter AFTER_NAME_SECTION = 3 class Preprocessor < Asciidoctor::Extensions::Preprocessor + include Asciidoctor::Logging + def process document, reader lines = reader.read_lines state = BEFORE_NAME_SECTION + command = document.attributes['docname'].split('.', 2)[0] lines.map! do |line| if state == IN_NAME_SECTION line.sub! " \u2013 ", " - " line.sub! " \u2014 ", " - " + if line.start_with? command and not line.start_with? "#{command} - " + logger.warn "adding dash to name section of #{document.attributes['docfile']}" + line.sub! command, "#{command} - " + end end if line.start_with? '== ' -- 2.47.2