Skip to content

Commit

Permalink
Merge pull request #425 from Krzysztof-Cieslak/remove_Razor
Browse files Browse the repository at this point in the history
Remove razor
  • Loading branch information
matthid authored Mar 18, 2017
2 parents d6c89e6 + 15465b1 commit 47acc98
Show file tree
Hide file tree
Showing 32 changed files with 897 additions and 685 deletions.
8 changes: 7 additions & 1 deletion FSharp.Formatting.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 12.0.31101.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{194BD478-0DB5-44F3-A6C2-1FC75D3F3294}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -108,6 +108,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crefLib4", "tests\FSharp.Me
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Formatting.Common", "src\FSharp.Formatting.Common\FSharp.Formatting.Common.fsproj", "{91BAD90E-BF3B-4646-A1A7-1568F8F25075}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Formatting.Razor", "src\FSharp.Formatting.Razor\FSharp.Formatting.Razor.fsproj", "{C6B3C274-71A8-4239-BA9A-1AF7B2F7C736}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -194,6 +196,10 @@ Global
{91BAD90E-BF3B-4646-A1A7-1568F8F25075}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91BAD90E-BF3B-4646-A1A7-1568F8F25075}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91BAD90E-BF3B-4646-A1A7-1568F8F25075}.Release|Any CPU.Build.0 = Release|Any CPU
{C6B3C274-71A8-4239-BA9A-1AF7B2F7C736}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6B3C274-71A8-4239-BA9A-1AF7B2F7C736}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6B3C274-71A8-4239-BA9A-1AF7B2F7C736}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6B3C274-71A8-4239-BA9A-1AF7B2F7C736}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 6 additions & 6 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let release = ReleaseNotesHelper.parseReleaseNotes (File.ReadLines "RELEASE_NOTE
// Generate assembly info files with the right version & up-to-date information

Target "AssemblyInfo" (fun _ ->
let info =
let info =
[ Attribute.Title project
Attribute.Product project
Attribute.Description summary
Expand Down Expand Up @@ -367,11 +367,11 @@ let bootStrapDocumentationFiles () =
ensureDirectory (__SOURCE_DIRECTORY__ @@ "packages/FSharp.Formatting/lib/net40")
let buildFiles = [ "CSharpFormat.dll"; "FSharp.CodeFormat.dll"; "FSharp.Literate.dll"
"FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll"; "RazorEngine.dll";
"System.Web.Razor.dll"; "FSharp.Formatting.Common.dll" ]
"System.Web.Razor.dll"; "FSharp.Formatting.Common.dll"; "FSharp.Formatting.Razor.dll" ]
let bundledFiles =
buildFiles
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "bin/%s" f,
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "bin/%s" f,
__SOURCE_DIRECTORY__ @@ sprintf "packages/FSharp.Formatting/lib/net40/%s" f)
|> List.map (fun (source, dest) -> Path.GetFullPath source, Path.GetFullPath dest)
for source, dest in bundledFiles do
Expand All @@ -384,7 +384,7 @@ Target "DogFoodCommandTool" (fun _ ->
// generate metadata reference
let dllFiles =
[ "FSharp.CodeFormat.dll"; "FSharp.Formatting.Common.dll"
"FSharp.Literate.dll"; "FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll" ]
"FSharp.Literate.dll"; "FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll"; "FSharp.Formatting.Razor.dll" ]
|> List.map (sprintf "bin/%s")
let layoutRoots =
[ "docs/tools"; "misc/templates"; "misc/templates/reference" ]
Expand Down Expand Up @@ -413,7 +413,7 @@ Target "DogFoodCommandTool" (fun _ ->
Target "GenerateDocs" (fun _ ->
bootStrapDocumentationFiles ()
buildDocumentationTarget "--define:RELEASE --define:REFERENCE --define:HELP" "Default")

Target "WatchDocs" (fun _ ->
bootStrapDocumentationFiles ()
buildDocumentationTarget "--define:WATCH" "Default")
Expand Down
16 changes: 8 additions & 8 deletions docs/tools/generate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let info =
"project-github", githubLink
"project-nuget", "http://nuget.org/packages/FSharp.Formatting" ]

let referenceBinaries =
let referenceBinaries =
[ "FSharp.CodeFormat.dll"; "FSharp.Literate.dll"; "FSharp.Markdown.dll"; "FSharp.MetadataFormat.dll"; "FSharp.Formatting.Common.dll" ]

// --------------------------------------------------------------------------------------
Expand All @@ -40,6 +40,7 @@ open Fake.FileHelper

open FSharp.Literate
open FSharp.MetadataFormat
open FSharp.Formatting.Razor

// When called from 'build.fsx', use the public project URL as <root>
// otherwise, use the current 'output' directory.
Expand All @@ -56,7 +57,7 @@ let bin = "../../bin"
let content = "../content"
let output = "../output"
let files = "../files"
let templates = "."
let templates = "."
let formatting = "../../misc/"
let docTemplate = formatting @@ "templates/docpage.cshtml"
let docTemplateSbS = templates @@ "docpage-sidebyside.cshtml"
Expand All @@ -80,7 +81,7 @@ let fsiEvaluator = lazy (Some (FsiEvaluator() :> IFsiEvaluator))
let copyFiles () =
CopyRecursive files output true |> Log "Copying file: "
ensureDirectory (output @@ "content")
//CopyRecursive (formatting @@ "styles") (output @@ "content") true
//CopyRecursive (formatting @@ "styles") (output @@ "content") true
// |> Log "Copying styles and scripts: "

let binaries =
Expand All @@ -93,7 +94,7 @@ let libDirs = [bin]
// Build API reference from XML comments
let buildReference () =
CleanDir (output @@ "reference")
MetadataFormat.Generate
RazorMetadataFormat.Generate
( binaries, output @@ "reference", layoutRootsAll.["en"],
parameters = ("root", root)::info,
sourceRepo = githubLink @@ "tree/master",
Expand All @@ -102,7 +103,7 @@ let buildReference () =

// Build documentation from `fsx` and `md` files in `docs/content`
let buildDocumentation () =
let subdirs =
let subdirs =
[ content @@ "sidebyside", docTemplateSbS
content, docTemplate; ]
for dir, template in subdirs do
Expand All @@ -115,7 +116,7 @@ let buildDocumentation () =
match key with
| Some lang -> layoutRootsAll.[lang]
| None -> layoutRootsAll.["en"] // "en" is the default language
Literate.ProcessDirectory
RazorLiterate.ProcessDirectory
( dir, template, output @@ sub, replacements = ("root", root)::info,
layoutRoots = layoutRoots,
generateAnchors = true,
Expand Down Expand Up @@ -153,8 +154,7 @@ let watch () =
hasData := false

printfn "Detected changes (%A). Invalidate cache and rebuild." !data
FSharp.MetadataFormat.RazorEngineCache.InvalidateCache (!data |> Seq.map (fun change -> change.FullPath))
FSharp.Literate.RazorEngineCache.InvalidateCache (!data |> Seq.map (fun change -> change.FullPath))
FSharp.Formatting.Razor.RazorEngineCache.InvalidateCache (!data |> Seq.map (fun change -> change.FullPath))
rebuildDocs()
printfn "Documentation generation finished."
with e ->
Expand Down
9 changes: 5 additions & 4 deletions misc/literate/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#load "../../src/FSharp.Formatting.fsx"
open System.IO
open FSharp.Literate
open FSharp.Formatting.Razor

// ----------------------------------------------------------------------------
// SETUP
Expand Down Expand Up @@ -30,26 +31,26 @@ let processScriptAsHtml () =
let file = relative "demo.fsx"
let output = relative "output/demo-script.html"
let template = relative "templates/template-file.html"
Literate.ProcessScriptFile(file, template, output)
RazorLiterate.ProcessScriptFile(file, template, output)

/// Processes a single F# Script file and produce LaTeX output
let processScriptAsLatex () =
let file = relative "demo.fsx"
let output = relative "output/demo-script.tex"
let template = relative "templates/template-color.tex"
Literate.ProcessScriptFile(file, template, output, format = OutputKind.Latex)
RazorLiterate.ProcessScriptFile(file, template, output, format = OutputKind.Latex)

/// Processes a single Markdown document and produce HTML output
let processDocAsHtml () =
let file = relative "demo.md"
let output = relative "output/demo-doc.html"
let template = relative "templates/template-file.html"
Literate.ProcessMarkdown(file, template, output)
RazorLiterate.ProcessMarkdown(file, template, output)

/// Processes a single Markdown document and produce LaTeX output
let processDocAsLatex () =
let file = relative "demo.md"
let output = relative "output/demo-doc.tex"
let template = relative "templates/template-color.tex"
Literate.ProcessMarkdown(file, template, output, format = OutputKind.Latex)
RazorLiterate.ProcessMarkdown(file, template, output, format = OutputKind.Latex)

1 change: 1 addition & 0 deletions packages/FSharp.Formatting/FSharp.Formatting.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if (typeof<System.Web.Razor.ParserResults>.Assembly.GetName().Version.Major <= 2

#r "FSharp.CodeFormat.dll"
#r "FSharp.MetadataFormat.dll"
#r "FSharp.Formatting.Razor.dll"

// Setup Logging for FSharp.Formatting and Yaaf.FSharp.Scripting
module Logging = FSharp.Formatting.Common.Log
Expand Down
4 changes: 1 addition & 3 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
REDIRECTS: ON
NUGET
remote: http://www.nuget.org/api/v2
specs:
CommandLineParser (1.9.71)
FAKE (4.22.8)
FSharp.Compiler.Service (2.0.0.6)
Expand All @@ -21,5 +20,4 @@ NUGET
Zlib.Portable (1.11) - framework: portable-net40+sl50+wp80+win80
GITHUB
remote: matthid/Yaaf.FSharp.Scripting
specs:
src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs (48789eeb63382a6934966472e270e87880cb49ed)
src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs (48789eeb63382a6934966472e270e87880cb49ed)
6 changes: 3 additions & 3 deletions src/FSharp.CodeFormat/FSharp.CodeFormat.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
-->
<Import Project="$(SolutionDir)\.paket\paket.targets" />
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
<ItemGroup>
<Reference Include="FSharp.Compiler.Service">
<HintPath>..\..\packages\FSharp.Compiler.Service\lib\net40\FSharp.Compiler.Service.dll</HintPath>
Expand All @@ -115,7 +115,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="FSharp.Compiler.Service">
<HintPath>..\..\packages\FSharp.Compiler.Service\lib\net45\FSharp.Compiler.Service.dll</HintPath>
Expand All @@ -126,7 +126,7 @@
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="FSharpVSPowerTools.Core">
<HintPath>..\..\packages\FSharpVSPowerTools.Core\lib\net45\FSharpVSPowerTools.Core.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
<Project>{bc4946ba-2724-4524-ac50-dfc49ee154a1}</Project>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\FSharp.Formatting.Razor\FSharp.Formatting.Razor.fsproj">
<Name>FSharp.Formatting.Razor.fsproj</Name>
<Project>{c6b3c274-71a8-4239-ba9a-1af7b2f7c736}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
Expand Down Expand Up @@ -142,7 +147,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\packages\CommandLineParser\lib\net40\CommandLine.dll</HintPath>
Expand All @@ -151,7 +156,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\packages\CommandLineParser\lib\net45\CommandLine.dll</HintPath>
Expand All @@ -162,7 +167,7 @@
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="System.Web.Razor">
<HintPath>..\..\packages\Microsoft.AspNet.Razor\lib\net45\System.Web.Razor.dll</HintPath>
Expand All @@ -173,7 +178,7 @@
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
<ItemGroup>
<Reference Include="RazorEngine">
<HintPath>..\..\packages\RazorEngine\lib\net40\RazorEngine.dll</HintPath>
Expand All @@ -182,7 +187,7 @@
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup>
<Reference Include="RazorEngine">
<HintPath>..\..\packages\RazorEngine\lib\net45\RazorEngine.dll</HintPath>
Expand Down
30 changes: 15 additions & 15 deletions src/FSharp.Formatting.CommandTool/OptionsLiterate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ open FSharp.Formatting.Common
open FSharp.Formatting.Options
open FSharp.Formatting.Options.Common
open FSharp.Formatting.IExecutable

open FSharp.Formatting.Razor


/// Process directory containing a mix of Markdown documents and F# Script files
// static member ProcessDirectory
// ( inputDirectory, ?templateFile, ?outputDirectory, ?format, ?fsharpCompiler, ?prefix, ?compilerOptions,
// ( inputDirectory, ?templateFile, ?outputDirectory, ?format, ?fsharpCompiler, ?prefix, ?compilerOptions,
// ?lineNumbers, ?references, ?replacements, ?includeSource, ?layoutRoots )
type ProcessDirectoryOptions() =

[<ParserState>]
[<ParserState>]
member val LastParserState = null with get, set

// does not work as desired in F#:
// the HelpOption attribute is not built,
// but receive a System.MemberAccessException
//[<HelpOption>]
/// autogenerated help text
member x.GetUsageOfOption() =
let help = new HelpText()
member x.GetUsageOfOption() =
let help = new HelpText()
help.AddDashesToOption <- true
help.AddOptions(x)
"\nfsformatting literate --processDirectory [options]" +
"\n--------------------------------------------------" +
help.ToString()
"\n--------------------------------------------------" +
help.ToString()

[<Option("help", Required = false,
HelpText = "Display this message. All options are case-insensitive.")>]
Expand All @@ -45,15 +45,15 @@ type ProcessDirectoryOptions() =

[<Option("inputDirectory", Required = true,
HelpText = "Input directory of *.fsx and *.md files.")>]
member val inputDirectory = "" with get, set
member val inputDirectory = "" with get, set

[<Option("templateFile", Required = false,
HelpText = "Template file for formatting (optional).")>]
member val templateFile = "" with get, set

[<Option("outputDirectory", Required = false,
HelpText = "Ouput Directory, defaults to input directory (optional).")>]
member val outputDirectory = "" with get, set
member val outputDirectory = "" with get, set

[<Option("format", Required = false,
HelpText = "Ouput format either 'latex' or 'html', defaults to 'html' (optional).")>]
Expand Down Expand Up @@ -99,16 +99,16 @@ type ProcessDirectoryOptions() =
HelpText = "Watches for changes in the input directory and re-runs, if a change occures")>]
member val live = false with get, set

interface IExecutable with
member x.Execute() =
interface IExecutable with
member x.Execute() =
let mutable res = 0
use watcher = new System.IO.FileSystemWatcher(x.inputDirectory)
try
if x.help then
if x.help then
printfn "%s" (x.GetUsageOfOption())
else
else
let run () =
Literate.ProcessDirectory(
RazorLiterate.ProcessDirectory(
x.inputDirectory,
?templateFile = (evalString x.templateFile),
?outputDirectory = Some (if x.outputDirectory = "" then x.inputDirectory else x.outputDirectory),
Expand Down Expand Up @@ -140,7 +140,7 @@ type ProcessDirectoryOptions() =

member x.GetErrorText() =
if x.LastParserState = null then ""
else
else
let errors = (x.LastParserState :> IParserState).Errors
parsingErrorMessage(errors)

Expand Down
Loading

0 comments on commit 47acc98

Please sign in to comment.