WhakerPy 0.1__tar.gz → 0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {WhakerPy-0.1 → WhakerPy-0.2}/AUTHORS +1 -1
  2. {WhakerPy-0.1/WhakerPy.egg-info → WhakerPy-0.2}/PKG-INFO +59 -13
  3. {WhakerPy-0.1 → WhakerPy-0.2}/README.md +58 -12
  4. {WhakerPy-0.1 → WhakerPy-0.2/WhakerPy.egg-info}/PKG-INFO +59 -13
  5. WhakerPy-0.2/WhakerPy.egg-info/SOURCES.txt +40 -0
  6. WhakerPy-0.2/doc/makedoc.py +227 -0
  7. {WhakerPy-0.1 → WhakerPy-0.2}/pyproject.toml +6 -1
  8. WhakerPy-0.2/samples/response.py +233 -0
  9. WhakerPy-0.2/tests/__init__.py +0 -0
  10. WhakerPy-0.2/tests/htmlmaker/__init__.py +0 -0
  11. WhakerPy-0.2/tests/htmlmaker/test_basenodes.py +178 -0
  12. WhakerPy-0.2/tests/htmlmaker/test_emptynodes.py +209 -0
  13. {WhakerPy-0.1/tests → WhakerPy-0.2/tests/htmlmaker}/test_hexc.py +32 -5
  14. {WhakerPy-0.1/tests → WhakerPy-0.2/tests/htmlmaker}/test_htree.py +56 -8
  15. WhakerPy-0.2/tests/htmlmaker/test_tagnodes.py +261 -0
  16. WhakerPy-0.2/tests/httpd/__init__.py +0 -0
  17. {WhakerPy-0.1/tests → WhakerPy-0.2/tests/httpd}/test_status.py +6 -1
  18. WhakerPy-0.2/whakerpy/htmlmaker/__init__.py +146 -0
  19. WhakerPy-0.2/whakerpy/htmlmaker/basenodes/__init__.py +9 -0
  20. WhakerPy-0.2/whakerpy/htmlmaker/basenodes/baseelts.py +161 -0
  21. WhakerPy-0.2/whakerpy/htmlmaker/basenodes/basenode.py +217 -0
  22. WhakerPy-0.2/whakerpy/htmlmaker/emptynodes/__init__.py +9 -0
  23. WhakerPy-0.2/whakerpy/htmlmaker/emptynodes/emptyelts.py +98 -0
  24. WhakerPy-0.2/whakerpy/htmlmaker/emptynodes/emptynode.py +250 -0
  25. WhakerPy-0.2/whakerpy/htmlmaker/hconsts.py +299 -0
  26. WhakerPy-0.2/whakerpy/htmlmaker/hexc.py +225 -0
  27. WhakerPy-0.2/whakerpy/htmlmaker/tagnodes/__init__.py +11 -0
  28. WhakerPy-0.2/whakerpy/htmlmaker/tagnodes/tagelts.py +184 -0
  29. WhakerPy-0.2/whakerpy/htmlmaker/tagnodes/tagnode.py +310 -0
  30. WhakerPy-0.2/whakerpy/htmlmaker/treeelts.py +230 -0
  31. WhakerPy-0.2/whakerpy/htmlmaker/treenode.py +494 -0
  32. WhakerPy-0.2/whakerpy/httpd/__init__.py +53 -0
  33. WhakerPy-0.2/whakerpy/httpd/handler.py +292 -0
  34. WhakerPy-0.2/whakerpy/httpd/hresponse.py +245 -0
  35. WhakerPy-0.2/whakerpy/httpd/hserver.py +124 -0
  36. WhakerPy-0.2/whakerpy/httpd/hstatus.py +219 -0
  37. {WhakerPy-0.1 → WhakerPy-0.2}/whakerpy/messages.py +2 -0
  38. WhakerPy-0.1/WhakerPy.egg-info/SOURCES.txt +0 -14
  39. WhakerPy-0.1/tests/test_hnode.py +0 -335
  40. {WhakerPy-0.1 → WhakerPy-0.2}/LICENSE +0 -0
  41. {WhakerPy-0.1 → WhakerPy-0.2}/WhakerPy.egg-info/dependency_links.txt +0 -0
  42. {WhakerPy-0.1 → WhakerPy-0.2}/WhakerPy.egg-info/top_level.txt +0 -0
  43. {WhakerPy-0.1 → WhakerPy-0.2}/setup.cfg +0 -0
  44. {WhakerPy-0.1 → WhakerPy-0.2}/whakerpy/__init__.py +0 -0
