Difference between revisions of "Raw Code Download"

From Scribus Wiki
Jump to: navigation, search
m (Added to Scripts category because this will most likely be used to pull scripts from the wiki directly)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[Category:Wiki_Help]]
+
[[Category:Wiki_Help]] [[Category:Scripts]]
 
This wiki is capable of letting users download raw code embedded into the pages. Please see [http://wiki.yobi.be/wiki/Mediawiki_RawFile Mediawiki_RawFile] for more details, especially the examples at the [http://wiki.yobi.be/wiki/Mediawiki_RawFile#Short_example Examples] page.
 
This wiki is capable of letting users download raw code embedded into the pages. Please see [http://wiki.yobi.be/wiki/Mediawiki_RawFile Mediawiki_RawFile] for more details, especially the examples at the [http://wiki.yobi.be/wiki/Mediawiki_RawFile#Short_example Examples] page.
  
Line 20: Line 20:
 
/*! Repeat text */
 
/*! Repeat text */
 
PyObject * scribus_repeattext(PyObject * /*self*/, PyObject * args);
 
PyObject * scribus_repeattext(PyObject * /*self*/, PyObject * args);
</source>
 
 
Let's save the following code [{{#file: myscript.sh}} as myscript.sh]
 
<source lang=bash>
 
#!/bin/bash
 
 
echo 'Hello world!'
 
exit 0
 
 
</source>
 
</source>

Revision as of 21:50, 13 February 2014

This wiki is capable of letting users download raw code embedded into the pages. Please see Mediawiki_RawFile for more details, especially the examples at the Examples page.

In short, use either <source lang=xxxxx></source> tags where xxxxx is the language such as 'bash', 'python', 'cpp' and so on around your code snippets or for more power use the specially designed {{#fileanchor: myotherscript.sh}} and {{#filelink: myotherscript.sh}} templates as shown in the long example.

Here is a working example using code taken from graphicslab.org


Save the following code as cmdtext.cpp

/*! docstring */
PyDoc_STRVAR
(scribus_repeattext__doc__,
QT_TR_NOOP("repeatText(n, [\"name\"])\n\
\n\
Repeat the text of the text frame \"name\" n times.\n\
If \"name\" is not given the currently selected item is used.\n\"
));
/*! Repeat text */
PyObject * scribus_repeattext(PyObject * /*self*/, PyObject * args);