Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
FransBouma committed Nov 18, 2016
1 parent 99bca92 commit 71105f3
Show file tree
Hide file tree
Showing 30 changed files with 100 additions and 1,450 deletions.
4 changes: 2 additions & 2 deletions src/DocNet/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
11 changes: 9 additions & 2 deletions src/DocNet/Docnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.3.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
Expand Down Expand Up @@ -72,6 +76,9 @@
<Name>MarkdownDeep</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
4 changes: 2 additions & 2 deletions src/DocNet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.13.2.0")]
[assembly: AssemblyFileVersion("0.13.2")]
[assembly: AssemblyVersion("0.14.0.0")]
[assembly: AssemblyFileVersion("0.14.0")]
4 changes: 2 additions & 2 deletions src/DocNet/SimpleNavigationElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat
this.MarkdownFromFile = File.ReadAllText(sourceFile, Encoding.UTF8);
// Check if the content contains @@include tag
content = Utils.IncludeProcessor(this.MarkdownFromFile, Utils.MakeAbsolutePath(activeConfig.Source, activeConfig.IncludeFolder));
content = Utils.ConvertMarkdownToHtml(content, Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage);
content = Utils.ConvertMarkdownToHtml(content, Path.GetDirectoryName(destinationFile), activeConfig.Destination, sourceFile, _relativeH2LinksOnPage);
}
else
{
Expand All @@ -90,7 +90,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat
defaultMarkdown.AppendFormat("* [{0}]({1}{2}){3}", sibling.Name, relativePathToRoot, HttpUtility.UrlPathEncode(sibling.TargetURL), Environment.NewLine);
}
defaultMarkdown.Append(Environment.NewLine);
content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage);
content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), Path.GetDirectoryName(destinationFile), activeConfig.Destination, string.Empty, _relativeH2LinksOnPage);
}
else
{
Expand Down
23 changes: 13 additions & 10 deletions src/DocNet/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ public static class Utils
private static Regex includeRegex = new Regex(@"@@include\((.*)\)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
#endregion

/// <summary>
/// Converts the markdown to HTML.
/// </summary>
/// <param name="toConvert">The markdown string to convert.</param>
/// <param name="documentPath">The document path (without the document filename).</param>
/// <param name="siteRoot">The site root.</param>
/// <param name="createdAnchorCollector">The created anchor collector, for ToC sublinks for H2 headers.</param>
/// <returns></returns>
public static string ConvertMarkdownToHtml(string toConvert, string documentPath, string siteRoot, List<Tuple<string, string>> createdAnchorCollector)
/// <summary>
/// Converts the markdown to HTML.
/// </summary>
/// <param name="toConvert">The markdown string to convert.</param>
/// <param name="destinationDocumentPath">The document path (without the document filename).</param>
/// <param name="siteRoot">The site root.</param>
/// <param name="sourceDocumentFilename">the filename of the source markdown file</param>
/// <param name="createdAnchorCollector">The created anchor collector, for ToC sublinks for H2 headers.</param>
/// <returns></returns>
public static string ConvertMarkdownToHtml(string toConvert, string destinationDocumentPath, string siteRoot, string sourceDocumentFilename,
List<Tuple<string, string>> createdAnchorCollector)
{
var parser = new MarkdownDeep.Markdown
{
Expand All @@ -56,8 +58,9 @@ public static string ConvertMarkdownToHtml(string toConvert, string documentPath
AutoHeadingIDs = true,
NewWindowForExternalLinks = true,
DocNetMode = true,
DocumentLocation = documentPath,
DestinationDocumentLocation = destinationDocumentPath,
DocumentRoot = siteRoot,
SourceDocumentFilename = sourceDocumentFilename,
HtmlClassTitledImages = "figure",
};

Expand Down
3 changes: 2 additions & 1 deletion src/DocNet/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.3.0" targetFramework="net461" />
</packages>
2 changes: 1 addition & 1 deletion src/MarkdownDeep/BlockProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ private bool HandleSnippetExtension(Block b)
}

// extract the snippet, then build the fenced block to return.
var fullFilename = Path.Combine(Path.GetDirectoryName(m_markdown.DocumentLocation) ?? string.Empty, filename);
var fullFilename = Path.Combine(Path.GetDirectoryName(m_markdown.SourceDocumentFilename) ?? string.Empty, filename);
var snippetText = extractor.Extract(fullFilename, pattern) ?? string.Empty;
b.BlockType = BlockType.codeblock;
b.Data = language;
Expand Down
10 changes: 7 additions & 3 deletions src/MarkdownDeep/MardownDeep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public virtual bool OnGetImageSize(string url, bool TitledImage, out int width,
return false;

// Work out base location
string str = url.StartsWith("/") ? DocumentRoot : DocumentLocation;
string str = url.StartsWith("/") ? DocumentRoot : DestinationDocumentLocation;
if (String.IsNullOrEmpty(str))
return false;

Expand Down Expand Up @@ -909,15 +909,19 @@ public string DocumentRoot
set;
}

// Local file system location of the current document. Used to locate relative
// Local file system location of the current destination document. Used to locate relative
// path images for image size.
// Typical value: c:\inetpub\www\wwwroot\subfolder
public string DocumentLocation
public string DestinationDocumentLocation
{
get;
set;
}


public string SourceDocumentFilename { get; set; }


// Limit the width of images (0 for no limit)
public int MaxImageWidth
{
Expand Down
5 changes: 5 additions & 0 deletions src/MarkdownDeep/MarkdownDeep.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -111,6 +113,9 @@
<Name>Projbook.Extension</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
15 changes: 15 additions & 0 deletions src/MarkdownDeep/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 4 additions & 0 deletions src/MarkdownDeepTests/MarkdownDeepTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<HintPath>..\..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.3.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand Down
12 changes: 12 additions & 0 deletions src/MarkdownDeepTests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
1 change: 1 addition & 0 deletions src/MarkdownDeepTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.5.10.11092" />
<package id="System.Collections.Immutable" version="1.3.0" targetFramework="net461" />
</packages>

This file was deleted.

This file was deleted.

Loading

0 comments on commit 71105f3

Please sign in to comment.