@@ -23,5 +23,5 @@ Main author, contributor, maintainer, developer:
23
23
 
24
24
  Contributors:
25
25
 
26
- * 2023: Florian Lopitaux
26
+ * avril-june 2023: Florian Lopitaux
27
27
  * any help or constructive comment is welcome
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: WhakerPy
3
- Version: 0.1
3
+ Version: 0.2
4
4
  Summary: Web HTML maker in Python - a light web application framework
5
5
  Author-email: Brigitte Bigi <develop@sppas.org>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -727,22 +727,22 @@ the GNU General Public License version 3.
727
727
 
728
728
  ### From its repo:
729
729
 
730
- Download the repository and unpack it or clone with `git`.
730
+ Download the repository and unpack it, or clone with `git`.
731
731
  WhakerPy package includes the following folders and files:
732
732
 
733
733
  1. "whakerpy": the source code package
734
- 2. "docs": the documentation of whakerpy in HTML
735
- 3. "tests": unittest of whakerpy source code
736
- 4. "sample":
737
- 5. "etc": etcetera!
734
+ 2. "doc": the documentation of whakerpy in HTML
735
+ 3. "sample":
736
+ 4. "etc": etcetera!
738
737
 
739
738
 
740
- ### From its package:
739
+ ### From its wheel package:
741
740
 
742
- Download the wheel file and install it in your python environment with:
741
+ Download the wheel file (WhakerPy-xxx.whl) and install it in your
742
+ python environment with:
743
743
 
744
744
  ```bash
745
- > python -m pip install dist/<whakerpy.whl>
745
+ > python -m pip install dist/<WhakerPy-xxx.whl>
746
746
  ````
747
747
 
748
748
  ### From pypi.org:
@@ -752,7 +752,6 @@ Download the wheel file and install it in your python environment with:
752
752
  ````
753
753
 
754
754
 
755
-
756
755
  ## Quick Start
757
756
 
758
757
  Open a Python interpreter and type or paste the following:
@@ -811,7 +810,6 @@ Let's view the result in your favorite web browser
811
810
  >>> webbrowser.open_new_tab(file_whakerpy)
812
811
  ```
813
812
 
814
-
815
813
  ## Create a web application frontend with dynamic HTML content
816
814
 
817
815
  For a quick start, see the file `sample.py`. It shows a very simple
@@ -826,13 +824,61 @@ For a more complex example of an already in-used web frontend, see:
826
824
 
827
825
  ## Projects using `WhakerPy `
828
826
 
829
- `WhakerPy` was initially developed within SPPAS <http://sppas/org>; it was
827
+ `WhakerPy` was initially developed within SPPAS <https://sppas.org>; it was
830
828
  extracted from its original software by its author to lead its own life as
831
829
  standalone package. The "setup" of SPPAS is entirely based on whakerpy API,
832
830
  and it's website too.
833
831
 
834
832
  Other projects:
835
- - pages of the website "<https://auto-cuedspeech.org>" are created by whakerpy.
833
+ - pages of the website <https://auto-cuedspeech.org> are created by whakerpy.
836
834
  - *contact the author if your project is using whakerpy*
837
835
 
838
836
 
