Skip to content

Commit

Permalink
Update doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
cyderize committed Jun 6, 2024
1 parent 4cfa711 commit f1e57cd
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 24 deletions.
26 changes: 26 additions & 0 deletions src/app/changes/index.html/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { changelog } from '@/utils/links'

export function GET() {
const url = changelog()
return new Response(
`<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<link rel="canonical" href="${url}">
<script>
const url = "${url}";
location = \`\${url}\${location.search}\${location.hash}\`;
</script>
<meta http-equiv="refresh" content="0; url=${url}">
<meta name="robots" content="noindex">
<h1>Redirecting&hellip;</h1>
<a href="${url}">Click here if you are not redirected.</a>
</html>`,
{
headers: {
'Content-Type': 'text/html',
},
},
)
}
10 changes: 7 additions & 3 deletions src/components/downloads/Downloads.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ export function Downloads() {
<div className="my-4">
<Bundles bundles={bundles} />
</div>
<p className="mb-6 max-w-prose leading-7">
<p className="mb-6 leading-7">
Both the compiler tool chain and the IDE are available as free and
open source software. Have a look at our{' '}
<Link href="/license">License Information</Link> page for the details.
open source software.
<br />
Have a look at our <Link href="/license">
License Information
</Link>{' '}
page for the details.
</p>
</section>
</Container>
Expand Down
13 changes: 8 additions & 5 deletions src/components/downloads/Releases.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Container } from '@/components/Container'
import { latest, releases } from '@/data/version'
import { Link } from '@/components/Link'
import { changelog, githubRelease } from '@/utils/links'
import { changelog, documentation, githubRelease } from '@/utils/links'
import ReleaseInfo from '@/data/release.mdx'

export function Releases() {
Expand All @@ -27,10 +27,13 @@ export function Releases() {
</h3>
<p className="mt-2 leading-7">
Unstable development builds with upcoming bugfixes and features are{' '}
<Link href="https://github.com/MiniZinc/MiniZincIDE/releases/tag/edge">
available on GitHub
</Link>
.
<Link href={githubRelease('edge')}>available on GitHub</Link>.
</p>
<p className="mt-2 leading-7">
Documentation for the latest development version of MiniZinc is
available <Link href={documentation('', 'latest')}>here</Link>.<br />
For a list of bugfixes/changes please refer to the{' '}
<Link href={changelog('edge')}>changelog</Link>.
</p>
<h3 className="mt-6 text-2xl font-medium tracking-tight text-gray-900">
Previous releases
Expand Down
16 changes: 5 additions & 11 deletions src/components/resources/Handbook.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container } from '@/components/Container'
import { Link } from '@/components/Link'
import { documentation } from '@/utils/links'
import { documentation, pdfDocumentation } from '@/utils/links'
import {
faBookBookmark,
faBookOpen,
Expand Down Expand Up @@ -54,26 +54,20 @@ export function Handbook() {
the documentation for the MiniZinc language and system.
<br />
Also available as a{' '}
<Link href={documentation('MiniZinc Handbook.pdf')}>
printable PDF
</Link>
.
<Link href={pdfDocumentation()}>printable PDF</Link>.
</p>
<Resources resources={resources} />
<p className="mt-4">
The tutorial is also available in{' '}
<Link href={documentation('index.html', 'latest', 'chi')}>
<Link href={documentation('index.html', 'stable', 'zh-cn')}>
Chinese
</Link>
! MiniZinc手册
<Link href={documentation('index.html', 'latest', 'chi')}>
<Link href={documentation('index.html', 'stable', 'zh-cn')}>
中文版
</Link>
已经提供 (
<Link href={documentation('MiniZinc Handbook.pdf', 'latest', 'chi')}>
PDF version
</Link>
)
<Link href={pdfDocumentation('stable', 'zh-cn')}>PDF version</Link>)
</p>
</Container>
</section>
Expand Down
19 changes: 14 additions & 5 deletions src/utils/links.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { latest } from '@/data/version'

export function changelog(version) {
const versionDash = (version || latest.version).replace(/\./g, '-')
return `https://www.minizinc.org/doc-${latest.version}/en/changelog.html#v${versionDash}`
if (version === 'edge') {
return `https://docs.minizinc.dev/en/latest/changelog.html#unreleased`
}
if (version) {
const versionDash = (version || latest.version).replace(/\./g, '-')
return `https://docs.minizinc.dev/en/stable/changelog.html#v${versionDash}`
}
return `https://docs.minizinc.dev/en/stable/changelog.html`
}

export function documentation(page = '', version = 'latest', lang = 'en') {
export function documentation(page = '', version = 'stable', lang = 'en') {
const suffix = page ? page.replace(/^\/+/, '') : ''
const ver = version === 'latest' ? latest.version : version
return `https://www.minizinc.org/doc-${ver}/${lang}/${suffix}`
return `https://docs.minizinc.dev/${lang}/${version}/${suffix}`
}

export function pdfDocumentation(version = 'stable', lang = 'en') {
return `https://docs.minizinc.dev/_/downloads/${lang}/${version}/pdf/`
}

export function bundles(version) {
Expand Down

0 comments on commit f1e57cd

Please sign in to comment.