Spaces:
Sleeping
Sleeping
Bor Hodošček
commited on
fix: graceful fallback
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
|
25 |
import marimo
|
26 |
|
27 |
-
__generated_with = "0.14.
|
28 |
app = marimo.App(width="full", app_title="Scattertext on English novels")
|
29 |
|
30 |
with app.setup:
|
@@ -100,7 +100,12 @@ def function_export():
|
|
100 |
E.g., 'e-r-eddison_the-worm-ouroboros.txt' -> 'ERE-TWO'.
|
101 |
"""
|
102 |
stem = _strip_advanced(fn)
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
104 |
initials = lambda s: "".join(part[0].upper() for part in s.split("-"))
|
105 |
return f"{initials(author)}-{initials(title)}"
|
106 |
|
|
|
24 |
|
25 |
import marimo
|
26 |
|
27 |
+
__generated_with = "0.14.10"
|
28 |
app = marimo.App(width="full", app_title="Scattertext on English novels")
|
29 |
|
30 |
with app.setup:
|
|
|
100 |
E.g., 'e-r-eddison_the-worm-ouroboros.txt' -> 'ERE-TWO'.
|
101 |
"""
|
102 |
stem = _strip_advanced(fn)
|
103 |
+
fields = stem.split("_", 1)
|
104 |
+
if len(fields) == 2:
|
105 |
+
author, title = fields
|
106 |
+
else:
|
107 |
+
author = fields[0]
|
108 |
+
title = fields[0]
|
109 |
initials = lambda s: "".join(part[0].upper() for part in s.split("-"))
|
110 |
return f"{initials(author)}-{initials(title)}"
|
111 |
|