Paragraphs now generate conversion breaks. This is nice.

master
kts 2014-11-28 07:15:27 -08:00
parent 4b57eaef6f
commit 9bc47652d7
3 changed files with 79 additions and 26 deletions

View File

@ -12,3 +12,12 @@ kettext...
* **contributions and enhancements are //promoted//**
Most of all, kettext provides a general syntax that strives to keep your markup __clean__ and easy to maintain.
A clean example:
#,,,,,,,,,,,,,,,,
#A Section!
#````````````````
#This seems kinda **neat**!
#
# * Oh
# * My!

View File

@ -45,27 +45,25 @@ The placement of formatters varies between the elements, but the general syntax
,,,,,,,,,,,,,,,,,,,,,,,,
2. Font styling and anchors
````````````````````````
Font may be styled in any of the following manners:
Font may be styled by surrounding a section of text around specific delimiters.
**example:**
# I am **bold**, but I can also be //italic//
#
# I am also ((small))!
#
# I may also contain ``code``!
#
# I can also be an [[anchor]], but you need an [[href]].href(#Font_styling_and_anchors)!
I am **bold**, but I can also be //italic//
I am also ((small))!
I may also contain ``code``!
I can also be an [[anchor]], but you need an [[href]].href(#Font_styling_and_anchors)!
----
Styled text may have formatters appended to them:
**example:**
# **bold**.class(super_bold)
**bold**.class(super_bold)
@ -73,6 +71,8 @@ Styled text may have formatters appended to them:
----
If using an HTML convertor, you can pass CSS styling directly:
**example:**
# **bold**.style(font-size:16pt;color:#AA2299;)
**bold**.style(font-size:16pt;color:#AA2299;)
@ -94,49 +94,70 @@ Header contents may have //text styling// applied.
,,,,,,,,,,,,,,,,
Small Headers
````````````````
Small headers are similar to other markup languages' headers, but are more flexible due to kettext's inherent design.
Small headers are similar to other markup languages' headers, but allow for more flexibility in plain text.
**example**:
#==== //Example Header// =====
==== //Example Header// ====
#==== //My Header// =====
==== //My Header// ====
----
Headers may use any character to signify their lead or close:
#~~~~ My Tilde'd Header ~~~~
~~~~ My Tilde'd Header ~~~~
**example**:
#~~~~ Example Tilde'd Header ~~~~
~~~~ Example Tilde'd Header ~~~~
----
Headers do not require a close:
#==== My Header Without Close
==== My Header Without Close
**example**:
#==== Example Header Without Close
==== Example Header Without Close
----
If the close-style is used, the close must match the lead:
#==== Header Without Close ----
==== Header Without Close ----
**example**:
#==== Example Header Without Close ----
==== Example Header Without Close ----
----
Formatters are applied at the end of the header content:
#==== Header With Formatter .class(alt_header) ====
==== Header With Formatter .class(alt_header) ====
Formatters are applied at the end of the header content.
#==== Header With Formatter .class(alt_header)
==== Header With Formatter .class(alt_header)
**example**:
#==== Example Header With Formatter .class(alt_header) ====
==== Example Header With Formatter .class(alt_header) ====
#==== Example Header With Formatter .class(alt_header)
==== Example Header With Formatter .class(alt_header)
,,,,,,,,,,,,,,,,
Big Headers
````````````````
Big headers are headers that span 3 lines and may have a more stylized visual. They are also the preferred header style of the author.
**example**:
#,,,,,,,,,,,,
#Big Header
#Example Big Header
#````````````
,,,,,,,,,,,,
Big Header
Example Big Header
````````````
----
Big headers can use any character for the head and the lead. They are not required to match.
**example**:
#____________
#//Big Header//
#------------
@ -145,6 +166,9 @@ ____________
------------
----
Formatters are placed at the end of the content line:
**example**:
#,,,,,,,,,,,,
#Big Header .class(big_alt)
#````````````
@ -160,6 +184,9 @@ Text blocks are a larger collection of text that may or may not span multiple li
Paragraph
````````````````
A paragraph is a section of text that spans one or more lines. A section of text will continue as a single paragraph until an empty line is found.
**example:**
# This is a multi-line paragraph
# that continues to here.
#
@ -170,13 +197,22 @@ that continues to here.
This is a **second paragraph**, note the above empty line.
----
Formatters may be applied by having a separate formatter line at the start of the paragraph:
Formatters may be applied by having a separate formatter line at the start of the paragraph.
**example:**
# .class(alt_paragraph)
# This is a formatted paragraph.
.class(alt_paragraph)
This is a formatted paragraph.
,,,,,,,,,,,,,,,,
Preformatted
````````````````
Preformatted text is a section of text that is unprocessed by kettext and put within its own paragraph-like section. Every line must be indented by a tab, 2 spaces, or 4 spaces.
**example:**
# .class(alt_pre)
# This is preformatted text and
# it can span multiple lines.
@ -194,6 +230,9 @@ Preformatted text is a section of text that is unprocessed by kettext and put wi
Code
````````````````
Code text is a section of text that is also unprocessed by kettext and follows the same general rules as preformatted. Every line must be indented by a tab, 2 spaces, or 4 spaces, and followed by a '#'.
**example:**
# #.class(alt_code)
# #This is code text and
# #it can span multiple lines as well.
@ -210,7 +249,10 @@ Code text is a section of text that is also unprocessed by kettext and follows t
,,,,,,,,,,,,,,,,
Blockquotes
````````````````
Blockquotes are unprocessed sections of quoted text. They are signified by the first character of a line being a '>':
Blockquotes are unprocessed sections of quoted text. They are signified by the first character of a line being a '>'.
**example:**
#>.class(alt_block)
#> This is a block quote. If blockquote.parse is not set, //font styling// is **ignored**!

View File

@ -357,7 +357,9 @@ if ($settings{'toc'}) {
print("<br />\n");
}
} elsif ($_->{type} == TYPE_PARAGRAPH) {
print("<p".($_->{opts} ? $_->{opts} : '').">$_->{text}</p>\n");
my $text = $_->{text};
$text =~ s/\n/<br>\n/g;
print("<p".($_->{opts} ? $_->{opts} : '').">$text</p>\n");
} elsif ($_->{type} == TYPE_PRE) {
print("<pre".($_->{opts} ? $_->{opts} : '').">$_->{text}</pre>\n");
} elsif ($_->{type} == TYPE_CODE) {