Skip to content

Commit

Permalink
Merge branch 'prod' into demo1
Browse files Browse the repository at this point in the history
  • Loading branch information
navaneethsnair1 committed Sep 10, 2024
2 parents 0c923f0 + 168cd40 commit dbfa216
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 56 deletions.
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

8 changes: 3 additions & 5 deletions scripts/build/clone_guides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ def directory_exists?(repo_name)
# Clone static & interactive guides that are ready to be published to openliberty.io
if repo_name.start_with?('iguide') || repo_name.start_with?('guide')
# Clone the guides, using the dev branch for travis and prod for all other environments.
`git clone https://github.com/OpenLiberty/#{repo_name}.git -b #{guide_branch} src/main/content/guides/#{repo_name}`

system("git","clone","https://github.com/OpenLiberty/#{repo_name}.git","-b","#{guide_branch}","src/main/content/guides/#{repo_name}")
# # Clone the fallback branch if the guide_branch does not exist for this guide repo.
if !(directory_exists?(repo_name))
`git clone https://github.com/OpenLiberty/#{repo_name}.git -b #{fallback_guide_branch} src/main/content/guides/#{repo_name}`
system("git","clone","https://github.com/OpenLiberty/#{repo_name}.git","-b","#{fallback_guide_branch}","src/main/content/guides/#{repo_name}")
end

# Clone the default branch if the fallback_guide_branch does not exist for this guide repo.
if !(directory_exists?(repo_name))
`git clone https://github.com/OpenLiberty/#{repo_name}.git src/main/content/guides/#{repo_name}`
system("git","clone","https://github.com/OpenLiberty/#{repo_name}.git","src/main/content/guides/#{repo_name}")
end
end
if ENV['DRAFT_SITE'] || ENV['GUIDES_DRAFT_SITE']
Expand Down
2 changes: 0 additions & 2 deletions scripts/build/javadoc_modify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ export -f modifySearch
export -f modifyFramelessSearch
export -f modifyRedirect

# find target/jekyll-webapp/docs -path "*liberty-javaee7*/stylesheet.css" -exec bash -c 'modifyStylesheet {}' \;
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 -not -path "*microprofile-6.0*" -name search.js -exec bash -c 'modifySearch {}' \;
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 {}' \;
Expand Down
35 changes: 19 additions & 16 deletions scripts/build/parse_features_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,25 @@ def sort_versions_for(feature, high_to_low=True):
print("Modifying the docs TOCs of version " + version + " to remove the duplicate feature versions.")
feature_version_path = featurePath + version
for root, dirs, files in os.walk(feature_version_path):
for basename in files:
if fnmatch.fnmatch(basename, "*.html"):
if(basename != "index.html"):
href = path.join(root, basename)
page = BeautifulSoup(open(href), "lxml")

# Find the toc and replace it with the modified toc
page_toc = page.find_all('ul', {'class': 'nav-list'})[0]
if page_toc.find('span', text='Features') is not None:
toc_to_replace = page_toc.find('span', text='Features').parent
elif page_toc.find('a', text='Features') is not None:
toc_to_replace = page_toc.find('a', text='Features').parent
toc_to_replace.clear()
toc_to_replace.append(featureTOC)
with open(href, "w") as file:
file.write(str(page))
if "../" not in root:
for basename in files:
if fnmatch.fnmatch(basename, "*.html"):
if(basename != "index.html"):
href = path.join(root, basename)
page = BeautifulSoup(open(href), "lxml")

# Find the toc and replace it with the modified toc
page_toc = page.find_all('ul', {'class': 'nav-list'})[0]
if page_toc.find('span', text='Features') is not None:
toc_to_replace = page_toc.find('span', text='Features').parent
elif page_toc.find('a', text='Features') is not None:
toc_to_replace = page_toc.find('a', text='Features').parent
toc_to_replace.clear()
toc_to_replace.append(featureTOC)
with open(href, "w") as file:
file.write(str(page))
else:
print("Invalid path for root")

timerEnd = time.time()
print('Total execution time for parsing ToC Features: ', timerEnd - timerStart)
15 changes: 15 additions & 0 deletions src/main/content/_assets/css/guide-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,18 @@
right: 10px;
top: 5px;
}

.quoteblock {
background: #fafafa;
color: #5d5d5d;
padding: .25rem 2rem 1.25rem;
blockquote {
margin-top: 1rem;
}
.attribution {
color: #8e8e8e;
}
.paragraph {
font-style: italic;
}
}
26 changes: 25 additions & 1 deletion src/main/content/_assets/css/post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -540,4 +540,28 @@ iframe{

div.sectionbody div.ulist > ul > li p{
font-size: 16px;
}
}

