Mailing List Archive

Manage Trac wiki content via git repo?
We have been using Trac to manage our company's internal wiki, but everyone responsible for working on this documentation complains about having to edit the content through the Trac GUI. They want to be able to manage the wiki content as a folder of Markdown files. They would edit files in a text editor and sync the content back up to the server. I want to support their needs, but also need to keep the wiki content published through the Trac wiki so it is accessible and editable to non-technical employees.

What is the best way to do this with Trac?

I've discovered the `trac-admin` command has `export` and `load` functions, so perhaps I could glue together an automation that regularly exports and important content. Has anyone done this before? Any potential pitfalls?

As for using Markdown, I see there is a MarkdownMacro, which supports using Markdown as a default wiki language.
https://trac-hacks.org/wiki/MarkdownMacro#MarkdownasWikiLanguage

Thanks,
Quinn

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/20210919152918486961.22788d17%40strangecode.com.
Re: Manage Trac wiki content via git repo? [ In reply to ]
Hi Quinn,

if you really want to go down this road you might consider a post commit
hook for git that takes care of bringing the changed file to a point where
you pick it up to stuff it into the trac db.

that said you need to think of a way to stuff it in the db.... a crud way
woud be trying to figure out where and how a page is
stored/added/deleted/edited and do it with some sql that a tool runs but I
am not sure if trac offers to interface somehow to bring these changes in,
if so you might take a loot at that first since it will produce more sane
results when it comes to storing data in the trac db.

I dont know if someone can point out more on that but i guess its a
starting point to do some research

cheers

Markus

Am So., 19. Sept. 2021 um 22:29 Uhr schrieb Quinn Comendant <
quinn@strangecode.com>:

> We have been using Trac to manage our company's internal wiki, but
> everyone responsible for working on this documentation complains about
> having to edit the content through the Trac GUI. They want to be able to
> manage the wiki content as a folder of Markdown files. They would edit
> files in a text editor and sync the content back up to the server. I want
> to support their needs, but also need to keep the wiki content published
> through the Trac wiki so it is accessible and editable to non-technical
> employees.
>
> What is the best way to do this with Trac?
>
> I've discovered the `trac-admin` command has `export` and `load`
> functions, so perhaps I could glue together an automation that regularly
> exports and important content. Has anyone done this before? Any potential
> pitfalls?
>
> As for using Markdown, I see there is a MarkdownMacro, which supports
> using Markdown as a default wiki language.
> https://trac-hacks.org/wiki/MarkdownMacro#MarkdownasWikiLanguage
>
> Thanks,
> Quinn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to trac-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/trac-users/20210919152918486961.22788d17%40strangecode.com
> .
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAJ4osOnxmrvytV6TH5XO2yPY1zOyGR_EnbAH5tFcQv2pRrex6Q%40mail.gmail.com.
Re: Manage Trac wiki content via git repo? [ In reply to ]
On Sunday, September 19, 2021 at 1:29:27 PM UTC-7 Quinn Comendant wrote:

> We have been using Trac to manage our company's internal wiki, but
> everyone responsible for working on this documentation complains about
> having to edit the content through the Trac GUI. They want to be able to
> manage the wiki content as a folder of Markdown files. They would edit
> files in a text editor and sync the content back up to the server. I want
> to support their needs, but also need to keep the wiki content published
> through the Trac wiki so it is accessible and editable to non-technical
> employees.
>
>

> What is the best way to do this with Trac?
>
> I've discovered the `trac-admin` command has `export` and `load`
> functions, so perhaps I could glue together an automation that regularly
> exports and important content. Has anyone done this before? Any potential
> pitfalls?
>

The idea has been raised in the past:
https://trac.edgewall.org/wiki/TracDev/Proposals/WikiStorage

Yes, I think you could probably make it work, but it will be complex to
allow two modes of editing: via web interface and repository. You need some
sort of locking and/or merging mechanism.

* Plugin implementing IWikiChangeListener to prevent concurrent edits and
save the content to the repository after editing through the web interface
* Repository hooks to prevent concurrent edits and saving wiki content to
the database on Git push

When saving a wiki page through the web interface you'd need to check if
the content in the repository has changed and reject saving if the content
has changed. You could do this using IWikiManipulator.
https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.wiki.api.IWikiPageManipulator

Basically, you need to implement the same checks and behavior that prevent
concurrent edits to wiki pages. Changes to the repository should be locked
during the save operation.

On the repository side, you need to check whether the repository is locked
before allowing a push, then lock changes to the modified wiki pages while
accepting the push and syncing changes to the wiki. If there are changes to
the repository you can block the push and tell the user to pull and merge
the changes into their clone of the repository. That's actually easier than
on the wiki side since Git is good at merging.


> As for using Markdown, I see there is a MarkdownMacro, which supports
> using Markdown as a default wiki language.
> https://trac-hacks.org/wiki/MarkdownMacro#MarkdownasWikiLanguage




--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/16d6b36d-cace-44e5-8360-71937c75117an%40googlegroups.com.
Re: Manage Trac wiki content via git repo? [ In reply to ]
Thank you Markus and RjOllos, your answers help a lot. If I come up with a solution that works well, I'll share it with the community.

Quinn

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/20210921161812332430.59e8aab0%40strangecode.com.
Re: Manage Trac wiki content via git repo? [ In reply to ]
On Tuesday, September 21, 2021 at 2:18:20 PM UTC-7 Quinn Comendant wrote:

> Thank you Markus and RjOllos, your answers help a lot. If I come up with a
> solution that works well, I'll share it with the community.
>
> Quinn
>

???? It's a really cool idea that I've thought about in the past because I
would like to edit all my docs out of a repository. Unfortunately, I'm not
working in a team where I could push the idea right now otherwise I would
love to work on implementing the solution. Maybe someday!

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/ffaaffd4-f5a1-45d1-9cfc-6a0ff16bf5d9n%40googlegroups.com.