Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for downloading CSV file #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bzfwunde
Copy link

Extended plugin to provide this, by adding the options:

import=
export=:dokuwiki:media:path:where:to:write:mediafile.csv
linkname=Name of the download link to create

Thus, I changed the syntax to use '|' as delimiter between options
rather than using ' '. I feel this is "more dokuwiki" :). However,
this breaks existing dokuwiki pages that use the csv plugin to display
a CVS file, which now would have to replace the separating space (' ')
with '|import='.

The idea behind this extension is that I want to maintain a list (in
my case a member list) in dokuwiki but provide a download link to the
csv file (also for users with only read access to the page). This is
now supported as shown in the following example:

<csv|export=:media:members.csv|linkname=Download member list>
Name,Email
,
Paul,[email protected]
Andreads,[email protected]

It renders the CSV data as a DokuWiki table but adds a CSV download link
with the title "Download member list".

This is done in the following way:

When rendering the CSV data, this data is also copied to the export=
file. Finally, a link to the just generated file is provided.

Extended plugin to provide this, by adding the options:

import=<file to display>
export=:dokuwiki:media:path:where:to:write:mediafile.csv
linkname=Name of the download link to create

Thus, I changed the syntax to use '|' as delimiter between options
rather than using ' '.  I feel this is "more dokuwiki" :).  However,
this breaks existing dokuwiki pages that use the csv plugin to display
a CVS file, which now would have to replace the separating space (' ')
with '|import='.

The idea behind this extension is that I want to maintain a list (in
my case a member list) in dokuwiki but provide a download link to the
csv file (also for users with only read access to the page).  This is
now supported as shown in the following example:

<csv|export=:media:members.csv|linkname=Download member list>
Name,Email
,
Paul,[email protected]
Andreads,[email protected]
</csv>

It renders the CSV data as a DokuWiki table but adds a CSV download link
with the title "Download member list".

This is done in the following way:

When rendering the CSV data, this data is also copied to the export=
file.  Finally, a link to the just generated file is provided.
@splitbrain
Copy link
Member

In general I like the functionality but there's a couple of things I would change:

  • keep spaces as separator. instead use optional double quotes around the parameter when you want to use spaces in the description
  • keep the file parameter to keep backwards compatibility (import could be an alias for it)
  • downloads should be supported for inline CSV data as well (see how downloadable code blocks do it)

@bzfwunde
Copy link
Author

On Tuesday 29 September 2015 08:52:23 Andreas Gohr wrote:

In general I like the functionality but there's a couple of things I would
change:

  • keep spaces as separator. instead use optional double quotes around the
    parameter when you want to use spaces in the description

I understand the upside that this would not render it incompatible with
the previous version. That makes parsing of the parameters so much harder. I
could no longer use explode and would actually have to start learning php :(.
Or do you have a "-aware explode function awailable anywhere I could just use?

Further, isn't space separation really uncommon for dokuwiki plugins using the
{{...}} syntax?

  • keep the file
    parameter to keep backwards compatibility (import could be an alias for it)

No problem with this one.

  • downloads should be supported for inline CSV data as well (see how
    downloadable code blocks do it)

I think it is working. In fact, that's what I am using in my docuwiki
installation, i.e. something like:

<csv|export=:media:members.csv|linkname=Download member list>
Name,Email
,
Paul,[email protected]
Andreads,[email protected]

Or is that now what you mean?

Roland

Roland Wunderling added 2 commits September 29, 2015 20:04
Options including spaces must be enclosed in quotes ".
Also revert back to using file= instead of import=.
@bzfwunde
Copy link
Author

OK, I changed to ' ' separators, wasn't so hard after all.
I also reverted back to file= instead of import=
I'm still not sure about your 3rd point. IMO this just works.

@bzfwunde bzfwunde closed this Sep 29, 2015
@splitbrain
Copy link
Member

why did you close this?

@splitbrain splitbrain reopened this Sep 29, 2015
@bzfwunde
Copy link
Author

Sorry - I only started today using github. This was my misuse of the tool.

@bzfwunde
Copy link
Author

bzfwunde commented Oct 7, 2015

Any news on pulling this?

@bzfwunde
Copy link
Author

Any reason why you don't want to pull this? Are other changes needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants