Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

Convert wiki page to HTML

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


ricli85 at gmail

Jul 3, 2009, 5:04 AM

Post #1 of 5 (158 views)
Permalink
Convert wiki page to HTML

Hi,

Is there an easy way to convert a wiki page to HTML using the Trac Python
files?

What I would like to do is to pull a wiki page down using wget, for example

wget http://.../wiki/Page?format=txt -O Page

and then convert it to HTML, for example

wikitohtml Page Page.html

I suppose I can write the wikitohtml script if I know what parts of the Trac
Python files to use.

--
Rickard Lindberg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


pmalmsten at gmail

Jul 3, 2009, 9:23 AM

Post #2 of 5 (151 views)
Permalink
Re: Convert wiki page to HTML [In reply to]

Rickard,

I hope I'm not misunderstanding your particular scenario, but can't you just wget the wiki page directly without setting format to txt? It is Trac's job, after all, to convert the wiki to HTML whenever a browser (or wget, for example) requests a page.

~Paul Malmsten
----- Original message -----

Hi,

Is there an easy way to convert a wiki page to HTML using the Trac Python
files?

What I would like to do is to pull a wiki page down using wget, for example

wget http://.../wiki/Page?format=txt -O Page

and then convert it to HTML, for example

wikitohtml Page Page.html

I suppose I can write the wikitohtml script if I know what parts of the Trac
Python files to use.

--
Rickard Lindberg




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


oddsimons at gmail

Jul 3, 2009, 10:15 AM

Post #3 of 5 (151 views)
Permalink
Re: Convert wiki page to HTML [In reply to]

On Jul 3, 2:04 pm, Rickard Lindberg <ricl...@gmail.com> wrote:
> What I would like to do is to pull a wiki page down using wget, for example
>
> wgethttp://.../wiki/Page?format=txt-O Page
>
> and then convert it to HTML, for example
>
> wikitohtml Page Page.html

You can't really do that, as the HTML needs to render in the context
of the project - if not then links will not be completed, and macros
will not run in context.

I'd suggest you look at http://trac-hacks.org/wiki/XmlRpcPlugin

With recently added JSON-RPC interface this is quite simple:

user: ~ > cat body.json
{"params": ["WikiStart"], "method": "wiki.getPageHTML", "id": 123}
user: ~ > curl -H "Content-Type: application/json" --data @body.json
http://host/project/jsonrpc
{"id": 123, "error": null, "result": "<the page as markup>"}


:::simon

https://www.coderesort.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


ricli85 at gmail

Jul 3, 2009, 2:04 PM

Post #4 of 5 (150 views)
Permalink
Re: Convert wiki page to HTML [In reply to]

> I hope I'm not misunderstanding your particular scenario, but can't you just
> wget the wiki page directly without setting format to txt? It is Trac's job,
> after all, to convert the wiki to HTML whenever a browser (or wget, for
> example) requests a page.

I wanted to avoid the problem of removing all the extra HTML that I am not
interested in. I would like to render the content part and then add my own HTML
header and footer.

--
Rickard Lindberg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


ricli85 at gmail

Jul 3, 2009, 2:07 PM

Post #5 of 5 (150 views)
Permalink
Re: Convert wiki page to HTML [In reply to]

> You can't really do that, as the HTML needs to render in the context
> of the project - if not then links will not be completed, and macros
> will not run in context.

I see.

> I'd suggest you look at http://trac-hacks.org/wiki/XmlRpcPlugin
>
> With recently added JSON-RPC interface this is quite simple:
>
> user: ~ > cat body.json
> {"params": ["WikiStart"], "method": "wiki.getPageHTML", "id": 123}
> user: ~ > curl -H "Content-Type: application/json" --data @body.json
> http://host/project/jsonrpc
> {"id": 123, "error": null, "result": "<the page as markup>"}

Thanks. I will have a look at that.

I do not need to convert that many pages, so maybe copying the interesting
parts of the HTML manually is the easiest option.

--
Rickard Lindberg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users[at]googlegroups.com
To unsubscribe from this group, send email to trac-users+unsubscribe[at]googlegroups.com
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.