Code Source Service
- This guide explains how to manage Code Sources in a Silva site, using the Code Source service.
In order to use code sources the Code Sources service (service_codesources) must be available. If you have a fresh Silva installation you’ll need to activate the Silva External Sources extension in the Extensions Service. Then the Code Sources service will be appear in Silva Services.
If you have an existing Silva instance with External Sources active but you don’t see the Code Sources service you must refresh Silva External Sources in Service Extensions. This will install the Code Sources service.
Navigate to the Code Sources service (Fig.1).
Fig.1. Code Sources listed in the Code Source Service
To make a code source available for Authors, copy the code source and paste it in the Silva root or a deeper level of the site. Then the code source will be listed in the select list of the ‘external source’ toolbox’s of the editor and Authors can insert it into documents.
The sources that appear in the toolbox are those that are found in the current path. The toolbox uses acquisition to locate code sources, climbing up the content tree from the current location. Code sources elsewhere, not in the path, will not appear. If two code sources with the same id are at different levels in the path, only the first one found (the lower one) will be listed. This makes it possible to have local variants of the same code source.
The code sources in the service will be updated whenever the External Sources extension is refreshed. If a new Silva version has been installed this may update existing sources and may make new code sources available.
A Manager can modify a code source. This should only be done after it’s been copied elsewhere in the site, otherwise your changes will be lost when the extension is refreshed. You’ll need to track and backup your changes.
For Developers it’s possible to add custom code sources which will appear in the Code Source service. Please refer to the code of the SilvaExternalSources product’s ‘install.py’ file to do this.