Skip to content

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjustino committed May 25, 2021
1 parent f44c971 commit 0fb5980
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 36 deletions.
30 changes: 0 additions & 30 deletions src/C4Sharp.Tests/C4Sharp.Tests.csproj

This file was deleted.

2 changes: 1 addition & 1 deletion src/C4Sharp/C4Sharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/8T4/c4sharp</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>c4, diagrams</PackageTags>
<PackageVersion>2.0.0</PackageVersion>
<PackageVersion>2.1.0</PackageVersion>
<PackageIconUrl>https://github.com/8T4/c4sharp/blob/main/LICENSE</PackageIconUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
18 changes: 13 additions & 5 deletions src/C4Sharp/Models/Plantuml/PlantumlDiagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ namespace C4Sharp.Models.Plantuml
/// </summary>
public static class PlantumlDiagram
{
const string standardLibraryBaseUrl = "https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master";
private const string StandardLibraryBaseUrl = "https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master";

/// <summary>
/// Create PUML content from Diagram
/// </summary>
/// <param name="diagram"></param>
/// <param name="useUrlInclude"></param>
/// <returns></returns>
public static string ToPumlString(this Diagram diagram, bool useUrlInclude = false)
{
var pumlFileName = $"{diagram.Name}.puml";
var path = useUrlInclude ? $"{standardLibraryBaseUrl}/{pumlFileName}"
: Path.Join(C4Directory.ResourcesFolderName, pumlFileName);
var path = GetPumlFilePath(diagram, useUrlInclude);

var stream = new StringBuilder();
stream.AppendLine($"@startuml {diagram.Slug()}");
Expand Down Expand Up @@ -61,6 +60,15 @@ public static string ToPumlString(this Diagram diagram, bool useUrlInclude = fal

stream.AppendLine("@enduml");
return stream.ToString();
}
}

private static string GetPumlFilePath(this Diagram diagram, bool useUrlInclude)
{
var pumlFileName = $"{diagram.Name}.puml";

return useUrlInclude
? $"{StandardLibraryBaseUrl}/{pumlFileName}"
: Path.Join(C4Directory.ResourcesFolderName, pumlFileName);
}
}
}

0 comments on commit 0fb5980

Please sign in to comment.