-
Notifications
You must be signed in to change notification settings - Fork 349
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
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
f7dabb5
inject test
reakaleek cdc5a32
try again
reakaleek 07a50ff
test
reakaleek 2f2e723
test again
reakaleek b00a51d
test
reakaleek d2259a0
test
reakaleek 2ec7424
ok
reakaleek f07f7ad
commit am speed up
reakaleek 8352c84
Revert conf
reakaleek 59a6ce0
ok
reakaleek 280a679
Try without file read
reakaleek 23f28c8
test
reakaleek 19ba219
fix
reakaleek 635cafa
test
reakaleek 3527106
fix
reakaleek 6bbea9b
test
reakaleek d21d9be
ok
reakaleek 1ed9188
Remove /guide prefix
reakaleek 8357040
Refactor and cleanup
reakaleek 0958cb0
Revert nav.rb
reakaleek 9f5f16e
Update v3-mapping.json (not finalized yet)
bmorelli25 0c5dde9
Refactor to satisfy rubocop
reakaleek ed06c65
bumping current docs to 8.18
eedugon 18e6723
Update stacklive
reakaleek 56f5bc1
remove 404ing redirects
bmorelli25 6722746
Fix styling
reakaleek c19b7ee
update with FINAL redirects
bmorelli25 83c0b71
fix 404
bmorelli25 4ef5547
Merge branch 'master' into test-version-mapping
bmorelli25 c204017
Adjust wording
reakaleek b9daa7e
Add old elastic docs experience warning
reakaleek 0f5da2a
Remove 404ing beats links
bmorelli25 6a8fc7a
css updates for landing page and text update
bmorelli25 cdd0891
Merge branch 'master' into test-version-mapping
bmorelli25 f2b7796
Fix z-index
reakaleek 27f9437
Increase font-weight for h2 and h3 tags
bmorelli25 76385d7
update landing page to point to 8.18, etc.
bmorelli25 29c1347
fix
bmorelli25 0b9d20e
Move heading
bmorelli25 52f5c27
Update documentation links to version 8.18
bmorelli25 4f1ac05
one row
colleenmcginnis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.