http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/case_fold_switch.inc
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/case_fold_switch.inc 
b/compiler/modules/CommonMark/src/case_fold_switch.inc
new file mode 100644
index 0000000..70fdd75
--- /dev/null
+++ b/compiler/modules/CommonMark/src/case_fold_switch.inc
@@ -0,0 +1,2637 @@
+    switch (c) {
+      case 0x0041:
+        bufpush(0x0061);
+        break;
+      case 0x0042:
+        bufpush(0x0062);
+        break;
+      case 0x0043:
+        bufpush(0x0063);
+        break;
+      case 0x0044:
+        bufpush(0x0064);
+        break;
+      case 0x0045:
+        bufpush(0x0065);
+        break;
+      case 0x0046:
+        bufpush(0x0066);
+        break;
+      case 0x0047:
+        bufpush(0x0067);
+        break;
+      case 0x0048:
+        bufpush(0x0068);
+        break;
+      case 0x0049:
+        bufpush(0x0069);
+        break;
+      case 0x004A:
+        bufpush(0x006A);
+        break;
+      case 0x004B:
+        bufpush(0x006B);
+        break;
+      case 0x004C:
+        bufpush(0x006C);
+        break;
+      case 0x004D:
+        bufpush(0x006D);
+        break;
+      case 0x004E:
+        bufpush(0x006E);
+        break;
+      case 0x004F:
+        bufpush(0x006F);
+        break;
+      case 0x0050:
+        bufpush(0x0070);
+        break;
+      case 0x0051:
+        bufpush(0x0071);
+        break;
+      case 0x0052:
+        bufpush(0x0072);
+        break;
+      case 0x0053:
+        bufpush(0x0073);
+        break;
+      case 0x0054:
+        bufpush(0x0074);
+        break;
+      case 0x0055:
+        bufpush(0x0075);
+        break;
+      case 0x0056:
+        bufpush(0x0076);
+        break;
+      case 0x0057:
+        bufpush(0x0077);
+        break;
+      case 0x0058:
+        bufpush(0x0078);
+        break;
+      case 0x0059:
+        bufpush(0x0079);
+        break;
+      case 0x005A:
+        bufpush(0x007A);
+        break;
+      case 0x00B5:
+        bufpush(0x03BC);
+        break;
+      case 0x00C0:
+        bufpush(0x00E0);
+        break;
+      case 0x00C1:
+        bufpush(0x00E1);
+        break;
+      case 0x00C2:
+        bufpush(0x00E2);
+        break;
+      case 0x00C3:
+        bufpush(0x00E3);
+        break;
+      case 0x00C4:
+        bufpush(0x00E4);
+        break;
+      case 0x00C5:
+        bufpush(0x00E5);
+        break;
+      case 0x00C6:
+        bufpush(0x00E6);
+        break;
+      case 0x00C7:
+        bufpush(0x00E7);
+        break;
+      case 0x00C8:
+        bufpush(0x00E8);
+        break;
+      case 0x00C9:
+        bufpush(0x00E9);
+        break;
+      case 0x00CA:
+        bufpush(0x00EA);
+        break;
+      case 0x00CB:
+        bufpush(0x00EB);
+        break;
+      case 0x00CC:
+        bufpush(0x00EC);
+        break;
+      case 0x00CD:
+        bufpush(0x00ED);
+        break;
+      case 0x00CE:
+        bufpush(0x00EE);
+        break;
+      case 0x00CF:
+        bufpush(0x00EF);
+        break;
+      case 0x00D0:
+        bufpush(0x00F0);
+        break;
+      case 0x00D1:
+        bufpush(0x00F1);
+        break;
+      case 0x00D2:
+        bufpush(0x00F2);
+        break;
+      case 0x00D3:
+        bufpush(0x00F3);
+        break;
+      case 0x00D4:
+        bufpush(0x00F4);
+        break;
+      case 0x00D5:
+        bufpush(0x00F5);
+        break;
+      case 0x00D6:
+        bufpush(0x00F6);
+        break;
+      case 0x00D8:
+        bufpush(0x00F8);
+        break;
+      case 0x00D9:
+        bufpush(0x00F9);
+        break;
+      case 0x00DA:
+        bufpush(0x00FA);
+        break;
+      case 0x00DB:
+        bufpush(0x00FB);
+        break;
+      case 0x00DC:
+        bufpush(0x00FC);
+        break;
+      case 0x00DD:
+        bufpush(0x00FD);
+        break;
+      case 0x00DE:
+        bufpush(0x00FE);
+        break;
+      case 0x00DF:
+        bufpush(0x0073);
+        bufpush(0x0073);
+        break;
+      case 0x0100:
+        bufpush(0x0101);
+        break;
+      case 0x0102:
+        bufpush(0x0103);
+        break;
+      case 0x0104:
+        bufpush(0x0105);
+        break;
+      case 0x0106:
+        bufpush(0x0107);
+        break;
+      case 0x0108:
+        bufpush(0x0109);
+        break;
+      case 0x010A:
+        bufpush(0x010B);
+        break;
+      case 0x010C:
+        bufpush(0x010D);
+        break;
+      case 0x010E:
+        bufpush(0x010F);
+        break;
+      case 0x0110:
+        bufpush(0x0111);
+        break;
+      case 0x0112:
+        bufpush(0x0113);
+        break;
+      case 0x0114:
+        bufpush(0x0115);
+        break;
+      case 0x0116:
+        bufpush(0x0117);
+        break;
+      case 0x0118:
+        bufpush(0x0119);
+        break;
+      case 0x011A:
+        bufpush(0x011B);
+        break;
+      case 0x011C:
+        bufpush(0x011D);
+        break;
+      case 0x011E:
+        bufpush(0x011F);
+        break;
+      case 0x0120:
+        bufpush(0x0121);
+        break;
+      case 0x0122:
+        bufpush(0x0123);
+        break;
+      case 0x0124:
+        bufpush(0x0125);
+        break;
+      case 0x0126:
+        bufpush(0x0127);
+        break;
+      case 0x0128:
+        bufpush(0x0129);
+        break;
+      case 0x012A:
+        bufpush(0x012B);
+        break;
+      case 0x012C:
+        bufpush(0x012D);
+        break;
+      case 0x012E:
+        bufpush(0x012F);
+        break;
+      case 0x0130:
+        bufpush(0x0069);
+        bufpush(0x0307);
+        break;
+      case 0x0132:
+        bufpush(0x0133);
+        break;
+      case 0x0134:
+        bufpush(0x0135);
+        break;
+      case 0x0136:
+        bufpush(0x0137);
+        break;
+      case 0x0139:
+        bufpush(0x013A);
+        break;
+      case 0x013B:
+        bufpush(0x013C);
+        break;
+      case 0x013D:
+        bufpush(0x013E);
+        break;
+      case 0x013F:
+        bufpush(0x0140);
+        break;
+      case 0x0141:
+        bufpush(0x0142);
+        break;
+      case 0x0143:
+        bufpush(0x0144);
+        break;
+      case 0x0145:
+        bufpush(0x0146);
+        break;
+      case 0x0147:
+        bufpush(0x0148);
+        break;
+      case 0x0149:
+        bufpush(0x02BC);
+        bufpush(0x006E);
+        break;
+      case 0x014A:
+        bufpush(0x014B);
+        break;
+      case 0x014C:
+        bufpush(0x014D);
+        break;
+      case 0x014E:
+        bufpush(0x014F);
+        break;
+      case 0x0150:
+        bufpush(0x0151);
+        break;
+      case 0x0152:
+        bufpush(0x0153);
+        break;
+      case 0x0154:
+        bufpush(0x0155);
+        break;
+      case 0x0156:
+        bufpush(0x0157);
+        break;
+      case 0x0158:
+        bufpush(0x0159);
+        break;
+      case 0x015A:
+        bufpush(0x015B);
+        break;
+      case 0x015C:
+        bufpush(0x015D);
+        break;
+      case 0x015E:
+        bufpush(0x015F);
+        break;
+      case 0x0160:
+        bufpush(0x0161);
+        break;
+      case 0x0162:
+        bufpush(0x0163);
+        break;
+      case 0x0164:
+        bufpush(0x0165);
+        break;
+      case 0x0166:
+        bufpush(0x0167);
+        break;
+      case 0x0168:
+        bufpush(0x0169);
+        break;
+      case 0x016A:
+        bufpush(0x016B);
+        break;
+      case 0x016C:
+        bufpush(0x016D);
+        break;
+      case 0x016E:
+        bufpush(0x016F);
+        break;
+      case 0x0170:
+        bufpush(0x0171);
+        break;
+      case 0x0172:
+        bufpush(0x0173);
+        break;
+      case 0x0174:
+        bufpush(0x0175);
+        break;
+      case 0x0176:
+        bufpush(0x0177);
+        break;
+      case 0x0178:
+        bufpush(0x00FF);
+        break;
+      case 0x0179:
+        bufpush(0x017A);
+        break;
+      case 0x017B:
+        bufpush(0x017C);
+        break;
+      case 0x017D:
+        bufpush(0x017E);
+        break;
+      case 0x017F:
+        bufpush(0x0073);
+        break;
+      case 0x0181:
+        bufpush(0x0253);
+        break;
+      case 0x0182:
+        bufpush(0x0183);
+        break;
+      case 0x0184:
+        bufpush(0x0185);
+        break;
+      case 0x0186:
+        bufpush(0x0254);
+        break;
+      case 0x0187:
+        bufpush(0x0188);
+        break;
+      case 0x0189:
+        bufpush(0x0256);
+        break;
+      case 0x018A:
+        bufpush(0x0257);
+        break;
+      case 0x018B:
+        bufpush(0x018C);
+        break;
+      case 0x018E:
+        bufpush(0x01DD);
+        break;
+      case 0x018F:
+        bufpush(0x0259);
+        break;
+      case 0x0190:
+        bufpush(0x025B);
+        break;
+      case 0x0191:
+        bufpush(0x0192);
+        break;
+      case 0x0193:
+        bufpush(0x0260);
+        break;
+      case 0x0194:
+        bufpush(0x0263);
+        break;
+      case 0x0196:
+        bufpush(0x0269);
+        break;
+      case 0x0197:
+        bufpush(0x0268);
+        break;
+      case 0x0198:
+        bufpush(0x0199);
+        break;
+      case 0x019C:
+        bufpush(0x026F);
+        break;
+      case 0x019D:
+        bufpush(0x0272);
+        break;
+      case 0x019F:
+        bufpush(0x0275);
+        break;
+      case 0x01A0:
+        bufpush(0x01A1);
+        break;
+      case 0x01A2:
+        bufpush(0x01A3);
+        break;
+      case 0x01A4:
+        bufpush(0x01A5);
+        break;
+      case 0x01A6:
+        bufpush(0x0280);
+        break;
+      case 0x01A7:
+        bufpush(0x01A8);
+        break;
+      case 0x01A9:
+        bufpush(0x0283);
+        break;
+      case 0x01AC:
+        bufpush(0x01AD);
+        break;
+      case 0x01AE:
+        bufpush(0x0288);
+        break;
+      case 0x01AF:
+        bufpush(0x01B0);
+        break;
+      case 0x01B1:
+        bufpush(0x028A);
+        break;
+      case 0x01B2:
+        bufpush(0x028B);
+        break;
+      case 0x01B3:
+        bufpush(0x01B4);
+        break;
+      case 0x01B5:
+        bufpush(0x01B6);
+        break;
+      case 0x01B7:
+        bufpush(0x0292);
+        break;
+      case 0x01B8:
+        bufpush(0x01B9);
+        break;
+      case 0x01BC:
+        bufpush(0x01BD);
+        break;
+      case 0x01C4:
+        bufpush(0x01C6);
+        break;
+      case 0x01C5:
+        bufpush(0x01C6);
+        break;
+      case 0x01C7:
+        bufpush(0x01C9);
+        break;
+      case 0x01C8:
+        bufpush(0x01C9);
+        break;
+      case 0x01CA:
+        bufpush(0x01CC);
+        break;
+      case 0x01CB:
+        bufpush(0x01CC);
+        break;
+      case 0x01CD:
+        bufpush(0x01CE);
+        break;
+      case 0x01CF:
+        bufpush(0x01D0);
+        break;
+      case 0x01D1:
+        bufpush(0x01D2);
+        break;
+      case 0x01D3:
+        bufpush(0x01D4);
+        break;
+      case 0x01D5:
+        bufpush(0x01D6);
+        break;
+      case 0x01D7:
+        bufpush(0x01D8);
+        break;
+      case 0x01D9:
+        bufpush(0x01DA);
+        break;
+      case 0x01DB:
+        bufpush(0x01DC);
+        break;
+      case 0x01DE:
+        bufpush(0x01DF);
+        break;
+      case 0x01E0:
+        bufpush(0x01E1);
+        break;
+      case 0x01E2:
+        bufpush(0x01E3);
+        break;
+      case 0x01E4:
+        bufpush(0x01E5);
+        break;
+      case 0x01E6:
+        bufpush(0x01E7);
+        break;
+      case 0x01E8:
+        bufpush(0x01E9);
+        break;
+      case 0x01EA:
+        bufpush(0x01EB);
+        break;
+      case 0x01EC:
+        bufpush(0x01ED);
+        break;
+      case 0x01EE:
+        bufpush(0x01EF);
+        break;
+      case 0x01F0:
+        bufpush(0x006A);
+        bufpush(0x030C);
+        break;
+      case 0x01F1:
+        bufpush(0x01F3);
+        break;
+      case 0x01F2:
+        bufpush(0x01F3);
+        break;
+      case 0x01F4:
+        bufpush(0x01F5);
+        break;
+      case 0x01F6:
+        bufpush(0x0195);
+        break;
+      case 0x01F7:
+        bufpush(0x01BF);
+        break;
+      case 0x01F8:
+        bufpush(0x01F9);
+        break;
+      case 0x01FA:
+        bufpush(0x01FB);
+        break;
+      case 0x01FC:
+        bufpush(0x01FD);
+        break;
+      case 0x01FE:
+        bufpush(0x01FF);
+        break;
+      case 0x0200:
+        bufpush(0x0201);
+        break;
+      case 0x0202:
+        bufpush(0x0203);
+        break;
+      case 0x0204:
+        bufpush(0x0205);
+        break;
+      case 0x0206:
+        bufpush(0x0207);
+        break;
+      case 0x0208:
+        bufpush(0x0209);
+        break;
+      case 0x020A:
+        bufpush(0x020B);
+        break;
+      case 0x020C:
+        bufpush(0x020D);
+        break;
+      case 0x020E:
+        bufpush(0x020F);
+        break;
+      case 0x0210:
+        bufpush(0x0211);
+        break;
+      case 0x0212:
+        bufpush(0x0213);
+        break;
+      case 0x0214:
+        bufpush(0x0215);
+        break;
+      case 0x0216:
+        bufpush(0x0217);
+        break;
+      case 0x0218:
+        bufpush(0x0219);
+        break;
+      case 0x021A:
+        bufpush(0x021B);
+        break;
+      case 0x021C:
+        bufpush(0x021D);
+        break;
+      case 0x021E:
+        bufpush(0x021F);
+        break;
+      case 0x0220:
+        bufpush(0x019E);
+        break;
+      case 0x0222:
+        bufpush(0x0223);
+        break;
+      case 0x0224:
+        bufpush(0x0225);
+        break;
+      case 0x0226:
+        bufpush(0x0227);
+        break;
+      case 0x0228:
+        bufpush(0x0229);
+        break;
+      case 0x022A:
+        bufpush(0x022B);
+        break;
+      case 0x022C:
+        bufpush(0x022D);
+        break;
+      case 0x022E:
+        bufpush(0x022F);
+        break;
+      case 0x0230:
+        bufpush(0x0231);
+        break;
+      case 0x0232:
+        bufpush(0x0233);
+        break;
+      case 0x0345:
+        bufpush(0x03B9);
+        break;
+      case 0x0386:
+        bufpush(0x03AC);
+        break;
+      case 0x0388:
+        bufpush(0x03AD);
+        break;
+      case 0x0389:
+        bufpush(0x03AE);
+        break;
+      case 0x038A:
+        bufpush(0x03AF);
+        break;
+      case 0x038C:
+        bufpush(0x03CC);
+        break;
+      case 0x038E:
+        bufpush(0x03CD);
+        break;
+      case 0x038F:
+        bufpush(0x03CE);
+        break;
+      case 0x0390:
+        bufpush(0x03B9);
+        bufpush(0x0308);
+        bufpush(0x0301);
+        break;
+      case 0x0391:
+        bufpush(0x03B1);
+        break;
+      case 0x0392:
+        bufpush(0x03B2);
+        break;
+      case 0x0393:
+        bufpush(0x03B3);
+        break;
+      case 0x0394:
+        bufpush(0x03B4);
+        break;
+      case 0x0395:
+        bufpush(0x03B5);
+        break;
+      case 0x0396:
+        bufpush(0x03B6);
+        break;
+      case 0x0397:
+        bufpush(0x03B7);
+        break;
+      case 0x0398:
+        bufpush(0x03B8);
+        break;
+      case 0x0399:
+        bufpush(0x03B9);
+        break;
+      case 0x039A:
+        bufpush(0x03BA);
+        break;
+      case 0x039B:
+        bufpush(0x03BB);
+        break;
+      case 0x039C:
+        bufpush(0x03BC);
+        break;
+      case 0x039D:
+        bufpush(0x03BD);
+        break;
+      case 0x039E:
+        bufpush(0x03BE);
+        break;
+      case 0x039F:
+        bufpush(0x03BF);
+        break;
+      case 0x03A0:
+        bufpush(0x03C0);
+        break;
+      case 0x03A1:
+        bufpush(0x03C1);
+        break;
+      case 0x03A3:
+        bufpush(0x03C3);
+        break;
+      case 0x03A4:
+        bufpush(0x03C4);
+        break;
+      case 0x03A5:
+        bufpush(0x03C5);
+        break;
+      case 0x03A6:
+        bufpush(0x03C6);
+        break;
+      case 0x03A7:
+        bufpush(0x03C7);
+        break;
+      case 0x03A8:
+        bufpush(0x03C8);
+        break;
+      case 0x03A9:
+        bufpush(0x03C9);
+        break;
+      case 0x03AA:
+        bufpush(0x03CA);
+        break;
+      case 0x03AB:
+        bufpush(0x03CB);
+        break;
+      case 0x03B0:
+        bufpush(0x03C5);
+        bufpush(0x0308);
+        bufpush(0x0301);
+        break;
+      case 0x03C2:
+        bufpush(0x03C3);
+        break;
+      case 0x03D0:
+        bufpush(0x03B2);
+        break;
+      case 0x03D1:
+        bufpush(0x03B8);
+        break;
+      case 0x03D5:
+        bufpush(0x03C6);
+        break;
+      case 0x03D6:
+        bufpush(0x03C0);
+        break;
+      case 0x03D8:
+        bufpush(0x03D9);
+        break;
+      case 0x03DA:
+        bufpush(0x03DB);
+        break;
+      case 0x03DC:
+        bufpush(0x03DD);
+        break;
+      case 0x03DE:
+        bufpush(0x03DF);
+        break;
+      case 0x03E0:
+        bufpush(0x03E1);
+        break;
+      case 0x03E2:
+        bufpush(0x03E3);
+        break;
+      case 0x03E4:
+        bufpush(0x03E5);
+        break;
+      case 0x03E6:
+        bufpush(0x03E7);
+        break;
+      case 0x03E8:
+        bufpush(0x03E9);
+        break;
+      case 0x03EA:
+        bufpush(0x03EB);
+        break;
+      case 0x03EC:
+        bufpush(0x03ED);
+        break;
+      case 0x03EE:
+        bufpush(0x03EF);
+        break;
+      case 0x03F0:
+        bufpush(0x03BA);
+        break;
+      case 0x03F1:
+        bufpush(0x03C1);
+        break;
+      case 0x03F2:
+        bufpush(0x03C3);
+        break;
+      case 0x03F4:
+        bufpush(0x03B8);
+        break;
+      case 0x03F5:
+        bufpush(0x03B5);
+        break;
+      case 0x0400:
+        bufpush(0x0450);
+        break;
+      case 0x0401:
+        bufpush(0x0451);
+        break;
+      case 0x0402:
+        bufpush(0x0452);
+        break;
+      case 0x0403:
+        bufpush(0x0453);
+        break;
+      case 0x0404:
+        bufpush(0x0454);
+        break;
+      case 0x0405:
+        bufpush(0x0455);
+        break;
+      case 0x0406:
+        bufpush(0x0456);
+        break;
+      case 0x0407:
+        bufpush(0x0457);
+        break;
+      case 0x0408:
+        bufpush(0x0458);
+        break;
+      case 0x0409:
+        bufpush(0x0459);
+        break;
+      case 0x040A:
+        bufpush(0x045A);
+        break;
+      case 0x040B:
+        bufpush(0x045B);
+        break;
+      case 0x040C:
+        bufpush(0x045C);
+        break;
+      case 0x040D:
+        bufpush(0x045D);
+        break;
+      case 0x040E:
+        bufpush(0x045E);
+        break;
+      case 0x040F:
+        bufpush(0x045F);
+        break;
+      case 0x0410:
+        bufpush(0x0430);
+        break;
+      case 0x0411:
+        bufpush(0x0431);
+        break;
+      case 0x0412:
+        bufpush(0x0432);
+        break;
+      case 0x0413:
+        bufpush(0x0433);
+        break;
+      case 0x0414:
+        bufpush(0x0434);
+        break;
+      case 0x0415:
+        bufpush(0x0435);
+        break;
+      case 0x0416:
+        bufpush(0x0436);
+        break;
+      case 0x0417:
+        bufpush(0x0437);
+        break;
+      case 0x0418:
+        bufpush(0x0438);
+        break;
+      case 0x0419:
+        bufpush(0x0439);
+        break;
+      case 0x041A:
+        bufpush(0x043A);
+        break;
+      case 0x041B:
+        bufpush(0x043B);
+        break;
+      case 0x041C:
+        bufpush(0x043C);
+        break;
+      case 0x041D:
+        bufpush(0x043D);
+        break;
+      case 0x041E:
+        bufpush(0x043E);
+        break;
+      case 0x041F:
+        bufpush(0x043F);
+        break;
+      case 0x0420:
+        bufpush(0x0440);
+        break;
+      case 0x0421:
+        bufpush(0x0441);
+        break;
+      case 0x0422:
+        bufpush(0x0442);
+        break;
+      case 0x0423:
+        bufpush(0x0443);
+        break;
+      case 0x0424:
+        bufpush(0x0444);
+        break;
+      case 0x0425:
+        bufpush(0x0445);
+        break;
+      case 0x0426:
+        bufpush(0x0446);
+        break;
+      case 0x0427:
+        bufpush(0x0447);
+        break;
+      case 0x0428:
+        bufpush(0x0448);
+        break;
+      case 0x0429:
+        bufpush(0x0449);
+        break;
+      case 0x042A:
+        bufpush(0x044A);
+        break;
+      case 0x042B:
+        bufpush(0x044B);
+        break;
+      case 0x042C:
+        bufpush(0x044C);
+        break;
+      case 0x042D:
+        bufpush(0x044D);
+        break;
+      case 0x042E:
+        bufpush(0x044E);
+        break;
+      case 0x042F:
+        bufpush(0x044F);
+        break;
+      case 0x0460:
+        bufpush(0x0461);
+        break;
+      case 0x0462:
+        bufpush(0x0463);
+        break;
+      case 0x0464:
+        bufpush(0x0465);
+        break;
+      case 0x0466:
+        bufpush(0x0467);
+        break;
+      case 0x0468:
+        bufpush(0x0469);
+        break;
+      case 0x046A:
+        bufpush(0x046B);
+        break;
+      case 0x046C:
+        bufpush(0x046D);
+        break;
+      case 0x046E:
+        bufpush(0x046F);
+        break;
+      case 0x0470:
+        bufpush(0x0471);
+        break;
+      case 0x0472:
+        bufpush(0x0473);
+        break;
+      case 0x0474:
+        bufpush(0x0475);
+        break;
+      case 0x0476:
+        bufpush(0x0477);
+        break;
+      case 0x0478:
+        bufpush(0x0479);
+        break;
+      case 0x047A:
+        bufpush(0x047B);
+        break;
+      case 0x047C:
+        bufpush(0x047D);
+        break;
+      case 0x047E:
+        bufpush(0x047F);
+        break;
+      case 0x0480:
+        bufpush(0x0481);
+        break;
+      case 0x048A:
+        bufpush(0x048B);
+        break;
+      case 0x048C:
+        bufpush(0x048D);
+        break;
+      case 0x048E:
+        bufpush(0x048F);
+        break;
+      case 0x0490:
+        bufpush(0x0491);
+        break;
+      case 0x0492:
+        bufpush(0x0493);
+        break;
+      case 0x0494:
+        bufpush(0x0495);
+        break;
+      case 0x0496:
+        bufpush(0x0497);
+        break;
+      case 0x0498:
+        bufpush(0x0499);
+        break;
+      case 0x049A:
+        bufpush(0x049B);
+        break;
+      case 0x049C:
+        bufpush(0x049D);
+        break;
+      case 0x049E:
+        bufpush(0x049F);
+        break;
+      case 0x04A0:
+        bufpush(0x04A1);
+        break;
+      case 0x04A2:
+        bufpush(0x04A3);
+        break;
+      case 0x04A4:
+        bufpush(0x04A5);
+        break;
+      case 0x04A6:
+        bufpush(0x04A7);
+        break;
+      case 0x04A8:
+        bufpush(0x04A9);
+        break;
+      case 0x04AA:
+        bufpush(0x04AB);
+        break;
+      case 0x04AC:
+        bufpush(0x04AD);
+        break;
+      case 0x04AE:
+        bufpush(0x04AF);
+        break;
+      case 0x04B0:
+        bufpush(0x04B1);
+        break;
+      case 0x04B2:
+        bufpush(0x04B3);
+        break;
+      case 0x04B4:
+        bufpush(0x04B5);
+        break;
+      case 0x04B6:
+        bufpush(0x04B7);
+        break;
+      case 0x04B8:
+        bufpush(0x04B9);
+        break;
+      case 0x04BA:
+        bufpush(0x04BB);
+        break;
+      case 0x04BC:
+        bufpush(0x04BD);
+        break;
+      case 0x04BE:
+        bufpush(0x04BF);
+        break;
+      case 0x04C1:
+        bufpush(0x04C2);
+        break;
+      case 0x04C3:
+        bufpush(0x04C4);
+        break;
+      case 0x04C5:
+        bufpush(0x04C6);
+        break;
+      case 0x04C7:
+        bufpush(0x04C8);
+        break;
+      case 0x04C9:
+        bufpush(0x04CA);
+        break;
+      case 0x04CB:
+        bufpush(0x04CC);
+        break;
+      case 0x04CD:
+        bufpush(0x04CE);
+        break;
+      case 0x04D0:
+        bufpush(0x04D1);
+        break;
+      case 0x04D2:
+        bufpush(0x04D3);
+        break;
+      case 0x04D4:
+        bufpush(0x04D5);
+        break;
+      case 0x04D6:
+        bufpush(0x04D7);
+        break;
+      case 0x04D8:
+        bufpush(0x04D9);
+        break;
+      case 0x04DA:
+        bufpush(0x04DB);
+        break;
+      case 0x04DC:
+        bufpush(0x04DD);
+        break;
+      case 0x04DE:
+        bufpush(0x04DF);
+        break;
+      case 0x04E0:
+        bufpush(0x04E1);
+        break;
+      case 0x04E2:
+        bufpush(0x04E3);
+        break;
+      case 0x04E4:
+        bufpush(0x04E5);
+        break;
+      case 0x04E6:
+        bufpush(0x04E7);
+        break;
+      case 0x04E8:
+        bufpush(0x04E9);
+        break;
+      case 0x04EA:
+        bufpush(0x04EB);
+        break;
+      case 0x04EC:
+        bufpush(0x04ED);
+        break;
+      case 0x04EE:
+        bufpush(0x04EF);
+        break;
+      case 0x04F0:
+        bufpush(0x04F1);
+        break;
+      case 0x04F2:
+        bufpush(0x04F3);
+        break;
+      case 0x04F4:
+        bufpush(0x04F5);
+        break;
+      case 0x04F8:
+        bufpush(0x04F9);
+        break;
+      case 0x0500:
+        bufpush(0x0501);
+        break;
+      case 0x0502:
+        bufpush(0x0503);
+        break;
+      case 0x0504:
+        bufpush(0x0505);
+        break;
+      case 0x0506:
+        bufpush(0x0507);
+        break;
+      case 0x0508:
+        bufpush(0x0509);
+        break;
+      case 0x050A:
+        bufpush(0x050B);
+        break;
+      case 0x050C:
+        bufpush(0x050D);
+        break;
+      case 0x050E:
+        bufpush(0x050F);
+        break;
+      case 0x0531:
+        bufpush(0x0561);
+        break;
+      case 0x0532:
+        bufpush(0x0562);
+        break;
+      case 0x0533:
+        bufpush(0x0563);
+        break;
+      case 0x0534:
+        bufpush(0x0564);
+        break;
+      case 0x0535:
+        bufpush(0x0565);
+        break;
+      case 0x0536:
+        bufpush(0x0566);
+        break;
+      case 0x0537:
+        bufpush(0x0567);
+        break;
+      case 0x0538:
+        bufpush(0x0568);
+        break;
+      case 0x0539:
+        bufpush(0x0569);
+        break;
+      case 0x053A:
+        bufpush(0x056A);
+        break;
+      case 0x053B:
+        bufpush(0x056B);
+        break;
+      case 0x053C:
+        bufpush(0x056C);
+        break;
+      case 0x053D:
+        bufpush(0x056D);
+        break;
+      case 0x053E:
+        bufpush(0x056E);
+        break;
+      case 0x053F:
+        bufpush(0x056F);
+        break;
+      case 0x0540:
+        bufpush(0x0570);
+        break;
+      case 0x0541:
+        bufpush(0x0571);
+        break;
+      case 0x0542:
+        bufpush(0x0572);
+        break;
+      case 0x0543:
+        bufpush(0x0573);
+        break;
+      case 0x0544:
+        bufpush(0x0574);
+        break;
+      case 0x0545:
+        bufpush(0x0575);
+        break;
+      case 0x0546:
+        bufpush(0x0576);
+        break;
+      case 0x0547:
+        bufpush(0x0577);
+        break;
+      case 0x0548:
+        bufpush(0x0578);
+        break;
+      case 0x0549:
+        bufpush(0x0579);
+        break;
+      case 0x054A:
+        bufpush(0x057A);
+        break;
+      case 0x054B:
+        bufpush(0x057B);
+        break;
+      case 0x054C:
+        bufpush(0x057C);
+        break;
+      case 0x054D:
+        bufpush(0x057D);
+        break;
+      case 0x054E:
+        bufpush(0x057E);
+        break;
+      case 0x054F:
+        bufpush(0x057F);
+        break;
+      case 0x0550:
+        bufpush(0x0580);
+        break;
+      case 0x0551:
+        bufpush(0x0581);
+        break;
+      case 0x0552:
+        bufpush(0x0582);
+        break;
+      case 0x0553:
+        bufpush(0x0583);
+        break;
+      case 0x0554:
+        bufpush(0x0584);
+        break;
+      case 0x0555:
+        bufpush(0x0585);
+        break;
+      case 0x0556:
+        bufpush(0x0586);
+        break;
+      case 0x0587:
+        bufpush(0x0565);
+        bufpush(0x0582);
+        break;
+      case 0x1E00:
+        bufpush(0x1E01);
+        break;
+      case 0x1E02:
+        bufpush(0x1E03);
+        break;
+      case 0x1E04:
+        bufpush(0x1E05);
+        break;
+      case 0x1E06:
+        bufpush(0x1E07);
+        break;
+      case 0x1E08:
+        bufpush(0x1E09);
+        break;
+      case 0x1E0A:
+        bufpush(0x1E0B);
+        break;
+      case 0x1E0C:
+        bufpush(0x1E0D);
+        break;
+      case 0x1E0E:
+        bufpush(0x1E0F);
+        break;
+      case 0x1E10:
+        bufpush(0x1E11);
+        break;
+      case 0x1E12:
+        bufpush(0x1E13);
+        break;
+      case 0x1E14:
+        bufpush(0x1E15);
+        break;
+      case 0x1E16:
+        bufpush(0x1E17);
+        break;
+      case 0x1E18:
+        bufpush(0x1E19);
+        break;
+      case 0x1E1A:
+        bufpush(0x1E1B);
+        break;
+      case 0x1E1C:
+        bufpush(0x1E1D);
+        break;
+      case 0x1E1E:
+        bufpush(0x1E1F);
+        break;
+      case 0x1E20:
+        bufpush(0x1E21);
+        break;
+      case 0x1E22:
+        bufpush(0x1E23);
+        break;
+      case 0x1E24:
+        bufpush(0x1E25);
+        break;
+      case 0x1E26:
+        bufpush(0x1E27);
+        break;
+      case 0x1E28:
+        bufpush(0x1E29);
+        break;
+      case 0x1E2A:
+        bufpush(0x1E2B);
+        break;
+      case 0x1E2C:
+        bufpush(0x1E2D);
+        break;
+      case 0x1E2E:
+        bufpush(0x1E2F);
+        break;
+      case 0x1E30:
+        bufpush(0x1E31);
+        break;
+      case 0x1E32:
+        bufpush(0x1E33);
+        break;
+      case 0x1E34:
+        bufpush(0x1E35);
+        break;
+      case 0x1E36:
+        bufpush(0x1E37);
+        break;
+      case 0x1E38:
+        bufpush(0x1E39);
+        break;
+      case 0x1E3A:
+        bufpush(0x1E3B);
+        break;
+      case 0x1E3C:
+        bufpush(0x1E3D);
+        break;
+      case 0x1E3E:
+        bufpush(0x1E3F);
+        break;
+      case 0x1E40:
+        bufpush(0x1E41);
+        break;
+      case 0x1E42:
+        bufpush(0x1E43);
+        break;
+      case 0x1E44:
+        bufpush(0x1E45);
+        break;
+      case 0x1E46:
+        bufpush(0x1E47);
+        break;
+      case 0x1E48:
+        bufpush(0x1E49);
+        break;
+      case 0x1E4A:
+        bufpush(0x1E4B);
+        break;
+      case 0x1E4C:
+        bufpush(0x1E4D);
+        break;
+      case 0x1E4E:
+        bufpush(0x1E4F);
+        break;
+      case 0x1E50:
+        bufpush(0x1E51);
+        break;
+      case 0x1E52:
+        bufpush(0x1E53);
+        break;
+      case 0x1E54:
+        bufpush(0x1E55);
+        break;
+      case 0x1E56:
+        bufpush(0x1E57);
+        break;
+      case 0x1E58:
+        bufpush(0x1E59);
+        break;
+      case 0x1E5A:
+        bufpush(0x1E5B);
+        break;
+      case 0x1E5C:
+        bufpush(0x1E5D);
+        break;
+      case 0x1E5E:
+        bufpush(0x1E5F);
+        break;
+      case 0x1E60:
+        bufpush(0x1E61);
+        break;
+      case 0x1E62:
+        bufpush(0x1E63);
+        break;
+      case 0x1E64:
+        bufpush(0x1E65);
+        break;
+      case 0x1E66:
+        bufpush(0x1E67);
+        break;
+      case 0x1E68:
+        bufpush(0x1E69);
+        break;
+      case 0x1E6A:
+        bufpush(0x1E6B);
+        break;
+      case 0x1E6C:
+        bufpush(0x1E6D);
+        break;
+      case 0x1E6E:
+        bufpush(0x1E6F);
+        break;
+      case 0x1E70:
+        bufpush(0x1E71);
+        break;
+      case 0x1E72:
+        bufpush(0x1E73);
+        break;
+      case 0x1E74:
+        bufpush(0x1E75);
+        break;
+      case 0x1E76:
+        bufpush(0x1E77);
+        break;
+      case 0x1E78:
+        bufpush(0x1E79);
+        break;
+      case 0x1E7A:
+        bufpush(0x1E7B);
+        break;
+      case 0x1E7C:
+        bufpush(0x1E7D);
+        break;
+      case 0x1E7E:
+        bufpush(0x1E7F);
+        break;
+      case 0x1E80:
+        bufpush(0x1E81);
+        break;
+      case 0x1E82:
+        bufpush(0x1E83);
+        break;
+      case 0x1E84:
+        bufpush(0x1E85);
+        break;
+      case 0x1E86:
+        bufpush(0x1E87);
+        break;
+      case 0x1E88:
+        bufpush(0x1E89);
+        break;
+      case 0x1E8A:
+        bufpush(0x1E8B);
+        break;
+      case 0x1E8C:
+        bufpush(0x1E8D);
+        break;
+      case 0x1E8E:
+        bufpush(0x1E8F);
+        break;
+      case 0x1E90:
+        bufpush(0x1E91);
+        break;
+      case 0x1E92:
+        bufpush(0x1E93);
+        break;
+      case 0x1E94:
+        bufpush(0x1E95);
+        break;
+      case 0x1E96:
+        bufpush(0x0068);
+        bufpush(0x0331);
+        break;
+      case 0x1E97:
+        bufpush(0x0074);
+        bufpush(0x0308);
+        break;
+      case 0x1E98:
+        bufpush(0x0077);
+        bufpush(0x030A);
+        break;
+      case 0x1E99:
+        bufpush(0x0079);
+        bufpush(0x030A);
+        break;
+      case 0x1E9A:
+        bufpush(0x0061);
+        bufpush(0x02BE);
+        break;
+      case 0x1E9B:
+        bufpush(0x1E61);
+        break;
+      case 0x1EA0:
+        bufpush(0x1EA1);
+        break;
+      case 0x1EA2:
+        bufpush(0x1EA3);
+        break;
+      case 0x1EA4:
+        bufpush(0x1EA5);
+        break;
+      case 0x1EA6:
+        bufpush(0x1EA7);
+        break;
+      case 0x1EA8:
+        bufpush(0x1EA9);
+        break;
+      case 0x1EAA:
+        bufpush(0x1EAB);
+        break;
+      case 0x1EAC:
+        bufpush(0x1EAD);
+        break;
+      case 0x1EAE:
+        bufpush(0x1EAF);
+        break;
+      case 0x1EB0:
+        bufpush(0x1EB1);
+        break;
+      case 0x1EB2:
+        bufpush(0x1EB3);
+        break;
+      case 0x1EB4:
+        bufpush(0x1EB5);
+        break;
+      case 0x1EB6:
+        bufpush(0x1EB7);
+        break;
+      case 0x1EB8:
+        bufpush(0x1EB9);
+        break;
+      case 0x1EBA:
+        bufpush(0x1EBB);
+        break;
+      case 0x1EBC:
+        bufpush(0x1EBD);
+        break;
+      case 0x1EBE:
+        bufpush(0x1EBF);
+        break;
+      case 0x1EC0:
+        bufpush(0x1EC1);
+        break;
+      case 0x1EC2:
+        bufpush(0x1EC3);
+        break;
+      case 0x1EC4:
+        bufpush(0x1EC5);
+        break;
+      case 0x1EC6:
+        bufpush(0x1EC7);
+        break;
+      case 0x1EC8:
+        bufpush(0x1EC9);
+        break;
+      case 0x1ECA:
+        bufpush(0x1ECB);
+        break;
+      case 0x1ECC:
+        bufpush(0x1ECD);
+        break;
+      case 0x1ECE:
+        bufpush(0x1ECF);
+        break;
+      case 0x1ED0:
+        bufpush(0x1ED1);
+        break;
+      case 0x1ED2:
+        bufpush(0x1ED3);
+        break;
+      case 0x1ED4:
+        bufpush(0x1ED5);
+        break;
+      case 0x1ED6:
+        bufpush(0x1ED7);
+        break;
+      case 0x1ED8:
+        bufpush(0x1ED9);
+        break;
+      case 0x1EDA:
+        bufpush(0x1EDB);
+        break;
+      case 0x1EDC:
+        bufpush(0x1EDD);
+        break;
+      case 0x1EDE:
+        bufpush(0x1EDF);
+        break;
+      case 0x1EE0:
+        bufpush(0x1EE1);
+        break;
+      case 0x1EE2:
+        bufpush(0x1EE3);
+        break;
+      case 0x1EE4:
+        bufpush(0x1EE5);
+        break;
+      case 0x1EE6:
+        bufpush(0x1EE7);
+        break;
+      case 0x1EE8:
+        bufpush(0x1EE9);
+        break;
+      case 0x1EEA:
+        bufpush(0x1EEB);
+        break;
+      case 0x1EEC:
+        bufpush(0x1EED);
+        break;
+      case 0x1EEE:
+        bufpush(0x1EEF);
+        break;
+      case 0x1EF0:
+        bufpush(0x1EF1);
+        break;
+      case 0x1EF2:
+        bufpush(0x1EF3);
+        break;
+      case 0x1EF4:
+        bufpush(0x1EF5);
+        break;
+      case 0x1EF6:
+        bufpush(0x1EF7);
+        break;
+      case 0x1EF8:
+        bufpush(0x1EF9);
+        break;
+      case 0x1F08:
+        bufpush(0x1F00);
+        break;
+      case 0x1F09:
+        bufpush(0x1F01);
+        break;
+      case 0x1F0A:
+        bufpush(0x1F02);
+        break;
+      case 0x1F0B:
+        bufpush(0x1F03);
+        break;
+      case 0x1F0C:
+        bufpush(0x1F04);
+        break;
+      case 0x1F0D:
+        bufpush(0x1F05);
+        break;
+      case 0x1F0E:
+        bufpush(0x1F06);
+        break;
+      case 0x1F0F:
+        bufpush(0x1F07);
+        break;
+      case 0x1F18:
+        bufpush(0x1F10);
+        break;
+      case 0x1F19:
+        bufpush(0x1F11);
+        break;
+      case 0x1F1A:
+        bufpush(0x1F12);
+        break;
+      case 0x1F1B:
+        bufpush(0x1F13);
+        break;
+      case 0x1F1C:
+        bufpush(0x1F14);
+        break;
+      case 0x1F1D:
+        bufpush(0x1F15);
+        break;
+      case 0x1F28:
+        bufpush(0x1F20);
+        break;
+      case 0x1F29:
+        bufpush(0x1F21);
+        break;
+      case 0x1F2A:
+        bufpush(0x1F22);
+        break;
+      case 0x1F2B:
+        bufpush(0x1F23);
+        break;
+      case 0x1F2C:
+        bufpush(0x1F24);
+        break;
+      case 0x1F2D:
+        bufpush(0x1F25);
+        break;
+      case 0x1F2E:
+        bufpush(0x1F26);
+        break;
+      case 0x1F2F:
+        bufpush(0x1F27);
+        break;
+      case 0x1F38:
+        bufpush(0x1F30);
+        break;
+      case 0x1F39:
+        bufpush(0x1F31);
+        break;
+      case 0x1F3A:
+        bufpush(0x1F32);
+        break;
+      case 0x1F3B:
+        bufpush(0x1F33);
+        break;
+      case 0x1F3C:
+        bufpush(0x1F34);
+        break;
+      case 0x1F3D:
+        bufpush(0x1F35);
+        break;
+      case 0x1F3E:
+        bufpush(0x1F36);
+        break;
+      case 0x1F3F:
+        bufpush(0x1F37);
+        break;
+      case 0x1F48:
+        bufpush(0x1F40);
+        break;
+      case 0x1F49:
+        bufpush(0x1F41);
+        break;
+      case 0x1F4A:
+        bufpush(0x1F42);
+        break;
+      case 0x1F4B:
+        bufpush(0x1F43);
+        break;
+      case 0x1F4C:
+        bufpush(0x1F44);
+        break;
+      case 0x1F4D:
+        bufpush(0x1F45);
+        break;
+      case 0x1F50:
+        bufpush(0x03C5);
+        bufpush(0x0313);
+        break;
+      case 0x1F52:
+        bufpush(0x03C5);
+        bufpush(0x0313);
+        bufpush(0x0300);
+        break;
+      case 0x1F54:
+        bufpush(0x03C5);
+        bufpush(0x0313);
+        bufpush(0x0301);
+        break;
+      case 0x1F56:
+        bufpush(0x03C5);
+        bufpush(0x0313);
+        bufpush(0x0342);
+        break;
+      case 0x1F59:
+        bufpush(0x1F51);
+        break;
+      case 0x1F5B:
+        bufpush(0x1F53);
+        break;
+      case 0x1F5D:
+        bufpush(0x1F55);
+        break;
+      case 0x1F5F:
+        bufpush(0x1F57);
+        break;
+      case 0x1F68:
+        bufpush(0x1F60);
+        break;
+      case 0x1F69:
+        bufpush(0x1F61);
+        break;
+      case 0x1F6A:
+        bufpush(0x1F62);
+        break;
+      case 0x1F6B:
+        bufpush(0x1F63);
+        break;
+      case 0x1F6C:
+        bufpush(0x1F64);
+        break;
+      case 0x1F6D:
+        bufpush(0x1F65);
+        break;
+      case 0x1F6E:
+        bufpush(0x1F66);
+        break;
+      case 0x1F6F:
+        bufpush(0x1F67);
+        break;
+      case 0x1F80:
+        bufpush(0x1F00);
+        bufpush(0x03B9);
+        break;
+      case 0x1F81:
+        bufpush(0x1F01);
+        bufpush(0x03B9);
+        break;
+      case 0x1F82:
+        bufpush(0x1F02);
+        bufpush(0x03B9);
+        break;
+      case 0x1F83:
+        bufpush(0x1F03);
+        bufpush(0x03B9);
+        break;
+      case 0x1F84:
+        bufpush(0x1F04);
+        bufpush(0x03B9);
+        break;
+      case 0x1F85:
+        bufpush(0x1F05);
+        bufpush(0x03B9);
+        break;
+      case 0x1F86:
+        bufpush(0x1F06);
+        bufpush(0x03B9);
+        break;
+      case 0x1F87:
+        bufpush(0x1F07);
+        bufpush(0x03B9);
+        break;
+      case 0x1F88:
+        bufpush(0x1F00);
+        bufpush(0x03B9);
+        break;
+      case 0x1F89:
+        bufpush(0x1F01);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8A:
+        bufpush(0x1F02);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8B:
+        bufpush(0x1F03);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8C:
+        bufpush(0x1F04);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8D:
+        bufpush(0x1F05);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8E:
+        bufpush(0x1F06);
+        bufpush(0x03B9);
+        break;
+      case 0x1F8F:
+        bufpush(0x1F07);
+        bufpush(0x03B9);
+        break;
+      case 0x1F90:
+        bufpush(0x1F20);
+        bufpush(0x03B9);
+        break;
+      case 0x1F91:
+        bufpush(0x1F21);
+        bufpush(0x03B9);
+        break;
+      case 0x1F92:
+        bufpush(0x1F22);
+        bufpush(0x03B9);
+        break;
+      case 0x1F93:
+        bufpush(0x1F23);
+        bufpush(0x03B9);
+        break;
+      case 0x1F94:
+        bufpush(0x1F24);
+        bufpush(0x03B9);
+        break;
+      case 0x1F95:
+        bufpush(0x1F25);
+        bufpush(0x03B9);
+        break;
+      case 0x1F96:
+        bufpush(0x1F26);
+        bufpush(0x03B9);
+        break;
+      case 0x1F97:
+        bufpush(0x1F27);
+        bufpush(0x03B9);
+        break;
+      case 0x1F98:
+        bufpush(0x1F20);
+        bufpush(0x03B9);
+        break;
+      case 0x1F99:
+        bufpush(0x1F21);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9A:
+        bufpush(0x1F22);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9B:
+        bufpush(0x1F23);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9C:
+        bufpush(0x1F24);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9D:
+        bufpush(0x1F25);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9E:
+        bufpush(0x1F26);
+        bufpush(0x03B9);
+        break;
+      case 0x1F9F:
+        bufpush(0x1F27);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA0:
+        bufpush(0x1F60);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA1:
+        bufpush(0x1F61);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA2:
+        bufpush(0x1F62);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA3:
+        bufpush(0x1F63);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA4:
+        bufpush(0x1F64);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA5:
+        bufpush(0x1F65);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA6:
+        bufpush(0x1F66);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA7:
+        bufpush(0x1F67);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA8:
+        bufpush(0x1F60);
+        bufpush(0x03B9);
+        break;
+      case 0x1FA9:
+        bufpush(0x1F61);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAA:
+        bufpush(0x1F62);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAB:
+        bufpush(0x1F63);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAC:
+        bufpush(0x1F64);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAD:
+        bufpush(0x1F65);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAE:
+        bufpush(0x1F66);
+        bufpush(0x03B9);
+        break;
+      case 0x1FAF:
+        bufpush(0x1F67);
+        bufpush(0x03B9);
+        break;
+      case 0x1FB2:
+        bufpush(0x1F70);
+        bufpush(0x03B9);
+        break;
+      case 0x1FB3:
+        bufpush(0x03B1);
+        bufpush(0x03B9);
+        break;
+      case 0x1FB4:
+        bufpush(0x03AC);
+        bufpush(0x03B9);
+        break;
+      case 0x1FB6:
+        bufpush(0x03B1);
+        bufpush(0x0342);
+        break;
+      case 0x1FB7:
+        bufpush(0x03B1);
+        bufpush(0x0342);
+        bufpush(0x03B9);
+        break;
+      case 0x1FB8:
+        bufpush(0x1FB0);
+        break;
+      case 0x1FB9:
+        bufpush(0x1FB1);
+        break;
+      case 0x1FBA:
+        bufpush(0x1F70);
+        break;
+      case 0x1FBB:
+        bufpush(0x1F71);
+        break;
+      case 0x1FBC:
+        bufpush(0x03B1);
+        bufpush(0x03B9);
+        break;
+      case 0x1FBE:
+        bufpush(0x03B9);
+        break;
+      case 0x1FC2:
+        bufpush(0x1F74);
+        bufpush(0x03B9);
+        break;
+      case 0x1FC3:
+        bufpush(0x03B7);
+        bufpush(0x03B9);
+        break;
+      case 0x1FC4:
+        bufpush(0x03AE);
+        bufpush(0x03B9);
+        break;
+      case 0x1FC6:
+        bufpush(0x03B7);
+        bufpush(0x0342);
+        break;
+      case 0x1FC7:
+        bufpush(0x03B7);
+        bufpush(0x0342);
+        bufpush(0x03B9);
+        break;
+      case 0x1FC8:
+        bufpush(0x1F72);
+        break;
+      case 0x1FC9:
+        bufpush(0x1F73);
+        break;
+      case 0x1FCA:
+        bufpush(0x1F74);
+        break;
+      case 0x1FCB:
+        bufpush(0x1F75);
+        break;
+      case 0x1FCC:
+        bufpush(0x03B7);
+        bufpush(0x03B9);
+        break;
+      case 0x1FD2:
+        bufpush(0x03B9);
+        bufpush(0x0308);
+        bufpush(0x0300);
+        break;
+      case 0x1FD3:
+        bufpush(0x03B9);
+        bufpush(0x0308);
+        bufpush(0x0301);
+        break;
+      case 0x1FD6:
+        bufpush(0x03B9);
+        bufpush(0x0342);
+        break;
+      case 0x1FD7:
+        bufpush(0x03B9);
+        bufpush(0x0308);
+        bufpush(0x0342);
+        break;
+      case 0x1FD8:
+        bufpush(0x1FD0);
+        break;
+      case 0x1FD9:
+        bufpush(0x1FD1);
+        break;
+      case 0x1FDA:
+        bufpush(0x1F76);
+        break;
+      case 0x1FDB:
+        bufpush(0x1F77);
+        break;
+      case 0x1FE2:
+        bufpush(0x03C5);
+        bufpush(0x0308);
+        bufpush(0x0300);
+        break;
+      case 0x1FE3:
+        bufpush(0x03C5);
+        bufpush(0x0308);
+        bufpush(0x0301);
+        break;
+      case 0x1FE4:
+        bufpush(0x03C1);
+        bufpush(0x0313);
+        break;
+      case 0x1FE6:
+        bufpush(0x03C5);
+        bufpush(0x0342);
+        break;
+      case 0x1FE7:
+        bufpush(0x03C5);
+        bufpush(0x0308);
+        bufpush(0x0342);
+        break;
+      case 0x1FE8:
+        bufpush(0x1FE0);
+        break;
+      case 0x1FE9:
+        bufpush(0x1FE1);
+        break;
+      case 0x1FEA:
+        bufpush(0x1F7A);
+        break;
+      case 0x1FEB:
+        bufpush(0x1F7B);
+        break;
+      case 0x1FEC:
+        bufpush(0x1FE5);
+        break;
+      case 0x1FF2:
+        bufpush(0x1F7C);
+        bufpush(0x03B9);
+        break;
+      case 0x1FF3:
+        bufpush(0x03C9);
+        bufpush(0x03B9);
+        break;
+      case 0x1FF4:
+        bufpush(0x03CE);
+        bufpush(0x03B9);
+        break;
+      case 0x1FF6:
+        bufpush(0x03C9);
+        bufpush(0x0342);
+        break;
+      case 0x1FF7:
+        bufpush(0x03C9);
+        bufpush(0x0342);
+        bufpush(0x03B9);
+        break;
+      case 0x1FF8:
+        bufpush(0x1F78);
+        break;
+      case 0x1FF9:
+        bufpush(0x1F79);
+        break;
+      case 0x1FFA:
+        bufpush(0x1F7C);
+        break;
+      case 0x1FFB:
+        bufpush(0x1F7D);
+        break;
+      case 0x1FFC:
+        bufpush(0x03C9);
+        bufpush(0x03B9);
+        break;
+      case 0x2126:
+        bufpush(0x03C9);
+        break;
+      case 0x212A:
+        bufpush(0x006B);
+        break;
+      case 0x212B:
+        bufpush(0x00E5);
+        break;
+      case 0x2160:
+        bufpush(0x2170);
+        break;
+      case 0x2161:
+        bufpush(0x2171);
+        break;
+      case 0x2162:
+        bufpush(0x2172);
+        break;
+      case 0x2163:
+        bufpush(0x2173);
+        break;
+      case 0x2164:
+        bufpush(0x2174);
+        break;
+      case 0x2165:
+        bufpush(0x2175);
+        break;
+      case 0x2166:
+        bufpush(0x2176);
+        break;
+      case 0x2167:
+        bufpush(0x2177);
+        break;
+      case 0x2168:
+        bufpush(0x2178);
+        break;
+      case 0x2169:
+        bufpush(0x2179);
+        break;
+      case 0x216A:
+        bufpush(0x217A);
+        break;
+      case 0x216B:
+        bufpush(0x217B);
+        break;
+      case 0x216C:
+        bufpush(0x217C);
+        break;
+      case 0x216D:
+        bufpush(0x217D);
+        break;
+      case 0x216E:
+        bufpush(0x217E);
+        break;
+      case 0x216F:
+        bufpush(0x217F);
+        break;
+      case 0x24B6:
+        bufpush(0x24D0);
+        break;
+      case 0x24B7:
+        bufpush(0x24D1);
+        break;
+      case 0x24B8:
+        bufpush(0x24D2);
+        break;
+      case 0x24B9:
+        bufpush(0x24D3);
+        break;
+      case 0x24BA:
+        bufpush(0x24D4);
+        break;
+      case 0x24BB:
+        bufpush(0x24D5);
+        break;
+      case 0x24BC:
+        bufpush(0x24D6);
+        break;
+      case 0x24BD:
+        bufpush(0x24D7);
+        break;
+      case 0x24BE:
+        bufpush(0x24D8);
+        break;
+      case 0x24BF:
+        bufpush(0x24D9);
+        break;
+      case 0x24C0:
+        bufpush(0x24DA);
+        break;
+      case 0x24C1:
+        bufpush(0x24DB);
+        break;
+      case 0x24C2:
+        bufpush(0x24DC);
+        break;
+      case 0x24C3:
+        bufpush(0x24DD);
+        break;
+      case 0x24C4:
+        bufpush(0x24DE);
+        break;
+      case 0x24C5:
+        bufpush(0x24DF);
+        break;
+      case 0x24C6:
+        bufpush(0x24E0);
+        break;
+      case 0x24C7:
+        bufpush(0x24E1);
+        break;
+      case 0x24C8:
+        bufpush(0x24E2);
+        break;
+      case 0x24C9:
+        bufpush(0x24E3);
+        break;
+      case 0x24CA:
+        bufpush(0x24E4);
+        break;
+      case 0x24CB:
+        bufpush(0x24E5);
+        break;
+      case 0x24CC:
+        bufpush(0x24E6);
+        break;
+      case 0x24CD:
+        bufpush(0x24E7);
+        break;
+      case 0x24CE:
+        bufpush(0x24E8);
+        break;
+      case 0x24CF:
+        bufpush(0x24E9);
+        break;
+      case 0xFB00:
+        bufpush(0x0066);
+        bufpush(0x0066);
+        break;
+      case 0xFB01:
+        bufpush(0x0066);
+        bufpush(0x0069);
+        break;
+      case 0xFB02:
+        bufpush(0x0066);
+        bufpush(0x006C);
+        break;
+      case 0xFB03:
+        bufpush(0x0066);
+        bufpush(0x0066);
+        bufpush(0x0069);
+        break;
+      case 0xFB04:
+        bufpush(0x0066);
+        bufpush(0x0066);
+        bufpush(0x006C);
+        break;
+      case 0xFB05:
+        bufpush(0x0073);
+        bufpush(0x0074);
+        break;
+      case 0xFB06:
+        bufpush(0x0073);
+        bufpush(0x0074);
+        break;
+      case 0xFB13:
+        bufpush(0x0574);
+        bufpush(0x0576);
+        break;
+      case 0xFB14:
+        bufpush(0x0574);
+        bufpush(0x0565);
+        break;
+      case 0xFB15:
+        bufpush(0x0574);
+        bufpush(0x056B);
+        break;
+      case 0xFB16:
+        bufpush(0x057E);
+        bufpush(0x0576);
+        break;
+      case 0xFB17:
+        bufpush(0x0574);
+        bufpush(0x056D);
+        break;
+      case 0xFF21:
+        bufpush(0xFF41);
+        break;
+      case 0xFF22:
+        bufpush(0xFF42);
+        break;
+      case 0xFF23:
+        bufpush(0xFF43);
+        break;
+      case 0xFF24:
+        bufpush(0xFF44);
+        break;
+      case 0xFF25:
+        bufpush(0xFF45);
+        break;
+      case 0xFF26:
+        bufpush(0xFF46);
+        break;
+      case 0xFF27:
+        bufpush(0xFF47);
+        break;
+      case 0xFF28:
+        bufpush(0xFF48);
+        break;
+      case 0xFF29:
+        bufpush(0xFF49);
+        break;
+      case 0xFF2A:
+        bufpush(0xFF4A);
+        break;
+      case 0xFF2B:
+        bufpush(0xFF4B);
+        break;
+      case 0xFF2C:
+        bufpush(0xFF4C);
+        break;
+      case 0xFF2D:
+        bufpush(0xFF4D);
+        break;
+      case 0xFF2E:
+        bufpush(0xFF4E);
+        break;
+      case 0xFF2F:
+        bufpush(0xFF4F);
+        break;
+      case 0xFF30:
+        bufpush(0xFF50);
+        break;
+      case 0xFF31:
+        bufpush(0xFF51);
+        break;
+      case 0xFF32:
+        bufpush(0xFF52);
+        break;
+      case 0xFF33:
+        bufpush(0xFF53);
+        break;
+      case 0xFF34:
+        bufpush(0xFF54);
+        break;
+      case 0xFF35:
+        bufpush(0xFF55);
+        break;
+      case 0xFF36:
+        bufpush(0xFF56);
+        break;
+      case 0xFF37:
+        bufpush(0xFF57);
+        break;
+      case 0xFF38:
+        bufpush(0xFF58);
+        break;
+      case 0xFF39:
+        bufpush(0xFF59);
+        break;
+      case 0xFF3A:
+        bufpush(0xFF5A);
+        break;
+      case 0x10400:
+        bufpush(0x10428);
+        break;
+      case 0x10401:
+        bufpush(0x10429);
+        break;
+      case 0x10402:
+        bufpush(0x1042A);
+        break;
+      case 0x10403:
+        bufpush(0x1042B);
+        break;
+      case 0x10404:
+        bufpush(0x1042C);
+        break;
+      case 0x10405:
+        bufpush(0x1042D);
+        break;
+      case 0x10406:
+        bufpush(0x1042E);
+        break;
+      case 0x10407:
+        bufpush(0x1042F);
+        break;
+      case 0x10408:
+        bufpush(0x10430);
+        break;
+      case 0x10409:
+        bufpush(0x10431);
+        break;
+      case 0x1040A:
+        bufpush(0x10432);
+        break;
+      case 0x1040B:
+        bufpush(0x10433);
+        break;
+      case 0x1040C:
+        bufpush(0x10434);
+        break;
+      case 0x1040D:
+        bufpush(0x10435);
+        break;
+      case 0x1040E:
+        bufpush(0x10436);
+        break;
+      case 0x1040F:
+        bufpush(0x10437);
+        break;
+      case 0x10410:
+        bufpush(0x10438);
+        break;
+      case 0x10411:
+        bufpush(0x10439);
+        break;
+      case 0x10412:
+        bufpush(0x1043A);
+        break;
+      case 0x10413:
+        bufpush(0x1043B);
+        break;
+      case 0x10414:
+        bufpush(0x1043C);
+        break;
+      case 0x10415:
+        bufpush(0x1043D);
+        break;
+      case 0x10416:
+        bufpush(0x1043E);
+        break;
+      case 0x10417:
+        bufpush(0x1043F);
+        break;
+      case 0x10418:
+        bufpush(0x10440);
+        break;
+      case 0x10419:
+        bufpush(0x10441);
+        break;
+      case 0x1041A:
+        bufpush(0x10442);
+        break;
+      case 0x1041B:
+        bufpush(0x10443);
+        break;
+      case 0x1041C:
+        bufpush(0x10444);
+        break;
+      case 0x1041D:
+        bufpush(0x10445);
+        break;
+      case 0x1041E:
+        bufpush(0x10446);
+        break;
+      case 0x1041F:
+        bufpush(0x10447);
+        break;
+      case 0x10420:
+        bufpush(0x10448);
+        break;
+      case 0x10421:
+        bufpush(0x10449);
+        break;
+      case 0x10422:
+        bufpush(0x1044A);
+        break;
+      case 0x10423:
+        bufpush(0x1044B);
+        break;
+      case 0x10424:
+        bufpush(0x1044C);
+        break;
+      case 0x10425:
+        bufpush(0x1044D);
+        break;
+      default:
+        bufpush(c);
+    }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/chunk.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/chunk.h 
b/compiler/modules/CommonMark/src/chunk.h
new file mode 100644
index 0000000..22594b1
--- /dev/null
+++ b/compiler/modules/CommonMark/src/chunk.h
@@ -0,0 +1,122 @@
+#ifndef CMARK_CHUNK_H
+#define CMARK_CHUNK_H
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "buffer.h"
+
+typedef struct {
+       unsigned char *data;
+       int len;
+       int alloc;  // also implies a NULL-terminated string
+} cmark_chunk;
+
+static inline void cmark_chunk_free(cmark_chunk *c)
+{
+       if (c->alloc)
+               free(c->data);
+
+       c->data = NULL;
+       c->alloc = 0;
+       c->len = 0;
+}
+
+static inline void cmark_chunk_ltrim(cmark_chunk *c)
+{
+       assert(!c->alloc);
+
+       while (c->len && isspace(c->data[0])) {
+               c->data++;
+               c->len--;
+       }
+}
+
+static inline void cmark_chunk_rtrim(cmark_chunk *c)
+{
+       while (c->len > 0) {
+               if (!isspace(c->data[c->len - 1]))
+                       break;
+
+               c->len--;
+       }
+}
+
+static inline void cmark_chunk_trim(cmark_chunk *c)
+{
+       cmark_chunk_ltrim(c);
+       cmark_chunk_rtrim(c);
+}
+
+static inline int cmark_chunk_strchr(cmark_chunk *ch, int c, int offset)
+{
+       const unsigned char *p = (unsigned char *)memchr(ch->data + offset, c, 
ch->len - offset);
+       return p ? (int)(p - ch->data) : ch->len;
+}
+
+static inline const char *cmark_chunk_to_cstr(cmark_chunk *c)
+{
+       unsigned char *str;
+
+       if (c->alloc) {
+               return (char *)c->data;
+       }
+       str = (unsigned char *)malloc(c->len + 1);
+       if(str != NULL) {
+               memcpy(str, c->data, c->len);
+               str[c->len] = 0;
+       }
+       c->data  = str;
+       c->alloc = 1;
+
+       return (char *)str;
+}
+
+static inline void cmark_chunk_set_cstr(cmark_chunk *c, const char *str)
+{
+       if (c->alloc) {
+               free(c->data);
+       }
+       c->len   = strlen(str);
+       c->data  = (unsigned char *)malloc(c->len + 1);
+       c->alloc = 1;
+       memcpy(c->data, str, c->len + 1);
+}
+
+static inline cmark_chunk cmark_chunk_literal(const char *data)
+{
+       cmark_chunk c = {(unsigned char *)data, data ? strlen(data) : 0, 0};
+       return c;
+}
+
+static inline cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, int pos, int 
len)
+{
+       cmark_chunk c = {ch->data + pos, len, 0};
+       return c;
+}
+
+static inline cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf)
+{
+       cmark_chunk c;
+
+       c.len = buf->size;
+       c.data = cmark_strbuf_detach(buf);
+       c.alloc = 1;
+
+       return c;
+}
+
+// Convenience macros
+#define chunk             cmark_chunk
+#define chunk_free        cmark_chunk_free
+#define chunk_ltrim       cmark_chunk_ltrim
+#define chunk_rtrim       cmark_chunk_rtrim
+#define chunk_trim        cmark_chunk_trim
+#define chunk_strchr      cmark_chunk_strchr
+#define chunk_to_cstr     cmark_chunk_to_cstr
+#define chunk_literal     cmark_chunk_literal
+#define chunk_dup         cmark_chunk_dup
+#define chunk_buf_detach  cmark_chunk_buf_detach
+
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/cmark.c
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/cmark.c 
b/compiler/modules/CommonMark/src/cmark.c
new file mode 100644
index 0000000..140a14c
--- /dev/null
+++ b/compiler/modules/CommonMark/src/cmark.c
@@ -0,0 +1,21 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include "node.h"
+#include "html/houdini.h"
+#include "cmark.h"
+#include "buffer.h"
+
+char *cmark_markdown_to_html(const char *text, int len)
+{
+       cmark_node *doc;
+       char *result;
+
+       doc = cmark_parse_document(text, len);
+
+       result = cmark_render_html(doc);
+       cmark_node_free(doc);
+
+       return result;
+}
+

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/cmark.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/cmark.h 
b/compiler/modules/CommonMark/src/cmark.h
new file mode 100644
index 0000000..cae4426
--- /dev/null
+++ b/compiler/modules/CommonMark/src/cmark.h
@@ -0,0 +1,343 @@
+#ifndef CMARK_H
+#define CMARK_H
+
+#include <stdio.h>
+#include "cmark_export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** .SH NAME
+ *
+ * .B cmark
+ * \- CommonMark parsing, manipulating, and rendering
+ */
+
+/** .SH SIMPLE INTERFACE
+ */
+
+/** Current version of library.
+ */
+#define CMARK_VERSION "0.1"
+
+/** Convert 'text' (assumed to be a UTF-8 encoded string with length
+ * 'len' from CommonMark Markdown to HTML, returning a null-terminated,
+ * UTF-8-encoded string.
+ */
+CMARK_EXPORT
+char *cmark_markdown_to_html(const char *text, int len);
+
+/** .SH NODE STRUCTURE
+ */
+
+/**
+ */
+typedef enum {
+       /* Block */
+       CMARK_NODE_DOCUMENT,
+       CMARK_NODE_BLOCK_QUOTE,
+       CMARK_NODE_LIST,
+       CMARK_NODE_LIST_ITEM,
+       CMARK_NODE_CODE_BLOCK,
+       CMARK_NODE_HTML,
+       CMARK_NODE_PARAGRAPH,
+       CMARK_NODE_HEADER,
+       CMARK_NODE_HRULE,
+       CMARK_NODE_REFERENCE_DEF,
+
+       CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT,
+       CMARK_NODE_LAST_BLOCK  = CMARK_NODE_REFERENCE_DEF,
+
+       /* Inline */
+       CMARK_NODE_TEXT,
+       CMARK_NODE_SOFTBREAK,
+       CMARK_NODE_LINEBREAK,
+       CMARK_NODE_INLINE_CODE,
+       CMARK_NODE_INLINE_HTML,
+       CMARK_NODE_EMPH,
+       CMARK_NODE_STRONG,
+       CMARK_NODE_LINK,
+       CMARK_NODE_IMAGE,
+
+       CMARK_NODE_FIRST_INLINE = CMARK_NODE_TEXT,
+       CMARK_NODE_LAST_INLINE  = CMARK_NODE_IMAGE,
+} cmark_node_type;
+
+
+/**
+ */
+typedef enum {
+       CMARK_NO_LIST,
+       CMARK_BULLET_LIST,
+       CMARK_ORDERED_LIST
+}  cmark_list_type;
+
+/**
+ */
+typedef enum {
+       CMARK_PERIOD_DELIM,
+       CMARK_PAREN_DELIM
+} cmark_delim_type;
+
+typedef struct cmark_node cmark_node;
+typedef struct cmark_parser cmark_parser;
+
+/**
+ * .SH CREATING AND DESTROYING NODES
+ */
+
+/**
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_new(cmark_node_type type);
+
+/**
+ */
+CMARK_EXPORT void
+cmark_node_free(cmark_node *node);
+
+/**
+ * .SH TREE TRAVERSAL
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_next(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_previous(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_parent(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_first_child(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT cmark_node*
+cmark_node_last_child(cmark_node *node);
+
+/**
+ * .SH ACCESSORS
+ */
+
+/**
+ */
+CMARK_EXPORT cmark_node_type
+cmark_node_get_type(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT const char*
+cmark_node_get_string_content(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_string_content(cmark_node *node, const char *content);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_header_level(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_header_level(cmark_node *node, int level);
+
+/**
+ */
+CMARK_EXPORT cmark_list_type
+cmark_node_get_list_type(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_list_type(cmark_node *node, cmark_list_type type);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_list_start(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_list_start(cmark_node *node, int start);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_list_tight(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_list_tight(cmark_node *node, int tight);
+
+/**
+ */
+CMARK_EXPORT const char*
+cmark_node_get_fence_info(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_fence_info(cmark_node *node, const char *info);
+
+/**
+ */
+CMARK_EXPORT const char*
+cmark_node_get_url(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_url(cmark_node *node, const char *url);
+
+/**
+ */
+CMARK_EXPORT const char*
+cmark_node_get_title(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_set_title(cmark_node *node, const char *title);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_start_line(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_start_column(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_get_end_line(cmark_node *node);
+
+/**
+ * .SH TREE MANIPULATION
+ */
+
+/**
+ */
+CMARK_EXPORT void
+cmark_node_unlink(cmark_node *node);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_insert_before(cmark_node *node, cmark_node *sibling);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_prepend_child(cmark_node *node, cmark_node *child);
+
+/**
+ */
+CMARK_EXPORT int
+cmark_node_append_child(cmark_node *node, cmark_node *child);
+
+/**
+ * .SH PARSING
+ */
+
+/**
+ */
+CMARK_EXPORT
+cmark_parser *cmark_parser_new();
+
+/**
+ */
+CMARK_EXPORT
+void cmark_parser_free(cmark_parser *parser);
+
+/**
+ */
+CMARK_EXPORT
+cmark_node *cmark_parser_finish(cmark_parser *parser);
+
+/**
+ */
+CMARK_EXPORT
+void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len);
+
+/**
+ */
+CMARK_EXPORT
+cmark_node *cmark_parse_document(const char *buffer, size_t len);
+
+/**
+ */
+CMARK_EXPORT
+cmark_node *cmark_parse_file(FILE *f);
+
+/**
+ * .SH RENDERING
+ */
+
+/**
+ */
+CMARK_EXPORT
+char *cmark_render_ast(cmark_node *root);
+
+/**
+ */
+CMARK_EXPORT
+char *cmark_render_html(cmark_node *root);
+
+/** .SH AUTHORS
+ *
+ * John MacFarlane, Vicent Marti,  Kārlis Gaņģis, Nick Wellnhofer.
+ */
+
+#ifndef CMARK_NO_SHORT_NAMES
+  #define NODE_DOCUMENT             CMARK_NODE_DOCUMENT
+  #define NODE_BLOCK_QUOTE          CMARK_NODE_BLOCK_QUOTE
+  #define NODE_LIST                 CMARK_NODE_LIST
+  #define NODE_LIST_ITEM            CMARK_NODE_LIST_ITEM
+  #define NODE_CODE_BLOCK           CMARK_NODE_CODE_BLOCK
+  #define NODE_HTML                 CMARK_NODE_HTML
+  #define NODE_PARAGRAPH            CMARK_NODE_PARAGRAPH
+  #define NODE_HEADER              CMARK_NODE_HEADER
+  #define NODE_HRULE                CMARK_NODE_HRULE
+  #define NODE_REFERENCE_DEF        CMARK_NODE_REFERENCE_DEF
+  #define NODE_TEXT                 CMARK_NODE_TEXT
+  #define NODE_SOFTBREAK            CMARK_NODE_SOFTBREAK
+  #define NODE_LINEBREAK            CMARK_NODE_LINEBREAK
+  #define NODE_INLINE_CODE          CMARK_NODE_INLINE_CODE
+  #define NODE_INLINE_HTML          CMARK_NODE_INLINE_HTML
+  #define NODE_EMPH                 CMARK_NODE_EMPH
+  #define NODE_STRONG               CMARK_NODE_STRONG
+  #define NODE_LINK                 CMARK_NODE_LINK
+  #define NODE_IMAGE                CMARK_NODE_IMAGE
+  #define NODE_LINK_LABEL           CMARK_NODE_LINK_LABEL
+  #define BULLET_LIST               CMARK_BULLET_LIST
+  #define ORDERED_LIST              CMARK_ORDERED_LIST
+  #define PERIOD_DELIM              CMARK_PERIOD_DELIM
+  #define PAREN_DELIM               CMARK_PAREN_DELIM
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/cmark_export.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/cmark_export.h 
b/compiler/modules/CommonMark/src/cmark_export.h
new file mode 100644
index 0000000..fa14b4d
--- /dev/null
+++ b/compiler/modules/CommonMark/src/cmark_export.h
@@ -0,0 +1,7 @@
+#ifndef CMARK_EXPORT_H
+#define CMARK_EXPORT_H
+
+#define CMARK_EXPORT
+#define CMARK_NO_EXPORT
+
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/config.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/config.h 
b/compiler/modules/CommonMark/src/config.h
new file mode 100644
index 0000000..ce3064e
--- /dev/null
+++ b/compiler/modules/CommonMark/src/config.h
@@ -0,0 +1,11 @@
+#include "charmony.h"
+
+#ifdef CHY_HAS_STDBOOL_H
+# include <stdbool.h>
+#elif !defined(__cplusplus)
+typedef char bool;
+# define true 1
+# define false 0
+#endif
+
+#define CMARK_ATTRIBUTE(list)

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/config.h.in
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/config.h.in 
b/compiler/modules/CommonMark/src/config.h.in
new file mode 100644
index 0000000..5294bc9
--- /dev/null
+++ b/compiler/modules/CommonMark/src/config.h.in
@@ -0,0 +1,17 @@
+#cmakedefine HAVE_STDBOOL_H
+
+#ifdef HAVE_STDBOOL_H
+  #include <stdbool.h>
+#elif !defined(__cplusplus)
+  typedef char bool;
+#endif
+
+#cmakedefine HAVE___BUILTIN_EXPECT
+
+#cmakedefine HAVE___ATTRIBUTE__
+
+#ifdef HAVE___ATTRIBUTE__
+  #define CMARK_ATTRIBUTE(list) __attribute__ (list)
+#else
+  #define CMARK_ATTRIBUTE(list)
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/debug.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/debug.h 
b/compiler/modules/CommonMark/src/debug.h
new file mode 100644
index 0000000..fd2ef62
--- /dev/null
+++ b/compiler/modules/CommonMark/src/debug.h
@@ -0,0 +1,36 @@
+#ifndef CMARK_DEBUG_H
+#define CMARK_DEBUG_H
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#ifdef NDEBUG
+#define debug(M, ...)
+#else
+#define debug(M, ...) \
+  fprintf(stderr, "DEBUG %s:%d: " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
+#endif
+
+#define clean_errno() (errno == 0 ? "None" : strerror(errno))
+
+#define log_err(M, ...) \
+  fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, \
+           clean_errno(), ##__VA_ARGS__)
+
+#define log_warn(M, ...) \
+  fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, \
+           clean_errno(), ##__VA_ARGS__)
+
+#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d) " M "\n", __FILE__, \
+            __LINE__, ##__VA_ARGS__)
+
+#define check(A, M, ...) \
+  if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; }
+
+#define sentinel(M, ...) \
+   { log_err(M, ##__VA_ARGS__); errno=0; goto error; }
+
+#define check_debug(A, M, ...) \
+  if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; }
+
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/html/houdini.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/html/houdini.h 
b/compiler/modules/CommonMark/src/html/houdini.h
new file mode 100644
index 0000000..9e1200e
--- /dev/null
+++ b/compiler/modules/CommonMark/src/html/houdini.h
@@ -0,0 +1,52 @@
+#ifndef CMARK_HOUDINI_H
+#define CMARK_HOUDINI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include "config.h"
+#include "buffer.h"
+
+#ifdef HAVE___BUILTIN_EXPECT
+#      define likely(x)        __builtin_expect((x),1)
+#      define unlikely(x)      __builtin_expect((x),0)
+#else
+#      define likely(x)        (x)
+#      define unlikely(x)      (x)
+#endif
+
+#ifdef HOUDINI_USE_LOCALE
+#      define _isxdigit(c) isxdigit(c)
+#      define _isdigit(c) isdigit(c)
+#else
+/*
+ * Helper _isdigit methods -- do not trust the current locale
+ * */
+#      define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL)
+#      define _isdigit(c) ((c) >= '0' && (c) <= '9')
+#endif
+
+#define HOUDINI_ESCAPED_SIZE(x) (((x) * 12) / 10)
+#define HOUDINI_UNESCAPED_SIZE(x) (x)
+
+extern size_t houdini_unescape_ent(strbuf *ob, const uint8_t *src, size_t 
size);
+extern int houdini_escape_html(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_html0(strbuf *ob, const uint8_t *src, size_t size, 
int secure);
+extern int houdini_unescape_html(strbuf *ob, const uint8_t *src, size_t size);
+extern void houdini_unescape_html_f(strbuf *ob, const uint8_t *src, size_t 
size);
+extern int houdini_escape_xml(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_uri(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_url(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_href(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_uri(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_url(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_js(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_js(strbuf *ob, const uint8_t *src, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/html/houdini_href_e.c
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/html/houdini_href_e.c 
b/compiler/modules/CommonMark/src/html/houdini_href_e.c
new file mode 100644
index 0000000..12456ce
--- /dev/null
+++ b/compiler/modules/CommonMark/src/html/houdini_href_e.c
@@ -0,0 +1,107 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "html/houdini.h"
+
+/*
+ * The following characters will not be escaped:
+ *
+ *             -_.+!*'(),%#@?=;:/,+&$ alphanum
+ *
+ * Note that this character set is the addition of:
+ *
+ *     - The characters which are safe to be in an URL
+ *     - The characters which are *not* safe to be in
+ *     an URL because they are RESERVED characters.
+ *
+ * We asume (lazily) that any RESERVED char that
+ * appears inside an URL is actually meant to
+ * have its native function (i.e. as an URL
+ * component/separator) and hence needs no escaping.
+ *
+ * There are two exceptions: the chacters & (amp)
+ * and ' (single quote) do not appear in the table.
+ * They are meant to appear in the URL as components,
+ * yet they require special HTML-entity escaping
+ * to generate valid HTML markup.
+ *
+ * All other characters will be escaped to %XX.
+ *
+ */
+static const char HREF_SAFE[] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+       0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+int
+houdini_escape_href(strbuf *ob, const uint8_t *src, size_t size)
+{
+       static const uint8_t hex_chars[] = "0123456789ABCDEF";
+       size_t  i = 0, org;
+       uint8_t hex_str[3];
+
+       hex_str[0] = '%';
+
+       while (i < size) {
+               org = i;
+               while (i < size && HREF_SAFE[src[i]] != 0)
+                       i++;
+
+               if (likely(i > org))
+                       strbuf_put(ob, src + org, i - org);
+
+               /* escaping */
+               if (i >= size)
+                       break;
+
+               switch (src[i]) {
+               /* amp appears all the time in URLs, but needs
+                * HTML-entity escaping to be inside an href */
+               case '&':
+                       strbuf_puts(ob, "&amp;");
+                       break;
+
+               /* the single quote is a valid URL character
+                * according to the standard; it needs HTML
+                * entity escaping too */
+               case '\'':
+                       strbuf_puts(ob, "&#x27;");
+                       break;
+
+               /* the space can be escaped to %20 or a plus
+                * sign. we're going with the generic escape
+                * for now. the plus thing is more commonly seen
+                * when building GET strings */
+#if 0
+               case ' ':
+                       strbuf_putc(ob, '+');
+                       break;
+#endif
+
+               /* every other character goes with a %XX escaping */
+               default:
+                       hex_str[1] = hex_chars[(src[i] >> 4) & 0xF];
+                       hex_str[2] = hex_chars[src[i] & 0xF];
+                       strbuf_put(ob, hex_str, 3);
+               }
+
+               i++;
+       }
+
+       return 1;
+}

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/html/houdini_html_e.c
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/html/houdini_html_e.c 
b/compiler/modules/CommonMark/src/html/houdini_html_e.c
new file mode 100644
index 0000000..f2e86fe
--- /dev/null
+++ b/compiler/modules/CommonMark/src/html/houdini_html_e.c
@@ -0,0 +1,81 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "html/houdini.h"
+
+/**
+ * According to the OWASP rules:
+ *
+ * & --> &amp;
+ * < --> &lt;
+ * > --> &gt;
+ * " --> &quot;
+ * ' --> &#x27;     &apos; is not recommended
+ * / --> &#x2F;     forward slash is included as it helps end an HTML entity
+ *
+ */
+static const char HTML_ESCAPE_TABLE[] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 4,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const char *HTML_ESCAPES[] = {
+        "",
+        "&quot;",
+        "&amp;",
+        "&#39;",
+        "&#47;",
+        "&lt;",
+        "&gt;"
+};
+
+int
+houdini_escape_html0(strbuf *ob, const uint8_t *src, size_t size, int secure)
+{
+       size_t  i = 0, org, esc = 0;
+
+       while (i < size) {
+               org = i;
+               while (i < size && (esc = HTML_ESCAPE_TABLE[src[i]]) == 0)
+                       i++;
+
+               if (i > org)
+                       strbuf_put(ob, src + org, i - org);
+
+               /* escaping */
+               if (unlikely(i >= size))
+                       break;
+
+               /* The forward slash is only escaped in secure mode */
+               if ((src[i] == '/' || src[i] == '\'') && !secure) {
+                       strbuf_putc(ob, src[i]);
+               } else {
+                       strbuf_puts(ob, HTML_ESCAPES[esc]);
+               }
+
+               i++;
+       }
+
+       return 1;
+}
+
+int
+houdini_escape_html(strbuf *ob, const uint8_t *src, size_t size)
+{
+       return houdini_escape_html0(ob, src, size, 1);
+}

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/html/houdini_html_u.c
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/html/houdini_html_u.c 
b/compiler/modules/CommonMark/src/html/houdini_html_u.c
new file mode 100644
index 0000000..b88b9d1
--- /dev/null
+++ b/compiler/modules/CommonMark/src/html/houdini_html_u.c
@@ -0,0 +1,112 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "buffer.h"
+#include "houdini.h"
+#include "utf8.h"
+#include "html_unescape.h"
+
+size_t
+houdini_unescape_ent(strbuf *ob, const uint8_t *src, size_t size)
+{
+       size_t i = 0;
+
+       if (size > 3 && src[0] == '#') {
+               int codepoint = 0;
+
+               if (_isdigit(src[1])) {
+                       for (i = 1; i < size && _isdigit(src[i]); ++i) {
+                               int cp = (codepoint * 10) + (src[i] - '0');
+
+                               if (cp < codepoint)
+                                       return 0;
+
+                               codepoint = cp;
+                       }
+               }
+
+               else if (src[1] == 'x' || src[1] == 'X') {
+                       for (i = 2; i < size && _isxdigit(src[i]); ++i) {
+                               int cp = (codepoint * 16) + ((src[i] | 32) % 39 
- 9);
+
+                               if (cp < codepoint)
+                                       return 0;
+
+                               codepoint = cp;
+                       }
+               }
+
+               if (i < size && src[i] == ';' && codepoint) {
+                       utf8proc_encode_char(codepoint, ob);
+                       return i + 1;
+               }
+       }
+
+       else {
+               if (size > MAX_WORD_LENGTH)
+                       size = MAX_WORD_LENGTH;
+
+               for (i = MIN_WORD_LENGTH; i < size; ++i) {
+                       if (src[i] == ' ')
+                               break;
+
+                       if (src[i] == ';') {
+                               const struct html_ent *entity = 
find_entity((char *)src, i);
+
+                               if (entity != NULL) {
+                                       strbuf_put(ob, entity->utf8, 
entity->utf8_len);
+                                       return i + 1;
+                               }
+
+                               break;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+int
+houdini_unescape_html(strbuf *ob, const uint8_t *src, size_t size)
+{
+       size_t  i = 0, org, ent;
+
+       while (i < size) {
+               org = i;
+               while (i < size && src[i] != '&')
+                       i++;
+
+               if (likely(i > org)) {
+                       if (unlikely(org == 0)) {
+                               if (i >= size)
+                                       return 0;
+
+                               strbuf_grow(ob, HOUDINI_UNESCAPED_SIZE(size));
+                       }
+
+                       strbuf_put(ob, src + org, i - org);
+               }
+
+               /* escaping */
+               if (i >= size)
+                       break;
+
+               i++;
+
+               ent = houdini_unescape_ent(ob, src + i, size - i);
+               i += ent;
+
+               /* not really an entity */
+               if (ent == 0)
+                       strbuf_putc(ob, '&');
+       }
+
+       return 1;
+}
+
+void houdini_unescape_html_f(strbuf *ob, const uint8_t *src, size_t size)
+{
+       if (!houdini_unescape_html(ob, src, size))
+               strbuf_put(ob, src, size);
+}

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/23472b18/compiler/modules/CommonMark/src/html/html.c
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/html/html.c 
b/compiler/modules/CommonMark/src/html/html.c
new file mode 100644
index 0000000..0e3dd15
--- /dev/null
+++ b/compiler/modules/CommonMark/src/html/html.c
@@ -0,0 +1,357 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "config.h"
+#include "cmark.h"
+#include "node.h"
+#include "buffer.h"
+#include "html/houdini.h"
+
+// Functions to convert cmark_nodes to HTML strings.
+
+static bool
+finish_node(strbuf *html, cmark_node *node, bool tight);
+
+static void escape_html(strbuf *dest, const unsigned char *source, int length)
+{
+       if (length < 0)
+               length = strlen((char *)source);
+
+       houdini_escape_html0(dest, source, (size_t)length, 0);
+}
+
+static void escape_href(strbuf *dest, const unsigned char *source, int length)
+{
+       if (length < 0)
+               length = strlen((char *)source);
+
+       houdini_escape_href(dest, source, (size_t)length);
+}
+
+static inline void cr(strbuf *html)
+{
+       if (html->size && html->ptr[html->size - 1] != '\n')
+               strbuf_putc(html, '\n');
+}
+
+// Convert the inline children of a node to a plain string.
+static void inlines_to_plain_html(strbuf *html, cmark_node* node)
+{
+       cmark_node* cur = node->first_child;
+
+       if (cur == NULL) {
+               return;
+       }
+
+       while (true) {
+               switch(cur->type) {
+               case NODE_TEXT:
+               case NODE_INLINE_CODE:
+               case NODE_INLINE_HTML:
+                       escape_html(html, cur->as.literal.data, 
cur->as.literal.len);
+                       break;
+
+               case NODE_LINEBREAK:
+               case NODE_SOFTBREAK:
+                       strbuf_putc(html, ' ');
+                       break;
+
+               default:
+                       break;
+               }
+
+               if (cur->first_child) {
+                       cur = cur->first_child;
+                       continue;
+               }
+
+       next_sibling:
+               if (cur->next) {
+                       cur = cur->next;
+                       continue;
+               }
+               cur = cur->parent;
+               if (cur == node) {
+                       break;
+               }
+               goto next_sibling;
+       }
+}
+
+
+// Convert a cmark_node to HTML.
+static void node_to_html(strbuf *html, cmark_node *node)
+{
+       cmark_node *cur;
+       char start_header[] = "<h0>";
+       bool tight = false;
+       bool visit_children;
+       strbuf *info;
+
+       if (node == NULL) {
+               return;
+       }
+
+       cur = node;
+       while (true) {
+               // Only NODE_IMAGE wants to skip its children.
+               visit_children = true;
+
+               switch(cur->type) {
+               case NODE_DOCUMENT:
+                       break;
+
+               case NODE_PARAGRAPH:
+                       if (!tight) {
+                               cr(html);
+                               strbuf_puts(html, "<p>");
+                       }
+                       break;
+
+               case NODE_BLOCK_QUOTE:
+                       cr(html);
+                       strbuf_puts(html, "<blockquote>\n");
+                       // BLOCK_QUOTE doesn't use any of the 'as' structs,
+                       // so the 'list' member can be used to store the
+                       // current value of 'tight'.
+                       cur->as.list.tight = tight;
+                       tight = false;
+                       break;
+
+               case NODE_LIST_ITEM:
+                       cr(html);
+                       strbuf_puts(html, "<li>");
+                       break;
+
+               case NODE_LIST: {
+                       cmark_list *list = &cur->as.list;
+                       bool tmp;
+
+                       // make sure a list starts at the beginning of the line:
+                       cr(html);
+
+                       if (list->list_type == CMARK_BULLET_LIST) {
+                               strbuf_puts(html, "<ul>\n");
+                       }
+                       else if (list->start == 1) {
+                               strbuf_puts(html, "<ol>\n");
+                       }
+                       else {
+                               strbuf_printf(html, "<ol start=\"%d\">\n",
+                                             list->start);
+                       }
+
+                       // Store the current value of 'tight' by swapping.
+                       tmp = list->tight;
+                       list->tight = tight;
+                       tight = tmp;
+                       break;
+               }
+
+               case NODE_HEADER:
+                       cr(html);
+                       start_header[2] = '0' + cur->as.header.level;
+                       strbuf_puts(html, start_header);
+                       break;
+
+               case NODE_CODE_BLOCK:
+                       info = &cur->as.code.info;
+                       cr(html);
+
+                       if (&cur->as.code.fence_length == 0
+                           || strbuf_len(info) == 0) {
+                               strbuf_puts(html, "<pre><code>");
+                       }
+                       else {
+                               int first_tag = strbuf_strchr(info, ' ', 0);
+                               if (first_tag < 0)
+                                       first_tag = strbuf_len(info);
+
+                               strbuf_puts(html,
+                                           "<pre><code class=\"language-");
+                               escape_html(html, info->ptr, first_tag);
+                               strbuf_puts(html, "\">");
+                       }
+
+                       escape_html(html, cur->string_content.ptr, 
cur->string_content.size);
+                       break;
+
+               case NODE_HTML:
+                       cr(html);
+                       strbuf_put(html, cur->string_content.ptr, 
cur->string_content.size);
+                       break;
+
+               case NODE_HRULE:
+                       cr(html);
+                       strbuf_puts(html, "<hr />\n");
+                       break;
+
+               case NODE_REFERENCE_DEF:
+                       break;
+
+               case NODE_TEXT:
+                       escape_html(html, cur->as.literal.data, 
cur->as.literal.len);
+                       break;
+
+               case NODE_LINEBREAK:
+                       strbuf_puts(html, "<br />\n");
+                       break;
+
+               case NODE_SOFTBREAK:
+                       strbuf_putc(html, '\n');
+                       break;
+
+               case NODE_INLINE_CODE:
+                       strbuf_puts(html, "<code>");
+                       escape_html(html, cur->as.literal.data, 
cur->as.literal.len);
+                       break;
+
+               case NODE_INLINE_HTML:
+                       strbuf_put(html,
+                                  cur->as.literal.data,
+                                  cur->as.literal.len);
+                       break;
+
+               case NODE_LINK:
+                       strbuf_puts(html, "<a href=\"");
+                       if (cur->as.link.url)
+                               escape_href(html, cur->as.link.url, -1);
+
+                       if (cur->as.link.title) {
+                               strbuf_puts(html, "\" title=\"");
+                               escape_html(html, cur->as.link.title, -1);
+                       }
+
+                       strbuf_puts(html, "\">");
+                       break;
+
+               case NODE_IMAGE:
+                       strbuf_puts(html, "<img src=\"");
+                       if (cur->as.link.url)
+                               escape_href(html, cur->as.link.url, -1);
+
+                       strbuf_puts(html, "\" alt=\"");
+                       inlines_to_plain_html(html, cur);
+
+                       if (cur->as.link.title) {
+                               strbuf_puts(html, "\" title=\"");
+                               escape_html(html, cur->as.link.title, -1);
+                       }
+
+                       strbuf_puts(html, "\" />");
+                       visit_children = false;
+                       break;
+
+               case NODE_STRONG:
+                       strbuf_puts(html, "<strong>");
+                       break;
+
+               case NODE_EMPH:
+                       strbuf_puts(html, "<em>");
+                       break;
+
+               default:
+                       assert(false);
+               }
+
+               if (visit_children && cur->first_child) {
+                       cur = cur->first_child;
+                       continue;
+               }
+
+       next_sibling:
+               tight = finish_node(html, cur, tight);
+               if (cur == node) {
+                       break;
+               }
+               if (cur->next) {
+                       cur = cur->next;
+                       continue;
+               }
+               cur = cur->parent;
+               goto next_sibling;
+       }
+}
+
+// Returns the restored value of 'tight'.
+static bool
+finish_node(strbuf *html, cmark_node *node, bool tight)
+{
+       char end_header[] = "</h0>\n";
+
+       switch (node->type) {
+       case NODE_PARAGRAPH:
+               if (!tight) {
+                       strbuf_puts(html, "</p>\n");
+               }
+               break;
+
+       case NODE_BLOCK_QUOTE: {
+               cmark_list *list = &node->as.list;
+               strbuf_puts(html, "</blockquote>\n");
+               // Restore old 'tight' value.
+               tight = list->tight;
+               list->tight = false;
+               break;
+       }
+
+       case NODE_LIST_ITEM:
+               strbuf_puts(html, "</li>\n");
+               break;
+
+       case NODE_LIST: {
+               cmark_list *list = &node->as.list;
+               bool tmp;
+               strbuf_puts(html,
+                           list->list_type == CMARK_BULLET_LIST ?
+                           "</ul>\n" : "</ol>\n");
+               // Restore old 'tight' value.
+               tmp = tight;
+               tight = list->tight;
+               list->tight = tmp;
+               break;
+       }
+
+       case NODE_HEADER:
+               end_header[3] = '0' + node->as.header.level;
+               strbuf_puts(html, end_header);
+               break;
+
+       case NODE_CODE_BLOCK:
+               strbuf_puts(html, "</code></pre>\n");
+               break;
+
+       case NODE_INLINE_CODE:
+               strbuf_puts(html, "</code>");
+               break;
+
+       case NODE_LINK:
+               strbuf_puts(html, "</a>");
+               break;
+
+       case NODE_STRONG:
+               strbuf_puts(html, "</strong>");
+               break;
+
+       case NODE_EMPH:
+               strbuf_puts(html, "</em>");
+               break;
+
+       default:
+               break;
+       }
+
+       return tight;
+}
+
+char *cmark_render_html(cmark_node *root)
+{
+       char *result;
+       strbuf html = GH_BUF_INIT;
+       node_to_html(&html, root);
+       result = (char *)strbuf_detach(&html);
+       strbuf_free(&html);
+       return result;
+}

Reply via email to