Repository: zng-ui/zng (language: rust)

Issue:
Incorrect links in some widget property input types
Some properties that are inherited twice can have incorrect links in docs, for example [`Text::underline_color`](https://zng-ui.github.io/doc/zng/text/struct.Text.html#method.underline_color).


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53986a5d8..64f2d3dd6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Unreleased
 
+* Fix doc links in inherited properties fetched from redirected original pages.
 * Fix `cargo zng res` not getting explicit metadata from lib crates.
 * Implement `--verbose` for `cargo zng res`.
 * Localize settings search box placeholder text.
diff --git a/crates/zng-app-proc-macros/js/widget.js b/crates/zng-app-proc-macros/js/widget.js
index 0ee5059a9..ed039c071 100644
--- a/crates/zng-app-proc-macros/js/widget.js
+++ b/crates/zng-app-proc-macros/js/widget.js
@@ -7,11 +7,12 @@
 
     // * `doc` - The document, can be this.document or a fetched doc.
     // * `propertiesSet` - Tracks property name overrides.
-    // * `inherits` - Array of `{ link, page }`, link is HTML str of the parent link, .
+    // * `inherits` - Array of `{ link, page }`, link is HTML str of the parent link.
     // * `fetchUrls` - Set of fetch URLs, used to avoid infinite recursion.
     async function refactorDocument(doc, propertiesSet, inherits, fetchUrls) {
         refactorSections(doc, propertiesSet, fetchUrls);
         refactorSidebar(doc, propertiesSet);
+        // fetch inherit docs and refactorDocument
         await fetchInherits(doc, propertiesSet, inherits, fetchUrls);
     }
 
@@ -205,15 +206,19 @@
                     throw page.statusText;
                 }
                 var parser = new DOMParser();
+                if (page.redirected) {
+                    url = page.url;
+                }
                 page = parser.parseFromString(await page.text(), 'text/html');
 
                 let refresh = page.head.querySelector("meta[http-equiv='refresh']");
                 if (refresh != null && refresh.content.startsWith('0;URL=')) {
-                    let url = refresh.content.replace('0;URL=', '');
+                    url = refresh.content.replace('0;URL=', '');
                     page = await fetch(url, { redirect: 'follow' });
                     if (!page.ok) {
                         throw page.statusText;
                     }
+                    url = page.url;
                     var parser = new DOMParser();
                     page = parser.parseFromString(await page.text(), 'text/html');
                 }


Test patch: