-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update applies to syntax to include product lifecycle
- Loading branch information
Showing
7 changed files
with
107 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Elastic.Markdown/Myst/FrontMatter/FrontMatterParser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using YamlDotNet.Serialization; | ||
|
||
namespace Elastic.Markdown.Myst.FrontMatter; | ||
|
||
[YamlStaticContext] | ||
public partial class YamlFrontMatterStaticContext; | ||
|
||
[YamlSerializable] | ||
public class YamlFrontMatter | ||
{ | ||
[YamlMember(Alias = "title")] | ||
public string? Title { get; set; } | ||
|
||
[YamlMember(Alias = "navigation_title")] | ||
public string? NavigationTitle { get; set; } | ||
|
||
[YamlMember(Alias = "sub")] | ||
public Dictionary<string, string>? Properties { get; set; } | ||
|
||
|
||
[YamlMember(Alias = "applies")] | ||
public Deployment? AppliesTo { get; set; } | ||
} | ||
|
||
public static class FrontMatterParser | ||
{ | ||
public static YamlFrontMatter Deserialize(string yaml) | ||
{ | ||
var input = new StringReader(yaml); | ||
|
||
var deserializer = new StaticDeserializerBuilder(new YamlFrontMatterStaticContext()) | ||
.IgnoreUnmatchedProperties() | ||
.WithTypeConverter(new SemVersionConverter()) | ||
.WithTypeConverter(new DeploymentConverter()) | ||
.Build(); | ||
|
||
var frontMatter = deserializer.Deserialize<YamlFrontMatter>(input); | ||
return frontMatter; | ||
|
||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.