Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/apidocs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index: 6
*)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Compiler.Service"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
Expand Down
2 changes: 1 addition & 1 deletion docs/codeformat.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index: 1
*)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
Expand Down
2 changes: 1 addition & 1 deletion docs/content.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index: 5
*)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
Expand Down
2 changes: 1 addition & 1 deletion docs/evaluation.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index: 7
*)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
Expand Down
4 changes: 2 additions & 2 deletions docs/literate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index: 3
*)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
Expand Down Expand Up @@ -197,7 +197,7 @@ A header may be needed to get the code to load, a typical example is this:
```text
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index: 2
---
*)
(*** condition: prepare ***)
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.0"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
(*** condition: fsx ***)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\Collections.fs">
Expand Down
1 change: 1 addition & 0 deletions src/FSharp.Formatting.ApiDocs/GenerateHtml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open System.Collections.Generic
open System.IO
open System.Web
open FSharp.Formatting.Common
open FSharp.Formatting.Common.Utils // compat layer for netstandard2.0
open FSharp.Compiler.Symbols
open FSharp.Formatting.Templating
open FSharp.Formatting.HtmlModel
Expand Down
1 change: 1 addition & 0 deletions src/FSharp.Formatting.ApiDocs/GenerateModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ open FSharp.Compiler.Symbols
open FSharp.Compiler.Text
open FSharp.Compiler.Text.Range
open FSharp.Formatting.Common
open FSharp.Formatting.Common.Utils // compat layer for netstandard2.0
open FSharp.Formatting.Internal
open FSharp.Formatting.CodeFormat
open FSharp.Formatting.Literate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\Collections.fs">
Expand Down
3 changes: 2 additions & 1 deletion src/FSharp.Formatting.Common/FSharp.Formatting.Common.fsproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<DefineConstants>TRACE;YAAF_FSHARP_SCRIPTING_PUBLIC</DefineConstants>
<DisableMSBuildAssemblyCopyCheck>true</DisableMSBuildAssemblyCopyCheck>
<WarningsAsErrors>FS0025;FS1182;$(WarningsAsErrors)</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="Utils.fs" />
<Compile Include="YaafFSharpScripting.fs" />
<Compile Include="Log.fs" />
<Compile Include="Range.fs" />
Expand Down
1 change: 1 addition & 0 deletions src/FSharp.Formatting.Common/PynbModel.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module internal FSharp.Formatting.PynbModel

open FSharp.Formatting.Common.Utils // compat layer for netstandard2.0
open System.Web

let escapeAndQuote (txt: string) =
Expand Down
3 changes: 2 additions & 1 deletion src/FSharp.Formatting.Common/Templating.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open System
open System.Collections.Generic
open System.IO
open System.Text
open FSharp.Formatting.Common.Utils // compat layer for netstandard2.0

/// <summary>
/// A parameter key
Expand Down Expand Up @@ -50,7 +51,7 @@ type FrontMatterFile =
isBlankLine || line.Contains(":"))
|> Seq.filter (String.IsNullOrWhiteSpace >> not)
|> Seq.map (fun line ->
let parts = line.Split(":")
let parts = line.Split ':'
parts.[0].ToLowerInvariant(), parts.[1])
|> Map.ofSeq

Expand Down
12 changes: 12 additions & 0 deletions src/FSharp.Formatting.Common/Utils.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module FSharp.Formatting.Common.Utils
#if NETSTANDARD_2_1_OR_GREATER
#else
type System.String with
member x.StartsWith c =
x.StartsWith(string<char> c, false, System.Globalization.CultureInfo.InvariantCulture)

member x.EndsWith c =
x.EndsWith(string<char> c, false, System.Globalization.CultureInfo.InvariantCulture)

member x.Contains c = x.Contains(string<char> c)
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
27 changes: 25 additions & 2 deletions src/FSharp.Formatting.Literate/Formatting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,31 @@ module internal Formatting =
let relativeSourceFileName =
match doc.RootInputFolder with
| None -> Path.GetFileName(doc.SourceFile)
| Some rootInputFolder -> Path.GetRelativePath(rootInputFolder, doc.SourceFile)

| Some rootInputFolder ->
#if NETSTANDARD2_1_OR_GREATER
Path.GetRelativePath(rootInputFolder, doc.SourceFile)
#else
if
doc.SourceFile.StartsWith(
rootInputFolder + string<char> Path.DirectorySeparatorChar,
false,
System.Globalization.CultureInfo.InvariantCulture
)
|| doc.SourceFile.StartsWith(
rootInputFolder + "/",
false,
System.Globalization.CultureInfo.InvariantCulture
)
|| doc.SourceFile.StartsWith(
rootInputFolder + "\\",
false,
System.Globalization.CultureInfo.InvariantCulture
)
then
doc.SourceFile.Substring(rootInputFolder.Length + 1)
else
failwith $"need to make {doc.SourceFile} relative to {rootInputFolder}"
#endif
let relativeSourceFileBaseName = Path.ChangeExtension(relativeSourceFileName, null)

let relativeSourceFileName = relativeSourceFileName.Replace(@"\", "/")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\Collections.fs">
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Formatting.Markdown/MarkdownParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open System.Text.RegularExpressions
open FSharp.Patterns
open FSharp.Collections
open FSharp.Formatting.Common

open FSharp.Formatting.Common.Utils // compat layer for netstandard2.0
// --------------------------------------------------------------------------------------
// Parsing of Markdown - first part handles inline formatting
// --------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Formatting/FSharp.Formatting.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
<UsesMarkdownComments>true</UsesMarkdownComments>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Formatting/FSharp.Formatting.fsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#nowarn "211"

// FSharp.Formatting repo context: uncomment for intellisense
//#I "bin/Release/netstandard2.1"
//#I "bin/Release/netstandard2.0"

// Standard NuGet or Paket location
#I __SOURCE_DIRECTORY__
#I "lib/netstandard2.1"
#I "lib/netstandard2.0"

// Standard Paket locations
#I "../FSharp.Compiler.Service/lib/netstandard2.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/AttributeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let configuration =
"Release"
#endif

let tfm = "netstandard2.1"
let tfm = "netstandard2.0"

// NOTE - For these tests to run properly they require the output of all the metadata
// test project to be directed to the directory below
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<NoWarn>FS1182</NoWarn>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/FsLib2/FsLib2.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<NoWarn>FS1182</NoWarn>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/TestLib1/TestLib1.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/TestLib2/TestLib2.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/TestLib3/TestLib3.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/crefLib1/crefLib1.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/crefLib2/crefLib2.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputPath>..\bin\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/crefLib3/crefLib3.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<NoWarn>CS0067;CS1591;CS1574</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.ApiDocs.Tests/files/crefLib4/crefLib4.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<NoWarn>CS0067;CS1591;CS1574</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<NoWarn>CS0067;CS1591;CS1574</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
Expand Down