Code Examples in Documents

John J. McDonough wb8rcr at arrl.net
Mon Jun 22 00:05:50 UTC 2015


AHA

The secret I overlooked is that the code fragment needs to be in a
different directory.  The error message is kind of misleading, took a
bit of head scratching.  My knee-jerk would probably have been to put
the code in its own directory anyway, but when you are throwing together
a quick test ...

OK, so that works pretty well, and in response to David's suggestion, it
looks like a real good one.

--McD

On Mon, 2015-06-22 at 09:10 +1000, 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.
> 
> Cheers, Jeff.




More information about the docs mailing list