[pmwiki-users] minimal text file to create pmwiki page

Mark Lee mark.lee.phd at gmail.com
Mon Jun 3 10:43:16 CDT 2013

I will share the Excel file with macro in a separate email. Here is the VBA
script that runs when a textbox object is clicked (the button). It
processes only one row currently. If you understand this script, it
shouldn't be too hard to add a loop to process all the rows. I haven't
gotten there myself since I am still working out some details of my markup
for the first row.

The script below will create a file called Test.HelloWorld. It displays
"Hello World" and then does a pagelist of the group Test. Here is what is
version=pmwiki-2.2.51 urlencoded=1
text=%0aHello World!%0a(:pagelist group=Test:)%0a

The spreadsheet has this information:
row3= PageName  Content               Markup Example: Pagelist group
row4= Test.HelloWorld              Hello World!         Test

The page is here: http://ediblelandscape.org/pmwiki.php?n=Test.HelloWorld

Sub TextBox2_Click()
    FilePath = ThisWorkbook.Path & "\" & Cells(4, 1).Value

    'Get an unused file number
    FileNumber = FreeFile

    'Create a new file (or overwrite an existing one)
    Open FilePath For Output As #FileNumber

    'Header for markup content
    StringOut = "version=pmwiki-2.2.51 urlencoded=1"
    Print #FileNumber, StringOut
    StringOut = "text=%0a"
    Print #FileNumber, StringOut; 'suppress newline with ";"

    StringOut = Cells(4, 2).Value 'hello world cell
    Print #FileNumber, StringOut; 'suppress newline with ";"

    StringOut = "%0a" 'newline
    Print #FileNumber, StringOut; 'suppress newline with ";"

    StringOut = "(:pagelist group=" & Cells(4, 3).Value & ":)"
    Print #FileNumber, StringOut; 'suppress newline with ";"

    StringOut = "%0a" 'newline
    Print #FileNumber, StringOut; 'suppress newline with ";"

    MsgBox ("done")

    'Close the file
    Close #FileNumber
End Sub


On Sun, Jun 2, 2013 at 8:25 AM, Edwin Marte <edwin.marte at leidba.com> wrote:

> Ok, Thanks!
> Actually I would like a sample of both if possible so I can Analyze the
> code and then change it to fit my needs.
> Regards,
> Edwin
> On Sun, Jun 2, 2013 at 10:02 AM, Mark Lee <mark.lee.phd at gmail.com> wrote:
>> Edwin,
>> Sure, I can share my script. Are you interested in the VBA code, or would
>> you like an example spreadsheet that runs the script?
>> -Mark
>> On Sat, Jun 1, 2013 at 3:10 PM, Edwin Marte <edwin.marte at leidba.com>wrote:
>>> Hello Mark! Very nice implementation!
>>>  Any chance that you could share your script, for a long time I have
>>> been waiting for such a script to keep track of my parts both locally and
>>> pmwiki.
>>> Regards,
>>> Edwin
>>> On Sat, Jun 1, 2013 at 3:54 PM, Tamara Temple <tamouse.lists at gmail.com>wrote:
>>>> Mark Lee <mark.lee.phd at gmail.com> wrote:
>>>> > Thank you Tamara. The following does just what I am looking for.
>>>> Quite welcome, I'm sure.
>>>> > I also realized that the symbol % needs to be replaced by the hex
>>>> code %25.
>>>> > I am well on my way to mapping my page content to pmwiki pages. Here
>>>> is an example page that I
>>>> > just put together using a text editor.
>>>> Again, the import recipe I described earlier is ace if you have a lot of
>>>> pages to convert at once. Generate the plain text files locally, ftp
>>>> them up to an import directory, then run the import script and done. No
>>>> need to worry about converting newlines to %0a, percent to %25, and less
>>>> than (<) to %3c.
>>>> > http://ediblelandscape.org/pmwiki.php?n=Plants.Plant167
>>>> *VERY* nicely designed site!
>>>> > In that example, a cell in my spreadsheet contained the species name
>>>> "Rosa woodsii". I have a
>>>> > script written in VBA (Excel spreadsheet) that writes this to a text
>>>> file
>>>> > %0a(:Species: Rosa woodsii:)%0a
>>>> > Each row in my spreadsheet contains the content for each page. Each
>>>> cell is assigned to a
>>>> > PageTextVariable, and each of these goes to the location on the page
>>>> I previously defined in the
>>>> > page template for the skin. With a click of a button, I can generate
>>>> all the pages for my site,
>>>> > and with a few more clicks the pages are uploaded to my site via ftp.
>>>> A simple Content
>>>> > Management System using a spreadsheet and FileZilla. I really like
>>>> PMWiki, but I like the
>>>> > ability to backup the content of the site in form that is independent
>>>> of PMWiki and is portable
>>>> > between different platforms.
>>>> Do not disagree with any of that, it's just a unique (to me) way of
>>>> using PmWiki as a publishing system. Perfectly valid, wonderful use of
>>>> PmWiki!
>>>> _______________________________________________
>>>> pmwiki-users mailing list
>>>> pmwiki-users at pmichaud.com
>>>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130603/16675c19/attachment.html>

More information about the pmwiki-users mailing list