Skip to content

Commit ba198d0

Browse files
authored
Merge pull request #83 from LKedward/tutorial-navigation
Add navigation structure for learn section
2 parents 9723ebf + d108c20 commit ba198d0

File tree

15 files changed

+1237
-608
lines changed

15 files changed

+1237
-608
lines changed

_data/learning.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Categories group mini-books on the 'Learn' landing page
2+
#
3+
# 'fa-icon' refers to the font-awesome icon to display
4+
# next to the category on the landing page
5+
#
6+
categories:
7+
- name: Getting started
8+
fa-icon: fas fa-cubes
9+
# - name: Advanced programming methods
10+
# fa-icon: fas fa-laptop-code
11+
12+
13+
14+
# Mini-books are single-page or multi-page tutorials
15+
#
16+
# 'link' refers to the 'permalink' field of the corresponding page
17+
#
18+
books:
19+
- title: Quickstart Fortran Tutorial
20+
description: An introduction to the Fortran syntax and its capabilities
21+
category: Getting started
22+
link: /learn/quickstart
23+
pages:
24+
- link: /learn/quickstart/hello_world
25+
- link: /learn/quickstart/variables
26+
- link: /learn/quickstart/arrays_strings
27+
- link: /learn/quickstart/operators_control_flow
28+
- link: /learn/quickstart/organising_code
29+
30+
31+
32+
# Web links listed at the bottom of the 'Learn' landing page
33+
#
34+
reference-links:
35+
- name: Fortran wiki
36+
url: http://fortranwiki.org/
37+
description: A rich collection of Fortran articles and resources in an editable wiki format
38+
39+
- name: "Fortran 2018 Standard Interpretation Document"
40+
url: https://j3-fortran.org/doc/year/18/18-007r1.pdf
41+
description: "J3/18-007r1 F2018, specification of the base Fortran 2018 language"
42+
43+
- name: "J3 Fortran Proposals"
44+
url: https://github.com/j3-fortran/fortran_proposals
45+
description: a repository for community collaboration on proposals for the Fortran Standards Committee
46+
47+
- name: "J3: US Fortran Standards Committee"
48+
url: https://j3-fortran.org/
49+
description: J3 is the US National Body for the international Fortran standards committee
50+
51+
- name: "WG5: International Fortran Standards Committe"
52+
url: https://wg5-fortran.org/
53+
description:
54+
55+
- name: "Scivision Fortran 2018 Examples"
56+
url: https://github.com/scivision/fortran2018-examples
57+
description: A github repository containing code samples for various Fortran 2018 features
58+
59+
60+
61+
62+
# Print books listed at the bottom of the 'Learn' landing page
63+
#
64+
reference-books:
65+
- author: Metcalf, M., Reid, J. and Cohen M.
66+
year: 2018
67+
title: Modern Fortran Explained
68+
url: https://global.oup.com/academic/product/modern-fortran-explained-9780198811893
69+
edition: 5th ed
70+
location: Oxford, UK
71+
publisher: Oxford Universtiy Press
72+
73+
- author: Curcic, M.
74+
year: 2020
75+
title: "Modern Fortran: Building Efficient Parallel Applications"
76+
url: https://www.manning.com/books/modern-fortran
77+
edition: 1st ed
78+
location: Shelter Island, NY
79+
publisher: Manning Publications
80+
81+
- author: Markus, A.
82+
year: 2012
83+
title: "Modern Fortran in Practice"
84+
url: https://www.cambridge.org/core/books/modern-fortran-in-practice/BC5BD23B2E478B4D457C5D6265BA9363
85+
edition: 1st ed
86+
location: Cambridge, UK
87+
publisher: Cambridge University Press
88+
89+
- author: Chivers, I. and Sleightholme, J.
90+
year: 2018
91+
title: Introduction to Programming with Fortran
92+
url: https://doi.org/10.1007/978-3-319-75502-1
93+
edition: 4th ed
94+
publisher: Springer International Publishing
95+
96+
- author: Chapman S. J.
97+
year: 2018
98+
title: Fortran for Scientists and Engineers
99+
url: https://www.mheducation.com/highered/product/fortran-scientists-engineers-chapman/M9780073385891.html
100+
edition: 4th ed
101+
location: New York
102+
publisher: McGraw-Hill Education

