diff --git a/main.c b/main.c index 7b4a19a..3f8cd8c 100644 --- a/main.c +++ b/main.c @@ -21,6 +21,7 @@ typedef struct { int italic; int hyperlink; int code; + int blockcode; int headingone; int headingtwo; int headingthree; @@ -250,7 +251,10 @@ void copy_css(void) { void newsetup(void) { struct stat st; - if (stat("./source", &st) == -1) mkdir("./source", 0700); + if (stat("./source", &st) == -1) { + mkdir("./source", 0700); + mkdir("./source/post", 0700); + } if (stat("./target", &st) == -1) mkdir("./target", 0700); if (stat("./media", &st) == -1) { mkdir("./media", 0700); @@ -389,7 +393,7 @@ docode(void) { mdt.code = 0; } } - + void dohyperlink(void) { int start_linkname = i + 1; @@ -442,8 +446,6 @@ dohyperlink(void) { } } -void build(void) { -} void generate(void) { @@ -464,7 +466,7 @@ void generate(void) { txt[--len] = '\0'; } - mdt.headingone = mdt.headingtwo = mdt.headingthree = mdt.quote = 0; + mdt.headingone = mdt.headingtwo = mdt.headingthree = mdt.quote = mdt.blockcode = 0; if (len == 0) { fprintf(fpto, "\n"); @@ -472,6 +474,7 @@ void generate(void) { i = 0; judul = 0; + if (txt[0] == '#') { int heading_count = 0; while (i < len && txt[i] == '#') { @@ -499,6 +502,27 @@ if (txt[0] == '#') { } continue; } +} +else if(len > 1 && txt[0] == '`' && txt[1] == '`' && txt[2] == '`' && (i == 0 || txt[3] != '\\')) { + if (!mdt.blockcode) { + fprintf(fpto, "
");
+ mdt.blockcode = 1;
+ i += 3;
+ } else {
+ fprintf(fpto, "");
+ mdt.blockcode = 0;
+ i += 3;
+ continue;
+ }
+} else if (mdt.blockcode) {
+ int start = i;
+ while (i < len && !(i + 2 < len && txt[i] == '`' && txt[i+1] == '`' && txt[i+2] == '`' && (i == 0 || txt[i+3] != '\\'))) {
+ i++;
+ }
+ fprintf(fpto, "%.*s", i - start, txt + start);
+ if (i < len && i + 2 < len && txt[i] == '`' && txt[i+1] == '`' && txt[i+2] == '`') {
+ i += 2;
+ }
}
else if (len > 1 && txt[0] == '>' && txt[1] != '\\') {
doblockquote();
@@ -531,9 +555,10 @@ if (txt[0] == '#') {
else if (mdt.headingone) fprintf(fpto, "\n");
else if (mdt.headingtwo) fprintf(fpto, "\n");
else if (mdt.headingthree) fprintf(fpto, "\n");
- if (!(mdt.headingone || mdt.headingtwo || mdt.headingthree || mdt.quote)) fprintf(fpto, "\n");
- mdt.italic = mdt.bold = mdt.quote = mdt.headingone = mdt.headingtwo = mdt.headingthree = mdt.code = 0;
+ if (!(mdt.headingone || mdt.headingtwo || mdt.headingthree || mdt.quote || mdt.blockcode)) fprintf(fpto, "\n");
+
+ mdt.italic = mdt.bold = mdt.quote = mdt.headingone = mdt.headingtwo = mdt.headingthree = mdt.code = mdt.blockcode = 0;
}
}
@@ -630,3 +655,4 @@ int main(int argc, char *argv[]) {
printf("salah perintah\n");
return 1;
}
+
diff --git a/style.css b/style.css
index d0d976e..9c0de24 100644
--- a/style.css
+++ b/style.css
@@ -1,5 +1,5 @@
body {
- background: #01242e;
+ background: #000;
color: #fff;
font-family: sans-serif;
margin: auto;
@@ -8,16 +8,16 @@ body {
}
blockquote {
- background:#1A3440;
+ background:#880808;
}
a:link {
- color: #EAE2C6;
+ color: #880808;
}
a:visited {
- color: #EAE2C6
+ color: #880808;
}
a:hover {
- color: #01242e;
+ color: #000;
background-color: #fff;
}