Skip to content

Commit 71105f3

Browse files
committed
Changes:
- v0.14 version bump (not done yet) - clean up of projbook project files on disk - fix in path read in @snippet statement - added references to System.Collections.Immutable to several projects as it's indirectly loaded and will make docnet fail at runtime if missing
1 parent 99bca92 commit 71105f3

30 files changed

Lines changed: 100 additions & 1450 deletions

src/DocNet/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
88
<dependentAssembly>
99
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
10-
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
10+
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
1111
</dependentAssembly>
1212
<dependentAssembly>
1313
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
14+
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
1515
</dependentAssembly>
1616
</assemblyBinding>
1717
</runtime>

src/DocNet/Docnet.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
37-
<HintPath>..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
36+
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
37+
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
3838
<Private>True</Private>
3939
</Reference>
4040
<Reference Include="System" />
41+
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
42+
<HintPath>..\..\packages\System.Collections.Immutable.1.3.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
4145
<Reference Include="System.Configuration" />
4246
<Reference Include="System.Core" />
4347
<Reference Include="System.Web" />
@@ -72,6 +76,9 @@
7276
<Name>MarkdownDeep</Name>
7377
</ProjectReference>
7478
</ItemGroup>
79+
<ItemGroup>
80+
<WCFMetadata Include="Service References\" />
81+
</ItemGroup>
7582
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7683
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7784
Other similar extension points exist, see Microsoft.Common.targets.

src/DocNet/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.13.2.0")]
36-
[assembly: AssemblyFileVersion("0.13.2")]
35+
[assembly: AssemblyVersion("0.14.0.0")]
36+
[assembly: AssemblyFileVersion("0.14.0")]

