I have many pages in this format:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/RandomSequence
I want to provide a button or a link to download the content in the source tag under the section CMakeLists.txt as a text file. Is it possible to do something like this?
Thanks!
David
David Doria wrote:
I have many pages in this format:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/RandomSequence
I want to provide a button or a link to download the content in the source tag under the section CMakeLists.txt as a text file. Is it possible to do something like this?
Thanks!
David
You will need to create an extension for that. Other option would be to use one page for each file, and embed with {{#tag:source|lang="cpp"|{{/RandomNumbers.cxx}} }}, offering the download link going to acion=raw.
You will need to create an extension for that. Other option would be to use one page for each file, and embed with {{#tag:source|lang="cpp"|{{/RandomNumbers.cxx}} }}, offering the download link going to acion=raw.
This sounds like it will do exactly what I'm looking for! I'm having a bit of trouble though:
I'm trying to display these two pages: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin... http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin...
from this page: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin...
Taking only the Cxx as an example, I tried to display the page like this:
{{#tag:source|lang="cpp"|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}} }}
but I get an error "Invalid language", even though I know 'cpp' is definitely a supported language.
I then tried to make the download link like this:
[[VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx?action=raw | Download Cxx file]]
but the link is red, so I'm assuming I can't put the action=raw in the local link like that?
I appreciate your help so far!
David
David Doria wrote:
You will need to create an extension for that. Other option would be to use one page for each file, and embed with {{#tag:source|lang="cpp"|{{/RandomNumbers.cxx}} }}, offering the download link going to acion=raw.
This sounds like it will do exactly what I'm looking for! I'm having a bit of trouble though:
I'm trying to display these two pages: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin... http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin...
from this page: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin...
Taking only the Cxx as an example, I tried to display the page like this:
{{#tag:source|lang="cpp"|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}} }}
but I get an error "Invalid language", even though I know 'cpp' is definitely a supported language.
Move the lang to the end {{#tag:source|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}}|lang=cpp}}
I then tried to make the download link like this:
[[VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx?action=raw | Download Cxx file]]
but the link is red, so I'm assuming I can't put the action=raw in the local link like that?
[{{fullurl:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx|action=raw}} Download Cxx file]
Move the lang to the end {{#tag:source|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}}|lang=cpp}}
[{{fullurl:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx|action=raw}} Download Cxx file]
Getting very close!
1) This part is working: [{{fullurl:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx|action=raw}} Download Cxx file]
However, when I click the link it right away downloads the file as 'index.php'. Is there a way to set the default name of the file to the name of the page, or another specified file name?
2) With this: {{#tag:source|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}}|lang="cpp"}}
I see:
[[:Template:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx]]
displayed (you can see it here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin... ), where it is supposed to display the text from DistancePointToLineCxx. One last tweak :) ?
Thanks,
David
David Doria wrote:
Move the lang to the end {{#tag:source|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}}|lang=cpp}}
[{{fullurl:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx|action=raw}} Download Cxx file]
Getting very close!
- This part is working:
[{{fullurl:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx|action=raw}} Download Cxx file]
However, when I click the link it right away downloads the file as 'index.php'. Is there a way to set the default name of the file to the name of the page, or another specified file name?
I don't think so. It's not the right mime either.
- With this:
{{#tag:source|{{VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx}}|lang="cpp"}}
I see:
[[:Template:VTK/Examples/Cxx/SimpleOperations/DistancePointToLineCxx]]
displayed (you can see it here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistancePointToLin... ), where it is supposed to display the text from DistancePointToLineCxx. One last tweak :) ?
Yes, add : after the {{ so it looks up the page in the main namespace instead of the template one.
Excellent, it is working! Thank you very much.
What did you mean by: "It's not the right mime either." ?
David
David Doria wrote:
Excellent, it is working! Thank you very much.
What did you mean by: "It's not the right mime either." ?
David
It will be served with a content-type of text/x-wiki instead of the mime of whatever programming language the page contains.
mediawiki-l@lists.wikimedia.org