Skip to content

Commit

Permalink
Merge pull request #2 from Microsoft/master
Browse files Browse the repository at this point in the history
Upgrade from Main
  • Loading branch information
XamlBrewer authored May 16, 2018
2 parents a40dfab + da110ef commit b995e1d
Show file tree
Hide file tree
Showing 346 changed files with 6,532 additions and 11,801 deletions.
42 changes: 42 additions & 0 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
trigger:
- master
- rel/*

variables:
BuildConfiguration: Release

steps:
- task: BatchScript@1
inputs:
filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
arguments: -no_logo
modifyEnvironment: true
displayName: Setup Environment Variables

- task: NuGetToolInstaller@0
displayName: Use NuGet 4.6.2
inputs:
versionSpec: 4.6.2

- task: DotNetCoreCLI@2
inputs:
command: build
projects: build/setversion.csproj
arguments: -c $(BuildConfiguration)
displayName: Set Version

- powershell: |
.\build\build.ps1 -target=SignNuGet
displayName: Build
env:
SignClientSecret: $(SignClientSecret)
SignClientUser: $(SignClientUser)


- task: PublishBuildArtifacts@1
displayName: Publish Package Artifacts
inputs:
pathToPublish: .\bin\nupkg
artifactType: container
artifactName: Packages
condition: always()
27 changes: 27 additions & 0 deletions .vsts-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
variables:
BuildConfiguration: Release

steps:
- task: BatchScript@1
inputs:
filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
arguments: -no_logo
modifyEnvironment: true
displayName: Setup Environment Variables

- task: NuGetToolInstaller@0
displayName: Use NuGet 4.6.2
inputs:
versionSpec: 4.6.2

- powershell: |
.\build\build.ps1 -target=Build
displayName: Build

- task: PublishBuildArtifacts@1
displayName: Publish Package Artifacts
inputs:
pathToPublish: .\bin\nupkg
artifactType: container
artifactName: Packages
condition: eq(variables['system.pullrequest.isfork'], false)
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<UwpMetaPackageVersion>5.4.1</UwpMetaPackageVersion>
<DefaultTargetPlatformVersion>16299</DefaultTargetPlatformVersion>
<DefaultTargetPlatformMinVersion>14393</DefaultTargetPlatformMinVersion>

<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
</PropertyGroup>

<Choose>
Expand Down
37 changes: 33 additions & 4 deletions Microsoft.Toolkit.Parsers/Markdown/MarkdownDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Toolkit.Extensions;
using Microsoft.Toolkit.Parsers.Markdown.Blocks;
using Microsoft.Toolkit.Parsers.Markdown.Enums;
using Microsoft.Toolkit.Parsers.Markdown.Helpers;
Expand Down Expand Up @@ -93,6 +95,7 @@ internal static List<MarkdownBlock> Parse(string markdown, int start, int end, i
var paragraphText = new StringBuilder();

// These are needed to parse underline-style header blocks.
int previousRealtStartOfLine = start;
int previousStartOfLine = start;
int previousEndOfLine = start;

Expand Down Expand Up @@ -150,15 +153,40 @@ internal static List<MarkdownBlock> Parse(string markdown, int start, int end, i
}
else
{
// There were less block quote characters than expected.
// But it doesn't matter if this is not the start of a new paragraph.
if (!lineStartsNewParagraph || nonSpaceChar == '\0')
int lastIndentation = 0;
string lastline = null;

// Determines how many Quote levels were in the last line.
if (realStartOfLine > 0)
{
lastline = markdown.Substring(previousRealtStartOfLine, previousEndOfLine - previousRealtStartOfLine);
lastIndentation = lastline.Count(c => c == '>');
}

var currentEndOfLine = Common.FindNextSingleNewLine(markdown, nonSpacePos, end, out _);
var currentline = markdown.Substring(realStartOfLine, currentEndOfLine - realStartOfLine);
var currentIndentation = currentline.Count(c => c == '>');
var firstChar = markdown[realStartOfLine];

// This is a quote that doesn't start with a Quote marker, but carries on from the last line.
if (lastIndentation == 1)
{
if (nonSpaceChar != '\0' && firstChar != '>')
{
break;
}
}

// Collapse down a level of quotes if the current indentation is greater than the last indentation.
// Only if the last indentation is greater than 1, and the current indentation is greater than 0
if (lastIndentation > 1 && currentIndentation > 0 && currentIndentation < lastIndentation)
{
break;
}

// This must be the end of the blockquote. End the current paragraph, if any.
actualEnd = previousEndOfLine;
actualEnd = realStartOfLine;

if (paragraphText.Length > 0)
{
blocks.Add(ParagraphBlock.Parse(paragraphText.ToString()));
Expand Down Expand Up @@ -317,6 +345,7 @@ internal static List<MarkdownBlock> Parse(string markdown, int start, int end, i
}

// Repeat.
previousRealtStartOfLine = realStartOfLine;
previousStartOfLine = startOfLine;
previousEndOfLine = endOfLine;
startOfLine = startOfNextLine;
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Parsers/Microsoft.Toolkit.Parsers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<Description>This .NET standard library contains various Parsers. It is part of the UWP Community Toolkit.</Description>
<Description>This .NET standard library contains various Parsers. It is part of the Windows Community Toolkit.</Description>
<PackageTags>UWP Toolkit Windows Parsers Parsing Markdown RSS</PackageTags>
<Title>UWP Community Toolkit .NET Standard Parsers</Title>
<Title>Windows Community Toolkit .NET Standard Parsers</Title>

<!-- This is a temporary workaround for https://github.com/dotnet/sdk/issues/955 -->
<DebugType>Full</DebugType>
Expand Down
2 changes: 2 additions & 0 deletions Microsoft.Toolkit.Parsers/Rss/Rss2Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ private static RssSchema ParseRssItem(XElement item)
image = item.GetImage();
}

rssItem.Categories = item.GetSafeElementsString("category");

rssItem.ImageUrl = image;

return rssItem;
Expand Down
32 changes: 31 additions & 1 deletion Microsoft.Toolkit.Parsers/Rss/RssHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static DateTime GetSafeElementDate(this XElement item, string elementName
/// Get item string value for xelement and element name.
/// </summary>
/// <param name="item">XElement item.</param>
/// <param name="elementName">Name of eleement.</param>
/// <param name="elementName">Name of element.</param>
/// <returns>Safe string.</returns>
public static string GetSafeElementString(this XElement item, string elementName)
{
Expand All @@ -140,6 +140,36 @@ public static string GetSafeElementString(this XElement item, string elementName
return GetSafeElementString(item, elementName, item.GetDefaultNamespace());
}

/// <summary>
/// Get item string values for xelement and element name.
/// </summary>
/// <param name="item">XElement item.</param>
/// <param name="elementName">Name of the element.</param>
/// <returns>Safe list of string values.</returns>
public static IEnumerable<string> GetSafeElementsString(this XElement item, string elementName)
{
return GetSafeElementsString(item, elementName, item.GetDefaultNamespace());
}

/// <summary>
/// Get item string values for xelement, element name and namespace.
/// </summary>
/// <param name="item">XELement item.</param>
/// <param name="elementName">Name of element.</param>
/// <param name="xNamespace">XNamespace namespace.</param>
/// <returns>Safe list of string values.</returns>
public static IEnumerable<string> GetSafeElementsString(this XElement item, string elementName, XNamespace xNamespace)
{
if (item != null)
{
IEnumerable<XElement> values = item.Elements(xNamespace + elementName);
return values.Where(f => !string.IsNullOrEmpty(f.Value))
.Select(f => f.Value);
}

return Enumerable.Empty<string>();
}

/// <summary>
/// Get item string value for xelement, element name and namespace.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Microsoft.Toolkit.Parsers/Rss/RssSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// ******************************************************************

using System;
using System.Collections.Generic;

namespace Microsoft.Toolkit.Parsers.Rss
{
Expand Down Expand Up @@ -63,5 +64,10 @@ public class RssSchema : SchemaBase
/// Gets or sets publish Date.
/// </summary>
public DateTime PublishDate { get; set; }

/// <summary>
/// Gets or sets item's categories.
/// </summary>
public IEnumerable<string> Categories { get; set; }
}
}
22 changes: 0 additions & 22 deletions Microsoft.Toolkit.Services/Core/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,5 @@ private static string GetStringValue(Enum value)

return output;
}

/// <summary>
/// Converts object into string.
/// </summary>
/// <param name="value">Object value.</param>
/// <returns>Returns string value.</returns>
[Obsolete("This method is being deprecated. Please use the counterpart in Microsoft.Toolkit.Extensions.StringExtensions.")]
public static string ToSafeString(this object value)
{
return StringExtensions.ToSafeString(value);
}

/// <summary>
/// Decode HTML string.
/// </summary>
/// <param name="htmlText">HTML string.</param>
/// <returns>Returns decoded HTML string.</returns>
[Obsolete("This method is being deprecated. Please use the counterpart in Microsoft.Toolkit.Extensions.StringExtensions.")]
public static string DecodeHtml(this string htmlText)
{
return StringExtensions.DecodeHtml(htmlText);
}
}
}
26 changes: 0 additions & 26 deletions Microsoft.Toolkit.Services/Core/IParser.cs

This file was deleted.

24 changes: 0 additions & 24 deletions Microsoft.Toolkit.Services/Core/SchemaBase.cs

This file was deleted.

39 changes: 0 additions & 39 deletions Microsoft.Toolkit.Services/Core/StringValueAttribute.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Services/Microsoft.Toolkit.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<Description>This .NET standard library enables access to different data sources such as Bing. It is part of the UWP Community Toolkit.</Description>
<Description>This .NET standard library enables access to different data sources such as Bing. It is part of the Windows Community Toolkit.</Description>
<PackageTags>UWP Toolkit Windows Bing</PackageTags>
<Title>UWP Community Toolkit .NET Standard Services</Title>
<Title>Windows Community Toolkit .NET Standard Services</Title>

<!-- This is a temporary workaround for https://github.com/dotnet/sdk/issues/955 -->
<DebugType>Full</DebugType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public Task SendEmailAsync(CancellationToken cancellationToken, string subject,
{
if (_currentUser == null)
{
throw new ServiceException(new Error { Message = "No user connected", Code = "NoUserConnected", ThrowSite = "UWP Community Toolkit" });
throw new ServiceException(new Error { Message = "No user connected", Code = "NoUserConnected", ThrowSite = "Windows Community Toolkit" });
}

List<Recipient> ccRecipients = null;
Expand Down
Loading

0 comments on commit b995e1d

Please sign in to comment.