Skip to content

Commit

Permalink
Add PDF handbook links
Browse files Browse the repository at this point in the history
Fixes #73
  • Loading branch information
cyderize committed Apr 12, 2024
1 parent 8020d3b commit 48f60b3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/components/resources/Courses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const resources = [

export function Courses() {
return (
<section id="courses" aria-labelledby="courses-title" className="my-6">
<section
id="courses"
aria-labelledby="courses-title"
className="mb-12 mt-6"
>
<Container>
<h2
id="courses-title"
Expand Down
27 changes: 26 additions & 1 deletion src/components/resources/Handbook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const resources = [

export function Handbook() {
return (
<section id="handbook" aria-labelledby="handbook-title" className="my-6">
<section
id="handbook"
aria-labelledby="handbook-title"
className="mb-12 mt-6"
>
<Container>
<h2
id="handbook-title"
Expand All @@ -48,8 +52,29 @@ export function Handbook() {
<p className="my-6">
The <Link href={documentation()}>MiniZinc Handbook</Link> contains all
the documentation for the MiniZinc language and system.
<br />
Also available as a{' '}
<Link href={documentation('MiniZinc Handbook.pdf')}>
printable PDF
</Link>
.
</p>
<Resources resources={resources} />
<p className="mt-4">
The tutorial is also available in{' '}
<Link href={documentation('index.html', 'latest', 'chi')}>
Chinese
</Link>
! MiniZinc手册
<Link href={documentation('index.html', 'latest', 'chi')}>
中文版
</Link>
已经提供 (
<Link href={documentation('MiniZinc Handbook.pdf', 'latest', 'chi')}>
PDF version
</Link>
)
</p>
</Container>
</section>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/resources/Other.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const resources = [

export function Others() {
return (
<section id="others" aria-labelledby="others-title" className="my-6">
<section id="others" aria-labelledby="others-title" className="mb-12 mt-6">
<Container>
<h2
id="others-title"
Expand Down
2 changes: 1 addition & 1 deletion src/components/resources/Publications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function Publications() {
<section
id="publications"
aria-labelledby="publications-title"
className="my-6"
className="mb-12 mt-6"
>
<Container>
<h2
Expand Down
2 changes: 1 addition & 1 deletion src/components/resources/Resources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function Resources({ resources }) {
return (
<ul
role="list"
className="mx-auto mb-12 grid max-w-2xl grid-cols-1 gap-6 sm:grid-cols-2 md:gap-y-10 lg:max-w-none lg:grid-cols-3"
className="mx-auto grid max-w-2xl grid-cols-1 gap-6 sm:grid-cols-2 md:gap-y-10 lg:max-w-none lg:grid-cols-3"
>
{resources.map((resource) => (
<li
Expand Down
5 changes: 3 additions & 2 deletions src/utils/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ export function changelog(version) {
return `https://www.minizinc.org/doc-${latest.version}/en/changelog.html#v-${versionDash}`
}

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

export function bundles(version) {
Expand Down

0 comments on commit 48f60b3

Please sign in to comment.