Skip to content
Snippets Groups Projects
Commit 00e4f6b1 authored by tuhe's avatar tuhe
Browse files

Updates

parent 7655b644
Branches
No related tags found
No related merge requests found
...@@ -30,9 +30,9 @@ examples/cs101_students # This directory contains the (processed) student fil ...@@ -30,9 +30,9 @@ examples/cs101_students # This directory contains the (processed) student fil
examples/cs101_output # This contains automatically generated contents (snippets, etc.). examples/cs101_output # This contains automatically generated contents (snippets, etc.).
``` ```
The basic functionality is you insert special comment tags in your source, such as `#!b` or `#!s` and the script then process The basic functionality is you insert special comment tags in your source, such as `#!b` or `#!s` and the script then process
the sources based on the tags. The following will show most basic usages: the sources based on the tags. The following will show most common usages:
## The #f!-tag ## The #!f-tag
Let's start with the simplest example, blocking out a function (see `examples/cs101_instructor/f_tag.py`; actually it will work for any scope) Let's start with the simplest example, blocking out a function (see `examples/cs101_instructor/f_tag.py`; actually it will work for any scope)
You insert a comment like: `#!f <exception message>` like so: You insert a comment like: `#!f <exception message>` like so:
```python ```python
...@@ -56,7 +56,7 @@ def myfun(a,b): ...@@ -56,7 +56,7 @@ def myfun(a,b):
return sm return sm
``` ```
## The #b!-tag ## The #!b-tag
The #!b-tag allows you more control over what is cut out. The instructor file: The #!b-tag allows you more control over what is cut out. The instructor file:
```python ```python
def primes_sieve(limit): def primes_sieve(limit):
...@@ -89,7 +89,7 @@ This allows you to cut out text across scopes, but still allows you to insert ex ...@@ -89,7 +89,7 @@ This allows you to cut out text across scopes, but still allows you to insert ex
## The #s!-tag ## The #!s-tag
The #!s-tag is useful for making examples to include in exercises and lecture notes. The #!s (snip) tag cuts out the text between The #!s-tag is useful for making examples to include in exercises and lecture notes. The #!s (snip) tag cuts out the text between
tags and places it in files found in the output-directory. As an example, here is the instructor file: tags and places it in files found in the output-directory. As an example, here is the instructor file:
```python ```python
...@@ -146,7 +146,7 @@ and finally: ...@@ -146,7 +146,7 @@ and finally:
I recommend using `\inputminted{filename}` to insert the cutouts in LaTeX. I recommend using `\inputminted{filename}` to insert the cutouts in LaTeX.
## The #o!-tag ## The #!o-tag
The #!o-tag allows you to capture output from the code, which can be useful when showing students the expected The #!o-tag allows you to capture output from the code, which can be useful when showing students the expected
behavior of their scripts. Like the #!s-tag, the #!o-tags can be named. behavior of their scripts. Like the #!s-tag, the #!o-tags can be named.
...@@ -178,7 +178,7 @@ Area of square of width 2 and height 4 is: ...@@ -178,7 +178,7 @@ Area of square of width 2 and height 4 is:
and that is a fact! and that is a fact!
``` ```
## The #i!-tag ## The #!i-tag
The #!i-tag allows you to create interactive python shell-snippets that can be imported using The #!i-tag allows you to create interactive python shell-snippets that can be imported using
the minted `pycon` environment (`\inputminted{python}{input.shell}`). the minted `pycon` environment (`\inputminted{python}{input.shell}`).
As an example, consider the instructor file As an example, consider the instructor file
......
...@@ -30,9 +30,9 @@ examples/cs101_students # This directory contains the (processed) student fil ...@@ -30,9 +30,9 @@ examples/cs101_students # This directory contains the (processed) student fil
examples/cs101_output # This contains automatically generated contents (snippets, etc.). examples/cs101_output # This contains automatically generated contents (snippets, etc.).
``` ```
The basic functionality is you insert special comment tags in your source, such as `#!b` or `#!s` and the script then process The basic functionality is you insert special comment tags in your source, such as `#!b` or `#!s` and the script then process
the sources based on the tags. The following will show most basic usages: the sources based on the tags. The following will show most common usages:
## The #f!-tag ## The #!f-tag
Let's start with the simplest example, blocking out a function (see `examples/cs101_instructor/f_tag.py`; actually it will work for any scope) Let's start with the simplest example, blocking out a function (see `examples/cs101_instructor/f_tag.py`; actually it will work for any scope)
You insert a comment like: `#!f <exception message>` like so: You insert a comment like: `#!f <exception message>` like so:
```python ```python
...@@ -47,7 +47,7 @@ The output can be found in `examples/students/f_tag.py`. It will cut out the bod ...@@ -47,7 +47,7 @@ The output can be found in `examples/students/f_tag.py`. It will cut out the bod
{{ cs101_students.f_tag_py }} {{ cs101_students.f_tag_py }}
``` ```
## The #b!-tag ## The #!b-tag
The #!b-tag allows you more control over what is cut out. The instructor file: The #!b-tag allows you more control over what is cut out. The instructor file:
```python ```python
{{ cs101_instructor.b_tag_py }} {{ cs101_instructor.b_tag_py }}
...@@ -60,7 +60,7 @@ This allows you to cut out text across scopes, but still allows you to insert ex ...@@ -60,7 +60,7 @@ This allows you to cut out text across scopes, but still allows you to insert ex
## The #s!-tag ## The #!s-tag
The #!s-tag is useful for making examples to include in exercises and lecture notes. The #!s (snip) tag cuts out the text between The #!s-tag is useful for making examples to include in exercises and lecture notes. The #!s (snip) tag cuts out the text between
tags and places it in files found in the output-directory. As an example, here is the instructor file: tags and places it in files found in the output-directory. As an example, here is the instructor file:
```python ```python
...@@ -87,7 +87,7 @@ and finally: ...@@ -87,7 +87,7 @@ and finally:
I recommend using `\inputminted{filename}` to insert the cutouts in LaTeX. I recommend using `\inputminted{filename}` to insert the cutouts in LaTeX.
## The #o!-tag ## The #!o-tag
The #!o-tag allows you to capture output from the code, which can be useful when showing students the expected The #!o-tag allows you to capture output from the code, which can be useful when showing students the expected
behavior of their scripts. Like the #!s-tag, the #!o-tags can be named. behavior of their scripts. Like the #!s-tag, the #!o-tags can be named.
...@@ -104,7 +104,7 @@ and ...@@ -104,7 +104,7 @@ and
{{ cs101_output.o_tag_b_txt }} {{ cs101_output.o_tag_b_txt }}
``` ```
## The #i!-tag ## The #!i-tag
The #!i-tag allows you to create interactive python shell-snippets that can be imported using The #!i-tag allows you to create interactive python shell-snippets that can be imported using
the minted `pycon` environment (`\inputminted{python}{input.shell}`). the minted `pycon` environment (`\inputminted{python}{input.shell}`).
As an example, consider the instructor file As an example, consider the instructor file
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment