2 stable releases

1.1.0 Nov 5, 2022
1.0.0 Aug 28, 2021

#3 in #story

Custom license

105KB
1.5K SLoC

ogam

What is ogam?

Typographic rules can be trick to enforce in a consistent manner in a document. In French, typographic rules for dialogues are arguably worst. ogam is a domain-specific markup language, intended to free fiction writers from the pain to enforce typographic rules within their productions manually.

Additionally, ogam allows to annotate one’s text with metadata. For instance, it is possible to indicate what character is speaking a given line of dialogue. This paves the road towards being able to discoverability, e.g., finding the list of scenes wherein a given character speaks.

The Language

Formatting

This is a regular sentence.
<p>This is a regular sentence.</p>

This is a regular sentence.


*This is a sentence with emphasize.*</p>
<p><em>This is a regular sentence.</em></p>

This is a regular sentence.


+This is a sentence with strong emphasize.+</p>
<p><strong>This is a sentence with strong emphasize.</strong></p>

This is a sentence with strong emphasize.


This +is+ a *sentence with +multiple emphasizes+*.
<p>This <strong>is</strong> a <em>sentence with <strong>multiple emphasizes</strong></em>.</p>

This is a sentence with multiple emphasizes.


"This is a +quote+."
<p>“This is a <strong>quote</strong>.”</p>

“This is a quote.”


This +is an "incorrect+" sentence.
<p>This <span class="illformed_inline">+is an "incorrect+" sentence.</span></p>

This +is an "incorrect+"
sentence.
<p>This <span class="illformed_inline">+is an "incorrect+"</span> sentence.</p>

Dialogues

[Hi,| she says.|](Clara)
<p><span class="dialogue by-Clara"><span class="reply">Hi,</span>” she says.</span></p>

Hi, she says.


[Hi,| she says.| How are you?](Clara)
<p><span class="dialogue by-Clara"><span class="reply">Hi,</span> she says. <span class="reply">How are you?</span></span></p>

Hi, she says. How are you?


[Hi,| she says.| How are you?](Clara) [I'm fine, thanks.]
<p><span class="dialogue by-Clara"><span class="reply">Hi,</span> she says. <span class="reply">How are you?</span></span></p><p><span class="dialogue"><span class="reply">I’m fine, thanks.</span></span></p>

Hi, she says. How are you?

I’m fine, thanks.


[Hi,| she says.| How are you?](Clara) She was smiling. [I'm fine, thanks.]
<p><span class="dialogue by-Clara"><span class="reply">Hi,</span> she says. <span class="reply">How are you?</span></span> She was smiling. <span class="dialogue"><span class="reply">I’m fine, thanks.</span></span></p>

Hi, she says. How are you? She was smiling. I’m fine, thanks.


It was a hot day. [Hi!| he said.](Aaron)
His friends smiled.
<div><p>It was a hot day.<span class="illformed_inline">[Hi!| he said.](Aaron)</span> His friends smiled. </p></div>

It was a hot day.[Hi!| he said.](Aaron) His friends smiled.

Paragraphs

This is a first paragraph.

This is a second paragraph.
<div><p>This is a first paragraph.</p><p>This is a second paragraph</p>

This is a first paragraph.

This is a second paragraph


[Ceci est une première ligne de dialogue.]

[Ceci est une autre ligne de dialogue.]
<div><p><span class="dialogue">«&nbsp;<span class="reply">Ceci est une première ligne de dialogue.</span></span></p><p><span class="dialogue"><span class="reply">Ceci est une autre ligne de dialogue.</span></span></p></div>

« Ceci est une première ligne de dialogue.

Ceci est une autre ligne de dialogue.

The Implementations

A first implementation of an ogamogmarkup at this time– parser and compiler has been written in Haskell, and has been published on hackage (MIT).

This first project has been deprecated in favor of this rewriting in Rust. Contrary to its predecessor, ogam is released under the terms of the MPL 2.0.

Dependencies

~0.8–1.3MB
~24K SLoC