Skip to content

fix the automatic generation of anchors in the reference doc #2012

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

Merged
merged 1 commit into from
Jun 3, 2025
Merged
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
6 changes: 3 additions & 3 deletions script/update-docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ def index_doc(filter_tags, doc_list, get_content)
clean_anchor = "#{txt_path}-#{clean_text}"
clean_anchor += "-1" while ids.include?(clean_anchor)
ids.add(clean_anchor)
clean_anchor = "<a class=\"anchor\" href=\"##{clean_anchor}\"></a> "
"<dt class=\"hdlist1\" id=\"#{anchor}\"><a id=\"#{clean_anchor}\" class=\"anchor\" href=\"##{clean_anchor}\"></a>#{$1} </dt>"
else
"<dt class=\"hdlist1\" id=\"#{anchor}\"><a class=\"anchor\" href=\"##{anchor}\"></a>#{$1} </dt>"
end

"<dt class=\"hdlist1\" id=\"#{anchor}\"> #{clean_anchor}<a class=\"anchor\" href=\"##{anchor}\"></a>#{$1} </dt>"
Comment on lines -490 to -493
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we simply have done a s/href/id/ instead?

end
# Make links relative
html.gsub!(/(<a href=['"])\/([^'"]*)/) do |relurl|
Expand Down
Loading