From 04f2a20a48be884c1e7768069d54f203d81865de Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 15 Apr 2020 02:32:10 +0800 Subject: [PATCH] Fix beginning of line whitespaces causing asciidoc to think stem blocks as literals --- lib/iev/termbase/term_builder.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/iev/termbase/term_builder.rb b/lib/iev/termbase/term_builder.rb index 61a4b27..4f1da5c 100644 --- a/lib/iev/termbase/term_builder.rb +++ b/lib/iev/termbase/term_builder.rb @@ -93,7 +93,7 @@ def definition_values end def replace_newlines(input) - input.gsub('\n', "\n\n").gsub(/<[pbr]+>/, "\n\n").gsub(/\n+/, "\n\n").strip + input.gsub('\n', "\n\n").gsub(/<[pbr]+>/, "\n\n").gsub(/\s*\n[\n\s]+/, "\n\n").strip end def split_definition @@ -287,7 +287,10 @@ def parse_anchor_tag(text) gsub(/(.*?)<\/a>/, '{{\3, \1:\2}}'). gsub(/(.*?)<\/a>/, '\1[\2]'). gsub(/\s*Figure\s+(\d)\s+[–-]\s+(.+?)\s*<\/b>\s+Figure\s+(\d)\s+[–-]\s(.+)\s*<\/b>/, "image::/assets/images/parts/#{part_number}/\\1[Figure \\2 - \\3; \\5]"). - gsub(/\s*Figure\s+(\d)\s+[–-]\s+(.+?)\s*<\/b>/, "image::/assets/images/parts/#{part_number}/\\1[Figure \\2 - \\3]") + gsub(/\s*Figure\s+(\d)\s+[–-]\s+(.+?)\s*<\/b>/, "image::/assets/images/parts/#{part_number}/\\1[Figure \\2 - \\3]"). + gsub(/<\/?ul>/, ''). + gsub(/
  • /, '* '). + gsub(/<\/li>/, '') end end end