Skip to content

Commit

Permalink
chore: prettify the navigation and fix some typos
Browse files Browse the repository at this point in the history
 - title up the API and give it a nav section so it's clear where docs end and the API begins
 - modify docs.py accordingly
  • Loading branch information
justindujardin committed Dec 16, 2023
1 parent ad57aee commit 5f81ef9
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 23 deletions.
5 changes: 5 additions & 0 deletions mathy_core/rules/balanced_move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Balanced move allows you to move things from one side of an equation to the other, by applying the same operation on both sides.

### Examples

`rule_tests:balanced_move`
5 changes: 5 additions & 0 deletions mathy_core/rules/restate_subtraction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Subtraction operations aren't commutable, but addition of negative values are. This flips a subtraction to a plus negation, to "unlock" terms and allow moving them around, e.g. for like-terms simplification.

### Examples

`rule_tests:restate_subtraction`
10 changes: 10 additions & 0 deletions website/docs/api/rules/balanced_move.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

import mathy_core.rules.balanced_move
```
Balanced move allows you to move things from one side of an equation to the other, by applying the same operation on both sides.

### Examples

`rule_tests:balanced_move`


## API


## BalancedMoveRule
```python
Expand All @@ -28,3 +37,4 @@ Supports the following configurations:
other.
- Multiply is a coefficient of a term that must be divided on both sides of
the equation or inequality.

10 changes: 10 additions & 0 deletions website/docs/api/rules/restate_subtraction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

import mathy_core.rules.restate_subtraction
```
Subtraction operations aren't commutable, but addition of negative values are. This flips a subtraction to a plus negation, to "unlock" terms and allow moving them around, e.g. for like-terms simplification.

### Examples

`rule_tests:restate_subtraction`


## API


## RestateSubtractionRule
```python
Expand All @@ -20,3 +29,4 @@ Determine the configuration of the tree for this transformation.
Support two types of tree configurations:
- Subtraction is a subtract to be restate as a plus negation
- PlusNegative is a plus negative const to be restated as subtraction

2 changes: 1 addition & 1 deletion website/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Mathy includes a Computer Algebra System (or CAS). Its job is to turn text into
## Installation

```bash
$ pip install mathy_envs
$ pip install mathy_core
```

## Examples
Expand Down
40 changes: 20 additions & 20 deletions website/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ nav:
- Home: https://mathy.ai
- Core:
- Home: index.md
- API:
- expressions: api/expressions.md
- layout: api/layout.md
- parser: api/parser.md
- problems: api/problems.md
- rule: api/rule.md
- rules:
- associative_swap: api/rules/associative_swap.md
- balanced_move: api/rules/balanced_move.md
- commutative_swap: api/rules/commutative_swap.md
- constants_simplify: api/rules/constants_simplify.md
- distributive_factor_out: api/rules/distributive_factor_out.md
- distributive_multiply_across: api/rules/distributive_multiply_across.md
- restate_subtraction: api/rules/restate_subtraction.md
- variable_multiply: api/rules/variable_multiply.md
- testing: api/testing.md
- tokenizer: api/tokenizer.md
- tree: api/tree.md
- util: api/util.md
- Releases: changelog.md
- License: license.md
- API:
- Expressions: api/expressions.md
- Layout: api/layout.md
- Parser: api/parser.md
- Problems: api/problems.md
- Rule: api/rule.md
- Rules:
- Associative Swap: api/rules/associative_swap.md
- Balanced Move: api/rules/balanced_move.md
- Commutative Swap: api/rules/commutative_swap.md
- Constants Simplify: api/rules/constants_simplify.md
- Distributive Factor Out: api/rules/distributive_factor_out.md
- Distributive Multiply Across: api/rules/distributive_multiply_across.md
- Restate Subtraction: api/rules/restate_subtraction.md
- Variable Multiply: api/rules/variable_multiply.md
- Testing: api/testing.md
- Tokenizer: api/tokenizer.md
- Tree: api/tree.md
- Util: api/util.md
- Environments: https://envs.mathy.ai
extra:
social:
Expand All @@ -62,6 +62,7 @@ theme:
logo: material/hub
features:
- instant
- navigation.sections
- navigation.tabs
- navigation.tabs.sticky
- navigation.footer
Expand Down Expand Up @@ -95,6 +96,5 @@ plugins:
- search
- social
- git-revision-date-localized
- git-committers
- minify:
minify_html: true
10 changes: 8 additions & 2 deletions website/tools/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
yaml = YAML()


def convert_module_to_title(input_string: str) -> str:
return input_string.replace("_", " ").title()


def prepend_md_content(original_md, prepending_md):
with open(prepending_md, "r") as file:
prepending_content = file.read()
Expand Down Expand Up @@ -97,7 +101,9 @@ def process_directory(directory):
h1_to_h2(to_file)

nav_item = {
file_path.stem: to_file.relative_to(parent_folder_path / "docs").as_posix()
convert_module_to_title(file_path.stem): to_file.relative_to(
parent_folder_path / "docs"
).as_posix()
}
nav_entries.append(nav_item)
return nav_entries
Expand Down Expand Up @@ -133,7 +139,7 @@ def main():
if src_folder not in [".", ""]:
new_entries = process_directory(folder)
new_entries.sort(key=lambda x: list(x)[0])
nav_entries.append({folder.name: new_entries})
nav_entries.append({convert_module_to_title(folder.name): new_entries})
else:
nav_entries += process_directory(folder)
nav_entries.sort(key=lambda x: list(x)[0])
Expand Down

0 comments on commit 5f81ef9

Please sign in to comment.