Skip to content

Commit

Permalink
Merge branch 'release/v2.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayley van Waas committed Jan 27, 2017
2 parents eb41469 + 737445c commit 320050a
Show file tree
Hide file tree
Showing 73 changed files with 9,648 additions and 172 deletions.
Empty file modified files/Adding-Sine-Waves.xls
100755 → 100644
Empty file.
21 changes: 11 additions & 10 deletions generateguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def parse_structure(self):
root_folder = FolderNode('Home', guide=self)
for content_data in self.guide_settings['structure']:
content_type = list(content_data.keys())[0]
content_settings = list(content_data.values())[0]
for title_path in content_settings['source_files']:
type_settings = list(content_data.values())[0]
for file_data in type_settings['source_files']:
# Reset current folder to root
current_folder = root_folder
folder_path, file_name = os.path.split(title_path)
folder_path, file_name = os.path.split(file_data['file'])
folder_path = folder_path.split('/')
# Navigate to correct folder
while folder_path:
Expand All @@ -105,7 +105,7 @@ def parse_structure(self):
text_root = self.generator_settings['Source']['Text Root'].format(language=self.language_code)
file_path = os.path.join(text_root, current_folder.path, file_name)
if file_exists(file_path):
current_folder.add_file(file_name, content_type, content_settings)
current_folder.add_file(file_name, content_type, file_data, type_settings)
return root_folder


Expand Down Expand Up @@ -437,11 +437,11 @@ def add_folder(self, folder_name):
self.folders.append(folder_node)
self.folders_dict[folder_name] = len(self.folders) - 1

def add_file(self, file_name, group_type, file_settings):
def add_file(self, file_name, content_type, file_settings, type_settings):
"""Add file to files list. Updates dictionary
of index references
"""
file_node = FileNode(file_name, file_settings, group_type, parent=self)
file_node = FileNode(file_name, file_settings, type_settings, content_type, parent=self)
self.files.append(file_node)
self.files_dict[file_name] = len(self.files) - 1

Expand Down Expand Up @@ -470,14 +470,15 @@ def __str__(self):

class FileNode:
"""Node object for storing file details in structure tree"""
def __init__(self, filename, settings, group_type, parent):
def __init__(self, filename, file_settings, type_settings, content_type, parent):
self.filename = filename
self.filename_without_extension = self.filename.rsplit('.', 1)[0]
self.group_type = group_type
self.content_type = content_type
self.parent = parent
self.section = None
self.settings = settings
self.tracked = settings['listed']
self.file_settings = file_settings
self.type_settings = type_settings
self.tracked = type_settings['listed']
self.depth = (parent.depth + 1)
self.path = os.path.join(self.parent.path, self.filename_without_extension)
self.guide = self.parent.guide
Expand Down
2 changes: 1 addition & 1 deletion generator/generator-settings.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[General]
Version Number: v2.8.1
Version Number: v2.9.0
Google Analytics Code: UA-49289263-2
Domain: http://www.csfieldguide.org.nz/

