Skip to content

Commit 5024fbc

Browse files
committed
fixes #79
1 parent 1cadeb8 commit 5024fbc

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
<!-- do not remove -->
44

5+
## 0.1.9
6+
7+
### New Features
8+
9+
- Add `htmlkw` param to `FastHTML` ([#78](https://github.com/AnswerDotAI/fasthtml/issues/78))
10+
11+
12+
513
## 0.1.8
614

715
### New Features

fasthtml/xtend.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def undouble_braces(s):
144144
# %% ../nbs/02_xtend.ipynb
145145
def loose_format(s, **kw):
146146
"String format `s` using `kw`, without being strict about braces outside of template params"
147+
if not kw: return s
147148
return undouble_braces(partial_format(double_braces(s), **kw)[0])
148149

149150
# %% ../nbs/02_xtend.ipynb
@@ -157,6 +158,7 @@ def ScriptX(fname, type=None, _async=None, defer=None, charset=None, crossorigin
157158
# %% ../nbs/02_xtend.ipynb
158159
def replace_css_vars(css, pre='tpl', **kwargs):
159160
"Replace `var(--)` CSS variables with `kwargs` if name prefix matches `pre`"
161+
if not kwargs: return css
160162
def replace_var(m):
161163
var_name = m.group(1).replace('-', '_')
162164
return kwargs.get(var_name, m.group(0))

nbs/02_xtend.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@
606606
"#| export\n",
607607
"def loose_format(s, **kw):\n",
608608
" \"String format `s` using `kw`, without being strict about braces outside of template params\"\n",
609+
" if not kw: return s\n",
609610
" return undouble_braces(partial_format(double_braces(s), **kw)[0])"
610611
]
611612
},
@@ -635,6 +636,7 @@
635636
"#| export\n",
636637
"def replace_css_vars(css, pre='tpl', **kwargs):\n",
637638
" \"Replace `var(--)` CSS variables with `kwargs` if name prefix matches `pre`\"\n",
639+
" if not kwargs: return css\n",
638640
" def replace_var(m):\n",
639641
" var_name = m.group(1).replace('-', '_')\n",
640642
" return kwargs.get(var_name, m.group(0))\n",
@@ -757,7 +759,7 @@
757759
},
758760
{
759761
"cell_type": "code",
760-
"execution_count": null,
762+
"execution_count": 1,
761763
"id": "d211e8e2",
762764
"metadata": {},
763765
"outputs": [],
@@ -777,9 +779,21 @@
777779
],
778780
"metadata": {
779781
"kernelspec": {
780-
"display_name": "python3",
782+
"display_name": "Python 3 (ipykernel)",
781783
"language": "python",
782784
"name": "python3"
785+
},
786+
"language_info": {
787+
"codemirror_mode": {
788+
"name": "ipython",
789+
"version": 3
790+
},
791+
"file_extension": ".py",
792+
"mimetype": "text/x-python",
793+
"name": "python",
794+
"nbconvert_exporter": "python",
795+
"pygments_lexer": "ipython3",
796+
"version": "3.11.8"
783797
}
784798
},
785799
"nbformat": 4,

nbs/03_oauth.ipynb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
"- eval: false"
2121
]
2222
},
23+
{
24+
"cell_type": "markdown",
25+
"id": "507cd009",
26+
"metadata": {},
27+
"source": [
28+
"- **NB**: *This is an incomplete draft of an OAuth framework for FastHTML. It's not working yet.*"
29+
]
30+
},
2331
{
2432
"cell_type": "code",
2533
"execution_count": null,
@@ -324,9 +332,21 @@
324332
],
325333
"metadata": {
326334
"kernelspec": {
327-
"display_name": "python3",
335+
"display_name": "Python 3 (ipykernel)",
328336
"language": "python",
329337
"name": "python3"
338+
},
339+
"language_info": {
340+
"codemirror_mode": {
341+
"name": "ipython",
342+
"version": 3
343+
},
344+
"file_extension": ".py",
345+
"mimetype": "text/x-python",
346+
"name": "python",
347+
"nbconvert_exporter": "python",
348+
"pygments_lexer": "ipython3",
349+
"version": "3.11.8"
330350
}
331351
},
332352
"nbformat": 4,

0 commit comments

Comments
 (0)