Skip to content

Commit 4520e90

Browse files
committed
Update docs: filter page
1 parent d2a40fa commit 4520e90

33 files changed

+1201
-154
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ COPY requirements.txt /app
1111
RUN pip install --no-cache-dir -r requirements.txt
1212

1313
COPY . /app
14+
15+
COPY scripts /usr/local/bin
16+
RUN find /usr/local/bin -type f -name "*" -exec chmod +x {} \;

docs/_static/style.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.wy-side-nav-search {
2+
margin: 0;
3+
}
4+
.wy-menu-vertical {
5+
a, a:visited {
6+
color: #d9d9d9;
7+
}
8+
}
9+
10+
.wy-nav-content {
11+
max-width: unset;
12+
13+
a:visited {
14+
color: #2980b9;
15+
}
16+
17+
.wy-breadcrumbs-aside {
18+
display: none;
19+
}
20+
21+
.document {
22+
max-width: 900px;
23+
}
24+
}
25+
26+
footer {
27+
.rst-footer-buttons {
28+
display: none;
29+
}
30+
}

docs/changelog.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ All notable changes to this project will be documented in this file.
55

66

77
[0.0.10] - 2025-03-06
8-
--------------------
8+
---------------------
99

1010
Added
1111
^^^^^
1212
- Added python 3.14 support.
1313

1414
Changed
1515
^^^^^^^
16-
- Use ``FieldModel`` vor field definition. (Only internal change, no impact on the user)
16+
- Use ``FieldModel`` for field definition. (Only internal change, no impact on usage)
1717

1818

1919
[0.0.9.1] - 2025-02-09
@@ -29,7 +29,7 @@ Changed
2929

3030
Added
3131
^^^^^
32-
- New ``copy`` functionality to copy the value of another field. `Check it out <options/copy>`_
32+
- New ``copy`` functionality to copy the value of another field. :doc:`Check it out <options/copy>`
3333

3434
Filter
3535
""""""
@@ -117,16 +117,16 @@ Removed
117117

118118
Added
119119
^^^^^
120-
- New ``condition`` functionality between fields. `Check it out <options/condition>`_
120+
- New ``condition`` functionality between fields. :doc:`Check it out <options/condition>`
121121

122122
Changed
123123
^^^^^^^
124-
- Switched ``external_api`` config from dict to class. `Check it out <options/external_api#Configuration>`_
124+
- Switched ``external_api`` config from dict to class. :doc:`Check it out <options/external_api>`
125125

126126

127127
[0.0.4] - 2025-01-09
128128
--------------------
129129

130130
Added
131131
^^^^^
132-
- New external API functionality. `Check it out <options/external_api>`_
132+
- New external API functionality. :doc:`Check it out <options/external_api>`

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
author = "Leander Cain Slotosch"
44
release = "0.0.10"
55

6-
extensions = []
6+
extensions = ["sphinx_rtd_theme"]
77

88
templates_path = []
99
exclude_patterns = []
1010

11-
html_theme = "alabaster"
12-
html_static_path = []
11+
html_theme = "sphinx_rtd_theme"
12+
html_static_path = ["_static"]
13+
html_css_files = ["style.css"]
14+
html_theme_options = {"navigation_depth": 4}

docs/development.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Development
22
===========
33

4+
This guide will help you set up a development environment for the library project.
5+
6+
You can find the source code for the library in the `GitHub repository <https://github.com/LeanderCS/flask-inputfilter>`_.
7+
48
Build docker image
59
-------------------
610

@@ -31,6 +35,4 @@ Run linting
3135

3236
.. code-block:: bash
3337
34-
docker exec -it flask-inputfilter sh -c "isort ."
35-
docker exec -it flask-inputfilter sh -c "autoflake --in-place --remove-all-unused-imports --ignore-init-module-imports --recursive ."
36-
docker exec -it flask-inputfilter black .
38+
docker exec -it flask-inputfilter lint
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Create own
2-
===========
1+
Create own components
2+
=====================
33

44
Depending on what you want to build your own version from, there are different
55
parameters and return values required to work properly.

