Introduction
Introduction Statistics Contact Development Disclaimer Help
More documentation; fixed dosurround - smu - smu - simple markup (Markdown) pro…
git clone git://git.codemadness.org/smu
Log
Files
Refs
README
LICENSE
---
commit fc9310966e8c38fea21fd1cfe2f3e916cbbb11b7
parent c87f6e21b60354f352c2fd8aa02fc7aff1b9d737
Author: gottox@work <gottox@work>
Date: Mon, 28 Jan 2008 14:10:32 +0100
More documentation; fixed dosurround
Diffstat:
M documentation | 69 ++++++++++++++++++-----------…
M smu.c | 23 +++++++++++------------
2 files changed, 51 insertions(+), 41 deletions(-)
---
diff --git a/documentation b/documentation
@@ -22,21 +22,31 @@ Inline pattern
There are several pattern you can use to highlight your text:
- * Emphasis
- * Surround your text with `*` or `_` to get *emphasis* text:
- This *is* cool.
- This _is_ cool, too.
- * Surround your text with `**` or `__` to get **strong** text:
- This **is** cool.
- This __is__ cool, too.
- * inline Code
+* Emphasis
+ * Surround your text with `*` or `_` to get *emphasis* text:
+ This *is* cool.
+ This _is_ cool, too.
+ * Surround your text with `**` or `__` to get **strong** text:
+ This **is** cool.
+ This __is__ cool, too.
+ * Surround your text with `***` or `___` to get ***strong and emphasis*** te…
+ This ***is*** cool.
+ This ___is___ cool, too.
+ * But this example won't work as expected:
+ ***Hello** you*
+ This is a wontfix bug because it would make the source to complex.
+ Use this instead:
+ ***Hello*** *you*
- You can produce inline code with surrounding `\`` or `\`\``
- Use `rm -rf /` if you're a N00b.
+* inline Code
- Use ``rm -rf /`` if you're a N00b.
+ You can produce inline code with surrounding `\`` or `\`\``
- `\`\`` makes it possible to use Backticks without backslashing them.
+ Use `rm -rf /` if you're a N00b.
+
+ Use ``rm -rf /`` if you're a N00b.
+
+ `\`\`ABC\`\`` makes it possible to use Backticks without backslashing them.
Titles
@@ -164,27 +174,28 @@ block.
Other interesting stuff
-----------------------
- * to insert a horizontal rule simple add `- - -` into an empty line:
+* to insert a horizontal rule simple add `- - -` into an empty line:
+
+ Hello
+ - - -
+ Hello2
- Hello
- - - -
- Hello2
+ Result:
+ <p>
+ Hello
+ <hr />
+
+ Hello2</p>
+* You can escape the following pattern to avoid them from being interpreted:
- Result:
- <p>
- Hello
- <hr />
-
- Hello2</p>
- * You can escape the following pattern to avoid them from being interpreted:
- `` \ ` * _ { } [ ] ( ) # + - . ! ``
+ \ ` * _ { } [ ] ( ) # + - . !
- * To force a linebreak simple add two spaces to the end of the line:
+* To force a linebreak simple add two spaces to the end of the line:
- No linebreak
- here.
- But here is
- one.
+ No linebreak
+ here.
+ But here is
+ one.
embed HTML
----------
diff --git a/smu.c b/smu.c
@@ -433,29 +433,28 @@ doshortlink(const char *begin, const char *end, int newbl…
int
dosurround(const char *begin, const char *end, int newblock) {
unsigned int i, l;
- const char *p, *ps, *q, *qend;
+ const char *p, *start, *stop;
for(i = 0; i < LENGTH(surround); i++) {
l = strlen(surround[i].search);
- if(end - begin < l || strncmp(begin, surround[i].search, l) !=…
+ if(end - begin < 2*l || strncmp(begin, surround[i].search, l) …
continue;
- for(ps = surround[i].search; *ps == '\n'; ps++);
- l = strlen(ps);
- p = begin + strlen(surround[i].search) - 1;
+ start = begin + l;
+ p = start - 1;
do {
- p = strstr(p + 1, ps);
+ p = strstr(p + 1, surround[i].search);
} while(p && p[-1] == '\\');
- if(!p || p == end)
+ if(!p || p >= end)
continue;
fputs(surround[i].before, stdout);
- for(q = begin + strlen(surround[i].search); *q == ' '; q++);
- for(qend = p-1; *qend == ' '; qend--);
+ if(!(stop = strstr(start, surround[i].search)) || stop >= end)
+ continue;
if(surround[i].process)
- process(q, qend + 1, 0);
+ process(start, stop, 0);
else
- hprint(q, qend + 1);
+ hprint(start, stop);
fputs(surround[i].after, stdout);
- return p - begin + l;
+ return stop - begin + l;
}
return 0;
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.