diff --git a/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc b/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc index 80598754911..073757fed84 100644 --- a/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc +++ b/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc @@ -230,4 +230,4 @@ The `release-tika-server` job builds from `tika-server-standard-.zip` * xref:maintainers/release-guides/tika.adoc[Releasing Apache Tika] * xref:maintainers/release-guides/docker.adoc[Releasing Tika Docker Images] -* xref:maintainers/release-guides/site-updates.adoc[Updating the Website After a Release] +* xref:maintainers/site.adoc[Updating the Website After a Release] diff --git a/docs/publish-docs.sh b/docs/publish-docs.sh index fcbed4e9954..e7e353506c1 100755 --- a/docs/publish-docs.sh +++ b/docs/publish-docs.sh @@ -28,6 +28,31 @@ set -euo pipefail cd "$(dirname "$0")" PUBLISH_DIR="${1:?usage: publish-docs.sh }" + +# Guard the 'rm -rf' below: the publish dir must already exist (it's a +# tika-site checkout, not something we create) and not be a dangerously +# short/root path that a typo could expand to. +if [[ ! -d "${PUBLISH_DIR}" ]]; then + echo "PUBLISH_DIR '${PUBLISH_DIR}' is not an existing directory." >&2 + echo "Point it at a tika-site 'publish/' checkout." >&2 + exit 1 +fi +PUBLISH_DIR="$(cd "${PUBLISH_DIR}" && pwd -P)" +if [[ "${#PUBLISH_DIR}" -lt 4 || "${PUBLISH_DIR}" != *"/"* ]]; then + echo "Refusing to operate on suspiciously short PUBLISH_DIR '${PUBLISH_DIR}'." >&2 + exit 1 +fi +# Confirm this looks like a tika-site 'publish/' dir: the documented argument +# is always /publish, and the downstream 'svn add' step +# hardcodes that name for the things written here (publish/docs, publish/_, +# publish/search-index.js). Refusing a non-'publish' basename catches a +# wrong-but-valid checkout before we 'rm -rf' inside it. +if [[ "$(basename "${PUBLISH_DIR}")" != "publish" ]]; then + echo "PUBLISH_DIR '${PUBLISH_DIR}' does not look like a tika-site publish dir" >&2 + echo "(expected its name to be 'publish'). Refusing to modify it." >&2 + exit 1 +fi + DOCS_DIR="${PUBLISH_DIR}/docs" if [[ ! -d target/site ]]; then @@ -40,12 +65,24 @@ mkdir -p "${DOCS_DIR}" # Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/... cp -r target/site/tika/* "${DOCS_DIR}/" -# UI assets one level above docs/, since HTML uses ../../_/ relative paths -cp -r target/site/_/ "${PUBLISH_DIR}/_/" +# UI assets one level above docs/, since HTML uses ../../_/ relative paths. +# Replace wholesale: cp -r into an existing directory nests source as a +# subdirectory (publish/_/_/), so remove first to keep the layout flat. +# Refuse if '_' is a symlink: 'rm -rf _/' would follow it and wipe the +# target's contents, and the cp below needs a real directory here anyway. +if [[ -L "${PUBLISH_DIR}/_" ]]; then + echo "Refusing to remove '${PUBLISH_DIR}/_': it is a symlink, not a directory." >&2 + exit 1 +fi +rm -rf "${PUBLISH_DIR}/_" +cp -r target/site/_ "${PUBLISH_DIR}/_" # Fix the root redirect and sitemap to match the flattened layout sed 's|tika/||g' target/site/index.html > "${DOCS_DIR}/index.html" sed 's|/docs/tika/|/docs/|g' target/site/sitemap.xml > "${DOCS_DIR}/sitemap.xml" cp target/site/404.html "${DOCS_DIR}/" -cp target/site/search-index.js "${DOCS_DIR}/" +# Lunr index lives next to _/ (one level above docs/), since HTML uses ../../search-index.js. +# Remove the stale copy from its old publish/docs/ location left by earlier runs. +rm -f "${DOCS_DIR}/search-index.js" +cp target/site/search-index.js "${PUBLISH_DIR}/" echo "Published to: ${DOCS_DIR}/" diff --git a/docs/supplemental-ui/css/search.css b/docs/supplemental-ui/css/search.css deleted file mode 100644 index 5fac6cf03b3..00000000000 --- a/docs/supplemental-ui/css/search.css +++ /dev/null @@ -1,82 +0,0 @@ -.navbar .search { - position: relative; - margin-right: 0.5rem; -} - -#search-input { - border: 1px solid #dbdbdb; - border-radius: 4px; - padding: 0.375rem 0.625rem; - font-size: 0.875rem; - width: 200px; - background: #fff; -} - -#search-input:focus { - border-color: #3273dc; - outline: none; - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -#search-results { - display: none; - position: absolute; - top: 100%; - right: 0; - background: white; - border: 1px solid #dbdbdb; - border-radius: 4px; - max-height: 400px; - overflow-y: auto; - width: 350px; - z-index: 1000; - box-shadow: 0 4px 6px rgba(0,0,0,0.1); - margin-top: 0.25rem; -} - -.search-result-item { - padding: 0.75rem 1rem; - border-bottom: 1px solid #f0f0f0; -} - -.search-result-item:last-child { - border-bottom: none; -} - -.search-result-item:hover { - background: #f5f5f5; -} - -.search-result-item a { - color: #363636; - text-decoration: none; - display: block; -} - -.search-result-item .title { - font-weight: 600; - margin-bottom: 0.25rem; -} - -.search-result-item .text { - font-size: 0.8125rem; - color: #666; - line-height: 1.4; -} - -/* Footer styles */ -.footer { - background: #363636; - color: #b5b5b5; - padding: 1.5rem; - text-align: center; - font-size: 0.875rem; -} - -.footer p { - margin: 0.25rem 0; -} - -.footer a { - color: #fff; -} diff --git a/docs/supplemental-ui/js/search.js b/docs/supplemental-ui/js/search.js deleted file mode 100644 index 00af02312db..00000000000 --- a/docs/supplemental-ui/js/search.js +++ /dev/null @@ -1,119 +0,0 @@ -/* Search functionality for Antora with Lunr */ -(function () { - 'use strict' - - var defined = function (val) { - return typeof val !== 'undefined' - } - - var searchInput = document.getElementById('search-input') - var searchResults = document.getElementById('search-results') - - if (!searchInput || !searchResults) return - - var index = null - var store = null - var indexLoaded = false - - // Determine the base path for the search index - var siteRootPath = document.body.dataset.siteRootPath || '' - var indexPath = siteRootPath + '/search-index.js' - - // Load the search index - var script = document.createElement('script') - script.src = indexPath - script.onload = function () { - if (typeof antoraSearch !== 'undefined' && defined(antoraSearch.index) && defined(antoraSearch.store)) { - index = lunr.Index.load(antoraSearch.index) - store = antoraSearch.store - indexLoaded = true - } - } - document.head.appendChild(script) - - // Load Lunr if not already loaded - if (typeof lunr === 'undefined') { - var lunrScript = document.createElement('script') - lunrScript.src = 'https://unpkg.com/lunr@2.3.9/lunr.min.js' - document.head.appendChild(lunrScript) - } - - searchInput.addEventListener('input', debounce(search, 200)) - searchInput.addEventListener('focus', function () { - if (this.value.length > 1) search() - }) - - document.addEventListener('click', function (e) { - if (!e.target.closest('.search')) { - searchResults.innerHTML = '' - searchResults.style.display = 'none' - } - }) - - function search () { - var query = searchInput.value.trim() - - if (query.length < 2) { - searchResults.innerHTML = '' - searchResults.style.display = 'none' - return - } - - if (!indexLoaded) { - searchResults.innerHTML = '
Loading search index...
' - searchResults.style.display = 'block' - return - } - - var results = [] - try { - results = index.search(query) - } catch (e) { - // Try wildcard search if exact search fails - try { - results = index.search(query + '*') - } catch (e2) { - results = [] - } - } - - if (results.length === 0) { - searchResults.innerHTML = '
No results found
' - searchResults.style.display = 'block' - return - } - - var html = results.slice(0, 10).map(function (result) { - var doc = store[result.ref] - if (!doc) return '' - var title = doc.title || 'Untitled' - var text = doc.text || '' - if (text.length > 150) text = text.substring(0, 150) + '...' - return '' - }).join('') - - searchResults.innerHTML = html - searchResults.style.display = 'block' - } - - function debounce (fn, delay) { - var timeout - return function () { - var context = this - var args = arguments - clearTimeout(timeout) - timeout = setTimeout(function () { - fn.apply(context, args) - }, delay) - } - } - - function escapeHtml (text) { - var div = document.createElement('div') - div.textContent = text - return div.innerHTML - } -})() diff --git a/docs/supplemental-ui/partials/footer-scripts.hbs b/docs/supplemental-ui/partials/footer-scripts.hbs deleted file mode 100644 index 9aa19101f12..00000000000 --- a/docs/supplemental-ui/partials/footer-scripts.hbs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/supplemental-ui/partials/head-scripts.hbs b/docs/supplemental-ui/partials/head-scripts.hbs deleted file mode 100644 index d5752e8e119..00000000000 --- a/docs/supplemental-ui/partials/head-scripts.hbs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/supplemental-ui/partials/header-content.hbs b/docs/supplemental-ui/partials/header-content.hbs index 88488dfbe90..940d6b760af 100644 --- a/docs/supplemental-ui/partials/header-content.hbs +++ b/docs/supplemental-ui/partials/header-content.hbs @@ -1,11 +1,16 @@
-