Added text/prose Type

Christopher Vollick [2011-12-13 01:33]
Added text/prose Type

The <pre> </pre> bits weren't really what I wanted.
This is much better.

I turn each group separated by a blank newline as a stanza and then each
source line in that becomes a line in the output.

It preserves the bits of the formatting I care about, while allowing the
browser to still do things with it.

It also ends up with a lot more metadata about stanzas and lines...
That's good, right?

I converted "Someone I Want" over to this new type, and added the css
required to make it formatted like I want.
diff --git a/someone_i_want.mime b/someone_i_want.mime
index ca9c62d..384d135 100644
--- a/someone_i_want.mime
+++ b/someone_i_want.mime
@@ -1,5 +1,5 @@
 Title: Someone I Want
-Content-Type: text/plain
+Content-Type: text/prose
 Tag: main
 Tag: poetry

diff --git a/static/style.css b/static/style.css
index 6fda2f4..fc1cbd7 100644
--- a/static/style.css
+++ b/static/style.css
@@ -87,3 +87,7 @@ P {
 	padding-bottom: 0;
 	margin-bottom: 0;
+.stanza .line {
+	display: block;
diff --git a/text_prose.typeconvert b/text_prose.typeconvert
new file mode 100755
index 0000000..fb20505
--- /dev/null
+++ b/text_prose.typeconvert
@@ -0,0 +1,9 @@
+# Turn all lines into spans with class "line"
+# Then put <p> around each group.
+# Not ideal, but good enough for now.
+echo '<p class="stanza">'
+cat | sed 's/&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g' | sed 's_^$_</p>&<p class="stanza">_' | sed '/^[^<]/s_.*_<span class="line">&</span>_'
+echo '</p>'