Welcome to little lamb

Code » qmdoc » commit 3515c22

Set title property on links inside TOC

author Olivier Brunel
2023-01-12 19:46:26 UTC
committer Olivier Brunel
2023-01-12 19:46:26 UTC
parent f09a34b60e80344c9ba6393d18381a5d86071672

Set title property on links inside TOC

src/main.c +6 -0

diff --git a/src/main.c b/src/main.c
index 54502b7..3ff31db 100644
--- a/src/main.c
+++ b/src/main.c
@@ -391,6 +391,8 @@ enter_block(MD_BLOCKTYPE type, void *details, void *ctx_)
                     for (int i = 0; i < ctx->nb_pages; ++i) {
                         if (!raw_str(ctx, "<li><a href=\"")
                                 || !escape_text(ctx, str_file(i), strlen(str_file(i)))
+                                || !raw_str(ctx, "\" title=\"")
+                                || !escape_text(ctx, str_title(i), strlen(str_title(i)))
                                 || !raw_str(ctx, "\">")
                                 || !escape_text(ctx, str_title(i), strlen(str_title(i)))
                                 || !raw_str(ctx, "</a>"))
@@ -410,6 +412,8 @@ enter_block(MD_BLOCKTYPE type, void *details, void *ctx_)
                                 if (i > 0 &&
                                         (!raw_str(ctx, "<li><a href=\"")
                                         || !escape_text(ctx, str_file(i), strlen(str_file(i)))
+                                        || !raw_str(ctx, "\" title=\"")
+                                        || !escape_text(ctx, str_title(i), strlen(str_title(i)))
                                         || !raw_str(ctx, "\">")
                                         || !escape_text(ctx, str_title(i), strlen(str_title(i)))
                                         || !raw_str(ctx, "</a>")))
@@ -747,6 +751,8 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_)
                             || !escape_text(ctx, file, strlen(file))
                             || !raw_str(ctx, "#")
                             || !anchor(ctx, toc, l)
+                            || !raw_str(ctx, "\" title=\"")
+                            || !escape_text(ctx, toc, l)
                             || !raw_str(ctx, "\">")
                             || !strip_tags(ctx, toc, l, 1)
                             || !raw_str(ctx, "</a>"))