[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 20 Mar 2022 04:55:22 -0400 (EDT) |
branch: master
commit 81cce22ef7ab06b6314419607ea0cd2a0c300fad
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Oct 21 13:54:39 2019 +0100
send the whole of the toc, not just the top-level entries
---
js/infog/extension.c | 41 ++++++++++++++++++++++++++++-------------
js/infog/main.c | 4 ++--
2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/js/infog/extension.c b/js/infog/extension.c
index 65b6996cc1..d57661877a 100644
--- a/js/infog/extension.c
+++ b/js/infog/extension.c
@@ -307,21 +307,12 @@ send_index (WebKitDOMHTMLCollection *links, gulong
num_links)
}
void
-send_toc (WebKitDOMDocument *dom_document)
+build_toc_string (GString *toc, WebKitDOMElement *elt)
{
- GString *toc;
- WebKitDOMElement *e, *e1;
- int level = 0;
char *s, *s1, *s2, *s3;
+ WebKitDOMElement *e, *e1;
- WebKitDOMElement *toc_elt = webkit_dom_document_query_selector
- (dom_document, "div.contents ul", NULL);
- if (!toc_elt)
- return;
-
- toc = g_string_new (NULL);
-
- e = webkit_dom_element_get_first_element_child (toc_elt);
+ e = webkit_dom_element_get_first_element_child (elt);
while (e)
{
s = webkit_dom_element_get_tag_name (e);
@@ -339,10 +330,34 @@ send_toc (WebKitDOMDocument *dom_document)
g_string_append (toc, s3);
g_string_append (toc, "\n");
}
- }
+ e1 = webkit_dom_element_get_next_element_sibling (e1);
+ if (e1)
+ {
+ s2 = webkit_dom_element_get_tag_name (e1);
+ if (!strcmp (s2, "UL") || !strcmp (s2, "ul"))
+ {
+ build_toc_string (toc, e1);
+ }
+ }
+ }
e = webkit_dom_element_get_next_element_sibling (e);
}
+}
+
+void
+send_toc (WebKitDOMDocument *dom_document)
+{
+ GString *toc;
+
+ WebKitDOMElement *toc_elt = webkit_dom_document_query_selector
+ (dom_document, "div.contents ul", NULL);
+ if (!toc_elt)
+ return;
+
+ toc = g_string_new (NULL);
+
+ build_toc_string (toc, toc_elt);
packetize ("toc", toc);
g_string_free (toc, TRUE);
diff --git a/js/infog/main.c b/js/infog/main.c
index 8192f8286b..8fd74a7b70 100644
--- a/js/infog/main.c
+++ b/js/infog/main.c
@@ -260,7 +260,7 @@ load_toc (char *p)
{
/* Strip HTML tags. */
char *p1, *p2;
- char *q3 = q2;
+ char *q3 = q;
while ((p1 = strchr (p, '<')) && (p2 = strchr (p1, '>')))
{
p2++;
@@ -657,7 +657,7 @@ main (int argc, char *argv[])
build_gui ();
-#define MANUAL "hello"
+#define MANUAL "texinfo"
GString *s = g_string_new (NULL);
g_string_append (s, "file:");
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20