Thank you both, this helped me a lot. I think right now I'm mostly battling the linked images in the original html files. Xwiki uses relative paths and those are not valid anymore after converting to a wiki page. I think I need to handle this when I create the html files and embed the images as text - ugly but the only option I see right now.
Cheers Sebastian -----Original Message----- From: users [mailto:users-boun...@xwiki.org] On Behalf Of Eduard Moraru Sent: Tuesday, May 17, 2016 3:54 PM To: XWiki Users Subject: Re: [xwiki-users] How to programmatically create pages from html files? I`m not much of a Python fan, but if you say you`re into it, you could always try the http://extensions.xwiki.org/xwiki/bin/view/Extension/Python+Macro and script your way using your favorite language :) If you try it, let me know how it went ;) For scripting API see http://platform.xwiki.org/xwiki/bin/view/DevGuide/API and the available bindings at http://extensions.xwiki.org/xwiki/bin/view/Extension/Script+Macro Now, for your particular use case, you could either create a new wiki page and: 1) use the HTML syntax directly for that wiki page and just dump your HTML content in it or 2) use the rendering script service ($services.rendering, i.e. https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/src/main/java/org/xwiki/rendering/script/RenderingScriptService.java) to parse the HTML content into XDOM and then render it to xwiki/2.1 syntax that you can then save inside the newly created page Depends where you want to go with it. Hope this helps, Eduard On Tue, May 17, 2016 at 10:52 PM, Paul Libbrecht <p...@hoplahup.net> wrote: > > > s.schafer wrote: > > Does that mean I create a ‘control’ page with a script that’ll grab > > data > and > > creates new pages? > Correct. And you can invoke that from a command-line or cron world if > you want with a curl (and some hard-coded passwords). > > I f so, it would be great if someone can point me to an example. > Using groovy is a good idea. It's a tick less limited than using Velocity. > > file = new java.io.File("filename.txt"); > name = "Space." + file.getName(); > doc = xwiki.getDocument(name); > println("Saving to document [[${doc}]].") > > doc.setContent(org.apache.commons.io.FileUtils.readFileToString(file, > "utf-8")); > > doc.setTitle("My beautiful page"); > doc.setSyntaxId("xhtml/1.0"); > doc.save("Fetching from ${file.getPath()}."); > > Hope it helps. > > Paul > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users