.quoteblock{
display: table;
margin: auto;
blockquote{
&:before{
content: "\201c";
float: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 2.5em;
font-weight: 700;
line-height: .6em;
margin-left: -.6em;
}
margin-left: 22px;
margin-right: 0;
text-align: justify;
}
.attribution{
text-align: right;
font-style: italic;
margin-right: 0.5ex;
}
}
7 changes: 3 additions & 4 deletions src/main/content/_assets/js/antora-redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $(document).ready(function () {
if (hash.indexOf("#") === 0) {
hash = hash.substring(1); // Remove hash
}
window.location.replace(window.location.origin + "/docs/latest/" + hash);
window.location.href= window.location.origin + "/docs/latest/" + hash;
} else if (
path.indexOf("/docs/ref/feature/") > -1 ||
path.indexOf("/docs/ref/config/") > -1 ||
Expand Down Expand Up @@ -48,13 +48,12 @@ $(document).ready(function () {
break;
}
}
window.location.replace(
window.location.href =
window.location.origin +
"/docs/latest/reference/" +
resource_type +
"/" +
page +
hash
);
hash;
}
});
39 changes: 33 additions & 6 deletions src/main/content/_assets/js/guides.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ $(document).ready(function () {
return window.innerWidth > tabletBreakpoint;
}

// Remove previous TOC section highlighted and highlight correct step
// Remove previous TOC section highlighted, highlight correct step and adjust TOC scroll position
function updateTOCHighlighting(id) {
$(".liSelected").removeClass("liSelected");
var anchor = $("#toc_container a[href='#" + id + "']");
anchor.parent().addClass("liSelected");
updateTOCScrollTop();
}

function updateTOCScrollTop(){
var liOffset= ($(".liSelected").offset().top) - ($("#toc_container").offset().top) + $("#toc_container").scrollTop();
$("#toc_container").animate({
scrollTop: liOffset- $("#toc_container").height()/2 + $(".liSelected").height()/2
},100)
}

// Find the first subcategory header that is visible in the viewport and return the id
Expand Down Expand Up @@ -135,7 +143,7 @@ $(document).ready(function () {
var headerVisibleHeight = getVisibleHeightPx(
$("#guides_information_container")
);
var tocHeight = $("#toc_container ul").height();
var tocHeight = $("#toc_container ul").innerHeight();
var footerVisibleHeight = getVisibleHeightPx($("footer"));
var totalHeight = headerVisibleHeight + tocHeight + footerVisibleHeight;
var windowHeight = $(window).height();
Expand All @@ -145,8 +153,27 @@ $(document).ready(function () {
$("#toc_container").css({
height: "calc(100vh - " + headerAndFooterHeight + "px)",
});
} else {
$("#toc_container").css({ height: "auto" });
headerVisibleHeight > 0 ? ($("#toc_container").scrollTop(0)) : null;
if(footerVisibleHeight > 0){
$("#toc_container").css({
position : 'fixed',
bottom : footerVisibleHeight+15+"px",
})
$("#toc_container").scrollTop($("#toc_container")[0].scrollHeight);
}
else{
$("#toc_container").css({
position : 'static',
bottom :'auto'
});
}
}
else {
$("#toc_container").css({
height : 'auto',
position : 'static',
bottom : 'auto'
});
}
}

Expand Down Expand Up @@ -702,11 +729,11 @@ $(document).ready(function () {
var total = $(this).find(".guide_column").length;
// update num_guides
if (showTotal) {
$("#" + $(this).attr("id").replace("_category", "_num_guides")).html(
$("#" + $(this).attr("id").replace("_category", "_num_guides")).text(
"(" + count + "/" + total + " guides)"
);
} else {
$("#" + $(this).attr("id").replace("_category", "_num_guides")).html(
$("#" + $(this).attr("id").replace("_category", "_num_guides")).text(
"(" + count + " guides)"
);
}
Expand Down
38 changes: 28 additions & 10 deletions src/main/content/_assets/js/javadoc-redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ $(function () {
window.top.location.href.includes('/docs/modules/reference/microprofile-')
) {
var jd = window.top.location.href;
var version = jd.substring(
jd.indexOf('microprofile-') + 13,
jd.indexOf('microprofile-') + 16
);
jd = jd.substring(jd.indexOf('microprofile-') + 25);
var ver_start_index= jd.indexOf('microprofile-') + 13;
var ver_string = jd.substring(ver_start_index); // To obtain the last index of version
var ver_end_index = ver_string.indexOf('-');
if(ver_end_index !== -1 ){
var version = ver_string.substring(
0,
ver_end_index
);
var add_index = version.length - 3;
jd = jd.substring(jd.indexOf('microprofile-') + add_index + 25);
}
else{
version = null;
}
javadocRedirect('microprofile-',version,jd);
} else if (
window.top.location.href.includes('/docs/modules/reference/liberty-javaee')
Expand All @@ -23,11 +32,20 @@ $(function () {
window.top.location.href.includes('/docs/modules/reference/liberty-jakartaee')
) {
var jd = window.top.location.href;
var version = jd.substring(
jd.indexOf('liberty-jakartaee') + 17,
jd.indexOf('liberty-jakartaee') + 20
);
jd = jd.substring(jd.indexOf('liberty-jakartaee') + 29);
var ver_start_index= jd.indexOf('liberty-jakartaee') + 17;
var ver_string = jd.substring(ver_start_index); // To obtain the last index of version
var ver_end_index = ver_string.indexOf('-');
if(ver_end_index !== -1 ){
var version = ver_string.substring(
0,
ver_end_index
);
var add_index = version.length - 3;
jd = jd.substring(jd.indexOf('liberty-jakartaee') + add_index + 29);
}
else{
version = null;
}
javadocRedirect('liberty-jakartaee',version,jd);
}
});
Expand Down
1 change: 0 additions & 1 deletion src/main/content/antora_ui/src/css/doc.css
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@

.doc .quoteblock {
background: var(--quote-background);
border-left: 5px solid var(--quote-border-color);
color: var(--quote-font-color);
padding: 0.25rem 2rem 1.25rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ ul.nav-list li {
float: none; }

/* doesn't seem to pick up this on focus */
.clickableNavListTab, ul.nav-list li:focus {
ul.nav-list li:focus {
background-color: #D6D9E4;
color: #253441; }

.clickableNavListTab {
color: #bb7a2a; }

.clickableNavListTab:hover {
cursor: pointer; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@
float: none; }

/* doesn't seem to pick up this on focus */
.clickableNavListTab, ul.nav-list li:focus {
ul.nav-list li:focus {
background-color: #D6D9E4;
color: #253441; }

.clickableNavListTab {
color: #bb7a2a; }

.clickableNavListTab:hover {
cursor: pointer; }
Expand Down
57 changes: 57 additions & 0 deletions src/main/content/antora_ui/src/js/01-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ var navigation = (function(){
if (e.detail > 1) e.preventDefault();
});

$('#filter_titles').on('keyup', filterNavTitles);

$('#clear_filter').on("click", function () {
$('#filter_titles').val('');
filterNavTitles();
})
};

$('.components .versions li a').on('click', function(e){
Expand Down Expand Up @@ -153,6 +159,57 @@ var navigation = (function(){
}
}

//Filter article titles in TOC using text input
function filterNavTitles(){
let input = $('#filter_titles').val().toLowerCase();
let title_match=false;
if(input==='' ){
$('#clear_filter, .no-results-container').hide();
$(".nav-menu > .nav-list > .nav-item").addClass('is-active');
$('.nav-menu > .nav-list >.nav-item .nav-item').has('.nav-item-toggle').removeClass('is-active');
$('.nav-item').each(function() {
if ($(this).css('display') === 'none') {
$(this).css('display', '');
}
});
return;
}
$('#clear_filter').show();
let articles = $('.nav-link , .nav-menu .nav-text');
articles.parent().hide();
articles.each(function() {
let article = $(this);
let title = article.text().toLowerCase();
if (title.includes(input)) {
title_match=true;
$('.no-results-container').hide();
article.parent().show();
article.parent().has('.nav-item-toggle').removeClass('is-active');
showAncestors(article.parent());
showDescendants(article.parent());
}
});
if(!title_match){
$('.no-results-container').show();
}
}

function showAncestors(item){
let parent = item.parents('.nav-item');
parent.each(function() {
$(this).show();
$(this).has('.nav-item-toggle').addClass('is-active');
});
}

function showDescendants(item) {
let children = item.find('.nav-item');
children.each(function() {
$(this).show();
$(this).has('.nav-item-toggle').removeClass('is-active');
});
}

return {
init: init,
activateCurrentPath: activateCurrentPath,
Expand Down
Loading

0 comments on commit dbfa216

Please sign in to comment.