Browse Source

Changes to PR code

tags/v0.15
Frans Bouma 8 years ago
parent
commit
f41ea3dd5d
3 changed files with 7 additions and 12 deletions
  1. +4
    -12
      src/MarkdownDeep/LinkDefinition.cs
  2. +1
    -0
      src/MarkdownDeepTests/testfiles/locallinks_enabled/markdown-readme(DocNetMode)(ConvertLocalLinks).html
  3. +2
    -0
      src/MarkdownDeepTests/testfiles/locallinks_enabled/markdown-readme(DocNetMode)(ConvertLocalLinks).text

+ 4
- 12
src/MarkdownDeep/LinkDefinition.cs View File

@@ -70,18 +70,10 @@ namespace MarkdownDeep
if (index >= 0) if (index >= 0)
{ {
Uri uri; Uri uri;
if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
if (!uri.IsAbsoluteUri)
{
// TODO: Check if link exists in the ToC
var existsInTableOfContents = true;
if (existsInTableOfContents)
{
url = url.Remove(index, ".md".Length).Insert(index, ".htm");
}
}
}
if(Uri.TryCreate(url, UriKind.Relative, out uri))
{
url = String.Concat(url.Substring(0, index), ".htm", url.Substring(index + ".md".Length));
}
} }
} }




+ 1
- 0
src/MarkdownDeepTests/testfiles/locallinks_enabled/markdown-readme(DocNetMode)(ConvertLocalLinks).html View File

@@ -1,5 +1,6 @@
<h1>Markdown</h1> <h1>Markdown</h1>


<p> <a href="https://github.com/FransBouma">Remote link</a> </p> <p> <a href="https://github.com/FransBouma">Remote link</a> </p>
<p> <a href="https://github.com/FransBouma/target1.md">Remote link</a></p>
<p> <a href="./target1.htm">Local 1</a> </p> <p> <a href="./target1.htm">Local 1</a> </p>
<p> <a href="./target2.htm#bla">Local 2</a> </p> <p> <a href="./target2.htm#bla">Local 2</a> </p>

+ 2
- 0
src/MarkdownDeepTests/testfiles/locallinks_enabled/markdown-readme(DocNetMode)(ConvertLocalLinks).text View File

@@ -3,6 +3,8 @@ Markdown


[Remote link](https://github.com/FransBouma) [Remote link](https://github.com/FransBouma)


[Remote link](https://github.com/FransBouma/target1.md)

[Local 1](./target1.md) [Local 1](./target1.md)


[Local 2](./target2.md#bla) [Local 2](./target2.md#bla)

Loading…
Cancel
Save