SHFB icon indicating copy to clipboard operation
SHFB copied to clipboard

Add an Example for SyntaxGeneratorExportAttribute.IsConfigurable Property

Open gowthamguptha opened this issue 7 years ago • 6 comments

Please add an example for SyntaxGeneratorExportAttribute.IsConfigurable Property.

I want to show some custom configuration message box for my plugin.

Help Topic: https://ewsoftware.github.io/SHFB/html/0ae85662-4766-f604-0542-2c567dc775ab.htm

gowthamguptha avatar Nov 22 '19 11:11 gowthamguptha

A syntax generator or a plug-in in general? If it's a syntax generator, the DefaultConfiguration and CurrentConfiguration properties supply the default and current configuration. The SynaxComponent handles editing of the syntax component configurations so there's nothing to do within your component specifically.

For a general plug-in, see any of the existing plug-ins that provide a configuration such as the DbcsFixPlugIn. The ConfigurePlugIn method handles showing the form and updating the configuration.

EWSoftware avatar Nov 22 '19 20:11 EWSoftware

Thanks, EWSoftware :)

This really helps me. But I have one more question on Syntax Generator. For Plug-in as you mentioned we can show a form and update the configuration. This is fine. But I need to use the same configuration which is saved in the above plug-in in the Syntax generator.

How can I access those configurations?

gowthamguptha avatar Nov 23 '19 21:11 gowthamguptha

I'd have your plug-in locate your syntax generator in the sandcastle.config file during the after execution stage of the MergeCustomConfigs build step and then insert the configuration elements into the syntax component's configuration element. The syntax generator would then access it normally when loaded by BuildAssembler.

EWSoftware avatar Nov 23 '19 21:11 EWSoftware

Hi EWSoftware,

As you suggested i was adding the configiration in MergeCustomConfig and this is how it looks in Syntax componet.

<!-- Generate syntax --> <component id="Syntax Component"> <!-- This element is not relevant to conceptual builds --> <syntax input="/document/reference" output="/document/syntax" /> <!-- The list of syntax generators to use --> <generators> <generator id="Json" /> </generators> <!-- Group snippets for languages in the syntax generator set within this element --> <containerElement name="codeSnippetGroup" addNoExampleTabs="true" includeOnSingleSnippets="false" groupingEnabled="true" /> ** <!-- My Confogoration which need to access in custom syntax generator --><configuration> <AppConfigLocale value="Namespace" /> </configuration>**

And in My Custom Syntax Generator -> Initialize method I was trying to access the above-added configuration But it was not accessing.

Could you please suggest if I am doing wrong?

gowthamguptha avatar Nov 23 '19 22:11 gowthamguptha

Your syntax component will be passed its generator element for the configuration. You need to add the configuration elements as children of that element:

<generators>
    <generator id="Json">
        <YourConfiguration Goes="Here"..... />
        <Etc />
    </generator>
</generators>

Also, remember that there are two copies of the syntax component, one for conceptual content and one for API content, so you'll want to insert them in both copies.

EWSoftware avatar Nov 23 '19 23:11 EWSoftware

Thanks, EWSoftware.

It worked :)

Thank you so much again for your quick response.

Have a nice day :)

gowthamguptha avatar Nov 23 '19 23:11 gowthamguptha