Fix self-link for TOC links.

Previously TOC links contained a closing </a>-tag, but lacked the
accompanying start tag, leading to invalid HTML. This fixes that, along
with placing class="justcenter" on the correct tag once again.
This commit is contained in:
Hugo Hörnquist
2021-06-03 02:00:10 +02:00
committed by Tinmarino
parent 760cab232d
commit eedc26bfe6
+8 -6
View File
@@ -1236,24 +1236,26 @@ function! s:process_tag_h(line, id) abort
endif endif
let h_complete_id = s:escape_html_attribute(h_complete_id) let h_complete_id = s:escape_html_attribute(h_complete_id)
let h_part = '<div id="'.h_complete_id.'">' let h_part = '<div id="'.h_complete_id.'">'
let h_part .= '<h'.h_level.' id="'.h_id.'" class="header">' let h_part .= '<h'.h_level.' id="'.h_id.'"'
let h_part .= '<a href="#'.h_complete_id.'"' let a_tag = '<a href="#'.h_complete_id.'">'
else else
let h_part = '<div id="'.h_id.'" class="toc"><h'.h_level.' id="'.h_id.'"' let h_part = '<div id="'.h_id.'" class="toc">'
let h_part .= '<h'.h_level.' id="'.h_id.'"'
let a_tag = '<a href="#'.h_id.'">'
endif endif
if centered if centered
let h_part .= ' class="justcenter">' let h_part .= ' class="header justcenter">'
else else
let h_part .= '>' let h_part .= ' class="header">'
endif endif
let h_text = s:process_inline_tags(h_text, a:id) let h_text = s:process_inline_tags(h_text, a:id)
let line = h_part.h_text.'</a></h'.h_level.'></div>' let line = h_part.a_tag.h_text.'</a></h'.h_level.'></div>'
let processed = 1 let processed = 1
endif endif