Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix readme not being searched #452

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion _plugins/rosindex_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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] << {
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