{"action":"created","issue":{"url":"https://api.github.com/repos/bel2125/civetweb/issues/60","labels_url":"https://api.github.com/repos/bel2125/civetweb/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/bel2125/civetweb/issues/60/comments","events_url":"https://api.github.com/repos/bel2125/civetweb/issues/60/events","html_url":"https://github.com/bel2125/civetweb/issues/60","id":53788049,"number":60,"title":"Generating HTML","user":{"login":"wiseoldman95","id":5030488,"avatar_url":"https://avatars.githubusercontent.com/u/5030488?v=3","gravatar_id":"","url":"https://api.github.com/users/wiseoldman95","html_url":"https://github.com/wiseoldman95","followers_url":"https://api.github.com/users/wiseoldman95/followers","following_url":"https://api.github.com/users/wiseoldman95/following{/other_user}","gists_url":"https://api.github.com/users/wiseoldman95/gists{/gist_id}","starred_url":"https://api.github.com/users/wiseoldman95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiseoldman95/subscriptions","organizations_url":"https://api.github.com/users/wiseoldman95/orgs","repos_url":"https://api.github.com/users/wiseoldman95/repos","events_url":"https://api.github.com/users/wiseoldman95/events{/privacy}","received_events_url":"https://api.github.com/users/wiseoldman95/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2015-01-08T19:10:05Z","updated_at":"2015-04-16T14:15:20Z","closed_at":null,"body":"I can implement an interface which would make the following code possible:\r\n\r\n```\r\nint helloWorld(struct mg_connection *conn, void *cbdata)\r\n{\r\n\tstruct mg_request_info * req_info = mg_get_request_info(conn);\t\r\n\tchar output[1000];\r\n\t\t\t\r\n\t\r\n\tel html=c(NULL,\"html\"); //create a new element called html\r\n\t\tel head=c(html,\"head\");\r\n\t\t\tel meta=c(head,\"meta\");\r\n\t\t\tsa(meta,\"charset\",\"utf-8\"); //set attribute\r\n\t\tel body=c(html,\"body\");\r\n\t\t\tt(body,\"Hello world!\"); //text node\r\n\t\t\tc(body,\"br\");\r\n\t\tel table=c(body,\"table\");\r\n\t\tsa(table,\"border\",\"1\");\r\n\t\tel td,tr;\r\n\t\t\ttd=c(table,\"td\");\r\n\t\t\t\t\ttr=c(td,\"tr\");\r\n\t\t\t\t\t\tt(tr,\"A third cell!\");\r\n\t\t\t\t\ttr=c(td,\"tr\");\r\n\t\t\t\t\t\tt(tr,\"A fourth cell!\");\r\n\t\t\ttd=c(table,\"td\");\r\n\t\t\t\t\ttr=c(td,\"tr\");\r\n\t\t\t\t\t\tt(tr,\"A cell!\");\r\n\t\t\t\t\ttr=c(td,\"tr\");\r\n\t\t\t\t\t\tt(tr,\"A second cell!\");\r\n\t\t\t\r\n\tint size=xmlToString(html,output,1000);\r\n\t\r\n\t mg_printf(conn,\r\n\t\"HTTP/1.1 200 OK\\r\\n\"\r\n\t\"Content-Type: text/html\\r\\n\"\r\n\t\"Content-Length: %d\\r\\n\"\r\n\t\"\\r\\n\"\r\n\t\"%s\",size, output);\r\n\t\r\n\txmlDelete(html);\r\n\treturn 0;\r\n}\r\n```\r\n\r\nThis would generate the following HTML:\r\n```\r\n<html><head><meta charset=\"utf-8\" /></head>\r\n<body>Hello world!<br /><table>...etc...</table></body></html>\r\n```\r\n\r\nAre you interested in this?"},"comment":{"url":"https://api.github.com/repos/bel2125/civetweb/issues/comments/93745208","html_url":"https://github.com/bel2125/civetweb/issues/60#issuecomment-93745208","issue_url":"https://api.github.com/repos/bel2125/civetweb/issues/60","id":93745208,"user":{"login":"wiseoldman95","id":5030488,"avatar_url":"https://avatars.githubusercontent.com/u/5030488?v=3","gravatar_id":"","url":"https://api.github.com/users/wiseoldman95","html_url":"https://github.com/wiseoldman95","followers_url":"https://api.github.com/users/wiseoldman95/followers","following_url":"https://api.github.com/users/wiseoldman95/following{/other_user}","gists_url":"https://api.github.com/users/wiseoldman95/gists{/gist_id}","starred_url":"https://api.github.com/users/wiseoldman95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiseoldman95/subscriptions","organizations_url":"https://api.github.com/users/wiseoldman95/orgs","repos_url":"https://api.github.com/users/wiseoldman95/repos","events_url":"https://api.github.com/users/wiseoldman95/events{/privacy}","received_events_url":"https://api.github.com/users/wiseoldman95/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T14:15:20Z","updated_at":"2015-04-16T14:15:20Z","body":">Anyway, the original repository above does not exist anymore\r\n\r\nI still have the code. I took it down because I felt it's too dirty to be public. I've cleaned it up since then, but didn't have the time to thoroughly test it. Note that it was only an XML generator, not a parser.\r\n\r\nI can set up a repo if you're interested, but I probably won't do any further work on it."}}