src/DocNet/SimpleNavigationElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat
6868
this.MarkdownFromFile = File.ReadAllText(sourceFile, Encoding.UTF8);
6969
// Check if the content contains @@include tag
7070
content = Utils.IncludeProcessor(this.MarkdownFromFile, Utils.MakeAbsolutePath(activeConfig.Source, activeConfig.IncludeFolder));
71-
content = Utils.ConvertMarkdownToHtml(content, Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage);
71+
content = Utils.ConvertMarkdownToHtml(content, Path.GetDirectoryName(destinationFile), activeConfig.Destination, sourceFile, _relativeH2LinksOnPage);
7272
}
7373
else
7474
{
@@ -90,7 +90,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat
9090
defaultMarkdown.AppendFormat("* [{0}]({1}{2}){3}", sibling.Name, relativePathToRoot, HttpUtility.UrlPathEncode(sibling.TargetURL), Environment.NewLine);
9191
}
9292
defaultMarkdown.Append(Environment.NewLine);
93-
content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage);
93+
content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), Path.GetDirectoryName(destinationFile), activeConfig.Destination, string.Empty, _relativeH2LinksOnPage);
9494
}
9595
else
9696
{

src/DocNet/Utils.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ public static class Utils
3939
private static Regex includeRegex = new Regex(@"@@include\((.*)\)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
4040
#endregion
4141

42-
/// <summary>
43-
/// Converts the markdown to HTML.
44-
/// </summary>
45-
/// <param name="toConvert">The markdown string to convert.</param>
46-
/// <param name="documentPath">The document path (without the document filename).</param>
47-
/// <param name="siteRoot">The site root.</param>
48-
/// <param name="createdAnchorCollector">The created anchor collector, for ToC sublinks for H2 headers.</param>
49-
/// <returns></returns>
50-
public static string ConvertMarkdownToHtml(string toConvert, string documentPath, string siteRoot, List<Tuple<string, string>> createdAnchorCollector)
42+
/// <summary>
43+
/// Converts the markdown to HTML.
44+
/// </summary>
45+
/// <param name="toConvert">The markdown string to convert.</param>
46+
/// <param name="destinationDocumentPath">The document path (without the document filename).</param>
47+
/// <param name="siteRoot">The site root.</param>
48+
/// <param name="sourceDocumentFilename">the filename of the source markdown file</param>
49+
/// <param name="createdAnchorCollector">The created anchor collector, for ToC sublinks for H2 headers.</param>
50+
/// <returns></returns>
51+
public static string ConvertMarkdownToHtml(string toConvert, string destinationDocumentPath, string siteRoot, string sourceDocumentFilename,
52+
List<Tuple<string, string>> createdAnchorCollector)
5153
{
5254
var parser = new MarkdownDeep.Markdown
5355
{
@@ -56,8 +58,9 @@ public static string ConvertMarkdownToHtml(string toConvert, string documentPath
5658
AutoHeadingIDs = true,
5759
NewWindowForExternalLinks = true,
5860
DocNetMode = true,
59-
DocumentLocation = documentPath,
61+
DestinationDocumentLocation = destinationDocumentPath,
6062
DocumentRoot = siteRoot,
63+
SourceDocumentFilename = sourceDocumentFilename,
6164
HtmlClassTitledImages = "figure",
6265
};
6366

src/DocNet/packages.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net461" />
3+
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
4+
<package id="System.Collections.Immutable" version="1.3.0" targetFramework="net461" />
45
</packages>

src/MarkdownDeep/BlockProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ private bool HandleSnippetExtension(Block b)
15331533
}
15341534

15351535
// extract the snippet, then build the fenced block to return.
1536-
var fullFilename = Path.Combine(Path.GetDirectoryName(m_markdown.DocumentLocation) ?? string.Empty, filename);
1536+
var fullFilename = Path.Combine(Path.GetDirectoryName(m_markdown.SourceDocumentFilename) ?? string.Empty, filename);
15371537
var snippetText = extractor.Extract(fullFilename, pattern) ?? string.Empty;
15381538
b.BlockType = BlockType.codeblock;
15391539
b.Data = language;

src/MarkdownDeep/MardownDeep.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public virtual bool OnGetImageSize(string url, bool TitledImage, out int width,
299299
return false;
300300

301301
// Work out base location
302-
string str = url.StartsWith("/") ? DocumentRoot : DocumentLocation;
302+
string str = url.StartsWith("/") ? DocumentRoot : DestinationDocumentLocation;
303303
if (String.IsNullOrEmpty(str))
304304
return false;
305305

@@ -909,15 +909,19 @@ public string DocumentRoot
909909
set;
910910
}
911911

912-
// Local file system location of the current document. Used to locate relative
912+
// Local file system location of the current destination document. Used to locate relative
913913
// path images for image size.
914914
// Typical value: c:\inetpub\www\wwwroot\subfolder
915-
public string DocumentLocation
915+
public string DestinationDocumentLocation
916916
{
917917
get;
918918
set;
919919
}
920920

921+
922+
public string SourceDocumentFilename { get; set; }
923+
924+
921925
// Limit the width of images (0 for no limit)
922926
public int MaxImageWidth
923927
{

src/MarkdownDeep/MarkdownDeep.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
<WarningLevel>4</WarningLevel>
4545
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
4646
<Prefer32Bit>false</Prefer32Bit>
47+
<DocumentationFile>
48+
</DocumentationFile>
4749
</PropertyGroup>
4850
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
4951
<DebugType>pdbonly</DebugType>
@@ -111,6 +113,9 @@
111113
<Name>Projbook.Extension</Name>
112114
</ProjectReference>
113115
</ItemGroup>
116+
<ItemGroup>
117+
<None Include="app.config" />
118+
</ItemGroup>
114119
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
115120
<PropertyGroup>
116121
<PostBuildEvent>

src/MarkdownDeep/app.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
8+
</dependentAssembly>
9+
<dependentAssembly>
10+
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
11+
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
12+
</dependentAssembly>
13+
</assemblyBinding>
14+
</runtime>
15+
</configuration>

0 commit comments

Comments
 (0)