docs/guides/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Guides
55
:maxdepth: 2
66
:glob:
77

8-
create_own
8+
create_own_components

docs/index.rst

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,15 @@ Available functions:
2020
- :doc:`Conditions <options/condition>`
2121
- :doc:`Filter <options/filter>`
2222
- :doc:`Validator <options/validator>`
23-
- :doc:`Creating your own Conditions, Filters and Validators <guides/create_own>`
23+
- :doc:`Creating your own Conditions, Filters and Validators <guides/create_own_components>`
2424
- :doc:`ExternalApi <options/external_api>`
2525

26+
.. tip::
2627

27-
.. raw:: html
28-
29-
<div style="border:1px solid #86989B;padding:1rem;border-radius:3px;margin-top:40px;">
30-
<p style="background-color:hsl(219.5, 84%, 90%);margin:-1rem -1rem 0.8rem -1rem;padding:0.3rem 1rem 0.3rem 2.5rem;position:relative;border-radius:3px 3px 0 0;">
31-
<span style="content:'';position:absolute;top:.25rem;left:.5rem;width:1.5rem;height:1.5rem;background-color:hsl(219.5, 84%, 50%);mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z&quot;/></svg>');"></span>
32-
Tip
33-
</p>
34-
<p style="margin:0;">
35-
Thank you for using <code>flask-inputfilter</code>!<br>
36-
If you have any questions or suggestions, please feel free to open an issue on <a href="https://github.com/LeanderCS/flask-inputfilter">GitHub</a>.<br>
37-
If you don't want to miss any updates, please star the repository.<br>
38-
This will help me to understand how many people are interested in this project.<br>
39-
</p>
40-
</div>
28+
Thank you for using `flask-inputfilter`!
29+
If you have any questions or suggestions, please feel free to open an issue on `GitHub <https://github.com/LeanderCS/flask-inputfilter>`_.
30+
If you don't want to miss any updates, please star the repository.
31+
This will help me to understand how many people are interested in this project.
4132

4233
Installation
4334
------------
@@ -52,7 +43,7 @@ Quickstart
5243
To use the `InputFilter` class, create a new class that inherits from it and define the
5344
fields you want to validate and filter.
5445

55-
There are numerous filters and validators available, but you can also create your :doc:`own <guides/create_own>`.
46+
There are numerous filters and validators available, but you can also create your :doc:`own <guides/create_own_components>`.
5647

5748
Definition
5849
^^^^^^^^^^

docs/options/condition.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Condition
22
=========
33

4-
The `Condition` module contains the conditions that can be used to validate the input data.
4+
``Conditions`` are used to validate the input data based on rules between fields.
55

6-
Conditions
7-
----------
6+
Overview
7+
--------
88

99
The `addCondition` method is used to add a condition between fields.
1010

11-
Example
12-
-------
11+
Examples
12+
--------
1313

1414
.. code-block:: python
1515

docs/options/copy.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,37 @@ Basic Copy Integration
4747
4848
# Cotains the same value as username but escaped eg. "very-important-user"
4949
print(validated_data["escapedUsername"])
50+
51+
52+
The coping can also be used as a chain.
53+
54+
.. code-block:: python
55+
56+
from flask_inputfilter import InputFilter
57+
from flask_inputfilter.Filter import SlugifyFilter, ToUpperFilter, ToLowerFilter
58+
59+
class MyInputFilter(InputFilter):
60+
def __init__(self):
61+
super().__init__()
62+
63+
self.add(
64+
"username"
65+
)
66+
67+
self.add(
68+
"escapedUsername",
69+
copy="username"
70+
filters=[SlugifyFilter()]
71+
)
72+
73+
self.add(
74+
"upperEscapedUsername",
75+
copy="escapedUsername"
76+
filters=[ToUpperFilter()]
77+
)
78+
79+
self.add(
80+
"lowerEscapedUsername",
81+
copy="escapedUsername"
82+
filters=[ToLowerFilter()]
83+
)

0 commit comments

Comments
 (0)