Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curry-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
curry
curry-frontend
Commits
ad65ed56
Commit
ad65ed56
authored
May 14, 2014
by
Björn Peemöller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option --htmldir=dir for HTML generation
parent
a2e61e50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
CHANGELOG.md
CHANGELOG.md
+3
-0
src/CompilerOpts.hs
src/CompilerOpts.hs
+19
-5
src/Html/CurryHtml.hs
src/Html/CurryHtml.hs
+5
-5
No files found.
CHANGELOG.md
View file @
ad65ed56
...
...
@@ -4,6 +4,9 @@ Change log for curry-frontend
Version 0.3.10
==============
*
The HTML generation now accepts an option
`--htmldir=dir`
to specify
the output directory of the generated HTML files.
*
Various improvements of the internal structure.
*
Improved status messages. The compilation status message are now of the form
...
...
src/CompilerOpts.hs
View file @
ad65ed56
...
...
@@ -23,6 +23,7 @@ module CompilerOpts
)
where
import
Data.List
(
intercalate
,
nub
)
import
Data.Maybe
(
isJust
)
import
System.Console.GetOpt
import
System.Environment
(
getArgs
,
getProgName
)
import
System.FilePath
(
splitSearchPath
)
...
...
@@ -45,6 +46,7 @@ data Options = Options
-- for libraries
,
optImportPaths
::
[
FilePath
]
-- ^ directories to search in
-- for imports
,
optHtmlDir
::
Maybe
FilePath
-- ^ output directory for HTML
,
optUseSubdir
::
Bool
-- ^ use subdir for output?
,
optInterface
::
Bool
-- ^ create a FlatCurry interface file?
,
optPrepOpts
::
PrepOpts
-- ^ preprocessor options
...
...
@@ -83,6 +85,7 @@ defaultOptions = Options
,
optForce
=
False
,
optLibraryPaths
=
[]
,
optImportPaths
=
[]
,
optHtmlDir
=
Nothing
,
optUseSubdir
=
True
,
optInterface
=
True
,
optPrepOpts
=
defaultPrepOpts
...
...
@@ -287,7 +290,7 @@ parseOptErr lift what table opt = case lookup3 opt table of
renderOptErrTable
::
OptErrTable
opt
->
String
renderOptErrTable
ds
=
intercalate
"
\n
"
$
map
(
\
(
k
,
d
,
_
)
->
rpad
maxLen
k
++
": "
++
d
)
ds
=
intercalate
"
\n
"
$
map
(
\
(
k
,
d
,
_
)
->
" "
++
rpad
maxLen
k
++
": "
++
d
)
ds
where
maxLen
=
maximum
$
map
(
\
(
k
,
_
,
_
)
->
length
k
)
ds
rpad
n
x
=
x
++
replicate
(
n
-
length
x
)
' '
...
...
@@ -305,9 +308,6 @@ options =
,
Option
""
[
"numeric-version"
]
(
NoArg
(
onOpts
$
\
opts
->
opts
{
optMode
=
ModeNumericVersion
}))
"show the numeric version number and exit"
,
Option
""
[
"html"
]
(
NoArg
(
onOpts
$
\
opts
->
opts
{
optMode
=
ModeHtml
}))
"generate html code and exit"
-- verbosity
,
mkOptDescr
onOpts
"v"
[
"verbosity"
]
"n"
"verbosity level"
verbDescriptions
,
Option
"q"
[
"no-verb"
]
...
...
@@ -325,6 +325,10 @@ options =
(
ReqArg
(
withArg
onOpts
$
\
arg
opts
->
opts
{
optImportPaths
=
nub
$
optImportPaths
opts
++
splitSearchPath
arg
})
"dir[:dir]"
)
"search for imports in dir[:dir]"
,
Option
[]
[
"htmldir"
]
(
ReqArg
(
withArg
onOpts
$
\
arg
opts
->
opts
{
optHtmlDir
=
Just
arg
})
"dir"
)
"write HTML documentation into directory `dir'"
,
Option
""
[
"no-subdir"
]
(
NoArg
(
onOpts
$
\
opts
->
opts
{
optUseSubdir
=
False
}))
(
"disable writing to `"
++
currySubdir
++
"' subdirectory"
)
...
...
@@ -340,6 +344,9 @@ options =
addFlag
WarnOverlapping
(
wnWarnFlags
opts
)
}))
"do not print warnings for overlapping rules"
-- target types
,
Option
""
[
"html"
]
(
NoArg
(
onOpts
$
\
opts
->
opts
{
optMode
=
ModeHtml
}))
"generate html code and exit"
,
Option
""
[
"parse-only"
]
(
NoArg
(
onOpts
$
\
opts
->
opts
{
optTargetTypes
=
nub
$
Parsed
:
optTargetTypes
opts
}))
...
...
@@ -439,11 +446,18 @@ removeFlag o opts = filter (/= o) opts
-- |Parse the command line arguments
parseOpts
::
[
String
]
->
(
Options
,
[
String
],
[
String
])
parseOpts
args
=
(
opts
,
files
,
errs
++
errs2
)
parseOpts
args
=
(
opts
,
files
,
errs
++
errs2
++
checkOpts
opts
files
)
where
(
opts
,
errs2
)
=
foldl
(
flip
(
$
))
(
defaultOptions
,
[]
)
optErrs
(
optErrs
,
files
,
errs
)
=
getOpt
Permute
options
args
-- |Check options and files and return a list of error messages
checkOpts
::
Options
->
[
String
]
->
[
String
]
checkOpts
opts
_
|
isJust
(
optHtmlDir
opts
)
&&
(
optMode
opts
)
/=
ModeHtml
=
[
"The option '--htmldir' is only valid for HTML generation mode"
]
|
otherwise
=
[]
-- |Print the usage information of the command line tool.
usage
::
String
->
String
usage
prog
=
usageInfo
header
options
...
...
src/Html/CurryHtml.hs
View file @
ad65ed56
...
...
@@ -18,11 +18,11 @@ import Control.Monad.Trans.Either
import
Data.Char
(
toLower
)
import
Data.Maybe
(
fromMaybe
,
isJust
)
import
System.FilePath
((
</>
),
dropFileName
,
takeBaseName
)
import
Curry.Base.Ident
(
QualIdent
(
..
),
unqualify
)
import
Curry.Base.Message
import
Curry.Base.Pretty
(
text
)
import
Curry.Files.Filenames
(
dropExtension
,
takeFileName
)
import
Curry.Files.PathUtils
(
readModule
,
lookupCurryFile
)
import
Curry.Syntax
(
Module
,
lexSource
,
parseModule
)
...
...
@@ -37,12 +37,12 @@ import Modules (loadAndCheckModule, checkModuleHeader)
--- @param sourcefilename
source2html
::
Options
->
FilePath
->
CYIO
()
source2html
opts
f
=
do
let
baseName
=
dropExtension
f
modulname
=
takeFileName
baseName
outFile
=
baseName
++
"_curry.html"
let
baseName
=
takeBaseName
f
outDir
=
fromMaybe
(
dropFileName
f
)
$
optHtmlDir
opts
outFile
=
outDir
</>
baseName
++
"_curry.html"
srcFile
<-
liftIO
$
lookupCurryFile
(
optImportPaths
opts
)
f
program
<-
filename2program
opts
(
fromMaybe
f
srcFile
)
liftIO
$
writeFile
outFile
(
program2html
moduln
ame
program
)
liftIO
$
writeFile
outFile
(
program2html
baseN
ame
program
)
--- @param importpaths
--- @param filename
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment