Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
cab9495315 | |||
54e28c36d4 | |||
a8327b01f1 | |||
78078813de | |||
73204a00b0 |
0
lexipython/__init__.py
Normal file
0
lexipython/__init__.py
Normal file
@ -126,7 +126,7 @@ class LexiconArticle:
|
||||
while link_match:
|
||||
# Identify the citation text and cited article
|
||||
cite_text = link_match.group(2) if link_match.group(2) else link_match.group(3)
|
||||
cite_title = utils.titlecase(re.sub(r"\s+", " ", link_match.group(3)))
|
||||
cite_title = utils.titlecase(link_match.group(3).strip())
|
||||
# Record the citation
|
||||
cite = LexiconCitation(format_id, cite_text, cite_title)
|
||||
citations.append(cite)
|
||||
|
@ -435,13 +435,24 @@ def build_all(path_prefix, lexicon_name):
|
||||
os.remove(pathto("article", filename))
|
||||
print("Writing article pages...")
|
||||
l = len(articles)
|
||||
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
||||
env = Environment(loader=FileSystemLoader('lexipython/templates'), autoescape=select_autoescape(['html']))
|
||||
template = env.get_template("page-skeleton.html")
|
||||
for idx in range(l):
|
||||
article = articles[idx]
|
||||
with open(pathto("article", article.title_filesafe + ".html"), "w", encoding="utf-8", newline='') as f:
|
||||
content = article.build_default_content()
|
||||
article_html = page.format(
|
||||
title = article.title,
|
||||
content = content)
|
||||
#article_html = page.format(
|
||||
# title = article.title,
|
||||
# content = content)
|
||||
tmp = {
|
||||
"lexicon": "lexicon",
|
||||
"prompt": "prompt",
|
||||
"title": "title",
|
||||
"sidebar_rows": ["hello", "world"],
|
||||
"contentblocks": ["<h1>hello</h1>", "world"],
|
||||
}
|
||||
article_html = template.render(**tmp)
|
||||
f.write(article_html)
|
||||
print(" Wrote " + article.title)
|
||||
|
||||
|
@ -1,67 +1,32 @@
|
||||
<div class="contentblock">
|
||||
<ol>
|
||||
<li>Each Lexicon has a <i>topic statement</i> that sets the tone for the game.
|
||||
It provides a starting point for shaping the developing world of the
|
||||
Lexicon. As it is a starting point, don't feel contrained to write only
|
||||
about the topics mentioned directly in it.</li>
|
||||
<li>Articles are sorted under an <i>index</i>, a grouping of letters. An article is
|
||||
in an index if its first letter is in that group of letters. "The", "A",
|
||||
and "An" aren't counted in indexing. <i>Example: One of the indices is JKL.
|
||||
An article titled 'The Jabberwock' would index under JKL, not T's index.</i></li><ol>
|
||||
<li>Until the game is over, some of the articles will have been cited, but not
|
||||
yet written. These are called <i>phantom</i> articles. A phantom article has a
|
||||
title, which is defined by the first citation to it, but no content.</li>
|
||||
<li>Generally, an index has a number of "slots" equal to the number of players.
|
||||
When an article is first written or cited, it takes up one slot in its
|
||||
corresponding index.</li></ol>
|
||||
<li>Each turn, you will be assigned to write in an index.</li><ol>
|
||||
<li>Your articles should be written from the perspective of your character.
|
||||
Your character should be a scholar collaborating with the other
|
||||
scholars on the production of the Lexicon. You should play the same
|
||||
character for the duration of the game.</li>
|
||||
<li>If the index has open slots, you may come up with a new article title
|
||||
and write an article under that title. If all unwritten slots in your
|
||||
index are filled by phantom articles, you must choose one of them and
|
||||
write it.</li>
|
||||
<li>There are no hard and fast rules about style, but it is recommended
|
||||
that players imitate an encyclopedic style to stay true to the game's
|
||||
conceit.</li>
|
||||
<li>There are no hard and fast rules about length, but it is recommended
|
||||
that the Editor enforce a maximum word limit. In general, aiming for
|
||||
200-300 words is ideal.</li>
|
||||
<li>You must respect and not contradict the factual content of all written
|
||||
articles. You may introduce new facts that put things in a new light,
|
||||
provide alternative interpretations, or flesh out unexplained details
|
||||
in unexpected ways; but you must not <i>contradict</i> what has been
|
||||
previously established as fact. Use the "yes, and" rule from improv
|
||||
acting: accept what your fellow scholars have written and add to it in
|
||||
new ways, rather than trying to undo their work. This rule includes
|
||||
facts that have been established in written articles about the topics
|
||||
of phantom articles.</li></ol>
|
||||
<li>Each article will cite other articles in the Lexicon.</li><ol>
|
||||
<li>You may not cite an entry that you have written. When you write an
|
||||
article, you may not cite it in later articles.</li>
|
||||
<li>As a corollary, you may not write phantom articles that you have cited.
|
||||
If you cite an article and then write it later, your former article
|
||||
now cites you, which is forbidden per the above.</li>
|
||||
<li>On the first turn, there are no written articles. Your first article
|
||||
must cite <i>exactly two</i> phantom articles.</li>
|
||||
<li>On subsequent turns, your article must cite <i>exactly two</i> phantoms,
|
||||
but you can cite phantoms that already exist. Your article must also
|
||||
cite <i>at least one</i> written article. You can cite more than one.</li>
|
||||
<li>On the penultimate turn, you must cite <i>exactly one</i> phantom
|
||||
article and <i>at least two</i> written articles.</li>
|
||||
<li>On the final turn, you must cite <i>at least three</i> written articles.</li></ol>
|
||||
<li>As the game goes on, it may come to pass that a player must write an
|
||||
article in an index, but that index is full, and that player has already
|
||||
cited all the phantoms in it. When this happens, the player instead writes
|
||||
their article as <b>Ersatz Scrivener</b>, radical skeptic. Ersatz does not
|
||||
believe in the existence of whatever he is writing about, no matter how
|
||||
obvious it seems to others or how central it is in the developing history
|
||||
of the world. For Ersatz, all references, testimony, etc. with regard to
|
||||
its existence are tragic delusion at best or malicious lies at worst.
|
||||
Unlike the other scholars, Ersatz does not treat the research of his peers
|
||||
as fact, because he does not believe he has peers. Players writing articles
|
||||
as Ersatz are encouraged to lambast the amateur work of his misguided
|
||||
"collaborators".</li>
|
||||
</div>
|
||||
<li>Each Lexicon has a <b>topic statement</b> that sets the tone for the game. It provides a starting point for shaping the developing world of the Lexicon. As it is a starting point, don't feel contrained to write only about the topics mentioned directly in it.</li>
|
||||
<li>Articles are sorted under an <b>index</b>, a grouping of letters. An article is in an index if its first letter is in that group of letters. "The", "A", and "An" aren't counted in indexing. <i>Example: Two indices are JKL and TUV. An article titled 'The Jabberwock' would index under JKL, not TUV.</i></li>
|
||||
<ol>
|
||||
<li>Until the game is over, some of the articles will have been cited, but not yet written. These are called <b>phantom articles</b>. A phantom article has a title, which is defined by the first citation to it, but no content.</li>
|
||||
<li>Generally, an index has a number of "slots" equal to the number of players. When an article is first written or cited, it takes up one slot in its corresponding index.</li>
|
||||
</ol>
|
||||
<li>Each turn, you will be assigned to write in an index.</li>
|
||||
<ol>
|
||||
<li>Your articles should be written from the perspective of your character. Your character should be a scholar collaborating with the other scholars on the production of the Lexicon. You should play the same character for the duration of the game.</li>
|
||||
<li>If the index has open slots, you may come up with a new article title and write an article under that title. If all unwritten slots in your index are filled by phantom articles, you must choose one of them and write it.</li>
|
||||
<li>There are no hard and fast rules about style, but it is recommended that players imitate an encyclopedic style to stay true to the game's conceit.</li>
|
||||
<li>There are no hard and fast rules about length, but it is recommended that the Editor enforce a maximum word limit. In general, aiming for 200-300 words is ideal.</li>
|
||||
<li>You must respect and not contradict the factual content of all written articles. You may introduce new facts that put things in a new light, provide alternative interpretations, or flesh out unexplained details in unexpected ways; but you must not <i>contradict</i> what has been previously established as fact. Use the "yes, and" rule from improv acting: accept what your fellow scholars have written and add to it in new ways, rather than trying to undo their work.</li>
|
||||
<ol>
|
||||
<li>This rule includes facts that have been established in other, written articles about the topics of phantom articles. When you set out to write a phantom article, be sure to check what's been said about the topic already. Lexipython will list the articles that have cited your article.</li>
|
||||
</ol>
|
||||
</ol>
|
||||
<li>Each article will cite other articles in the Lexicon.</li>
|
||||
<ol>
|
||||
<li>You may not cite an entry that you have written. When you write an article, you may not cite it in later articles.</li>
|
||||
<li>As a corollary, you may not write phantom articles that you have cited. If you cite an article and then write it later, your former article now cites you, which is forbidden per the above.</li>
|
||||
<li>On the first turn, there are no written articles. Your first article must cite <b>exactly two</b> phantom articles.</li>
|
||||
<li>On subsequent turns, your article must cite <b>exactly two</b> phantoms, but you can cite phantoms that already exist. Your article must also cite <b>at least one</b> written article. You can cite more than one.</li>
|
||||
<li>On the penultimate turn, you must cite <b>exactly one</b> phantom article and <b>at least two</b> written articles.</li>
|
||||
<li>On the final turn, you must cite <b>at least three</b> written articles.</li>
|
||||
</ol>
|
||||
<li>As the game goes on, it may come to pass that a player must write an article in an index, but that index is full, and that player has already cited all the phantoms in it. When this happens, the player instead writes their article as <b>Ersatz Scrivener</b>, radical skeptic. Ersatz does not believe in the existence of whatever he is writing about, no matter how obvious it seems to others or how central it is in the developing history of the world. For Ersatz, all references, testimony, etc. with regard to its existence are tragic delusion at best or malicious lies at worst. Unlike the other scholars, Ersatz does not treat the research of his peers as fact, because he does not believe he has peers. Players writing articles as Ersatz are encouraged to lambast the amateur work of his misguided "collaborators".</li>
|
||||
<li>Finally, the rules are always subject to the discretion of the Editor.</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
8
lexipython/server.py
Normal file
8
lexipython/server.py
Normal file
@ -0,0 +1,8 @@
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def root():
|
||||
return "yello"
|
||||
|
24
lexipython/templates/page-skeleton.html
Normal file
24
lexipython/templates/page-skeleton.html
Normal file
@ -0,0 +1,24 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{{title}} | {{lexicon}}</title>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../lexicon.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<h2 id="title">{{lexicon}}</h2>
|
||||
<p>{{prompt}}</p>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<table>{% for row in sidebar_rows %}
|
||||
<tr><td>{{row}}</td></tr>{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<div id="content">{% for contentblock in contentblocks %}
|
||||
<div class="contentblock">{{contentblock}}</div>{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
22
server.py
Normal file
22
server.py
Normal file
@ -0,0 +1,22 @@
|
||||
from lexipython.server import app as server
|
||||
server.run()
|
||||
|
||||
|
||||
|
||||
import argparse
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--run", action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if args.run:
|
||||
from flaskapp import app
|
||||
app.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
else:
|
||||
print(__name__)
|
Loading…
Reference in New Issue
Block a user