{{ file.fm.title_html | safe }}
{% if file.fm.author %} - This page was contributed by {{ file.data.authorsMap[file.fm.author].name }} under the UPL -+ {% include "app/templates/partials/_author_byline.html" %} {% endif %}
\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index d399ea6..81d9800 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -26,6 +26,9 @@ for (const author of authorsArray) { } var javadoc = require('./app/data/javadoc.json') +var javafxdoc = require('./app/data/javafxdoc.json') +var jep = require('./app/data/jep.json') + function getAuthorID(name) { return name.replace(/\s/g, '') @@ -145,6 +148,14 @@ function pre_process_pages() { "path": processedLink, "title_html": text }) + } else if (link_id != null && javafxdoc[link_id[1]]) { + console.log(javafxdoc[link_id[1]]); + let processedLink = processDocLink(javafxdoc[link_id[1]]["link"]); + let text = javafxdoc[link_id[1]]["text"] + tutorials["tutorials"][group]["doc_links"].push({ + "path": processedLink, + "title_html": text + }) } let page_id = link.match(/related_page:([\w|\.|-]+)/); if (page_id != null && link_map.get(page_id[1])) { @@ -163,7 +174,15 @@ function pre_process_pages() { .pipe(data(function (file) { if (file.fm.author) { - authorsMap[file.fm.author].tutorials.push(file.fm.id); + if (file.fm.author.length > 1) { + console.log("Adding tutorial " + file.fm.id + " to multiple authors: " + file.fm.author); + for (const author of file.fm.author) { + authorsMap[author].tutorials.push(file.fm.id); + } + } else { + console.log("Adding tutorial " + file.fm.id + " to single author: " + file.fm.author); + authorsMap[file.fm.author].tutorials.push(file.fm.id); + } } })) } @@ -205,6 +224,17 @@ function pages() { } } + if (href.includes("javafxdoc:")) { + let javafxdoc_id = href.match(/javafxdoc:([\w\.\-(),]+)/) + if (javafxdoc_id != null) { + processedHref = processJavaFxDocLink(javafxdoc["javafxdoc_root"] + javafxdoc[javafxdoc_id[1]]); + if (processedHref.includes("undefined")) { + console.log("JavaFX Javadoc " + javafxdoc_id[1] + " resolved to undefined"); + } + return `${text}`; + } + } + if (href.includes("doc:")) { let doc_id = href.match(/doc:([\w\.\-(),]+)/); @@ -222,7 +252,37 @@ function pages() { } } + if (href.includes("jep:")) { + let jep_id = href.match(/jep:([\d]+)/); + if (jep_id != null) { + if (jep[jep_id[1]] == undefined) { + console.log("JEP " + jep_id[1] + " is not defined"); + } else { + processedHref = jep["root"] + jep_id[1]; + let anchor = href.match(/#[\w|-]+/); + if (anchor) { + processedHref = processedHref + anchor; + } + if (jep[jep_id[1]]["status"] == "preview" && jep[jep_id[1]]["version"] != javadoc["current_release"]) { + console.log( + "Current release is " + javadoc["current_release"] + ", JEP " + jep_id[1] + + " is a preview of " + jep[jep_id[1]]["version"] + " and still referenced"); + } + if (jep[jep_id[1]]["status"] == "incubator" && jep[jep_id[1]]["version"] != javadoc["current_release"]) { + console.log( + "Current release is " + javadoc["current_release"] + ", JEP " + jep_id[1] + + " is an incubator of " + jep[jep_id[1]]["version"] + " and still referenced"); + } + if (jep[jep_id[1]]["title"]) { + text = "JEP " + jep_id[1] + ": " + jep[jep_id[1]]["title"]; + } else { + text = "JEP " + jep_id[1] + ": " + jep[jep_id[1]]; + } + return `${text}`; + } + } + } if (title) { link = `${text}`; @@ -284,7 +344,7 @@ function pages() { .pipe(data(function (file) { if (file.fm.toc) { - const section_name_regex = /^[\s|\w|/|,]+[^{|^\s{]+/; + const section_name_regex = /^[\s\w.,|]+[^{|^\s{]+/; const anchor_regex = /{([^{|^}]+)}/; file.fm.toc = file.fm.toc .map(entry => ({ @@ -373,6 +433,10 @@ function processDocLink(link) { return link.replace("@@CURRENT_RELEASE@@", javadoc[`current_release`]); } +function processJavaFxDocLink(link) { + return link.replace("@@CURRENT_RELEASE@@", javafxdoc[`current_release`]).replace("@@RELEASE_UUID@@", javafxdoc[`release_uuid`]); +} + function is_tutorial(file) { return file.fm.type == "tutorial" || file.fm.type == "tutorial-group"; @@ -386,10 +450,10 @@ function serve(done) { } }); - watch("app/**/*.md", {}, series(build)); - watch("app/**/*.html", {}, series(build)); - watch("app/scss/*.scss", {}, series(build)); - watch("site/**/", {}, browserSync.reload()); + watch("app/**/*.md", {interval: 1000, usePolling: true}, series(build)); + watch("app/**/*.html", {interval: 1000, usePolling: true}, series(build)); + watch("app/scss/*.scss", {interval: 1000, usePolling: true}, series(build)); + watch("site/**/", {interval: 1000, usePolling: true}, browserSync.reload()); done(); } diff --git a/package-lock.json b/package-lock.json index 7a9c501..6029cab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,8 @@ }, "devDependencies": { "dotenv": "^16.0.3", - "gulp-markdown-toc": "^1.1.0" + "gulp-markdown-toc": "^1.1.0", + "gulp-util": "^3.0.8" } }, "node_modules/-": { diff --git a/package.json b/package.json index 8fa098a..62f4815 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ }, "devDependencies": { "dotenv": "^16.0.3", - "gulp-markdown-toc": "^1.1.0" + "gulp-markdown-toc": "^1.1.0", + "gulp-util": "^3.0.8" } }