Skip to content

Commit

Permalink
Merge pull request #3807 from OpenLiberty/javadocs_frameless_staging
Browse files Browse the repository at this point in the history
Adding Frameless Javadocs into Staging
  • Loading branch information
steven1046 authored Jul 19, 2024
2 parents 272d94c + 91e96a1 commit 704e14a
Show file tree
Hide file tree
Showing 8 changed files with 1,379 additions and 305 deletions.
30 changes: 25 additions & 5 deletions scripts/build/javadoc_modify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,28 @@ modifyStylesheetFrameless () {
mv newstylesheet.css "$1"
}

modifyStylesheetFramelessSPIAPI () {
# Append extra javadoc styling located in the css direcctory to the stylesheet.css located in the javadoc api/spi subdirectories
cat src/main/content/antora_ui/src/css/javadoc-extended-stylesheet-frameless-api_spi.css >> "$1"

# insert extra import to the beginning of the file
sed '1 i\
@import url("https://fonts.googleapis.com/css?family=Asap:300,400,500");
' "$1" > newstylesheet.css

mv newstylesheet.css "$1"
}

modifySearch () {
# add url support to search
cp src/main/content/_assets/js/javadoc-search.js "$1"
}

modifyFramelessSearch () {
# add url support to frameless javadoc search
cp src/main/content/_assets/js/javadoc-search-frameless.js "$1"
}

modifyRedirect () {
a=$1
cp src/main/content/_assets/js/javadoc-redirect.js "${a/script.js/redirect.js}"
Expand All @@ -38,14 +55,17 @@ modifyRedirect () {

export -f modifyStylesheet
export -f modifyStylesheetFrameless
export -f modifyStylesheetFramelessSPIAPI
export -f modifySearch
export -f modifyFramelessSearch
export -f modifyRedirect

find target/jekyll-webapp/docs -path "*microprofile*/stylesheet.css" -exec bash -c 'modifyStylesheet {}' \;
find target/jekyll-webapp/docs -path "*liberty-*/stylesheet.css" -exec bash -c 'modifyStylesheet {}' \;
find target/jekyll-webapp/docs -path "*io.openliberty*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*com.ibm.websphere.appserver*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -name search.js -exec bash -c 'modifySearch {}' \;
find target/jekyll-webapp/docs -path "*liberty-*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*microprofile*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*io.openliberty*/stylesheet.css" -exec bash -c 'modifyStylesheetFramelessSPIAPI {}' \;
find target/jekyll-webapp/docs -path "*com.ibm.websphere.appserver*/stylesheet.css" -exec bash -c 'modifyStylesheetFramelessSPIAPI {}' \;
find target/jekyll-webapp/docs -path "*microprofile*" -name search.js -exec bash -c 'modifyFramelessSearch {}' \;
find target/jekyll-webapp/docs -path "*liberty-*" -name search.js -exec bash -c 'modifyFramelessSearch {}' \;
find target/jekyll-webapp/docs -name script.js -exec bash -c 'modifyRedirect {}' \;

timer_end=$(date +%s)
Expand Down
29 changes: 21 additions & 8 deletions src/main/content/_assets/js/javadoc-redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,26 @@ function javadocRedirect(api,version,jd) {
}
var pack = jd.substring(0, jd.lastIndexOf('/'));
var port = window.top.location.port !== '' ? ':' + window.top.location.port : '';
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?package='+pack+'/package-frame.html&class=': '-javadoc.html?class=') +
jd;
var mainFrame = $('#javadoc_container');
var isFrameless = mainFrame.contents().find('iframe').length === 0;
if(isFrameless){
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?path='+api+version+'-javadoc/'+jd: '-javadoc.html');
}
else{
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?package='+pack+'/package-frame.html&class=': '-javadoc.html?class=') +
jd;
}
}

Loading

0 comments on commit 704e14a

Please sign in to comment.