1
0
Эх сурвалжийг харах

#439 rename "reference" to "documentation"

Falko Schindler 2 жил өмнө
parent
commit
75810fa823

+ 2 - 2
CONTRIBUTING.md

@@ -87,7 +87,7 @@ pytest
 
 ## Documentation
 
-New features should be well documented in [website/reference.py](https://github.com/zauberzeug/nicegui/blob/main/website/reference.py).
+New features should be well documented in [website/documentation.py](https://github.com/zauberzeug/nicegui/blob/main/website/documentation.py).
 By calling the `element_example(...)` function with an element as a parameter the docstring is used as a description.
 The docstrings are written in restructured-text.
 
@@ -95,7 +95,7 @@ Because it has [numerous benefits](https://nick.groenen.me/notes/one-sentence-pe
 
 ### Demos
 
-Besides the documentation/reference (see above) we collect useful, but compact demonstrations.
+Besides the documentation (see above) we collect useful, but compact demonstrations.
 Each demo should be about one concept.
 Please try to make them as minimal as possible to show what is needed to get some kind of functionality.
 We are happy to merge pull requests with new demos which show new concepts, ideas or interesting use cases.

+ 1 - 1
README.md

@@ -75,7 +75,7 @@ Note: NiceGUI will automatically reload the page when you modify the code.
 
 ## Documentation and Examples
 
-The API reference is hosted at [https://nicegui.io/reference](https://nicegui.io/reference) and provides plenty of live examples.
+The documentation is hosted at [https://nicegui.io/documentation](https://nicegui.io/documentation) and provides plenty of live examples.
 The whole content of [https://nicegui.io](https://nicegui.io) is [implemented with NiceGUI itself](https://github.com/zauberzeug/nicegui/blob/main/main.py).
 
 You may also have a look at [our in-depth demonstrations](https://github.com/zauberzeug/nicegui/tree/main/examples) of what you can do with NiceGUI.

+ 16 - 16
main.py

@@ -18,15 +18,15 @@ import prometheus
 from nicegui import Client, app
 from nicegui import globals as nicegui_globals
 from nicegui import ui
-from website import demo_card, reference, svg
+from website import demo_card, documentation, svg
+from website.documentation_tools import create_anchor_name, element_example
 from website.example import bash_window, browser_window, python_window
-from website.reference_tools import create_anchor_name, element_example
 from website.star import add_star
 from website.style import example_link, features, heading, link_target, section_heading, side_menu, subtitle, title
 
 prometheus.start_monitor(app)
 
-# session middleware is required for demo in reference and prometheus
+# session middleware is required for demo in documentation and prometheus
 app.add_middleware(SessionMiddleware, secret_key='NiceGUI is awesome!')
 
 app.add_static_files('/favicon', str(Path(__file__).parent / 'website' / 'favicon'))
@@ -60,7 +60,7 @@ def add_header() -> None:
         'Features': '/#features',
         'Installation': '/#installation',
         'Examples': '/#examples',
-        'API Reference': '/reference',
+        'Documentation': '/documentation',
         'Demos': '/#demos',
         'Why?': '/#why',
     }
@@ -203,7 +203,7 @@ The command searches for `main.py` in in your current directory and makes the ap
         link_target('examples', '-50px')
         section_heading('Examples', 'Try *this*')
         with ui.column().classes('w-full'):
-            reference.create_intro()
+            documentation.create_intro()
 
     with ui.column().classes('dark-box p-8 lg:p-16 my-16'):
         with ui.column().classes('mx-auto items-center gap-y-8 gap-x-32 lg:flex-row'):
@@ -212,7 +212,7 @@ The command searches for `main.py` in in your current directory and makes the ap
                     .classes('text-white text-2xl md:text-3xl font-medium')
                 ui.html('Fun-Fact: This whole website is also coded with NiceGUI.') \
                     .classes('text-white text-lg md:text-xl')
-            ui.link('API reference', '/reference') \
+            ui.link('Documentation', '/documentation') \
                 .classes('rounded-full mx-auto px-12 py-2 text-white bg-white font-medium text-lg md:text-xl')
 
     with ui.column().classes('w-full p-8 lg:p-16 max-w-[1600px] mx-auto'):
@@ -288,30 +288,30 @@ The command searches for `main.py` in in your current directory and makes the ap
             svg.face().classes('stroke-white shrink-0 w-[200px] md:w-[300px] lg:w-[450px]')
 
 
-@ui.page('/reference')
-def reference_page():
+@ui.page('/documentation')
+def documentation_page():
     add_head_html()
     add_header()
     menu = side_menu()
     ui.add_head_html('<style>html {scroll-behavior: auto;}</style>')
     with ui.column().classes('w-full p-8 lg:p-16 max-w-[1250px] mx-auto'):
-        section_heading('Documentation and Examples', '*API* Reference')
+        section_heading('API Reference and Examples', '*NiceGUI* Documentation')
         ui.markdown(
-            'This is the API reference for NiceGUI >= 1.0. '
+            'This is the documentation for NiceGUI >= 1.0. '
             'Documentation for older versions can be found at [https://0.9.nicegui.io/](https://0.9.nicegui.io/reference).'
         ).classes('bold-links arrow-links')
-        reference.create_full(menu)
+        documentation.create_full(menu)
 
 
-@ui.page('/reference/{name}')
-def reference_page_more(name: str):
+@ui.page('/documentation/{name}')
+def documentation_page_more(name: str):
     add_head_html()
     add_header()
     with side_menu():
-        ui.markdown(f'[← back](/reference#{create_anchor_name(name)})').classes('bold-links')
+        ui.markdown(f'[← back](/documentation#{create_anchor_name(name)})').classes('bold-links')
     with ui.column().classes('w-full p-8 lg:p-16 max-w-[1250px] mx-auto'):
-        section_heading('Reference', f'ui.*{name}*')
-        module = importlib.import_module(f'website.more_reference.{name}_reference')
+        section_heading('Documentation', f'ui.*{name}*')
+        module = importlib.import_module(f'website.more_documentation.{name}_documentation')
         element_example(getattr(ui, name))(getattr(module, 'main_example'))
         getattr(module, 'more')()
 

+ 6 - 5
website/reference.py → website/documentation.py

@@ -3,8 +3,9 @@ from typing import Dict
 
 from nicegui import app, ui
 
+from .documentation_tools import (element_example, heading, intro_example, load_example, markdown, subheading,
+                                  text_example)
 from .example import bash_window, python_window
-from .reference_tools import element_example, heading, intro_example, load_example, markdown, subheading, text_example
 
 CONSTANT_UUID = str(uuid.uuid4())
 
@@ -39,7 +40,7 @@ def create_intro() -> None:
         with ui.row():
             ui.input('Text input', on_change=show)
             ui.select(['One', 'Two'], value='One', on_change=show)
-        ui.link('And many more...', '/reference').classes('mt-8')
+        ui.link('And many more...', '/documentation').classes('mt-8')
 
     @intro_example('Value Binding',
                    'Binding values between UI elements and data models is built into NiceGUI.')
@@ -647,12 +648,12 @@ def create_full(menu: ui.element) -> None:
         @ui.page('/other_page')
         def other_page():
             ui.label('Welcome to the other side')
-            ui.link('Back to main page', '/reference#page')
+            ui.link('Back to main page', '/documentation#page')
 
         @ui.page('/dark_page', dark=True)
         def dark_page():
             ui.label('Welcome to the dark side')
-            ui.link('Back to main page', '/reference#page')
+            ui.link('Back to main page', '/documentation#page')
 
         ui.link('Visit other page', other_page)
         ui.link('Visit dark page', dark_page)
@@ -746,7 +747,7 @@ def create_full(menu: ui.element) -> None:
         @ui.page('/yet_another_page')
         def yet_another_page():
             ui.label('Welcome to yet another page')
-            ui.button('RETURN', on_click=lambda: ui.open('reference#open'))
+            ui.button('RETURN', on_click=lambda: ui.open('documentation#open'))
 
         ui.button('REDIRECT', on_click=lambda: ui.open(yet_another_page))
 

+ 1 - 1
website/reference_tools.py → website/documentation_tools.py

@@ -101,5 +101,5 @@ def load_example(element_class: type) -> None:
     def pascal_to_snake(name: str) -> str:
         return re.sub(r'(?<!^)(?=[A-Z])', '_', name).lower()
     name = pascal_to_snake(element_class.__name__)
-    module = importlib.import_module(f'website.more_reference.{name}_reference')
+    module = importlib.import_module(f'website.more_documentation.{name}_documentation')
     element_example(element_class)(getattr(module, 'main_example'))

+ 0 - 0
website/more_documentation/__init__.py


+ 1 - 1
website/more_reference/table_reference.py → website/more_documentation/table_documentation.py

@@ -1,6 +1,6 @@
 from nicegui import ui
 
-from ..reference_tools import text_example
+from ..documentation_tools import text_example
 
 
 def main_example() -> None:

+ 0 - 1
website/more_reference/__init__.py

@@ -1 +0,0 @@
-from . import table_reference