2

How can I add a new topic to TWiki programmatically?

I've got a working TWiki (http://twiki.org/) installation, everything works fine.

I need to find a way to create and add new Topics through the command line, programmatically.

Any ideas how this can be accomplished?

Thanx!

d.

dengel
  • 305
  • 5
  • 8

2 Answers2

1

What I did was

  • take a look at some wiki pages (files in <twiki-home>/data/Main/<PageName>.txt) to figure out the file/text format (pretty much what you see in the browser, preceded by one line of meta info)
  • generate that text format with a perl script
    with content based on data from a DB or some Excel
  • copy the files to the apropriate location using putty's pscp on windows

lexu
  • 8,766
  • 5
  • 45
  • 63
  • Very nice... and easy. One more file to change is .changes, which I need to append a single line with the topic, author, timestamp, and version. Thanx! – dengel Oct 23 '09 at 13:49
  • another thing I forgot to mention: beware of access rights to the file! My original copy was done with root => files were not visible in the webbrowser, since the httpd couldn't read/access them. – lexu Oct 24 '09 at 07:32
0

I think using TWiki scripts is a more "clean" way, as you wouldn't have to worry about metadata in the TXT file or update the .changes file.

Just use wget to make a POST call using the 'save' script (see documentation here)

zeroquaranta
  • 392
  • 4
  • 16