Skip to content

Commit

Permalink
Documentation fixes for RC1 (#7228)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Sep 5, 2024
1 parent f4192ee commit 7ffa91a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 18 deletions.
3 changes: 1 addition & 2 deletions doc/how_to/custom_components/esm/custom_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ split_anywidget = SplitAnyWidget(
)
split_anywidget.servable()
```
:::

::::

Expand All @@ -264,8 +265,6 @@ split_react.right=pn.pane.Markdown("Hi. I'm a `Markdown` pane replacing the `Cod
```
:::

:::

:::{tab-item} `AnyWidgetComponent`
```{pyodide}
split_anywidget.right=pn.pane.Markdown("Hi. I'm a `Markdown` pane replacing the `CodeEditor` widget!", sizing_mode="stretch_both")
Expand Down
14 changes: 3 additions & 11 deletions doc/how_to/custom_components/reactive_html/reactive_html_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,8 @@ The component will trigger a rerendering if you update the `List` value.

You must

- wrap the `{% for object in objects %}` loop in an HTML element with an `id`. Here it is wrapped
with `<div id="container">...</div>`.
- close all HTML tags! `<hr>` is valid HTML, but not valid with `ReactiveHTML`. You must close it
as `<hr/>`.
- wrap the `{% for object in objects %}` loop in an HTML element with an `id`. Here it is wrapped with `<div id="container">...</div>`.
- close all HTML tags! `<hr>` is valid HTML, but not valid with `ReactiveHTML`. You must close it as `<hr/>`.

You can optionally

Expand Down Expand Up @@ -232,11 +230,9 @@ You can now use `[...]` indexing and the `.append`, `.insert`, `pop`, ... method
expect.

:::{note}

You must list `ListLike, ReactiveHTML` in exactly that order when you define the class! The other
way around `ReactiveHTML, NamedListLike` will not work.

::::
:::

## Layout a dictionary

Expand Down Expand Up @@ -271,10 +267,6 @@ LayoutOfDict(object={
```

:::{note}

Please note

- We can insert the `key` as a literal value only using `{{ key }}`. Inserting it as a template variable `${key}` will not work.
- We must not give the HTML element containing `{{ key }}` an `id`. If we do, an exception will be raised.

:::
1 change: 1 addition & 0 deletions doc/how_to/editor/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def hello_world(text):
pn.Row(widget, pn.bind(hello_world, widget)).servable()
```
````
:::

Then, from the command line, launch a server with:

Expand Down
2 changes: 1 addition & 1 deletion doc/how_to/extending_panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta http-equiv='refresh' content='0; URL=./index.html#extending-panel>
</head>

# Test and debug
# Extending Panel

```{toctree}
:titlesonly:
Expand Down
2 changes: 2 additions & 0 deletions doc/how_to/integrations/FastAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ conda install fastapi
```
:::

::::

## Create a FastAPI application

Start by creating a FastAPI application. In this application, we will define a root endpoint that returns a simple JSON response. Open your text editor or IDE and create a file named main.py:
Expand Down
2 changes: 1 addition & 1 deletion doc/how_to/templates/template_theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ template.main.append(
)
template.servable();
```
::::
:::

Now, we can activate this app on the command line:

Expand Down
2 changes: 1 addition & 1 deletion doc/pyodide_dependencies.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"gallery/altair_brushing.ipynb": ["altair"],
"gallery/gapminders.ipynb": ["altair", "plotly", "hvplot"],
"gallery/gapminders.ipynb": ["altair", "plotly", "hvplot", "matplotlib"],
"gallery/glaciers.ipynb": ["holoviews", "colorcet", "hvplot"],
"gallery/hvplot_explorer.ipynb": ["hvplot", "scipy"],
"gallery/iris_kmeans.ipynb": ["hvplot", "scikit-learn"],
Expand Down
4 changes: 2 additions & 2 deletions panel/io/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def convert_apps(
compiled: bool
Whether to use the compiled and faster version of Pyodide.
"""
if isinstance(apps, str):
if isinstance(apps, (str, os.PathLike)):
apps = [apps]
if dest_path is None:
dest_path = pathlib.Path('./')
Expand All @@ -563,7 +563,7 @@ def convert_apps(
for app in apps:
matches = [
deps for name, deps in requirements.items()
if app.endswith(name.replace(os.path.sep, '/'))
if str(app).endswith(name.replace(os.path.sep, '/'))
]
app_requirements[app] = matches[0] if matches else 'auto'
else:
Expand Down
25 changes: 25 additions & 0 deletions panel/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,28 @@ def test_markdown_codeblocks(file, tmp_path):
f.writelines(lines)

runpy.run_path(str(mod))


@doc_available
@pytest.mark.parametrize(
"file", doc_files, ids=[str(f.relative_to(DOC_PATH)) for f in doc_files]
)
def test_colon_blocks_symmetric(file):
stack = []
for i, line in enumerate(file.read_text(encoding='utf-8').splitlines(), 1):
if ':::::' in line:
# Not checking triple nesting
stack.clear()
break
elif '::::' in line:
if stack:
assert stack[-1] == '::::', f'Expected ::: on line {i}, found ::::'
stack.pop()
else:
stack.append('::::')
elif ':::' in line:
if not stack or stack[-1] == '::::':
stack.append(':::')
else:
stack.pop()
assert not stack, 'Colon blocks were not symmetric, ensure all blocks were closed'

0 comments on commit 7ffa91a

Please sign in to comment.