Reusing Reference Content
In This Topic
If you are authoring content for reference documentation items, you may find that the same content is usable in several places. There are several ways in which you can minimize duplication by re-using content associated with reference documentation items:
For .NET method or property overrides, use the content from the base member
If you have an overriden member for which the base documentation content is valid, you can tell Document! X to use the base member content rather than duplicating the content.
To automatically use the base member content for all overriden members that don't have any specific content defined:
- Open the Build Profile editor.
- Select the .NET Source Comments option under Reference Documentation.
- Select the For overriden members without content, use the content from the base member option.
The overriden members without any specific content will automatically use the content from the base member when you build your project for output.
To use the base member content just for a specific overriden member:
- In the Content File editor, select the override member.
- Select the Content From content item type (either from the toolbar or page menu on the right side of the Content File Editor).
- Click the New toolbar button to create a new Content From item.
- Leave the Copy content from field blank - Document! X will automatically use the content from the member in the base type.
You can also do this for specific override members in a .NET Xml source comment by using an <inheritdoc/> or <contentfrom/> comment. An <inheritdoc/> comment applied to a type will apply this behavior to all overrides in that type.
For .NET documentation, automatically use the content from inherited members
For members inherited from types that are contained in assemblies within the project, the Document! X will automatically use the content defined for the inherited member in the base type - that behavior is always enabled.
For members inherited from types that are contained in assemblies that are not included in the current project, including .NET Framework assemblies, the Document! X can use the content (contained in xml comment files) from the member as defined in the base type by enabling a specific option in the Build Profile editor.
To enable using content from other assemblies for inherited members:
- Open the Build Profile editor.
- Select the .NET Source Comments page.
- Select the Find and integrate XML Documentation for members inherited from other assemblies option.
Use the Content From Content Item Type to use content from another item in the project
You can use the Content From content item type to specifically identify another item from which you would like to use the content when the generated documentation is built.
- In the Content File editor, select the item in which you would like to re-use another items content.
- Select the Content From content item type (either from the toolbar or page menu on the right hand side of the Content File editor).
- Click the New toolbar button to create a new Content From item;
- Click the Build button and identify the source item that contains the content you would like to re-use.
When the documentation is built (or when you Preview in the Content File editor) the content from the identified source item will be used.
You can use the Filter list in the Content From editor to specific particular parts of the content to re-use. For example you might want to use just the summary content, or just the Examples.
Define a Project Property for short pieces of common content
If you have a short phrase or description that you want to make use of in several locations, you can define a Project Property to contain the text so that you can avoid duplication and are able to manage that text in one place.
To create a Project Property:
- Select the Project Settings option on the Project ribbon menu.
- Select the Project Properties.
- Select the New toolbar option to create a new project property.
- Enter the project property name and description (optional). You will use this name to reference the project property in your content.
- Select project property type as Text, Number, HTML, Date & Time, or Color.
- Click Ok to save the new Project Property.
- Click the ... button next to the newly created Property to define the value associated with the Project Property (e.g. the text you want to use in multiple locations in your content).
You can now reference the Project Property anywhere in the content editors by surrounding the Project Property name with %% symbols - e.g. %%MyProjectProperty%%. The placeholder will be replaced with the Project Property when you Preview a page or build the project.
If you are generating multiple outputs, you can define different values for your Project Property in each Build Profile using the Project Properties page in the Build Profile Editor.
Applying content to multiple items automatically by creating an AutoDoc file
AutoDoc is a powerful Document! X feature that allows you to author content that is used in the generated output according to rules that you define. For example you might want to author some specific remarks for inclusion in every method with a particular name in order to prevent duplicating the same content in many places.
See the AutoDoc Topic for more information on creating and using AutoDoc files.
See Also