_includes/book_navbar.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<div class="col-fixed" id="pagenav-sidebar">
2+
3+
<!-- Find parent book using page.permalink -->
4+
<!-- NB. This search is inefficient but simplifies
5+
the definition of book pages in learning.yml -->
6+
{% for book_i in site.data.learning.books %}
7+
{% if book_i.link == page.permalink %}
8+
{% assign book = book_i %}
9+
{% break %}
10+
{% endif %}
11+
{% if book_i.pages %}
12+
{% for bookPage in book_i.pages %}
13+
{% if bookPage.link == page.permalink %}
14+
{% assign book = book_i %}
15+
{% break %}
16+
{% endif %}
17+
{% endfor %}
18+
{% else %}
19+
{% if book_i.link == page.permalink %}
20+
{% assign book = book_i %}
21+
{% break %}
22+
{% endif %}
23+
{% endif %}
24+
{% endfor %}
25+
26+
<a href="{{site.baseurl}}/learn#book-index">
27+
<i class="fas fa-arrow-circle-left"></i>
28+
Back to Learn Fortran index
29+
</a>
30+
31+
<h3>
32+
<i class="fas fa-book"></i>
33+
{{ book.title }}</h3>
34+
35+
<div class="content">
36+
{% if book.pages %} <!-- If this book has multiple pages -->
37+
38+
{% assign nPage = book.pages | size %}
39+
40+
<ul>
41+
42+
<!-- Add link to book introduction (index) -->
43+
{% if page.permalink == book.link %}
44+
<li><b><a href="{{site.baseurl}}{{ book.link }}">
45+
Introduction</a></b></li>
46+
<ul id="page-nav"></ul>
47+
{% assign nextPage = 0 %}
48+
{% else %}
49+
<li><a href="{{site.baseurl}}{{ book.link }}">
50+
Introduction</a></li>
51+
{% endif %}
52+
53+
<!-- List pages in this book -->
54+
{% for page_link in book.pages %}
55+
56+
<!-- Get page title from page metadata -->
57+
{% for sitePage in site.pages %}
58+
{% if sitePage.permalink == page_link.link %}
59+
{% assign bookPage = sitePage %}
60+
{% break %}
61+
{% endif %}
62+
{% endfor %}
63+
64+
{% if bookPage.permalink == page.permalink %}
65+
<li>
66+
<b><a href="{{site.baseurl}}{{ bookPage.url }}">
67+
{{ bookPage.title }}</a></b>
68+
<ul id="page-nav"></ul>
69+
</li>
70+
{% assign prevPage = forloop.index | minus: 2 %}
71+
{% assign nextPage = forloop.index %}
72+
73+
{% else %}
74+
<li><a href="{{site.baseurl}}{{ bookPage.url }}">
75+
{{ bookPage.title }}</a></li>
76+
{% endif %}
77+
78+
{% endfor %}
79+
</ul>
80+
81+
{% else %}
82+
83+
<!-- If this book is single-page -->
84+
<ul id="page-nav"></ul>
85+
86+
{% endif %}
87+
</div>
88+
89+
</div>
90+

