From 500ac49480c62ecf3ab46a3a3427353124fb6ef7 Mon Sep 17 00:00:00 2001 From: "R. Kent James" Date: Tue, 3 Dec 2024 20:56:47 -0800 Subject: [PATCH] Fix readme not being searched --- _plugins/rosindex_generator.rb | 8 +++++++- _ruby_libs/text_rendering.rb | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/_plugins/rosindex_generator.rb b/_plugins/rosindex_generator.rb index e7361a1..01cc7bf 100644 --- a/_plugins/rosindex_generator.rb +++ b/_plugins/rosindex_generator.rb @@ -1554,7 +1554,13 @@ def generate(site) p = package.data - readme_filtered = if p['readme'] then self.strip_stopwords(p['readme']) else "" end + # collect rendered readmes into simple text + readmes_text = '' + p['readmes'].each do |readme| + readmes_text << get_text_from_html(readme['readme_rendered']) + end + + readme_filtered = self.strip_stopwords(readmes_text) index += 1 packages_index[distro] << { diff --git a/_ruby_libs/text_rendering.rb b/_ruby_libs/text_rendering.rb index 9642f75..850e118 100644 --- a/_ruby_libs/text_rendering.rb +++ b/_ruby_libs/text_rendering.rb @@ -101,3 +101,7 @@ def get_md_rst_txt(site, path, glob, raw_uri, browse_uri) return file_rendered, file_md end + +def get_text_from_html(html) + return Nokogiri::HTML(html).text +end