Skip to content

Commit

Permalink
Merge branch 'feature/summer2024' of https://github.com/ofloveandhate…
Browse files Browse the repository at this point in the history
…/markdown2canvas into feature/summer2024
  • Loading branch information
ofloveandhate committed Jul 24, 2024
2 parents 6ecda24 + ee6301f commit 32c6673
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Notes
:caption: Some useful notes on aspects of using the library

on_meta_dot_json
markdown_1
making_links_to_existing_content
wishlist
unit_tests
Expand Down
5 changes: 5 additions & 0 deletions docs/markdown_1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Making sure markdown renders when there is a <div>
===================================================

Any time you have a "<div>" (in a header, footer, body, etc.) make sure that the option markdown="1" is included.
Otherwise, markdown will not render properly on Canvas.
6 changes: 5 additions & 1 deletion docs/tutorials/styling_content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ I hope they're self-documenting in purpose and content. Here's what's in the `h
<script href="https://media.uwex.edu/app/droplets_v3/script/droplets.js" type="test/javascript"></script>


<div id="uws-droplets-page">
<div id="uws-droplets-page" markdown="1">

<!-- Droplets elements and components -->


Note the markdown="1" included in the <div> above. Any time you include a <div>, make sure that this appears.
Otherwise, markdown will not render.

The footer simply closes the `div` I opened in the header:

.. code-block:: html
Expand Down
9 changes: 5 additions & 4 deletions docs/tutorials/uploading_files.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
How to upload a file
--------------------------------------------------------------------------


When uploading a file `FILE.XXX`, a `meta.json` file should be created in a folder named `FILE.file`,
specifying where the file is sent on Canvas.

The `meta.json` file
====================

Filenames and titles of files are distinct on canvas:
Filenames and titles of files are distinct on Canvas:
the latter is what you will see when the file is placed in a module, while the former is what is shown in the file structure.

You can place a file in as many modules as you wish by specifying the modules in the `meta.json` file.
Expand All @@ -16,7 +17,7 @@ If no module with the specified name exists, a module will be created to house t
The `destination` key specifies where in the file structure you would like the file to be placed.

Note that while a file cannot be simultaneously placed in multiple file structure locations using `meta.json`, if `meta.json` is updated,
the file will not automatically be deleted from any previous location unless that instance is specifically deleted.
the file will **not** automatically be deleted from any previous location unless that instance is specifically deleted.


Example
Expand All @@ -34,7 +35,7 @@ If the `meta.json` file looks like:
"destination": "course_info/syllabus_schedule"
}
then the file `F24_Math100_syllabus.pdf` will be put into two modules: `Course Information` and `Week 1`.
then the file in question will be named `F24_Math100_syllabus.pdf` and put into two modules: `Course Information` and `Week 1`.
Within these two modules, its title will appear to students as `Syllabus`. The file will be located in `course_info/syllabus_schedule`,
which will be created if it did not already exist.

Expand Down
8 changes: 4 additions & 4 deletions test/test_droplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ def test_doesnt_find_deleted(self, course, page):
name = page.name

page.publish(course,overwrite=True)
assert mc.is_page_already_uploaded(name,course)
f = mc.find_page_in_course(name,course)
assert mc.course_interaction_functions.is_page_already_uploaded(name,course)
f = mc.course_interaction_functions.find_page_in_course(name,course)
f.delete()
# print([i.name for i in course.get_pages()])
assert not mc.is_page_already_uploaded(name,course)
assert not mc.course_interaction_functions.is_page_already_uploaded(name,course)



def test_can_find_published(self, course, page):
page.publish(course,overwrite=True)
assert mc.is_page_already_uploaded(page.name,course)
assert mc.course_interaction_functions.is_page_already_uploaded(page.name,course)



Expand Down
1 change: 0 additions & 1 deletion test/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_already_online_raises(self, course, content):
def test_attributes(self, course, content, current_file):
content.publish(course,overwrite=True)
assert current_file.filename == 'ds150_course_logo.pdf'
assert current_file.modified_at_date.day == datetime.date.today().day



