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/xwi…)
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 <paul(a)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(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users