hdoc-tools 0.41.5 → 0.41.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -51,16 +51,27 @@ api-param-name {
|
|
51
51
|
font-style: italic;
|
52
52
|
font-weight: 600;
|
53
53
|
}
|
54
|
+
|
54
55
|
api-param-optional:before {
|
55
56
|
content: "Optional [default=";
|
56
57
|
font-style: normal;
|
57
58
|
font-weight: 400;
|
58
59
|
}
|
60
|
+
|
59
61
|
api-param-optional:after {
|
60
|
-
font-style: normal;
|
61
62
|
content: "]";
|
63
|
+
font-style: normal;
|
62
64
|
font-weight: 400;
|
63
65
|
}
|
66
|
+
|
67
|
+
/* If no default provided */
|
68
|
+
api-param-optional[no-default-value]:before {
|
69
|
+
content: "Optional";
|
70
|
+
}
|
71
|
+
|
72
|
+
api-param-optional[no-default-value]:after {
|
73
|
+
content: "";
|
74
|
+
}
|
64
75
|
|
65
76
|
/* API parameter description block */
|
66
77
|
api-param-desc {
|
package/ui/index.html
CHANGED
@@ -47,6 +47,16 @@
|
|
47
47
|
}
|
48
48
|
customElements.define("api-param-name", APIParamName);
|
49
49
|
|
50
|
+
class ApiParamOptional extends HTMLElement {
|
51
|
+
connectedCallback() {
|
52
|
+
const text = (this.textContent || '').trim();
|
53
|
+
if (!text) {
|
54
|
+
this.innerHTML = ''; // remove content
|
55
|
+
this.setAttribute('no-default-value', '');
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
customElements.define('api-param-optional', ApiParamOptional);
|
50
60
|
|
51
61
|
var ThemePreference = localStorage.getItem('hdocbook-theme-appearance') || '';
|
52
62
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
package/ui/js/doc.hornbill.js
CHANGED
@@ -258,8 +258,12 @@ function loadContentUrl(
|
|
258
258
|
fromPopState,
|
259
259
|
fromBook = true,
|
260
260
|
) {
|
261
|
-
|
262
|
-
|
261
|
+
let downloadFile = false;
|
262
|
+
if (linkRef.includes('_books/')) {
|
263
|
+
downloadFile = linkRef.split('').length > 1;
|
264
|
+
console.log('downloadFile', downloadFile);
|
265
|
+
}
|
266
|
+
|
263
267
|
//-- clear table of contents
|
264
268
|
view.docApp.tableOfContents = [];
|
265
269
|
let clean_linkRef = linkRef;
|
@@ -271,23 +275,30 @@ function loadContentUrl(
|
|
271
275
|
clean_linkRef = removeTrailingSlash(clean_linkRef);
|
272
276
|
//-- remove starting / if link starts with it
|
273
277
|
clean_linkRef = removeStartingSlash(clean_linkRef);
|
274
|
-
|
275
|
-
//-- update url in browser
|
276
|
-
if (fromBook)
|
277
|
-
setBrowserViewUrl(clean_linkRef, {}, fromPageRefresh, fromPopState);
|
278
|
-
//-- destroy any existing content children and events properly
|
279
|
-
jqContentContainer.empty();
|
280
|
-
jqDocumentHeader.find(".document-title").empty();
|
281
|
-
|
282
|
-
//-- for now just load whatever the href prop is (we can add actions to perform specific processing and then load content based on element atts etc)
|
283
|
-
let frontmatterData = {};
|
278
|
+
|
284
279
|
let booksLinkRef = clean_linkRef;
|
285
280
|
if (fromBook) {
|
286
281
|
booksLinkRef = clean_linkRef.includes("_books/")
|
287
282
|
? clean_linkRef
|
288
283
|
: `_books/${clean_linkRef}`;
|
289
284
|
}
|
290
|
-
|
285
|
+
|
286
|
+
if (downloadFile) {
|
287
|
+
//-- open in new tab to download
|
288
|
+
window.open(booksLinkRef, '_blank');
|
289
|
+
} else {
|
290
|
+
//-- update url in browser
|
291
|
+
if (fromBook) {
|
292
|
+
setBrowserViewUrl(clean_linkRef, {}, fromPageRefresh, fromPopState);
|
293
|
+
}
|
294
|
+
|
295
|
+
//-- destroy any existing content children and events properly
|
296
|
+
jqContentContainer.empty();
|
297
|
+
jqDocumentHeader.find(".document-title").empty();
|
298
|
+
|
299
|
+
//-- for now just load whatever the href prop is (we can add actions to perform specific processing and then load content based on element atts etc)
|
300
|
+
let frontmatterData = {};
|
301
|
+
fetch(booksLinkRef)
|
291
302
|
.then((response) => {
|
292
303
|
if (response.headers.has("X-frontmatter")) {
|
293
304
|
frontmatterData = response.headers.get("X-frontmatter");
|
@@ -417,6 +428,8 @@ function loadContentUrl(
|
|
417
428
|
|
418
429
|
listenForHrefClicks();
|
419
430
|
});
|
431
|
+
}
|
432
|
+
|
420
433
|
}
|
421
434
|
|
422
435
|
function setGitHubBookUrl(linkRef) {
|
@@ -625,6 +638,7 @@ Vue.component("nav-section-component", {
|
|
625
638
|
},
|
626
639
|
});
|
627
640
|
|
641
|
+
|
628
642
|
const hslDocLog = {
|
629
643
|
_entry: [],
|
630
644
|
log: function (strMessage, varData) {
|