Skip to content

Commit

Permalink
Fix readme not being searched (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkent authored Jan 8, 2025
1 parent f5450d5 commit df6c78c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion _plugins/rosindex_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,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] << {
Expand Down
4 changes: 4 additions & 0 deletions _ruby_libs/text_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit df6c78c

Please sign in to comment.