837
+ # The developer's corner
838
+
839
+ ## Create a wheel
840
+
841
+ WhakerPy is no system dependent. Information to build its wheel are stored
842
+ into the file `pyproject.toml`.
843
+
844
+ The universal wheel is created with: `python -m build`
845
+
846
+ ## Make the doc
847
+
848
+ The API documentation is available in the `doc` folder. Click the file `index.html`
849
+ to browse throw the documented classes of WhakerPy.
850
+
851
+ To re-generate the doc, install the required external program:
852
+ `python -m pip install -r doc/requirements.txt`
853
+ Then, launch the doc generator: `cd doc; python makedoc.py`
854
+
855
+ ## Analyze WhakerPy code
856
+
857
+ Unittests coverage can be analyzed with pytest and coverage. Install them
858
+ with the command: `python -m pip install -r tests/requirements.txt`
859
+
860
+ Then, perform the following steps:
861
+
862
+ 1. `coverage run -m pytest`
863
+ 2. `coverage report` to see a summary report into the terminal,
864
+ or use this command to get the result in XML format: `coverage xml; mv coverage.xml tests`
865
+
866
+ The whakerpy package can be analyzed with SonarQube by following these steps:
867
+
868
+ 1. Download and install Docker
869
+ 2. Download and install SonarQube:
870
+ `docker pull sonarqube:latest`
871
+ 3. Start the SonarQube server by running:
872
+ `docker run --stop-timeout 3600 -d --name sonarqube -p 9000:9000 sonarqube:latest`
873
+ Log in to http://localhost:9000. Both login and password are "admin".
874
+ Add the python plugin and restart server.
875
+ 4. Click "Add project" with name "WhakerPy", and provide it a token
876
+ 5. Copy/Paste the token into the file whakerpy/sonar-project.properties
877
+ 6. Download sonar-scanner client:
878
+ `brew install sonar-scanner` (or something else, it obviously depends on your OS)
879
+ 7. Launch: `sonar-scanner`
880
+ 8. See results in the opened URL, and don't forget it's an *automatic* code analyzer, not an *intelligent* one.
881
+
882
+ ## Contribute
883
+
884
+ If you plan to contribute to the code, please send an e-mail to the author.
@@ -32,22 +32,22 @@ the GNU General Public License version 3.
32
32
 
33
33
  ### From its repo:
34
34
 
35
- Download the repository and unpack it or clone with `git`.
35
+ Download the repository and unpack it, or clone with `git`.
36
36
  WhakerPy package includes the following folders and files:
37
37
 
38
38
  1. "whakerpy": the source code package
39
- 2. "docs": the documentation of whakerpy in HTML
40
- 3. "tests": unittest of whakerpy source code
41
- 4. "sample":
42
- 5. "etc": etcetera!
39
+ 2. "doc": the documentation of whakerpy in HTML
40
+ 3. "sample":
41
+ 4. "etc": etcetera!
43
42
 
44
43
 
45
- ### From its package:
44
+ ### From its wheel package:
46
45
 
47
- Download the wheel file and install it in your python environment with:
46
+ Download the wheel file (WhakerPy-xxx.whl) and install it in your
47
+ python environment with:
48
48
 
49
49
  ```bash
50
- > python -m pip install dist/<whakerpy.whl>
50
+ > python -m pip install dist/<WhakerPy-xxx.whl>
51
51
  ````
52
52
 
53
53
  ### From pypi.org:
@@ -57,7 +57,6 @@ Download the wheel file and install it in your python environment with:
57
57
  ````
58
58
 
59
59
 
60
-
61
60
  ## Quick Start
62
61
 
63
62
  Open a Python interpreter and type or paste the following:
@@ -116,7 +115,6 @@ Let's view the result in your favorite web browser
116
115
  >>> webbrowser.open_new_tab(file_whakerpy)
117
116
  ```
118
117
 
119
-
120
118
  ## Create a web application frontend with dynamic HTML content
121
119
 
122
120
  For a quick start, see the file `sample.py`. It shows a very simple
@@ -131,13 +129,61 @@ For a more complex example of an already in-used web frontend, see:
131
129
 
132
130
  ## Projects using `WhakerPy `
133
131
 