_layouts/book.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: default
3+
---
4+
5+
{% include nav.html active="Learn" %}
6+
7+
<section class="front-section">
8+
<div class="container">
9+
10+
{% include book_navbar.html %}
11+
12+
<div class="newsletter col-right">
13+
14+
<h1>{{ page.title }}</h1>
15+
16+
<div style="margin-top: 0.5em; margin-bottom: 0.5em;">
17+
<i>{{ page.date | date: "%B %d, %Y" }}</i>
18+
{% if page.author != null %}
19+
<p><i>Authors:</i> {{ page.author }}</p>
20+
{% endif %}
21+
</div>
22+
23+
{{ content }}
24+
25+
<div class="container-flex">
26+
27+
{% if prevPage %}
28+
{% if prevPage < 0 %}
29+
<a href="{{ site.baseurl }}{{ book.link }}" style="margin-right: auto;">
30+
{% else %}
31+
<a href="{{ site.baseurl }}{{ book.pages[prevPage].link }}" style="margin-right: auto;">
32+
{% endif %}
33+
<h3><i class="fas fa-arrow-circle-left"></i>
34+
Back
35+
</h3>
36+
</a>
37+
{% endif %}
38+
39+
{% if nextPage %}
40+
{% if nextPage < nPage %}
41+
<a href="{{ site.baseurl }}{{ book.pages[nextPage].link }}"
42+
style="margin-left: auto;">
43+
<h3>
44+
Next
45+
<i class="fas fa-arrow-circle-right"></i>
46+
</h3>
47+
</a>
48+
{% endif %}
49+
{% endif %}
50+
51+
</div>
52+
53+
</div>
54+
55+
</div>
56+
</section>

_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
3030
{% include google_analytics.html %}
3131
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
32+
<script src="{{ site.baseurl }}/assets/js/page_nav.js"></script>
3233
<script>
3334
feather.replace()
3435
</script>

assets/css/main.css

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,42 @@ a {
2525
font-weight: bold;
2626
}
2727

28+
.button {
29+
background-color: #734f96;
30+
border: none;
31+
color: white;
32+
padding: 10px 32px;
33+
text-align: center;
34+
text-decoration: none;
35+
display: inline-block;
36+
font-size: 20px;
37+
border-radius: 8px;
38+
}
39+
40+
.button.center {
41+
display: block;
42+
margin: 0 auto;
43+
width: fit-content;
44+
}
45+
46+
.button:hover {
47+
background-color: #777;
48+
color: white;
49+
text-decoration: none;
50+
}
51+
52+
.button.blue{
53+
background-color: #008CBA;
54+
}
55+
56+
.button.blue:hover{
57+
background-color: #777;
58+
}
59+
60+
#page-nav {
61+
padding-left: 20px;
62+
}
63+
2864
h1,
2965
h2,
3066
h3 {
@@ -55,11 +91,15 @@ a[target="_blank"]:after {
5591
margin: 0 3px 0 5px;
5692
}
5793

58-
/* " except in the navbar */
94+
/* " except in the navbar and buttons*/
5995
.navbar a[target="_blank"]:after {
6096
content:'';
6197
margin: 0px;
6298
}
99+
.button[target="_blank"]:after {
100+
content:'';
101+
margin: 0px;
102+
}
63103

64104
/* Hide text for social navbar icons
65105
if not on mobile device*/
@@ -106,7 +146,8 @@ pre {
106146
}
107147

108148
.container-flex{
109-
margin: 0 15px;
149+
margin: 0 auto;
150+
width: 90%;
110151
display: flex;
111152
flex-wrap: wrap;
112153
}
@@ -217,6 +258,35 @@ pre {
217258
}
218259
}
219260

261+
.col-right,
262+
.col-fixed {
263+
display: block;
264+
}
265+
266+
@media (min-width: 568px) {
267+
.col-right {
268+
/* display: table-cell; */
269+
width: 61.8%;
270+
vertical-align: top;
271+
margin-left: 380px;
272+
min-height: 500px;
273+
}
274+
.col-fixed {
275+
/* display: table-cell; */
276+
position: fixed;
277+
width: 350px;
278+
height: 500px;
279+
z-index: 1; /* Stay on top */
280+
}
281+
.col-fixed .content{
282+
overflow-y: auto;
283+
overflow-x: hidden;
284+
height: 90%;
285+
width: 100%;
286+
}
287+
}
288+
289+
220290
.front-section {
221291
padding: 8px 0;
222292
}

0 commit comments

Comments
 (0)