Skip to content

Commit

Permalink
Merge pull request #38 from executablebooks/remove-exc-dir
Browse files Browse the repository at this point in the history
🗑️ DEPRECATE: Remove exercise directive
  • Loading branch information
najuzilu authored Sep 24, 2020
2 parents b1de9e6 + bb1b3e8 commit 8eb2e45
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 76 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

This package contains a [Sphinx](http://www.sphinx-doc.org/en/master/) extension
for producing proof, theorem, axiom, lemma, definition, criterion, remark, conjecture,
corollary, algorithm, exercise, example, property, observation and proposition directives.
corollary, algorithm, example, property, observation and proposition directives.


## Get started
Expand Down
3 changes: 1 addition & 2 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
install
syntax
contribute
testing
zreferences
```
Expand All @@ -18,7 +17,7 @@ zreferences

This package contains a [Sphinx](http://www.sphinx-doc.org/en/master/) extension
for producing proof, theorem, axiom, lemma, definition, criterion, remark, conjecture,
corollary, algorithm, exercise, example, property, observation and proposition directives.
corollary, algorithm, example, property, observation and proposition directives.


```{warning}
Expand Down
52 changes: 0 additions & 52 deletions docs/source/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,58 +514,6 @@ _Source:_ [Wikipedia](https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algor

You can refer to a algorithms using the `{proof:ref}` role like: ```{proof:ref}`my-algorithm` ```, which will replace the reference with the algorithm number like so: {proof:ref}`my-algorithm`. When an explicit text is provided, this caption will serve as the title of the reference.

## Exercises

An exercise directive can be included using the `proof:exercise` pattern. The directive is enumerated by default and can take in an optional title argument. The following options are also supported:

* `label` : text

A unique identifier for your exercise that you can use to reference it with `{proof:ref}`. Cannot contain spaces or special characters.
* `class` : text

Value of the exercise’s class attribute which can be used to add custom CSS or JavaScript.
* `nonumber` : flag (empty)

Turns off exercise auto numbering.

**Example**

```{proof:exercise}
:label: my-exercise
Recall that $n!$ is read as "$n$ factorial" and defined as
$n! = n \times (n - 1) \times \cdots \times 2 \times 1$.
There are functions to compute this in various modules, but let's
write our own version as an exercise.
In particular, write a function `factorial` such that `factorial(n)` returns $n!$
for any positive integer $n$.
```

**MyST Syntax**

``````md
```{proof:exercise}
:label: my-exercise

Recall that $n!$ is read as "$n$ factorial" and defined as
$n! = n \times (n - 1) \times \cdots \times 2 \times 1$.

There are functions to compute this in various modules, but let's
write our own version as an exercise.

In particular, write a function `factorial` such that `factorial(n)` returns $n!$
for any positive integer $n$.
```
``````

_Source:_ [QuantEcon](https://python-programming.quantecon.org/functions.html#Exercise-1)

### Referencing Exercises

You can refer to an exercise using the `{proof:ref}` role like: ```{proof:ref}`my-exercise` ```, which will replace the reference with the exercise number like so: {proof:ref}`my-exercise`. When an explicit text is provided, this caption will serve as the title of the reference.


## Examples

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
LONG_DESCRIPTION = """
This package contains a [Sphinx](http://www.sphinx-doc.org/en/master/) extension
for producing proof, theorem, axiom, lemma, definition, criterion, remark, conjecture,
corollary, algorithm, exercise, example, property, observation and proposition
directives.
corollary, algorithm, example, property, observation and proposition directives.
This project is maintained and supported by [najuzilu](https://github.com/najuzilu).
"""
Expand Down
12 changes: 0 additions & 12 deletions sphinxcontrib/_static/proof.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ div.criterion p.admonition-title {
background-color: var(--caution-title-color);
}

/*********************************************
* Exercise *
*********************************************/
div.exercise {
border-left: .2rem solid var(--note-border-color);
background-color: var(--note-title-color);
}

div.exercise p.admonition-title {
background-color: var(--note-title-color);
}

/*********************************************
* Lemma *
*********************************************/
Expand Down
7 changes: 0 additions & 7 deletions sphinxcontrib/prettyproof/proof_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ class AxiomDirective(ElementDirective):
name = "axiom"


class ExerciseDirective(ElementDirective):
"""A custom exercise directive."""

name = "exercise"


class ExampleDirective(ElementDirective):
"""A custom example directive."""

Expand Down Expand Up @@ -105,7 +99,6 @@ class PropositionDirective(ElementDirective):
"corollary": CorollaryDirective,
"algorithm": AlgorithmDirective,
"criterion": CriterionDirective,
"exercise": ExerciseDirective,
"example": ExampleDirective,
"property": PropertyDirective,
"observation": ObservationDirective,
Expand Down

0 comments on commit 8eb2e45

Please sign in to comment.