134
- `WhakerPy` was initially developed within SPPAS <http://sppas/org>; it was
132
+ `WhakerPy` was initially developed within SPPAS <https://sppas.org>; it was
135
133
  extracted from its original software by its author to lead its own life as
136
134
  standalone package. The "setup" of SPPAS is entirely based on whakerpy API,
137
135
  and it's website too.
138
136
 
139
137
  Other projects:
140
- - pages of the website "<https://auto-cuedspeech.org>" are created by whakerpy.
138
+ - pages of the website <https://auto-cuedspeech.org> are created by whakerpy.
141
139
  - *contact the author if your project is using whakerpy*
142
140
 
143
141
 
142
+ # The developer's corner
143
+
144
+ ## Create a wheel
145
+
146
+ WhakerPy is no system dependent. Information to build its wheel are stored
147
+ into the file `pyproject.toml`.
148
+
149
+ The universal wheel is created with: `python -m build`
150
+
151
+ ## Make the doc
152
+
153
+ The API documentation is available in the `doc` folder. Click the file `index.html`
154
+ to browse throw the documented classes of WhakerPy.
155
+
156
+ To re-generate the doc, install the required external program:
157
+ `python -m pip install -r doc/requirements.txt`
158
+ Then, launch the doc generator: `cd doc; python makedoc.py`
159
+
160
+ ## Analyze WhakerPy code
161
+
162
+ Unittests coverage can be analyzed with pytest and coverage. Install them
163
+ with the command: `python -m pip install -r tests/requirements.txt`
164
+
165
+ Then, perform the following steps:
166
+
167
+ 1. `coverage run -m pytest`
168
+ 2. `coverage report` to see a summary report into the terminal,
169
+ or use this command to get the result in XML format: `coverage xml; mv coverage.xml tests`
170
+
171
+ The whakerpy package can be analyzed with SonarQube by following these steps:
172
+
173
+ 1. Download and install Docker
174
+ 2. Download and install SonarQube:
175
+ `docker pull sonarqube:latest`
176
+ 3. Start the SonarQube server by running:
177
+ `docker run --stop-timeout 3600 -d --name sonarqube -p 9000:9000 sonarqube:latest`
178
+ Log in to http://localhost:9000. Both login and password are "admin".
179
+ Add the python plugin and restart server.
180
+ 4. Click "Add project" with name "WhakerPy", and provide it a token
181
+ 5. Copy/Paste the token into the file whakerpy/sonar-project.properties
182
+ 6. Download sonar-scanner client:
183
+ `brew install sonar-scanner` (or something else, it obviously depends on your OS)
184
+ 7. Launch: `sonar-scanner`
185
+ 8. See results in the opened URL, and don't forget it's an *automatic* code analyzer, not an *intelligent* one.
186
+
187
+ ## Contribute
188
+
189
+ If you plan to contribute to the code, please send an e-mail to the author.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: WhakerPy
3
- Version: 0.1
3
+ Version: 0.2
4
4
  Summary: Web HTML maker in Python - a light web application framework
5
5
  Author-email: Brigitte Bigi <develop@sppas.org>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -727,22 +727,22 @@ the GNU General Public License version 3.
727
727
 
728
728
  ### From its repo:
729
729
 
730
- Download the repository and unpack it or clone with `git`.
730
+ Download the repository and unpack it, or clone with `git`.
731
731
  WhakerPy package includes the following folders and files:
732
732
 
733
733
  1. "whakerpy": the source code package
734
- 2. "docs": the documentation of whakerpy in HTML
735
- 3. "tests": unittest of whakerpy source code
736
- 4. "sample":
737
- 5. "etc": etcetera!
734
+ 2. "doc": the documentation of whakerpy in HTML
735
+ 3. "sample":
736
+ 4. "etc": etcetera!
738
737
 
739
738
 
740
- ### From its package:
739
+ ### From its wheel package:
741
740
 
742
- Download the wheel file and install it in your python environment with:
741
+ Download the wheel file (WhakerPy-xxx.whl) and install it in your
742
+ python environment with:
743
743
 
