Skip to content

Commit

Permalink
Merge pull request #67 from RussKie/make_docs_locale_agnostic
Browse files Browse the repository at this point in the history
Make docs links locale agnostic
  • Loading branch information
AArnott authored Jan 26, 2021
2 parents a9c8eb3 + e3937ed commit dd1d9e6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should install the version specified in `global.json` or a later version wit
the same major.minor.Bxx "hundreds" band.
For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310
while the 2.2.400 version would not be considered compatible by .NET SDK.
See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information.
See [.NET Core Versioning](https://docs.microsoft.com/dotnet/core/versions/) for more information.

## Package restore

Expand All @@ -39,4 +39,4 @@ This repository can be built on Windows, Linux, and OSX.

Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.).

[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6
[pwsh]: https://docs.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-6
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

Expand All @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

Expand All @@ -38,4 +38,4 @@ We prefer all communications to be in English.

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
<!-- END MICROSOFT SECURITY.MD BLOCK -->
2 changes: 1 addition & 1 deletion src/Microsoft.Windows.CsWin32/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Generator : IDisposable

internal static readonly Dictionary<string, string> BannedAPIs = new Dictionary<string, string>
{
{ "GetLastError", "Do not generate GetLastError. Call Marshal.GetLastWin32Error() instead. Learn more from https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getlastwin32error" },
{ "GetLastError", "Do not generate GetLastError. Call Marshal.GetLastWin32Error() instead. Learn more from https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.marshal.getlastwin32error" },
};

private const string SystemRuntimeCompilerServices = "System.Runtime.CompilerServices";
Expand Down
6 changes: 3 additions & 3 deletions src/ScrapeDocs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ where result is { }

private (string ApiName, YamlNode YamlNode)? ParseDocFile(string filePath)
{
string presumedMethodName = FileNamePattern.Match(Path.GetFileNameWithoutExtension(filePath)).Groups[1].Value;
Uri helpLink = new Uri("https://docs.microsoft.com/en-us/windows/win32/api/" + filePath.Substring(this.contentBasePath.Length, filePath.Length - 3 - this.contentBasePath.Length).Replace('\\', '/'));

var yaml = new YamlStream();
using StreamReader mdFileReader = File.OpenText(filePath);
using var markdownToYamlReader = new YamlSectionReader(mdFileReader);
Expand Down Expand Up @@ -159,6 +156,8 @@ bool TryGetProperName(string searchFor, char? suffix, [NotNullWhen(true)] out st
return match is object;
}

string presumedMethodName = FileNamePattern.Match(Path.GetFileNameWithoutExtension(filePath)).Groups[1].Value;

// Some structures have filenames that include the W or A suffix when the content doesn't. So try some fuzzy matching.
if (!TryGetProperName(presumedMethodName, null, out string? properName) &&
!TryGetProperName(presumedMethodName, 'a', out properName) &&
Expand All @@ -169,6 +168,7 @@ bool TryGetProperName(string searchFor, char? suffix, [NotNullWhen(true)] out st
}

var methodNode = new YamlMappingNode();
Uri helpLink = new Uri("https://docs.microsoft.com/windows/win32/api/" + filePath.Substring(this.contentBasePath.Length, filePath.Length - 3 - this.contentBasePath.Length).Replace('\\', '/'));
methodNode.Add("HelpLink", helpLink.AbsoluteUri);

var description = ((YamlMappingNode)yaml.Documents[0].RootNode).Children.FirstOrDefault(n => n.Key is YamlScalarNode { Value: "description" }).Value as YamlScalarNode;
Expand Down

0 comments on commit dd1d9e6

Please sign in to comment.