Expand Down
16 changes: 13 additions & 3 deletions generator/html-templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ title='{title_text}'
{mathjax-screen-config}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
CommonHTML: { linebreaks: { automatic: true } },
"HTML-CSS": { linebreaks: { automatic: true } },
SVG: { linebreaks: { automatic: true } }
});
</script>
{mathjax-screen-config end}
Expand Down Expand Up @@ -367,15 +369,14 @@ MathJax.Hub.Config({
{{ page_heading }}
<div class='container'>
<div class='row'>
<div class='col s12{%- if file.settings.table_of_contents_sidebar %} l9{%- endif %} main-content'>
<div class='col s12{%- if file.type_settings.table_of_contents_sidebar %} l9{%- endif %} main-content'>
{{ body_html }}
</div>
{%- if file.settings.table_of_contents_sidebar %}
{%- if file.type_settings.table_of_contents_sidebar %}
<div id='page-navigation' class='hide-on-med-and-down hide_for_print'>
{{ prerelease_notice }}
{{ version_link_html }}
<h6>{{ translations.table_of_contents }}</h6>
<div class='divider'></div>
<ul class='table-of-contents'>
{%- for heading in heading_root.children %}
<li><a href='#section-{{ heading.permalink }}'>{{ heading.heading }}</a>
Expand All @@ -389,6 +390,15 @@ MathJax.Hub.Config({
</li>
{%- endfor %}
</ul>
{%- if file.file_settings['authors'] %}
<div class='divider'></div>
<h6>{{ translations.authors }}</h6>
<ul class='author-list'>
{%- for author in file.file_settings['authors'] %}
<li>{{ author }}</li>
{%- endfor %}
</ul>
{% endif %}
</div>
{% endif %}
</div>
Expand Down
6 changes: 3 additions & 3 deletions generator/markdownsection.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def edit_interactive_tree(self, root, source_folder):
- Implement better system for checking whether link is relative
and needs to be adjusted
"""
link_attributes = ['href', 'src']
link_attributes = ['href', 'src', 'data']
for element in root.find_all():
for attr in link_attributes:
raw_link = element.get(attr, None)
Expand Down Expand Up @@ -975,7 +975,7 @@ def __str__(self):
return '{}{}'.format('--' * (self.level - 1), self.heading)

def to_html(self):
if self.section.file_node.group_type == "chapters":
if self.section.file_node.content_type == "chapters":
html_type = 'heading-numbered'
else:
html_type = 'heading-unnumbered'
Expand All @@ -984,7 +984,7 @@ def to_html(self):

if self.guide.output_type == WEB:
# Create section starts for Materialize ScrollSpy
if self.level == 2 and self.section.file_node.settings['table_of_contents_sidebar']:
if self.level == 2 and self.section.file_node.type_settings['table_of_contents_sidebar']:
# Close previous section if needed
if self.section.sectioned:
html = self.section.html_templates['section-end']
Expand Down
3 changes: 2 additions & 1 deletion generator/scss/print.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
display: block;
a img {
display: block;
max-width: 10rem;
max-height: 5rem;
width: auto;
}
}
}
Expand Down
44 changes: 28 additions & 16 deletions generator/scss/website.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,36 @@ ul.side-nav.fixed li a {
padding: 0 1rem;
}
#page-navigation {
padding: 1rem 1rem 0 0;
width: 24%;
float: right;
h6 {
margin-top: 15px;
}
ul.table-of-contents {
li, ul, a {
display: block !important;
}
a {
height: initial !important;
padding-left: 10px;
&:hover {
padding-left: 9px;
}
&.active {
padding-left: 8px;
}
}
ul.table-of-contents-subtitle {
padding-left: 10px;
font-size: 0.9em;
}
a:not(.active) + ul.table-of-contents-subtitle {
display: none !important;
}
}
.author-list {
font-weight: 300;
}
}
.btn-expand {
width: 100% !important;
Expand Down Expand Up @@ -333,21 +360,6 @@ ul.panel {
.text-box-indented {
margin-left: 40px !important;
}
.table-of-contents {
li, ul, a {
display: block !important;
}
a {
height: initial !important;
}
&-subtitle {
padding-left: 0.8rem;
font-size: 90%;
a:not(.active) + & {
display: none !important;
}
}
}
.btn {
text-transform: none !important;
margin-bottom: 1rem !important;
Expand Down
13 changes: 13 additions & 0 deletions interactives/2d-arrow-manipulations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# 2D Arrow Manipulations

**Author:** Hayley van Waas

This is the base system for a series of interactive used to show how to translate, scale and rotate an arrow by using coordinates and/or matrices.

## Required files

- No required files

## Licenses
Code was modified from the [css3patterns](https://github.com/LeaVerou/css3patterns/blob/master/license.txt) library to create the graph background, the licence file can be found in css/css3patterns-license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "coordinates",
"title": "Combining Scaling and Translation Challenge",
"task": "Try to get the blue arrow to match up with the red one.<br>Hint: you may like to use expressions like 2*(2+1) or fractions like 1/5",
"target": "5 12 -1 6 3 6 3 -4 7 -4 7 6 11 6"
}
6 changes: 6 additions & 0 deletions interactives/2d-arrow-manipulations/config/coord-scale.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "coordinates",
"title": "Scaling",
"task": "Try multiplying the original coordinates by 2. What is the effect of this transform?<br>What would happen if you multiply each value by 10? How about 0.5? What if you only multiply the x values?",
"target": "0 8 -6 2 -2 2 -2 -8 2 -8 2 2 6 2"
}
6 changes: 6 additions & 0 deletions interactives/2d-arrow-manipulations/config/coord-swap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "coordinates",
"title": "Swapping Coordinates",
"task": "What happens if you swap the x and y value for each coordinate?",
"target": "4 0 1 -3 1 -1 -4 -1 -4 1 1 1 1 3"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "coordinates",
"title": "Changing Point Locations",
"task": "Try adding 2 to all the x points, and 3 to all the y points. What effect does this have on the original arrow? <br>What happens if you subtract 3 from each of the original coordinates?",
"target": "2 7 -1 4 1 4 1 -1 3 -1 3 4 5 4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Multiple Transformation Challenge",
"task": "Try moving the arrow to the target position by using the two multiplication matrices (one to scale and one to rotate) then translating.",
"target": "-9.68 -1.32 -9.68 -9.84 -6.84 -7 0.26 -14.1 3.1 -11.26 -4 -4.16 -1.16 -1.32",
"modules": ["first-scale", "second-scale", "first-translate"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Combining Translation, Scaling and Rotation",
"task": "Try moving the arrow to the target position by using the two multiplication matrices (one to scale and one to rotate) then translating.",
"target": "12 4 9 10 9 6 4 6 4 2 9 2 9 -2",
"modules": ["first-scale", "second-scale", "first-translate"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "matrix",
"title": "Using Translation to Simplify Rotation",
"task": "To move the arrow to the new position, you'll have to translate the tip to the origin, apply the rotation, then translate it back.",
"start": "5 12 2 9 4 9 4 4 6 4 6 9 8 9",
"target": "5 12 5 7.74 6.42 9.16 9.97 5.61 11.39 7.03 7.84 10.58 9.26 12",
"modules": ["first-translate", "first-scale", "second-translate"]
}
7 changes: 7 additions & 0 deletions interactives/2d-arrow-manipulations/config/matrix-rotate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Matrix Rotation",
"task": "Rotate and translate the arrow to the new position. You can use the Trig Function Calculator interactive to calculate exact angles, the target arrow has accuracy of 2 decimal places",
"target": "7.84 6.84 3.58 6.84 5 5.42 1.45 1.87 2.87 0.45 6.42 4 7.84 2.58",
"modules": ["first-scale", "first-translate"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Translation before Scaling",
"task": "This time, the order of translation and scaling has been swapped. Try to transform the arrow to the target position. The order in which operations happens makes a difference!",
"target": "9 2 3 -4 7 -4 7 -14 11 -14 11 -4 15 -4",
"modules": ["first-translate", "first-scale"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "matrix",
"title": "Using Translation to Simplify Scaling",
"task": "This time the tip of the arrow is at (12, 12), so you should translate it to the origin, scale it, then transform it back.",
"start": "12 12 15 9 13 9 13 4 11 4 11 9 9 9",
"target": "12 12 18 6 14 6 14 -4 10 -4 10 6 6 6",
"modules": ["first-translate", "first-scale", "second-translate"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Scaling and Translation Challenge",
"task": "Use both scaling and translation to move the arrow to the target position.",
"target": "9 2 3 -4 7 -4 7 -14 11 -14 11 -4 15 -4",
"modules": ["first-scale", "first-translate"]
}
7 changes: 7 additions & 0 deletions interactives/2d-arrow-manipulations/config/matrix-scale.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "2D Scaling",
"task": "Try replacing the 1s with 2s in the multiplication matrix",
"target": "0 8 -6 2 -2 2 -2 -8 2 -8 2 2 6 2",
"modules": ["first-scale"]
}
7 changes: 7 additions & 0 deletions interactives/2d-arrow-manipulations/config/matrix-single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Single Matrix",
"task": "Try putting in the final matrix here and see if it does scale by 2 and rotate by 45 degrees.",
"target": "5.6 5.6 -2.8 5.6 0 2.8 -7 -4.2 -4.2 -7 2.8 0 5.6 -2.8",
"modules": ["first-scale"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "matrix",
"title": "Translation",
"task": "Use the translation matrix to move the arrow to it's target position.",
"target": "9 -3 6 -6 8 -6 8 -11 10 -11 10 -6 12 -6",
"modules": ["first-translate"]
}
20 changes: 20 additions & 0 deletions interactives/2d-arrow-manipulations/css/css3patterns-license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2011 Lea Verou, http://lea.verou.me/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 320050a

Please sign in to comment.