744
744
  ```bash
745
- > python -m pip install dist/<whakerpy.whl>
745
+ > python -m pip install dist/<WhakerPy-xxx.whl>
746
746
  ````
747
747
 
748
748
  ### From pypi.org:
@@ -752,7 +752,6 @@ Download the wheel file and install it in your python environment with:
752
752
  ````
753
753
 
754
754
 
755
-
756
755
  ## Quick Start
757
756
 
758
757
  Open a Python interpreter and type or paste the following:
@@ -811,7 +810,6 @@ Let's view the result in your favorite web browser
811
810
  >>> webbrowser.open_new_tab(file_whakerpy)
812
811
  ```
813
812
 
814
-
815
813
  ## Create a web application frontend with dynamic HTML content
816
814
 
817
815
  For a quick start, see the file `sample.py`. It shows a very simple
@@ -826,13 +824,61 @@ For a more complex example of an already in-used web frontend, see:
826
824
 
827
825
  ## Projects using `WhakerPy `
828
826
 
829
- `WhakerPy` was initially developed within SPPAS <http://sppas/org>; it was
827
+ `WhakerPy` was initially developed within SPPAS <https://sppas.org>; it was
830
828
  extracted from its original software by its author to lead its own life as
831
829
  standalone package. The "setup" of SPPAS is entirely based on whakerpy API,
832
830
  and it's website too.
833
831
 
834
832
  Other projects:
835
- - pages of the website "<https://auto-cuedspeech.org>" are created by whakerpy.
833
+ - pages of the website <https://auto-cuedspeech.org> are created by whakerpy.
836
834
  - *contact the author if your project is using whakerpy*
837
835
 
838
836
 
