Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View TextParseForShare.md

Text Parsing for Sharing

Task description

I have a text-based wiki (a VimWiki) and I want to share arbitrary parts of its texts by automatically copy-pasting the parts marked with {:group1,group2,..,groupN| PART :} into the (shared) folders defined for each group. For example, let's say we have just a single wiki page called OnePage.wiki, and group definitions in GroupDefinitions.wiki.

The task is to recursively copy the extracted and merged fractions of the text into appropriate folders. (Should be a recursive split-apply-merge.) The code you write would be made public, and GPL-licensed.

GroupDefinitions.wiki

individuals {
 'friend1': '/media/truecrypt1/vimwikis/friend1',
 'friend2': '/media/truecrypt1/vimwikis/friend2'
}

groups {
 'group1': ['friend1','friend2'],
 'group2': ['friend2']
}

Example Input

OnePage.wiki

{:group1|
== Example Story ==
One day, I realized that we could use shared diaries on VIM, and I hacked a solution to let my dear friend also see my diary. We started writing diaries together, side-by-side, every day. We share them via Dropbox, but encrypted, and using gnupg plugin for VimWiki.

It is a wonder to share minds like that together. I think it is like being two hemispheres of brain, connected via corpus callosum. We merged to form something new! Two minds working in unison.

{:-group2|Then. We thought we should share more with our friends, and we found BTSync, which is like Dropbox, but P2P. It was the solution, because we didn't need to teach every friend how to use GPG and VIM. However, there is a little problem that we would like to fix, but have no time right now.:}

We already have a Python script {:-friend1|( https://github.com/Mindey/diary-scripts/blob/master/diary-cron.py ) :}that does something similar. We would like to have a general solution, which goes as deep into the hierarchy defined by nested braces {: :} as needed to parse them.
:}

Example Output

/media/truecrypt1/vimwikis/friend1/OnePage.wiki

== Example Story ==
One day, I realized that we could use shared diaries on VIM, and I hacked a solution to let my dear friend also see my diary. We started writing diaries together, side-by-side, every day. We share them via Dropbox, but encrypted, and using gnupg plugin for VimWiki.

It is a wonder to share minds like that together. I think it is like being two hemispheres of brain, connected via corpus callosum. We merged to form something new! Two minds working in unison.

Then. We thought we should share more with our friends, and we found BTSync, which is like Dropbox, but P2P. It was the solution, because we didn't need to teach every friend how to use GPG and VIM. However, there is a little problem that we would like to fix, but have no time right now.

We already have a Python script that does something similar. We would like to have a general solution, which goes as deep into the hierarchy defined by nested braces {: :} as needed to parse them.

/media/truecrypt1/vimwikis/friend2/OnePage.wiki

== Example Story ==
One day, I realized that we could use shared diaries on VIM, and I hacked a solution to let my dear friend also see my diary. We started writing diaries together, side-by-side, every day. We share them via Dropbox, but encrypted, and using gnupg plugin for VimWiki.

It is a wonder to share minds like that together. I think it is like being two hemispheres of brain, connected via corpus callosum. We merged to form something new! Two minds working in unison.

We already have a Python script ( https://github.com/Mindey/diary-scripts/blob/master/diary-cron.py ) that does something similar. We would like to have a general solution, which goes as deep into the hierarchy defined by nested braces {: :} as needed to parse them.

Hopefully, this solution would let us have a VIM command :Vimwiki2Friends like :Vimwiki2HTML. Unlike the :Vimwiki2HTML, :Vimwiki2HTML would let you automatically distribute the wiki multiple times to different friends by generating different versions from sharing definition.

Inyuki commented

Write a comment :) @Mindey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.