Expand Down
6 changes: 4 additions & 2 deletions test/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ def test_can_find_published_image(self, course, image):
def test_doesnt_find_deleted_image(self, course, image):
image.publish(course,'images',overwrite=True)
assert mc.course_interaction_functions.is_file_already_uploaded(file_to_publish,course)
f = mc.find_file_in_course(file_to_publish,course)

f = mc.course_interaction_functions.find_file_in_course(file_to_publish,course)
f.delete()

assert not mc.course_interaction_functions.is_file_already_uploaded(file_to_publish,course)

def test_can_get_already_published_image(self, course, image):
# first, definitely publish
image.publish(course,'images',overwrite=True)

img_on_canvas = mc.find_file_in_course(file_to_publish,course)
img_on_canvas = mc.course_interaction_functions.find_file_in_course(file_to_publish,course)

assert img_on_canvas.filename == filename

Expand Down
8 changes: 4 additions & 4 deletions test/test_link_to_local_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ def test_doesnt_find_deleted(self, course, page):
name = page.name

page.publish(course,overwrite=True)
assert mc.is_page_already_uploaded(name,course)
f = mc.find_page_in_course(name,course)
assert mc.course_interaction_functions.is_page_already_uploaded(name,course)
f = mc.course_interaction_functions.find_page_in_course(name,course)
f.delete()
# print([i.name for i in course.get_pages()])
assert not mc.is_page_already_uploaded(name,course)
assert not mc.course_interaction_functions.is_page_already_uploaded(name,course)



def test_can_find_published(self, course, page):
page.publish(course,overwrite=True)
assert mc.is_page_already_uploaded(page.name,course)
assert mc.course_interaction_functions.is_page_already_uploaded(page.name,course)



16 changes: 8 additions & 8 deletions test/test_page_in_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def destination_modules(page_plain_text_in_a_module):

def _delete_test_modules(course, destination_modules):
for m in destination_modules:
mc.delete_module(m, course, even_if_doesnt_exist=True)
mc.course_interaction_functions.delete_module(m, course, even_if_doesnt_exist=True)



Expand All @@ -58,23 +58,23 @@ def test_already_online_raises(self, course, page_plain_text_in_a_module):

def test_can_make_modules(self, course, destination_modules):
for m in destination_modules:
mc.create_or_get_module(m,course)
mc.course_interaction_functions.create_or_get_module(m,course)


def test_can_delete_modules(self, course, destination_modules):
_delete_test_modules(course, destination_modules)
for m in destination_modules:
mc.create_or_get_module(m,course)
mc.course_interaction_functions.create_or_get_module(m,course)

for m in destination_modules:
mc.delete_module(m, course, even_if_doesnt_exist=False)
mc.course_interaction_functions.delete_module(m, course, even_if_doesnt_exist=False)



def test_page_in_module_after_publishing(self, course, page_plain_text_in_a_module, destination_modules):

page_plain_text_in_a_module.publish(course,overwrite=True)
assert mc.is_page_already_uploaded(page_plain_text_in_a_module.name,course)
assert mc.course_interaction_functions.is_page_already_uploaded(page_plain_text_in_a_module.name,course)


page_plain_text_in_a_module.ensure_in_modules(course)
Expand All @@ -89,15 +89,15 @@ def test_page_in_module_after_publishing(self, course, page_plain_text_in_a_modu
# name = self.page.name

# self.page.publish(self.course,overwrite=True)
# self.assertTrue(mc.is_page_already_uploaded(name,self.course))
# self.assertTrue(mc.course_interaction_functions.is_page_already_uploaded(name,self.course))
# f = mc.find_page_in_course(name,self.course)
# f.delete()
# # print([i.name for i in self.course.get_pages()])
# self.assertTrue(not mc.is_page_already_uploaded(name,self.course))
# self.assertTrue(not mc.course_interaction_functions.is_page_already_uploaded(name,self.course))



# def test_zzz_can_find_published(self):
# self.page.publish(self.course,overwrite=True)
# self.assertTrue(mc.is_page_already_uploaded(self.page.name,self.course))
# self.assertTrue(mc.course_interaction_functions.is_page_already_uploaded(self.page.name,self.course))

0 comments on commit 32c6673

Please sign in to comment.