diff '--exclude=.vcs' -uNr ./.vcs/ref/COPYING ./COPYING --- ./.vcs/ref/COPYING 1970-01-01 10:00:00.000000000 +1000 +++ ./COPYING 2020-05-01 19:32:50.602005468 +1000 @@ -0,0 +1,31 @@ +Copyright (c) 2020 Oreamnos, All rights reserved. + +Redistribution and use in source and binary forms, without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +Redistribution and use in source and binary forms, with modification, are +permitted provided that the following conditions are met: + + 1. Said modifications are subject to the terms of this license. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff '--exclude=.vcs' -uNr ./.vcs/ref/readme ./readme --- ./.vcs/ref/readme 1970-01-01 10:00:00.000000000 +1000 +++ ./readme 2020-05-02 10:01:01.070810796 +1000 @@ -0,0 +1,25 @@ +Shit +==== +Shit (Shit hopefully isn't troff) is a typesetting/documenting system, inspired by troff. + +Installation +============ +make install + +Usage +===== +shit < file.shit | output-format > file.whatever + +Contributing +============ +Contribution is welcome, +Email me a patch, explaining what is does, and your reasoning + +Contacting +========== +You can find my contact information at: +gopher://tilde.club/1/~oreamnos + +License +======= +See COPYING file diff '--exclude=.vcs' -uNr ./.vcs/ref/shit ./shit --- ./.vcs/ref/shit 1970-01-01 10:00:00.000000000 +1000 +++ ./shit 2020-05-02 09:17:56.300697732 +1000 @@ -0,0 +1,75 @@ +#!/usr/bin/awk -f + +BEGIN { + FS="\n" + italic=0; + bold=0; + underline=0 +} + +{ + for(i=1; i<=NF; i++) + { + if (substr($0,1) ~ /[.]/) { + printf "macr "; + print substr($0,2) + } else { + printf "text "; + split($i, chars, "") + for (x=1; x <= length($i); x++) { + if (substr(chars[x],1) ~ /\\/) { + x++ + printf("%s", chars[x]) + } + else if (substr(chars[x],1) ~ /\*/) { + if (italic == 0) { + italic=1; + printf("\nsita\ntext ") + } else { + italic=0 + printf("\neita\ntext ") + } + + } + else if (substr(chars[x],1) ~ /&/) { + if (bold == 0) { + bold=1; + printf("\nsbld\ntext ") + } else { + bold=0 + printf("\nebld\ntext ") + } + + } + else if (substr(chars[x],1) ~ /_/) { + if (underline == 0) { + underline=1; + printf("\nsund\ntext ") + } else { + underline=0 + printf("\neund\ntext ") + } + + } + else if (substr(chars[x],1) ~ /-/) { + if (underline == 0) { + underline=1; + printf("\nsstk\ntext ") + } else { + underline=0 + printf("\nestk\ntext ") + } + + } + else { + printf("%s", chars[x]) + } + } + printf("\n") + } + } +} + +END { + printf("EOF") +} \ No newline at end of file diff '--exclude=.vcs' -uNr ./.vcs/ref/shit2html ./shit2html --- ./.vcs/ref/shit2html 1970-01-01 10:00:00.000000000 +1000 +++ ./shit2html 2020-05-02 09:39:12.117420132 +1000 @@ -0,0 +1,106 @@ +#!/usr/bin/awk -f + +BEGIN { + FS=" " + LF=1 +} + +function paragraph() { + printf("<p>\n") + while (1) { + getline + if (($0 == "EOF") || ($0 == "macr PP")) {break} + if ($1 == "text") { + if (LF == 1) {printf "<br>"} + LF = 1 + # $1 = "" + # print + for (x=2; x <= NF; x++) { + printf("%s", $x) + if (x != NF) {printf " "} + } + } + # italics + else if ($1 == "sita") { + printf(" <i>") + LF = 0 + } + else if ($1 == "eita") { + printf("</i>") + LF = 0 + } + # bold + else if ($1 == "sbld") { + printf(" <b>") + LF = 0 + } + else if ($1 == "ebld") { + printf("</b>") + LF = 0 + } + # underline + else if ($1 == "sund") { + printf(" <u>") + LF = 0 + } + else if ($1 == "eund") { + printf("</u>") + LF = 0 + } + # striken + else if ($1 == "sstk") { + printf(" <del>") + LF = 0 + } + else if ($1 == "estk") { + printf("</del>") + LF = 0 + } + # unordered list + else if ($0 == "macr UL") { + printf(" <ul>") + while (1) { + getline + if (($0 == "EOF") || ($0 == "macr PP")) {break} + if ($0 != "macr UL") { + $1="" + printf("<li>%s</li>", $0) + } + } + printf("</ul>") + } + # ordered list + else if ($0 == "macr OL") { + printf(" <ol>") + while (1) { + getline + if (($0 == "EOF") || ($0 == "macr PP")) {break} + if ($0 != "macr OL") { + $1="" + printf("<li>%s</li>", $0) + } + } + printf("</OL>") + } + } + printf("</p>\n") + return +} + +/^macr TL$/{ + getline + $1 = "" + printf("<title>%s</title>\n", $0) + printf("<h1>%s</h1>\n", $0) +} + +/^macr AU$/{ + getline + $1 = "" + printf("<p>By%s</p>\n", $0) +} + +/^macr PP$/{ + paragraph() + if ($0 == "macr PP") {paragraph()} +} \ No newline at end of file diff '--exclude=.vcs' -uNr ./.vcs/ref/test.shit ./test.shit --- ./.vcs/ref/test.shit 1970-01-01 10:00:00.000000000 +1000 +++ ./test.shit 2020-05-02 09:39:17.437420366 +1000 @@ -0,0 +1,28 @@ +.TL +This is my document title +.AU +John Doe +.PP +This is a paragraph, this is *italic*, +this is &bold&, this is *&bold and italic&*, +this is _underlined_, +this is -striken through- + +Here is an unordered list: +.UL +Apricots +.UL +Bananas +.UL +Cherry + +.PP +Here is an ordered list: +.OL +Asparagus +.OL +Beetroot +.OL +Carrot +.PP +This is a new paragraph \ No newline at end of file