Code Examples in Documents

Jeff Fearn jfearn at redhat.com
Sun Jun 21 23:10:34 UTC 2015


On 06/22/2015 02:16 AM, David Ashley wrote:
> All -
> 
> In the past when creating a new document that will contain code examples
> in C/C++ or Python I always placed the examples in separate files from
> the main XML. This way it would be easier to test those examples to make
> sure that they work as intended. Being new to the Fedora Docs team I
> have looked at some of the current documents and they do not seem to
> separate the code from the document itself. So I am wondering if I
> should follow that convention or separate the code from the XML like I
> have done in the past?

IMHO you are doing it the right way.

https://jfearn.fedorapeople.org/en-US/Publican/4.3/html/Users_Guide/sect-Publican-Users_Guide-Adding_code_samples.html

The trick is to ensure, as per step 3, that your xi:include of the file
uses 'parse="text"' so that special characters in your code and handled
properly.

Cheers, Jeff.


More information about the docs mailing list