From: Jonathan S. Katz <jkatz@postgresql.org>
To: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
Subject: Re: Release Notes Archive Patch
Date: Wed, 13 Feb 2019 08:46:25 -0500
Message-ID: <751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org> (raw)
In-Reply-To: <e0f09c9a-bd2b-862a-d379-601dfabc8969@postgresql.org>
References: <e0f09c9a-bd2b-862a-d379-601dfabc8969@postgresql.org>
On 2/12/19 8:12 PM, Jonathan S. Katz wrote:
> Hi,
>
> Attached is a proposed patch for archiving the release notes on the
> website. The patch builds the release note archive without modifying the
> schema and works with old and new releases.
>
> Known adjustments to be made:
>
> - The URLs on each release note page are broken. I have to figure out
> how the best way to change the relative path in the URLs that are on the
> page as it is going from the page root (/docs/release) instead of the
> site root. This _should_ be easy
> - Even with above fix, some URLs will be broken in them, i.e. references
> to other release notes
> - PostgreSQL v1 + v0: I need to relabel this for Postgres95
> - Also, some of the earlier versions do not have the proper release
> numbering (e.g. 1.03)
All of the above are now fixed. Attached is v2 of the patch. I've also
attached a couple of screenshots so you can see how it looks.
IMV this is ready to go, but would like some review and/or additional
testing prior to pushing.
Thanks,
Jonathan
From 1c79231c2442f5fac8e303420b6b5b5966f9ed8a Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 64 +++++++++++++++++++++++++++++
5 files changed, 158 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.cssindex 6c93c8b7..915c4a29 100644--- a/media/css/main.css+++ b/media/css/main.css@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */+#release-notes .navheader,+#release-notes .navfooter,+#release-notes .titlepage,+#release-notes .toc {+ display: none;+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.pyindex 4577f0ce..1da162fd 100644--- a/pgweb/docs/views.py+++ b/pgweb/docs/views.py@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):+ """Contains the main archive of release notes."""+ sql = """+ SELECT+ docs.*,+ r.major_version,+ r.minor_version+ FROM (+ SELECT DISTINCT+ r.major_version,+ r.minor_version,+ first_value(r.id) OVER (+ PARTITION BY (r.major_version, r.minor_version)+ ORDER BY r.tree DESC+ ) AS id+ FROM (+ SELECT+ r.id,+ r.tree,+ CASE array_length(versions, 1)+ WHEN 1 THEN versions[1]+ WHEN 2 THEN (+ CASE+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6+ THEN versions[1]+ ELSE (versions[1] || '.' || versions[2])+ END+ )+ ELSE (versions[1] || '.' || versions[2])+ END::numeric AS major_version,+ CASE array_length(versions, 1)+ WHEN 1 THEN '0'+ WHEN 2 THEN (+ CASE+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6+ THEN versions[2]+ ELSE '0'+ END+ )+ ELSE versions[3]+ END::int AS minor_version+ FROM (+ SELECT+ d.id,+ v.tree,+ regexp_split_to_array(+ regexp_replace(d.file, 'release-|.html?', '', 'g'),+ '-') AS versions+ FROM docs d+ JOIN core_version v ON+ v.tree = d.version AND+ v.testing = 0+ WHERE file ~ '^release-'+ ) r+ ) r+ ) r+ JOIN docs ON docs.id = r.id+ """+ params = []+ # if the major + minor version are provided, then we want to narrow down+ # the results to the exact release notes+ # otherwise ensure the release notes are returned in order+ if major_version and minor_version:+ sql += """+ WHERE major_version = %s AND minor_version = %s;+ """+ params += [major_version, minor_version]+ else:+ sql += """+ ORDER BY r.major_version DESC, r.minor_version DESC;+ """+ # execute the query to get the full queryset+ queryset = DocPage.objects.raw(sql, params)+ # if major + minor version are provided, we want to render something similar+ # to the docs page+ # otherwise, load the page that lists all of the versions+ if major_version and minor_version:+ docs = [d for d in queryset]+ if not docs:+ raise Http404()+ context = { 'd': docs[0] }+ else:+ context = { 'versions': [d for d in queryset], }+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.pyindex d40673fc..9382975a 100644--- a/pgweb/urls.py+++ b/pgweb/urls.py@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.pyindex 43f6c3e2..8f0b047b 100644--- a/pgweb/util/contexts.py+++ b/pgweb/util/contexts.py@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.htmlnew file mode 100644index 00000000..fdf32fef--- /dev/null+++ b/templates/docs/release_notes.html@@ -0,0 +1,64 @@+{% extends "base/page.html" %}++{% block extrahead %}+{% if d %}+ <base href="/docs/{{ d.major_version }}/" />+{% endif %}+{% endblock extrahead %}++{%block title%}Release Notes{%endblock%}++{% block contents %}+{% regroup versions by major_version as version_groups %}++<div id="release-notes" class="row">+ {% if d %}+ <div class="col-md-10">+ <section>+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>+ <h2>+ {% if d.major_version == 0 %}Postgres95{% else %}PostgreSQL{% endif %}+ {{ d.major_version }}.{% if d.major_version == 0 or d.major_version == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}+ </h2>+ </section>+ <div id="docContent">+ {{ d.content|safe }}+ </div>+ </div>+ {% else %}+ <div class="col-md-9">+ <section>+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>+ </section>+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>+ {% for version_group in version_groups %}+ <h2 id="release-{{ version_group.grouper }}">{% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}</h2>+ <ul>+ {% for d in version_group.list %}+ <li>+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">+ {{ version_group.grouper }}.{% if version_group.grouper == 0 or version_group.grouper == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}+ </a>+ </li>+ {% endfor %}+ </ul>+ {% endfor %}+ </div>+ <div class="col-md-3">+ <section>+ <h2>Jump to...</h2>+ </section>+ <ul>+ {% for version_group in version_groups %}+ <li>+ <a href="#release-{{ version_group.grouper }}">+ {% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}+ </a>+ </li>+ {% endfor %}+ </ul>+ </div>+ {% endif %}+</div>++{% endblock %}
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Create-Release-Notes-archive-in-the-Documentation-se_v2.patch (8.4K, ../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/2-0001-Create-Release-Notes-archive-in-the-Documentation-se_v2.patch)
download | inline diff:
From 1c79231c2442f5fac8e303420b6b5b5966f9ed8a Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 64 +++++++++++++++++++++++++++++
5 files changed, 158 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.cssindex 6c93c8b7..915c4a29 100644--- a/media/css/main.css+++ b/media/css/main.css@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */+#release-notes .navheader,+#release-notes .navfooter,+#release-notes .titlepage,+#release-notes .toc {+ display: none;+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.pyindex 4577f0ce..1da162fd 100644--- a/pgweb/docs/views.py+++ b/pgweb/docs/views.py@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):+ """Contains the main archive of release notes."""+ sql = """+ SELECT+ docs.*,+ r.major_version,+ r.minor_version+ FROM (+ SELECT DISTINCT+ r.major_version,+ r.minor_version,+ first_value(r.id) OVER (+ PARTITION BY (r.major_version, r.minor_version)+ ORDER BY r.tree DESC+ ) AS id+ FROM (+ SELECT+ r.id,+ r.tree,+ CASE array_length(versions, 1)+ WHEN 1 THEN versions[1]+ WHEN 2 THEN (+ CASE+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6+ THEN versions[1]+ ELSE (versions[1] || '.' || versions[2])+ END+ )+ ELSE (versions[1] || '.' || versions[2])+ END::numeric AS major_version,+ CASE array_length(versions, 1)+ WHEN 1 THEN '0'+ WHEN 2 THEN (+ CASE+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6+ THEN versions[2]+ ELSE '0'+ END+ )+ ELSE versions[3]+ END::int AS minor_version+ FROM (+ SELECT+ d.id,+ v.tree,+ regexp_split_to_array(+ regexp_replace(d.file, 'release-|.html?', '', 'g'),+ '-') AS versions+ FROM docs d+ JOIN core_version v ON+ v.tree = d.version AND+ v.testing = 0+ WHERE file ~ '^release-'+ ) r+ ) r+ ) r+ JOIN docs ON docs.id = r.id+ """+ params = []+ # if the major + minor version are provided, then we want to narrow down+ # the results to the exact release notes+ # otherwise ensure the release notes are returned in order+ if major_version and minor_version:+ sql += """+ WHERE major_version = %s AND minor_version = %s;+ """+ params += [major_version, minor_version]+ else:+ sql += """+ ORDER BY r.major_version DESC, r.minor_version DESC;+ """+ # execute the query to get the full queryset+ queryset = DocPage.objects.raw(sql, params)+ # if major + minor version are provided, we want to render something similar+ # to the docs page+ # otherwise, load the page that lists all of the versions+ if major_version and minor_version:+ docs = [d for d in queryset]+ if not docs:+ raise Http404()+ context = { 'd': docs[0] }+ else:+ context = { 'versions': [d for d in queryset], }+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.pyindex d40673fc..9382975a 100644--- a/pgweb/urls.py+++ b/pgweb/urls.py@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.pyindex 43f6c3e2..8f0b047b 100644--- a/pgweb/util/contexts.py+++ b/pgweb/util/contexts.py@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.htmlnew file mode 100644index 00000000..fdf32fef--- /dev/null+++ b/templates/docs/release_notes.html@@ -0,0 +1,64 @@+{% extends "base/page.html" %}++{% block extrahead %}+{% if d %}+ <base href="/docs/{{ d.major_version }}/" />+{% endif %}+{% endblock extrahead %}++{%block title%}Release Notes{%endblock%}++{% block contents %}+{% regroup versions by major_version as version_groups %}++<div id="release-notes" class="row">+ {% if d %}+ <div class="col-md-10">+ <section>+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>+ <h2>+ {% if d.major_version == 0 %}Postgres95{% else %}PostgreSQL{% endif %}+ {{ d.major_version }}.{% if d.major_version == 0 or d.major_version == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}+ </h2>+ </section>+ <div id="docContent">+ {{ d.content|safe }}+ </div>+ </div>+ {% else %}+ <div class="col-md-9">+ <section>+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>+ </section>+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>+ {% for version_group in version_groups %}+ <h2 id="release-{{ version_group.grouper }}">{% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}</h2>+ <ul>+ {% for d in version_group.list %}+ <li>+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">+ {{ version_group.grouper }}.{% if version_group.grouper == 0 or version_group.grouper == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}+ </a>+ </li>+ {% endfor %}+ </ul>+ {% endfor %}+ </div>+ <div class="col-md-3">+ <section>+ <h2>Jump to...</h2>+ </section>+ <ul>+ {% for version_group in version_groups %}+ <li>+ <a href="#release-{{ version_group.grouper }}">+ {% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}+ </a>+ </li>+ {% endfor %}+ </ul>+ </div>+ {% endif %}+</div>++{% endblock %}--
2.14.3 (Apple Git-98)
[image/png] Screen Shot 2019-02-13 at 8.44.07 AM.png (405.7K, ../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/3-Screen%20Shot%202019-02-13%20at%208.44.07%20AM.png)
download | view image
[image/png] Screen Shot 2019-02-13 at 8.44.40 AM.png (554.9K, ../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/4-Screen%20Shot%202019-02-13%20at%208.44.40%20AM.png)
download | view image
[application/pgp-signature] signature.asc (832B, ../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/5-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-www@postgresql.org
Cc: jkatz@postgresql.org, pgsql-www@lists.postgresql.org
Subject: Re: Release Notes Archive Patch
In-Reply-To: <751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox