From 9bc47652d7a3199ee3aeeb3a90e790e065c7bfd6 Mon Sep 17 00:00:00 2001 From: kts Date: Fri, 28 Nov 2014 07:15:27 -0800 Subject: [PATCH] Paragraphs now generate conversion breaks. This is nice. --- documentation/kettext_define.ktx | 9 ++++ documentation/kettext_rules.ktx | 92 +++++++++++++++++++++++--------- kettext.pl | 4 +- 3 files changed, 79 insertions(+), 26 deletions(-) diff --git a/documentation/kettext_define.ktx b/documentation/kettext_define.ktx index 1915af4..77f2981 100644 --- a/documentation/kettext_define.ktx +++ b/documentation/kettext_define.ktx @@ -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! diff --git a/documentation/kettext_rules.ktx b/documentation/kettext_rules.ktx index 3aa51f7..880f00c 100644 --- a/documentation/kettext_rules.ktx +++ b/documentation/kettext_rules.ktx @@ -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**! diff --git a/kettext.pl b/kettext.pl index 1daf2dc..ab6abcc 100755 --- a/kettext.pl +++ b/kettext.pl @@ -357,7 +357,9 @@ if ($settings{'toc'}) { print("
\n"); } } elsif ($_->{type} == TYPE_PARAGRAPH) { - print("{opts} ? $_->{opts} : '').">$_->{text}

\n"); + my $text = $_->{text}; + $text =~ s/\n/
\n/g; + print("{opts} ? $_->{opts} : '').">$text

\n"); } elsif ($_->{type} == TYPE_PRE) { print("{opts} ? $_->{opts} : '').">$_->{text}\n"); } elsif ($_->{type} == TYPE_CODE) {