Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
docs
Commits
4c74a861
Commit
4c74a861
authored
Nov 07, 2017
by
Tobias Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADd warning for outdated versioned content
parent
4ca8a08f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
Rules
Rules
+1
-0
outdated_content.rb
lib/filters/outdated_content.rb
+23
-0
nanoc.yaml
nanoc.yaml
+1
-0
No files found.
Rules
View file @
4c74a861
...
...
@@ -54,6 +54,7 @@ compile '*' do
elsif
item
[
:extension
]
==
'md'
filter
:redcarpet
,
options:
{
filter_html:
true
,
autolink:
true
,
no_intraemphasis:
true
,
fenced_code_blocks:
true
,
gh_blockcode:
true
,
tables:
true
},
renderer_options:
{
with_toc_data:
true
}
filter
:normalize_links
,
item
[
:repo_docs
]
if
item
[
:repo_docs
]
filter
:outdated_content
,
item
[
:repo_docs
]
if
item
[
:repo_docs
]
&&
item
[
:repo_docs
][
:outdated
]
filter
:add_anchors
filter
:bootstrappify
filter
:admonition
...
...
lib/filters/outdated_content.rb
0 → 100644
View file @
4c74a861
# encoding: utf-8
require
'nokogiri'
class
OutdatedContent
<
::
Nanoc
::
Filter
identifier
:outdated_content
def
run
(
content
,
params
=
{})
doc
=
Nokogiri
::
HTML
(
content
)
# TODO(ts): We need to link to the same page or the first child without hardcoding /getting_started/.
warning
=
%(<p>CAUTION: This page documents an old version of Prometheus.
Check out the <a href="#{params[:outdated]}getting_started/">latest version</a>.</p>)
body
=
doc
.
css
(
'body'
)
if
first
=
body
.
children
.
first
first
.
add_previous_sibling
(
warning
)
else
body
<<
Nokogiri
::
HTML
::
DocumentFragment
.
parse
(
warning
)
end
doc
.
to_s
end
end
nanoc.yaml
View file @
4c74a861
...
...
@@ -82,6 +82,7 @@ data_sources:
name
:
'
1.8'
repository
:
https://github.com/prometheus/prometheus.git
refspec
:
release-1.8
outdated
:
/docs/prometheus/latest/
-
type
:
static
items_root
:
/assets/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment