Beispiel #1
0
void Parser::parseTag(const char* tag, size_t len) {
	bool hasAttributes;
	//printf("tag: %i %.*s\n", tagState, (int)len, tag);
	FORMATTING_TAG("b", BOLD);
	FORMATTING_TAG("i", ITALIC);
	FORMATTING_TAG("small", SMALL);
	FORMATTING_TAG("s", SMALL);
	FORMATTING_TAG("u", UNDERLINED);
	SIMPLE_TAG("table", TABLE);
	SIMPLE_TAG("tr", TR);
	SIMPLE_TAG("td", TD);
	//SIMPLE_TAG("li", LIST_ITEM);
	SPECIAL_TAG("li", addListItem());
	SPECIAL_TAG("code", addCodeTag());
	SPECIAL_TAG("quote", addQuoteTag());
	SIMPLE_TAG("ul", LIST);
	SIMPLE_TAG("ol", LIST);

	if(!strncasecmp("url=", tag, 4) || !strncasecmp("url:", tag, 4) || !strncasecmp("url ", tag, 4)) {
		//printf("url tag: %i %.*s\n", tagState, (int)len, tag);
		const char* url = tag + 4;
		size_t urlLen = len - 4;
		parseUrl(url, urlLen);
		return;
	}
	//C_TAG("url", ANCHOR, "a", "/a");
	COMPARE_TAG("url", return;);	// get rid of empty [url] tags.
Beispiel #2
0
void xml_expr_code(enum tree_code code, int indent, FILE *out)
{
    switch (code)
    {
#define SIMPLE_TAG(expr, tag) \
    case (expr): \
      fprintf(out, "%s<" tag " />\n", spc(indent)); \
      break

        SIMPLE_TAGS
        SIMPLE_TAG(CONSTRUCTOR, "constructed");

#undef SIMPLE_TAG
    default:
        fprintf(stderr, "xml_tree_expr_code: unhandled expression tree type %s\n",
                tree_code_name[code]);
        abort();
        break;
    }
}