ttcMD: added a cleanup step to make sure that line endings are as we expect,

fixes p blocks not replacing line breaks with spaces leading to unintentional linguistic collisions
This commit is contained in:
Emmaline Autumn 2024-03-15 23:09:41 -06:00
parent 30a1c74711
commit 16497edd46
3 changed files with 21 additions and 16 deletions

View File

@ -104,7 +104,7 @@ export const buildOnlyDefaultElements = () => {
debugger;
return (
<span className="whitespace-pre-wrap">
{t.content.replaceAll("\\n", "\n")}
{t.content.replaceAll(/\\n ?/g, "\n")}
</span>
);
});
@ -509,9 +509,9 @@ export const buildOnlyDefaultElements = () => {
},
);
registerIdentifier("p", /(?<=\n\n)([\s\S]*?)(?=\n\n)/g, (s, rx) => {
registerIdentifier("p", /(?<=\n\n)([\s\S]*?)(?=\n\n)/g, (s) => {
return {
content: s,
content: s.replace("\n", " "),
raw: s,
metadata: {},
uuid: crypto.randomUUID(),

View File

@ -11,6 +11,8 @@ export const createElements = (body: string): Token[] => {
const tokenize = (body: string) => {
const tokenizedBody: TokenMarker[] = [];
body = body.replaceAll(/[ \t]+\n/g, "\n");
const addToken = (thing: TokenMarker) => {
tokenizedBody.push(thing);
};

View File

@ -1,10 +1,13 @@
[[
Tabletop Commander (TC) is a rules-and-tools app for tabletop games - board, card, war, role-playing, you name it! It is the spiritual successor of Chapter Master by Emmaline Autumn, a Warhammer 40,000 9th Edition rules reference and game helper.
Tabletop Commander (TTC) is a rules-and-tools app for tabletop games - board, card, war, role-playing, you name it! It is the spiritual successor of Chapter Master by Emmaline Autumn, a Warhammer 40,000 9th Edition rules reference and game helper.
Emma decided to move on from Chapter Master as her interest in 40k was supplanted by the greater wargaming hobby after the release of 10th edition made clear that Chapter Master was too inflexible and tedious to work on.
See, Emma had a vision that anyone could contribute to making rules corrections so that anyone could have all of the rules as they currently exist. This ballooned into the idea that you could have all the rules as they existed at *any time*
See, Emma had a vision that anyone could contribute to making rules corrections so that anyone could have all of the rules as they currently exist. This ballooned into the idea that you could have all the rules as they existed at *any point in time.* As soon as she realized that every code change either needed to keep that backward compatibility in mind or would cause the data to no longer be usable, she decided to drop Chapter Master entirely.
It didn't sit right with her. A big project no longer being worked on and a dead dream. Enter Tabletop Commander. Inspired by the flexibility of Battlescribe and disappointed in its features and lack of updates, Emma started designing a new system, from the ground up, that can be used to build almost anything.
]]
[][][]
@ -13,7 +16,7 @@ See, Emma had a vision that anyone could contribute to making rules corrections
### Game Systems
The basis of TC is called a Game System Package. This package
The basis of TTC is called a Game System Package. This package
includes everything needed for a game system, including schemas,
publications, and tools. Players can follow a Game System to get
consistently updated content publications, or fork it to
@ -41,18 +44,18 @@ enough approvals, you can even be the one to merge it in!
### Schemas
Those who have studied English or databases, you would know that
a schema is a structural pattern. TC aims to provide a simple,
a schema is a structural pattern. TTC aims to provide a simple,
user-edited and maintained schema system for *any* game.
If that flew over your head, don&apos;t worry. Others can share
the schemas they&apos;ve made with everyone, which come as part
If that flew over your head, don't worry. Others can share
the schemas they've made with everyone, which come as part
of a Game System package that you can fork or follow to get both
content and schemas ready to use.
**For the techies:**
The schema system makes use of a powerful custom query language
(tcQuery) I designed. By writing queries directly into the
(ttcQuery) I designed. By writing queries directly into the
schema, we can reduce the amount of re-written content, while
maintaining the presence of data anywhere we need it.
@ -65,7 +68,7 @@ maintaining the presence of data anywhere we need it.
### Publications
Publications are the actual content of the rules. They
don&apos;t just contain the content, but also the style in which
don't just contain the content, but also the style in which
the content is shown.
Content can include text, images, and even video (through
@ -75,7 +78,7 @@ parts of the publication through context based pop-overs.
**For the techies (again):**
Publications use an enhanced markdown syntax (ttcMD) that
implements tcQuery, and adds a bit of custom syntax for things
implements ttcQuery, and adds a bit of custom syntax for things
like pop-overs and styling hints for rendering.
The styling aspect is similar to a very trimmed down CSS, but