aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-24 20:22:05 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-24 20:26:03 -0700
commitabc95bdfa1fd4f4ffb5b0727aec34791a6e472e5 (patch)
tree41d7aadcb3a91edd0610da1cd85d9c0a1c02fff7
parent7f0d1a80c7871a97dcf6495fba9f0e3c8d86be81 (diff)
Renamed c program and library stmd -> cmark.
Also renamed internal library functions accordingly.
-rw-r--r--Makefile8
-rw-r--r--README.md9
-rw-r--r--man/Makefile2
-rw-r--r--man/cmark.1.md (renamed from man/stmd.1.md)14
-rw-r--r--man/man1/cmark.1 (renamed from man/man1/stmd.1)10
-rw-r--r--narrative.md6
-rw-r--r--src/blocks.c10
-rw-r--r--src/cmark.h (renamed from src/stmd.h)10
-rw-r--r--src/html/html.c4
-rw-r--r--src/inlines.c2
-rw-r--r--src/main.c18
-rw-r--r--src/print.c4
-rw-r--r--src/references.c2
-rw-r--r--src/scanners.h2
-rw-r--r--src/utf8.h4
15 files changed, 53 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index e8a37d7..0e14161 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ LDFLAGS?=-g -O3 -Wall -Werror
SRCDIR?=src
DATADIR?=data
BENCHINP?=bench.md
-PROG?=./stmd
+PROG?=./cmark
JSMODULES=$(wildcard js/lib/*.js)
.PHONY: all test spec benchjs testjs
@@ -46,10 +46,10 @@ benchjs:
HTML_OBJ=$(SRCDIR)/html/html.o $(SRCDIR)/html/houdini_href_e.o $(SRCDIR)/html/houdini_html_e.o $(SRCDIR)/html/houdini_html_u.o
-STMD_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o $(SRCDIR)/references.c
+CMARK_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o $(SRCDIR)/references.c
-$(PROG): $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc $(HTML_OBJ) $(STMD_OBJ) $(SRCDIR)/main.c
- $(CC) $(LDFLAGS) -o $@ $(HTML_OBJ) $(STMD_OBJ) $(SRCDIR)/main.c
+$(PROG): $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c
+ $(CC) $(LDFLAGS) -o $@ $(HTML_OBJ) $(CMARK_OBJ) $(SRCDIR)/main.c
$(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
re2c --case-insensitive -bis $< > $@ || (rm $@ && false)
diff --git a/README.md b/README.md
index a4b0817..447e9b8 100644
--- a/README.md
+++ b/README.md
@@ -2,20 +2,21 @@ CommonMark
==========
CommonMark is a [specification of Markdown syntax][the spec],
-together with BSD3-licensed implementations (`stmd`) in C and JavaScript.
+together with BSD3-licensed implementations (`cmark`) in C and
+JavaScript.
The implementations
-------------------
The C implementation provides both a library and a standalone program
-`stmd` that converts Markdown to HTML. It is written in standard C99
+`cmark` that converts Markdown to HTML. It is written in standard C99
and has no library dependencies. (However, if you check it out from the
repository, you'll need [`re2c`](http://re2c.org) to generate
`scanners.c` from `scanners.re`. This is only a build dependency for
developers, since `scanners.c` can be provided in a released source
tarball.)
- Usage: stmd [FILE*]
+ Usage: cmark [FILE*]
Options: --help, -h Print usage information
--ast Print AST instead of HTML
--version Print version
@@ -37,7 +38,7 @@ sanitizer to protect against
[XSS attacks](http://en.wikipedia.org/wiki/Cross-site_scripting).
[The spec] contains over 450 embedded examples which serve as conformance
-tests. To run the tests for `stmd`, do `make test`. To run them for
+tests. To run the tests for `cmark`, do `make test`. To run them for
another Markdown program, say `myprog`, do `make test PROG=myprog`. To
run the tests for `stmd.js`, do `make testjs`.
diff --git a/man/Makefile b/man/Makefile
index 98528c3..f5a5fad 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -1,4 +1,4 @@
-ALL=man1/stmd.1
+ALL=man1/cmark.1
.PHONY: all
diff --git a/man/stmd.1.md b/man/cmark.1.md
index 3947a79..ddc1b42 100644
--- a/man/stmd.1.md
+++ b/man/cmark.1.md
@@ -1,22 +1,22 @@
---
-title: stmd
+title: cmark
section: 1
-footer: stmd manual
-date: August 12, 2014
+footer: cmark manual
+date: October 22, 2014
...
# NAME
-stmd - convert markdown formatted text to HTML
+cmark - convert CommonMark formatted text to HTML
# SYNOPSIS
-stmd [*options*] [file\*]
+cmark [*options*] [file\*]
# DESCRIPTION
-`stmd` acts as a pipe, reading from stdin or from the specified
-files and writing to stdout. It converts markdown formatted plain
+`cmark` acts as a pipe, reading from stdin or from the specified
+files and writing to stdout. It converts Markdown formatted plain
text to HTML, using the conventions described in the CommonMark
spec.
diff --git a/man/man1/stmd.1 b/man/man1/cmark.1
index 6bfdd80..65e10c1 100644
--- a/man/man1/stmd.1
+++ b/man/man1/cmark.1
@@ -1,15 +1,15 @@
-.TH "stmd" "1" "August 12, 2014" "stmd manual" ""
+.TH "cmark" "1" "October 22, 2014" "cmark manual" ""
.SH NAME
.PP
-stmd \- convert markdown formatted text to HTML
+cmark \- convert CommonMark formatted text to HTML
.SH SYNOPSIS
.PP
-stmd [\f[I]options\f[]] [file*]
+cmark [\f[I]options\f[]] [file*]
.SH DESCRIPTION
.PP
-\f[C]stmd\f[] acts as a pipe, reading from stdin or from the specified
+\f[C]cmark\f[] acts as a pipe, reading from stdin or from the specified
files and writing to stdout.
-It converts markdown formatted plain text to HTML, using the conventions
+It converts Markdown formatted plain text to HTML, using the conventions
described in the CommonMark spec.
.SH OPTIONS
.TP
diff --git a/narrative.md b/narrative.md
index 0a86a88..313f831 100644
--- a/narrative.md
+++ b/narrative.md
@@ -4,13 +4,13 @@ title: CommonMark
CommonMark is a [specification of Markdown
syntax](http://jgm.github.io/stmd/spec.html), together with
-BSD3-licensed implementations (`stmd`) in C and JavaScript. The source
+BSD3-licensed implementations (`cmark`) in C and JavaScript. The source
for the spec and the two implementations can be found in [this
repository](http://github.com/jgm/stmd).
The C implementation provides both a library and a standalone program
-`stmd` that converts Markdown to HTML. It is written in standard C99 and
-has no library dependencies.
+`cmark` that converts Markdown to HTML. It is written in standard C99
+and has no library dependencies.
The JavaScript implementation is a single JavaScript file, with no
dependencies. [Try it now!](http://jgm.github.io/stmd/js/)
diff --git a/src/blocks.c b/src/blocks.c
index bcec27a..ae106d2 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -4,7 +4,7 @@
#include <stdbool.h>
#include <ctype.h>
-#include "stmd.h"
+#include "cmark.h"
#include "utf8.h"
#include "scanners.h"
#include "inlines.h"
@@ -253,7 +253,7 @@ static node_block* add_child(node_block* parent,
}
// Free a node_block list and any children.
-void stmd_free_nodes(node_block *e)
+void cmark_free_nodes(node_block *e)
{
node_block * next;
while (e != NULL) {
@@ -265,7 +265,7 @@ void stmd_free_nodes(node_block *e)
} else if (e->tag == BLOCK_DOCUMENT) {
reference_map_free(e->as.document.refmap);
}
- stmd_free_nodes(e->children);
+ cmark_free_nodes(e->children);
free(e);
e = next;
}
@@ -380,7 +380,7 @@ static node_block *finalize_document(node_block *document, int linenum)
return document;
}
-extern node_block *stmd_parse_file(FILE *f)
+extern node_block *cmark_parse_file(FILE *f)
{
strbuf line = GH_BUF_INIT;
unsigned char buffer[4096];
@@ -398,7 +398,7 @@ extern node_block *stmd_parse_file(FILE *f)
return finalize_document(document, linenum);
}
-extern node_block *stmd_parse_document(const unsigned char *buffer, size_t len)
+extern node_block *cmark_parse_document(const unsigned char *buffer, size_t len)
{
strbuf line = GH_BUF_INIT;
int linenum = 1;
diff --git a/src/stmd.h b/src/cmark.h
index 552e60e..ff2f9a2 100644
--- a/src/stmd.h
+++ b/src/cmark.h
@@ -104,12 +104,12 @@ struct node_block {
typedef struct node_block node_block;
-node_block *stmd_parse_document(const unsigned char *buffer, size_t len);
-node_block *stmd_parse_file(FILE *f);
+node_block *cmark_parse_document(const unsigned char *buffer, size_t len);
+node_block *cmark_parse_file(FILE *f);
-void stmd_free_nodes(node_block *e);
+void cmark_free_nodes(node_block *e);
-void stmd_debug_print(node_block *root);
-void stmd_render_html(strbuf *html, node_block *root);
+void cmark_debug_print(node_block *root);
+void cmark_render_html(strbuf *html, node_block *root);
#endif
diff --git a/src/html/html.c b/src/html/html.c
index ab6fc35..fde1cb4 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <assert.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
#include "html/houdini.h"
@@ -222,7 +222,7 @@ static void blocks_to_html(strbuf *html, node_block *b, bool tight)
}
}
-void stmd_render_html(strbuf *html, node_block *root)
+void cmark_render_html(strbuf *html, node_block *root)
{
blocks_to_html(html, root, false);
}
diff --git a/src/inlines.c b/src/inlines.c
index 4744312..7a7f08a 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -4,7 +4,7 @@
#include <stdbool.h>
#include <ctype.h>
-#include "stmd.h"
+#include "cmark.h"
#include "html/houdini.h"
#include "utf8.h"
#include "scanners.h"
diff --git a/src/main.c b/src/main.c
index 99d14f8..b2404f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
void print_usage()
{
- printf("Usage: stmd [FILE*]\n");
+ printf("Usage: cmark [FILE*]\n");
printf("Options: --help, -h Print usage information\n");
printf(" --ast Print AST instead of HTML\n");
printf(" --version Print version\n");
@@ -17,9 +17,9 @@ static void print_document(node_block *document, bool ast)
strbuf html = GH_BUF_INIT;
if (ast) {
- stmd_debug_print(document);
+ cmark_debug_print(document);
} else {
- stmd_render_html(&html, document);
+ cmark_render_html(&html, document);
printf("%s", html.ptr);
strbuf_free(&html);
}
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--version") == 0) {
- printf("stmd %s", VERSION);
+ printf("cmark %s", VERSION);
printf(" - CommonMark converter (c) 2014 John MacFarlane\n");
exit(0);
} else if ((strcmp(argv[i], "--help") == 0) ||
@@ -52,9 +52,9 @@ int main(int argc, char *argv[])
}
if (numfps == 0) {
- document = stmd_parse_file(stdin);
+ document = cmark_parse_file(stdin);
print_document(document, ast);
- stmd_free_nodes(document);
+ cmark_free_nodes(document);
} else {
for (i = 0; i < numfps; i++) {
FILE *fp = fopen(argv[files[i]], "r");
@@ -65,9 +65,9 @@ int main(int argc, char *argv[])
exit(1);
}
- document = stmd_parse_file(fp);
+ document = cmark_parse_file(fp);
print_document(document, ast);
- stmd_free_nodes(document);
+ cmark_free_nodes(document);
fclose(fp);
}
}
diff --git a/src/print.c b/src/print.c
index f3bd8e5..be3bced 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
static void print_str(const unsigned char *s, int len)
@@ -170,7 +170,7 @@ static void print_blocks(node_block* b, int indent)
}
}
-void stmd_debug_print(node_block *root)
+void cmark_debug_print(node_block *root)
{
print_blocks(root, 0);
}
diff --git a/src/references.c b/src/references.c
index 6759c2c..04b9025 100644
--- a/src/references.c
+++ b/src/references.c
@@ -1,4 +1,4 @@
-#include "stmd.h"
+#include "cmark.h"
#include "utf8.h"
#include "references.h"
#include "inlines.h"
diff --git a/src/scanners.h b/src/scanners.h
index 785d424..86dbcf5 100644
--- a/src/scanners.h
+++ b/src/scanners.h
@@ -1,4 +1,4 @@
-#include "stmd.h"
+#include "cmark.h"
extern int _scan_autolink_uri(const unsigned char *p);
extern int _scan_autolink_email(const unsigned char *p);
diff --git a/src/utf8.h b/src/utf8.h
index c971250..496eae9 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -1,5 +1,5 @@
-#ifndef _H_STMD_UTF8_
-#define _H_STMD_UTF8_
+#ifndef _H_cmark_UTF8_
+#define _H_cmark_UTF8_
#include <stdint.h>
#include "buffer.h"