Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ----
FROM maven:3.8.3-openjdk-17-slim AS build_image
FROM maven:3.9.12-eclipse-temurin-11-alpine AS build_image

WORKDIR /var/build/widoco

Expand All @@ -9,7 +9,7 @@ RUN mvn package && \
mv ./JAR/widoco*.jar ./JAR/widoco.jar

# ----
FROM openjdk:17-slim
FROM eclipse-temurin:11-jdk-noble

RUN apt-get update
RUN apt-get install -y libfreetype6 fontconfig
Expand All @@ -18,6 +18,10 @@ RUN useradd widoco
RUN mkdir -p /usr/local/widoco
RUN chown -R widoco:widoco /usr/local/widoco

# allow execution of widoco with another UID while using the container's GID for writing the tmp files
# UPDATE: all users need to have write permissions to the widoco folder, otherwise issues with .devcontainers
RUN chmod -R 0777 /usr/local/widoco

USER widoco

WORKDIR /usr/local/widoco
Expand Down
48 changes: 26 additions & 22 deletions src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ public static String getIndexDocument(String resourcesFolderName, Configuration
+ "<script type=\"module\">import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.14.0/+esm';mermaid.initialize({startOnLoad:false});window.mermaid=mermaid;</script> \n"
+ " <script> \n" + "function loadHash() {\n"
+ " jQuery(\".markdown\").each(function(el){jQuery(this).after(marked.parse(jQuery(this).text())).remove()});\n"
+ " if (typeof window.mermaid !== 'undefined') { window.mermaid.run({ querySelector: 'pre code.language-mermaid' }); }\n"
+ " var hash = location.hash;\n" + " if($(hash).offset()!=null){\n"
+ " $('html, body').animate({scrollTop: $(hash).offset().top}, 0);\n" + "}\n" + " loadTOC();\n"
+ "}\n" + "function loadTOC(){\n" + " //process toc dynamically\n" + " var t='<h2>"
Expand All @@ -789,60 +790,62 @@ public static String getIndexDocument(String resourcesFolderName, Configuration
+ " t+= '<li>'+(i-1)+'.'+j+'. '+'<a href=#'+ jQuery(this).attr('id')+'>'+ jQuery(this).ignore(\"span\").text()+'</a></li>';\n"
+ " }\n" + " });\n" + " t+='</ul>';\n" + " $(\"#toc\").html(t); \n" + "}\n"
+ " $.fn.ignore = function(sel){\n" + " return this.clone().find(sel||\">*\").remove().end();\n"
+ " };" + " $(function(){\n";
// the script for loading the table is called after loading everything else,
// after the loadHash function
+ " };" + " $(function(){\n"
+ " var loads = [];\n"
+ " function _ls(sel,url){var d=$.Deferred();$(sel).load(url,function(){d.resolve();});return d.promise();}\n";
// collect all section loads; call loadHash only after all complete
if (c.isIncludeAbstract()) {
if(c.getAbstractPath()!=null && !c.getAbstractPath().isEmpty()){
document += " $(\"#abstract\").load(\""+c.getAbstractPath()+"\"); \n";
document += " loads.push(_ls(\"#abstract\",\""+c.getAbstractPath()+"\")); \n";
}else {
document += " $(\"#abstract\").load(\"sections/abstract-" + c.getCurrentLanguage() + ".html\"); \n";
document += " loads.push(_ls(\"#abstract\",\"sections/abstract-" + c.getCurrentLanguage() + ".html\")); \n";
}
}
if (c.isIncludeIntroduction()){
if(c.getIntroductionPath()!=null && !c.getIntroductionPath().isEmpty()){
document += " $(\"#introduction\").load(\""+c.getIntroductionPath()+"\"); \n";
document += " loads.push(_ls(\"#introduction\",\""+c.getIntroductionPath()+"\")); \n";
}else {
document += " $(\"#introduction\").load(\"sections/introduction-" + c.getCurrentLanguage()
+ ".html\"); \n";
document += " loads.push(_ls(\"#introduction\",\"sections/introduction-" + c.getCurrentLanguage()
+ ".html\")); \n";
}
//namespace table is always a separated document
document += " $(\"#nstable\").load(\"sections/ns-" + c.getCurrentLanguage()
+ ".html\"); \n";
document += " loads.push(_ls(\"#nstable\",\"sections/ns-" + c.getCurrentLanguage()
+ ".html\")); \n";
}
if (c.isIncludeOverview()){
if(c.getOverviewPath()!=null && !c.getOverviewPath().isEmpty()){
document += " $(\"#overview\").load(\""+c.getOverviewPath()+"\"); \n";
document += " loads.push(_ls(\"#overview\",\""+c.getOverviewPath()+"\")); \n";
}else {
document += " $(\"#overview\").load(\"sections/overview-" + c.getCurrentLanguage() + ".html\"); \n";
document += " loads.push(_ls(\"#overview\",\"sections/overview-" + c.getCurrentLanguage() + ".html\")); \n";
}
}
if (c.isIncludeDescription()){
if(c.getDescriptionPath()!=null && !c.getDescriptionPath().isEmpty()){
document += " $(\"#description\").load(\""+c.getDescriptionPath()+"\"); \n";
document += " loads.push(_ls(\"#description\",\""+c.getDescriptionPath()+"\")); \n";
}else {
document += " $(\"#description\").load(\"sections/description-" + c.getCurrentLanguage()
+ ".html\"); \n";
document += " loads.push(_ls(\"#description\",\"sections/description-" + c.getCurrentLanguage()
+ ".html\")); \n";
}
}
if (c.isIncludeReferences()){
if(c.getReferencesPath()!=null && !c.getReferencesPath().isEmpty()){
document += " $(\"#references\").load(\""+c.getReferencesPath()+"\"); \n";
document += " loads.push(_ls(\"#references\",\""+c.getReferencesPath()+"\")); \n";
}else {
document += " $(\"#references\").load(\"sections/references-" + c.getCurrentLanguage()
+ ".html\"); \n";
document += " loads.push(_ls(\"#references\",\"sections/references-" + c.getCurrentLanguage()
+ ".html\")); \n";
}
}
if (c.isIncludeChangeLog()) {
if (c.getMainOntology().getPreviousVersion() != null && !"".equals(c.getMainOntology().getPreviousVersion())
&& c.isChangeLogSuccessfullyCreated()) {
document += " $(\"#changelog\").load(\"sections/changelog-" + c.getCurrentLanguage()
+ ".html\"); \n";
document += " loads.push(_ls(\"#changelog\",\"sections/changelog-" + c.getCurrentLanguage()
+ ".html\")); \n";
}
}
if (c.isIncludeCrossReferenceSection())
document += " $(\"#crossref\").load(\"sections/crossref-" + c.getCurrentLanguage()
+ ".html\", null, loadHash); \n";
document += " loads.push(_ls(\"#crossref\",\"sections/crossref-" + c.getCurrentLanguage()
+ ".html\")); \n";
document += " $.when.apply($, loads).then(loadHash);\n";

document += " });\n" + " </script> \n" + " </head> \n" + "\n" + "<body>\n";

Expand Down Expand Up @@ -939,6 +942,7 @@ public static String getUnifiedIndexDocument(String resourcesFolderName, Configu
+ "<script type=\"module\">import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.14.0/+esm';mermaid.initialize({startOnLoad:false});window.mermaid=mermaid;</script> \n"
+ " " + "<script> \n" + "function loadHash() {\n"
+ " jQuery(\".markdown\").each(function(el){jQuery(this).after(marked.parse(jQuery(this).text())).remove()});\n"
+ " if (typeof window.mermaid !== 'undefined') { window.mermaid.run({ querySelector: 'pre code.language-mermaid' }); }\n"
+ " var hash = location.hash;\n" + " if($(hash).offset()!=null){\n"
+ " $('html, body').animate({scrollTop: $(hash).offset().top}, 0);\n" + "}\n" + " loadTOC();\n"
+ "}\n" + "function loadTOC(){\n" + " //process toc dynamically\n" + " var t='<h2>"
Expand Down
Loading