837
+ # The developer's corner
838
+
839
+ ## Create a wheel
840
+
841
+ WhakerPy is no system dependent. Information to build its wheel are stored
842
+ into the file `pyproject.toml`.
843
+
844
+ The universal wheel is created with: `python -m build`
845
+
846
+ ## Make the doc
847
+
848
+ The API documentation is available in the `doc` folder. Click the file `index.html`
849
+ to browse throw the documented classes of WhakerPy.
850
+
851
+ To re-generate the doc, install the required external program:
852
+ `python -m pip install -r doc/requirements.txt`
853
+ Then, launch the doc generator: `cd doc; python makedoc.py`
854
+
855
+ ## Analyze WhakerPy code
856
+
857
+ Unittests coverage can be analyzed with pytest and coverage. Install them
858
+ with the command: `python -m pip install -r tests/requirements.txt`
859
+
860
+ Then, perform the following steps:
861
+
862
+ 1. `coverage run -m pytest`
863
+ 2. `coverage report` to see a summary report into the terminal,
864
+ or use this command to get the result in XML format: `coverage xml; mv coverage.xml tests`
865
+
866
+ The whakerpy package can be analyzed with SonarQube by following these steps:
867
+
868
+ 1. Download and install Docker
869
+ 2. Download and install SonarQube:
870
+ `docker pull sonarqube:latest`
871
+ 3. Start the SonarQube server by running:
872
+ `docker run --stop-timeout 3600 -d --name sonarqube -p 9000:9000 sonarqube:latest`
873
+ Log in to http://localhost:9000. Both login and password are "admin".
874
+ Add the python plugin and restart server.
875
+ 4. Click "Add project" with name "WhakerPy", and provide it a token
876
+ 5. Copy/Paste the token into the file whakerpy/sonar-project.properties
877
+ 6. Download sonar-scanner client:
878
+ `brew install sonar-scanner` (or something else, it obviously depends on your OS)
879
+ 7. Launch: `sonar-scanner`
880
+ 8. See results in the opened URL, and don't forget it's an *automatic* code analyzer, not an *intelligent* one.
881
+
882
+ ## Contribute
883
+
884
+ If you plan to contribute to the code, please send an e-mail to the author.
@@ -0,0 +1,40 @@
1
+ AUTHORS
2
+ LICENSE
3
+ README.md
4
+ pyproject.toml
5
+ WhakerPy.egg-info/PKG-INFO
6
+ WhakerPy.egg-info/SOURCES.txt
7
+ WhakerPy.egg-info/dependency_links.txt
8
+ WhakerPy.egg-info/top_level.txt
9
+ doc/makedoc.py
10
+ samples/response.py
11
+ tests/__init__.py
12
+ tests/htmlmaker/__init__.py
13
+ tests/htmlmaker/test_basenodes.py
14
+ tests/htmlmaker/test_emptynodes.py
15
+ tests/htmlmaker/test_hexc.py
16
+ tests/htmlmaker/test_htree.py
17
+ tests/htmlmaker/test_tagnodes.py
18
+ tests/httpd/__init__.py
19
+ tests/httpd/test_status.py
20
+ whakerpy/__init__.py
21
+ whakerpy/messages.py
22
+ whakerpy/htmlmaker/__init__.py
23
+ whakerpy/htmlmaker/hconsts.py
24
+ whakerpy/htmlmaker/hexc.py
25
+ whakerpy/htmlmaker/treeelts.py
26
+ whakerpy/htmlmaker/treenode.py
27
+ whakerpy/htmlmaker/basenodes/__init__.py
28
+ whakerpy/htmlmaker/basenodes/baseelts.py
29
+ whakerpy/htmlmaker/basenodes/basenode.py
30
+ whakerpy/htmlmaker/emptynodes/__init__.py
31
+ whakerpy/htmlmaker/emptynodes/emptyelts.py
32
+ whakerpy/htmlmaker/emptynodes/emptynode.py
33
+ whakerpy/htmlmaker/tagnodes/__init__.py
34
+ whakerpy/htmlmaker/tagnodes/tagelts.py
35
+ whakerpy/htmlmaker/tagnodes/tagnode.py
36
+ whakerpy/httpd/__init__.py
37
+ whakerpy/httpd/handler.py
38
+ whakerpy/httpd/hresponse.py
39
+ whakerpy/httpd/hserver.py
40
+ whakerpy/httpd/hstatus.py
@@ -0,0 +1,227 @@
1
+ # makedoc.py
2
+ # Summary: Create the documentation of WhakerPy, using Clamming library.
3
+ # Usage: python makedoc.py
4
+ #
5
+ # This file is part of WhakerPy tool.
6
+ # (C) 2023 Brigitte Bigi, Laboratoire Parole et Langage,
7
+ # Aix-en-Provence, France.
8
+ #
9
+ # Use of this software is governed by the GNU Public License, version 3.
10
+ #
11
+ # Clamming is free software: you can redistribute it and/or modify
12
+ # it under the terms of the GNU General Public License as published by
13
+ # the Free Software Foundation, either version 3 of the License, or
14
+ # (at your option) any later version.
15
+ #
16
+ # Clamming is distributed in the hope that it will be useful,
17
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ # GNU General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU General Public License
22
+ # along with Clamming. If not, see <http://www.gnu.org/licenses/>.
23
+ #
24
+ # This banner notice must not be removed.
25
+ #
26
+ # ---------------------------------------------------------------------------
27
+
28
+ from __future__ import annotations
29
+ import os
30
+ import sys
31
+ sys.path.append(os.path.dirname(os.path.dirname(__file__)))
32
+
33
+ from whakerpy.htmlmaker import *
34
+ from whakerpy.httpd import *
35
+ try:
36
+ from clamming import ClamsClass
37
+ from clamming import ClammingClassParser
38
+ except ImportError:
39
+ print("This program requires `Clamming` documentation generator.")
40
+ print("It can be installed with: pip install Clamming.")
41
+ print("See <https://pypi.org/project/Clamming/> for details.")
42
+ sys.exit(-1)
43
+
44
+ # ----------------------------------------------------------------------------
45
+ # Constants
46
+ # ----------------------------------------------------------------------------
47
+
48
+ HTML_TOP = """<!DOCTYPE html>
49
+ <html>
50
+ <head>
51
+ <meta charset="utf-8" />
52
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
53
+ <title>WhakerPy Doc</title>
54
+ <link rel="logo icon" href="../etc/whakerpy32x32.ico" />
55
+ <link rel="stylesheet" href="../etc/colors_light.css" type="text/css" />
56
+ <link rel="stylesheet" href="../etc/main.css" type="text/css" />
57
+ <link rel="stylesheet" href="../etc/main_sppas.css" type="text/css" />
58
+ <link rel="stylesheet" href="../etc/code.css" type="text/css" />
59
+ <link rel="stylesheet" href="../etc/cards.css" type="text/css" />
60
+ <script src="../etc/toc.js" type="text/javascript"></script>
61
+ </head>
62
+ <body class="light">
63
+ <header></header>
64
+ <nav id="nav-book" class="side-nav">
65
+ <p><strong>WhakerPy doc</strong></p>
66
+ <ul>
67
+ <li class="center">
68
+ <a class="width-three-quarters" role="button" tabindex="0" {prev}> &uarr; Prev. Class</a>
69
+ </li>
70
+ <li class="center">
71
+ <a class="width-three-quarters" role="button" tabindex="0" href="index.html">&#8962; Doc Home</a></li>
72
+ <li class="center">
73
+ <a class="width-three-quarters" role="button" tabindex="0" {next}> &darr; Next Class</a>
74
+ </li>
75
+ </ul>
76
+
77
+ <p><strong>Table of Contents</strong></p>
78
+ <ul id="toc"></ul>
79
+
80
+ </nav>
81
+ <main id="toc-content">
82
+
83
+ <h1>
84
+ <img class="center small-logo" src="../etc/whakerpy.png" alt="WhakerPy logo">
85
+ <img class="center small-logo" src="../etc/whakerpy.png" alt="WhakerPy logo">
86
+ <img class="center small-logo" src="../etc/whakerpy.png" alt="WhakerPy logo">
87
+ <p class="center">WhakerPy tool documentation</p>
88
+ </h1>
89
+
90
+ """
91
+
92
+ HTML_BOTTOM = """
93
+ </main>
94
+ <footer>
95
+ <p class="copyright"> Copyright (C) Brigitte Bigi - LPL 2023 </p>
96
+ </footer>
97
+
98
+ <script>
99
+ document.addEventListener('DOMContentLoaded', function() {
100
+ htmlTableOfContents();
101
+ }
102
+ );
103
+
104
+ try {
105
+ module.exports = htmlTableOfContents;
106
+ } catch (e) {
107
+ // module.exports is not defined
108
+ }
109
+ </script>
110
+ <script src="../etc/accordion.js" type="text/javascript"></script>
111
+ </body>
112
+ </html>
113
+
114
+ """
115
+
116
+ # ---------------------------------------------------------------------------
117
+ # Useful function to export a class into a valid HTML file.
118
+ # ---------------------------------------------------------------------------
119
+
120
+
121
+ def html_top(prev_link: str | None, next_link: str | None) -> str:
122
+ """Return the custom top part of the html output file.
123
+
124
+ """
125
+ if prev_link is None:
126
+ aprev = 'aria-disabled="true"'
127
+ else:
128
+ aprev = 'href="{:s}"'.format(prev_link)
129
+ if next_link is None:
130
+ anext = 'aria-disabled="true"'
131
+ else:
132
+ anext = 'href="{:s}"'.format(next_link)
133
+ return HTML_TOP.format(prev=aprev, next=anext)
134
+
135
+ # ---------------------------------------------------------------------------
136
+
137
+
138
+ def html_index_page(pages: dict) -> None:
139
+ """Write the index.html file from the given pages.
140
+
141
+ """
142
+ with open(os.path.join("", "index.html"), "w") as fp:
143
+ fp.write(html_top(prev_link=None, next_link=None))
144
+
145
+ for package in pages:
146
+ fp.write('<section id="{:s}">\n'.format(package))
147
+ fp.write("<h2>WhakerPy.{:s} classes</h2>\n".format(package))
148
+
149
+ fp.write('<section class="cards-panel">\n')
150
+ for i in range(len(pages[package])):
151
+ obj, page = pages[package][i]
152
+ fp.write(' <article class="card">\n')
153
+ fp.write(' <header><span>{:d}</span></header>'.format(i+1))
154
+ fp.write(' <main>')
155
+ fp.write(' <h3>{:s}</h3>'.format(obj.__name__))
156
+ fp.write(' </main>')
157
+ fp.write(' <footer>')
158
+ fp.write(_add_link("Read me →", page))
159
+ fp.write(' </footer>')
160
+ fp.write(' </article>')
161
+
162
+ fp.write("</section>\n")
163
+
164
+ fp.write(HTML_BOTTOM)
165
+
166
+
167
+ def _add_link(name: str, page: str) -> str:
168
+ return ' <a role="button" href="{:s}">{:s}</a>'.format(page, name)
169
+
170
+ # ---------------------------------------------------------------------------
171
+
172
+
173
+ def obj_to_html(obj, out_html, prev_page=None, next_page=None) -> None:
174
+ """Return the custom documentation html output file of the given object.
175
+
176
+ :param obj: (Any) A python class object
177
+ :param out_html: (str) Output filename
178
+ :param prev_page: (str|None) Previous page name
179
+ :param next_page: (str|None) Previous page name
180
+
181
+ """
182
+ # Parse the object and store collected information = clamming
183
+ clamming = ClammingClassParser(obj)
184
+
185
+ # Export the collected clams to html
186
+ clams = ClamsClass(clamming)
187
+ html_content = clams.html()
188
+ with open(out_html, "w") as fp:
189
+ fp.write(html_top(prev_page, next_page))
190
+ fp.write(html_content)
191
+ fp.write(HTML_BOTTOM)
192
+
193
+ # ---------------------------------------------------------------------------
194
+ # Main
195
+ # ---------------------------------------------------------------------------
196
+
197
+
198
+ if __name__ == "__main__":
199
+ # List of HTML pages dynamically created by Clamming
200
+ pack1 = [
201
+ (BaseNode, "basenode.html"),
202
+ (EmptyNode, "emptynode.html"),
203
+ (HTMLNode, "node.html"),
204
+ (HTMLTree, "tree.html")
205
+ ]
206
+ pack2 = [
207
+ (sppasHTTPDHandler, "handler.html"),
208
+ (sppasBaseHTTPDServer, "server.html"),
209
+ (BaseResponseRecipe, "response.html")
210
+ ]
211
+ pages = {
212
+ "htmlmaker": pack1,
213
+ "httpd": pack2
214
+ }
215
+
216
+ # Create the index.html page. It's a table of content.
217
+ html_index_page(pages)
218
+
219
+ # HTML export of all documented classes.
220
+ for pack in pages:
221
+ for i in range(len(pages[pack])):
222
+ obj, page = pages[pack][i]
223
+ p = None if i == 0 else pages[pack][i-1][1]
224
+ n = None if i+1 == len(pages[pack]) else pages[pack][i+1][1]
225
+ print("{:s}".format(page))
226
+ obj_to_html(obj, page, prev_page=p, next_page=n)
227
+
@@ -6,7 +6,7 @@
6
6
 
7
7
  [project]
8
8
  name = "WhakerPy"
9
- version = "0.1"
9
+ version = "0.2"
10
10
  authors = [
11
11
  { name="Brigitte Bigi", email="develop@sppas.org" },
12
12
  ]
@@ -32,5 +32,10 @@ classifiers = [
32
32
  [build-system]
33
33
  requires = ["setuptools"]
34
34
 
35
+ #[tool.setuptools.packages.find]
36
+ #where = ["."]
37
+
35
38
  [tool.setuptools]
36
39
  packages = ["whakerpy"]
40
+
41
+