Code Examples in Documents

Jeff Fearn jfearn at redhat.com
Sun Jun 21 23:13:39 UTC 2015


On 06/22/2015 09:10 AM, Jeff Fearn wrote:
> 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.

Oh also annoy people to start using DocBook5 and Publican 4.3 so you can
play with code switchers [1] and poppers [2] :D

Cheers, Jeff.

1:
https://jfearn.fedorapeople.org/en-US/Publican/4.3/html/Users_Guide/pref-Publican-Users_Guide-Introduction.html#BZ1092351

2:
https://jfearn.fedorapeople.org/en-US/Publican/4.3/html/Users_Guide/pref-Publican-Users_Guide-Introduction.html#BZ1088051


More information about the docs mailing list