Verified Commit dc33a728 authored by Camil Staps's avatar Camil Staps 🚀

Make work on Windows (in generated HTML, always use /, in file names, use...

Make work on Windows (in generated HTML, always use /, in file names, use </>); added project file for windows
parent a1cc7e29
Pipeline #14993 failed with stage
in 57 seconds
......@@ -2,5 +2,6 @@
*.abc
*.o
*.prj
*.prp
cleandoc
clean-compiler/
......@@ -5,6 +5,7 @@ import StdBool
import StdFile
import StdList
import StdOrdList
import StdString
import StdTuple
import Clean.Doc => qualified :: ParamDoc{name}
......@@ -29,7 +30,7 @@ import Clean.Doc.ModuleCollection.Index => qualified :: IndexItem{name}
generateHTML :: !ModuleCollection -> WebSite
generateHTML mcoll =
[("js/lunr-index.js", "build_lunr(" +++ (toString $ toJSON $ indexModuleCollection mcoll) +++ ");")] ++
[("js" </> "lunr-index.js", "build_lunr(" +++ (toString $ toJSON $ indexModuleCollection mcoll) +++ ");")] ++
map (\(fp,html) -> (fp,finalizeHtml fp $ addSideBar fp html))
[ ("index.html", Text "")
: map moduleFile mcoll
......@@ -47,7 +48,7 @@ where
, MetaTag [CharsetAttr "utf-8"]
, LinkTag [RelAttr "stylesheet", TypeAttr "text/css", HrefAttr (relativePath "modules/clean-highlighter/clean.css")]
, LinkTag [RelAttr "stylesheet", TypeAttr "text/css", HrefAttr (relativePath "css/style.css")]
, ScriptTag [] [Text ("var this_relative_url = '" +++ fp +++ "'")]
, ScriptTag [] [Text ("var this_relative_url = '" +++ {if (c == pathSeparator) '/' c \\ c <-: fp} +++ "'")]
, ScriptTag [DeferAttr "defer", SrcAttr (relativePath "modules/clean-highlighter/clean.js")] []
, ScriptTag [DeferAttr "defer", SrcAttr (relativePath "modules/clean-doc-markup/clean-doc-markup.js")] []
, ScriptTag [DeferAttr "defer", SrcAttr (relativePath "js/cleandoc.js")] []
......@@ -176,7 +177,9 @@ where
[Text (if dcl "dcl:" "icl:" <+ line)]
highlightedFile :: !FilePath !String -> (FilePath, HtmlTag)
highlightedFile fp contents = ("file" </?> fp +++ ".html", TableTag [] [TrTag []
highlightedFile fp contents
# fp = if (startsWith {'.',pathSeparator} fp) (fp % (2,size fp-1)) fp
= ("file" </?> fp +++ ".html", TableTag [] [TrTag []
[ TdTag [] [PreTag [ClassAttr "linenos"] [SpanTag [IdAttr ("l" <+ i)] [Text (i <+ "\n")] \\ i <- [1..lineCount contents]]]
, TdTag [] [PreTag [ClassAttr "clean-code"] [Text contents]]
]])
......@@ -189,11 +192,12 @@ where
count n i = count (if (s.[i] == '\n') (n+1) n) (i-1)
(relativeTo) :: !FilePath !FilePath -> FilePath
(relativeTo) target source = concat (repeatn (dirLength source-1) {'.','.',pathSeparator}) +++ target
(relativeTo) target source = concat (repeatn (dirLength source-1) "../") +++ target
where
dirLength :: FilePath -> Int
dirLength "" = 0
dirLength fp = 1 + dirLength (takeDirectory fp)
dirLength fp = if (name == ".") 0 1 + dirLength parent
where (parent,name) = splitFileName fp
(</?>) :: !FilePath !FilePath -> FilePath
(</?>) a b
......
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}\cleandoc.exe
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 209715200
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: True
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: False
GenericFusion: False
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*clean-compiler*frontend
Path: {Project}*clean-compiler*backend
Path: {Project}*clean-compiler*main
Path: {Project}*clean-compiler*main*Windows
Path: {Application}*Libraries*Platform
Path: {Application}*Libraries*Platform*Deprecated*ArgEnv
OtherPaths
Path: {Application}*Libraries*StdEnv
Precompile:
Postlink:
MainModule
Name: cleandoc
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment