Hello, While looking at solutions for converting HTML into XHTML that can be parsed by revXML I decided to test HTMLTidy which has an option to output the input as XHTML. While I could bundle up the tidy command line tool and include it with my app, I prefer to wrap things up in LCB if possible.
Unfortunately I haven't gotten very far with HTMLTidy and I'm hoping someone else might be able to figure out what I'm doing wrong. If you are up for loading up an LCB project in LC 9 on macOS and looking at some C files then please read on: RESOURCES - Github repo with LCB file, a test stack, and compiled HTMLTidy dylib for testing on macOS: https://github.com/trevordevore/lc-htmltidy - HTMLTidy github repo where source files are located: https://github.com/htacg/tidy-html5 WHAT WORKS In the htmltidy.lcb file I've wrapped some of the simple APIs that return strings: tidyReleaseDate(), tidyLibraryVersion(), and tidyPlatform(). Those all work. WHAT DOESN'T WORK? tidyHTMLToXHTML() in the htmltidy.lcb file has some test code in it that isn't working. As a test I want to call `tidyOptGetIdForName()` from the htmltidy C library and get a valid value returned. I expect the following code to log `0` but it is logging `104`. I don't think I am creating the Ctmbstr pointer properly but I don't really know. Here is code from the htmltidy.lcb file along with links to the ctmbstr definition in the HTMLTidy source code: ``` variable tCStr as Pointer -- Attempting to create a Ctmbstr from a LiveCode string -- ctmbstr: https://github.com/htacg/tidy-html5/blob/next/include/tidyplatform.h#L607 MCStringConvertToCString("TidyUnknownOption", tCStr) -- The next handler is logging `104` which is N_TIDY_OPTIONS (error) -- Appears that tCStr is not the right format. log c_tidyOptGetIdForName(tCStr) ``` MCStringConvertToCString is defined as follows in the htmltidy.lcb file: ``` foreign handler MCStringConvertToCString(in pString as String, out rCString as Pointer) returns CBool binds to "<builtin>" ``` If anyone can provide some pointers or a PR I would really appreciate it. -- Trevor DeVore ScreenSteps www.screensteps.com _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode