Skip to content

Add version mapping and bump to 8.18 #3198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f7dabb5
inject test
reakaleek Mar 26, 2025
cdc5a32
try again
reakaleek Mar 26, 2025
07a50ff
test
reakaleek Mar 26, 2025
2f2e723
test again
reakaleek Mar 26, 2025
b00a51d
test
reakaleek Mar 27, 2025
d2259a0
test
reakaleek Mar 27, 2025
2ec7424
ok
reakaleek Mar 27, 2025
f07f7ad
commit am speed up
reakaleek Mar 27, 2025
8352c84
Revert conf
reakaleek Mar 27, 2025
59a6ce0
ok
reakaleek Mar 27, 2025
280a679
Try without file read
reakaleek Mar 27, 2025
23f28c8
test
reakaleek Mar 27, 2025
19ba219
fix
reakaleek Mar 27, 2025
635cafa
test
reakaleek Mar 27, 2025
3527106
fix
reakaleek Mar 27, 2025
6bbea9b
test
reakaleek Mar 27, 2025
d21d9be
ok
reakaleek Mar 27, 2025
1ed9188
Remove /guide prefix
reakaleek Mar 28, 2025
8357040
Refactor and cleanup
reakaleek Mar 28, 2025
0958cb0
Revert nav.rb
reakaleek Mar 28, 2025
9f5f16e
Update v3-mapping.json (not finalized yet)
bmorelli25 Mar 28, 2025
0c5dde9
Refactor to satisfy rubocop
reakaleek Mar 28, 2025
ed06c65
bumping current docs to 8.18
eedugon Mar 13, 2025
18e6723
Update stacklive
reakaleek Mar 29, 2025
56f5bc1
remove 404ing redirects
bmorelli25 Mar 31, 2025
6722746
Fix styling
reakaleek Apr 1, 2025
c19b7ee
update with FINAL redirects
bmorelli25 Apr 7, 2025
83c0b71
fix 404
bmorelli25 Apr 7, 2025
4ef5547
Merge branch 'master' into test-version-mapping
bmorelli25 Apr 7, 2025
c204017
Adjust wording
reakaleek Apr 7, 2025
b9daa7e
Add old elastic docs experience warning
reakaleek Apr 11, 2025
0f5da2a
Remove 404ing beats links
bmorelli25 Apr 11, 2025
6a8fc7a
css updates for landing page and text update
bmorelli25 Apr 11, 2025
cdd0891
Merge branch 'master' into test-version-mapping
bmorelli25 Apr 11, 2025
f2b7796
Fix z-index
reakaleek Apr 11, 2025
27f9437
Increase font-weight for h2 and h3 tags
bmorelli25 Apr 11, 2025
76385d7
update landing page to point to 8.18, etc.
bmorelli25 Apr 14, 2025
29c1347
fix
bmorelli25 Apr 14, 2025
0b9d20e
Move heading
bmorelli25 Apr 14, 2025
52f5c27
Update documentation links to version 8.18
bmorelli25 Apr 14, 2025
4f1ac05
one row
colleenmcginnis Apr 14, 2025
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
4 changes: 2 additions & 2 deletions conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ contents_title: Elastic documentation
# <key>: &<variable> <value>
# The keys don't really matter, but by convention the are the same as the variable.
variables:
stackcurrent: &stackcurrent 8.17
stacklive: &stacklive [ 8.17, 7.17 ]
stackcurrent: &stackcurrent 8.18
stacklive: &stacklive [ 8.18 ]

cloudSaasCurrent: &cloudSaasCurrent ms-122

Expand Down
10 changes: 10 additions & 0 deletions resources/asciidoctor/lib/chunker/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require_relative 'find_related'
require_relative 'footnotes'
require_relative 'nav'
require_relative 'url_to_v3'

##
# HTML5 converter that chunks like docbook.
Expand Down Expand Up @@ -49,6 +50,7 @@ def convert_document(doc)
)
doc.attributes['next_section'] = find_next_in doc, 0
add_nav doc
add_url_to_v3 doc
yield
end

Expand Down Expand Up @@ -81,6 +83,11 @@ def add_nav(doc)
doc.blocks.append nav.footer
end

def add_url_to_v3(doc)
url_to_v3 = UrlToV3.new doc
doc.blocks.insert 0, url_to_v3.url
end

def correct_xref(node)
refid = node.attributes['refid']
return unless (ref = node.document.catalog[:refs][refid])
Expand Down Expand Up @@ -108,6 +115,8 @@ def form_section_into_page(doc, section, html)

def add_subdoc_sections(doc, subdoc, html)
nav = Nav.new subdoc
url_to_v3 = UrlToV3.new subdoc
subdoc << url_to_v3.url
subdoc << nav.header
subdoc << Asciidoctor::Block.new(subdoc, :pass, source: html)
subdoc << footnotes(doc, subdoc) if doc.footnotes?
Expand Down Expand Up @@ -143,6 +152,7 @@ def subdoc_attrs(doc, section)
attrs['subdoc'] = true # Mark the subdoc so we don't try and chunk it
attrs['title-separator'] = ''
attrs['canonical-url'] = section.attributes['canonical-url']
attrs['current-url'] = "#{section.id}.html"
attrs.merge! find_related(section)
attrs
end
Expand Down
61 changes: 61 additions & 0 deletions resources/asciidoctor/lib/chunker/url_to_v3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true

module Chunker
# Add a warning to the page with a link to docs v3
class UrlToV3
attr_reader :url

def initialize(doc)
current_url = doc.attr('current-url')
outdir = doc.attr('outdir')
current_url ||= 'index.html'
m = mapping
# This only works in CI.
segments = outdir.sub('/tmp/docsbuild/target_repo/raw', '').split('/')
version = segments[-1] || 'unknown'
actual_url = get_actual_url(outdir, current_url)
new_url = if m.key?(actual_url)
m[actual_url]
else
'/docs'
end
render_warning(doc, version, new_url)
end

def mapping
file_path = File.expand_path('v3-mapping.json', __dir__)
JSON.parse(File.read(file_path)) if File.exist?(file_path)
end

def get_path_dir(outdir)
segments = outdir.sub('/tmp/docsbuild/target_repo/raw', '').split('/')
if segments.empty?
''
elsif segments.length > 1
segments[0...-1].join('/')
else
segments[0]
end
end

def get_actual_url(outdir, current_url)
get_path_dir(outdir) + '/*/' + current_url
end

def render_warning(doc, version, new_url)
if version == '8.18'
@url = Asciidoctor::Block.new(doc, :pass, source: <<~HTML)
<div id="url-to-v3" class="version-warning">
A newer version is available. Check out the <a href="https://www.elastic.co#{new_url}">latest documentation</a>.
</div>
HTML
else
@url = Asciidoctor::Block.new(doc, :pass, source: <<~HTML)
<div id="url-to-v3" class="version-warning">
<strong>IMPORTANT</strong>: This documentation is no longer updated. Refer to <a href="https://www.elastic.co/support/eol">Elastic's version policy</a> and the <a href="https://www.elastic.co#{new_url}">latest documentation</a>.
</div>
HTML
end
end
end
end
Loading