This project has moved. For the latest updates, please go here.

Code Group in Conceptual Topic

May 8, 2014 at 5:13 PM
Hello there.

First, I want to say thanks for the great tool!

In my project I want to show some sample codes, both in C# and VB.NET in my conceptual topics. The problem I got is when I place two <code/> elements, one for C# the other for VB.NET, in a conceptual topic, the code blocks does not fit together. On the output webpage, it shows two separate code blocks: one with C# code, and tab 'VB' disabled. And the other code block with VB.Net code and tab 'C#' disabled. I tested that if I put the those two <code/> elements in within comments (in my code file), it works well, i.e. there are only one code block with two enabled tabs.

My version of Sandcastle Help File Builder is v2014.4.22.0.

My code is something like this.
<topic ...>
  <developerConceptualDocument ...>
        <code lang="C#" source="Samples.cs" region="TEST" />
        <code lang="VB.NET" source="Samples.vb" region="TEST" />
And the output looks like this.
    |C#|  VB
    // Here goes my c# code

    C# |VB|
    // Blank, need to click on the tab 'VB' to show the VB.NET code
May 8, 2014 at 5:58 PM
This is a known issue with the current release and is related to the old branding transformations. They never handled code snippet grouping all that well. I've just recently completed the removal of the branding transformations and have completely reworked code snippet grouping and sorting so that it works correctly and logically based on what snippets are present and whether they are contiguous or standalone. Here's an example of the above case from the SHFB documentation that works as expected now:

These fixes will be in the next release. I don't have a planned release date yet and I'm still finishing up a few additional related features. If you need the changes sooner, most of the changes have been checked into source control so you can download the code and build it if necessary.

May 8, 2014 at 6:11 PM
Edited May 8, 2014 at 6:12 PM
Thank you for your prompt response, Eric. I think I will need to build it myself.

BTW, in case some one met with the same issue and don't want to build from trunk, the <codeReference> tag and code snippets file can achieve the same purpose. But the indentation and syntax coloring does not work as well as the code block component plugin.

Thanks again for your help!

May 8, 2014 at 9:12 PM
I confirm that the code in trunk (r105807) fixed that issue and it groups code well. Great job, Eric!

One minor issue I found is it seems there is one extra blank line added for F#. For example,
    //#region Test
    let a = 1
Will generate two lines:
    1| let a = 1

And the fix is put the //endregion right at end of the code like this:
    //#region Test
    let a = 1//#endregion