Commit a1636377 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Many little enhancements, mostly style

parent 254e4604
......@@ -162,13 +162,15 @@ main = do
phony "publish" $ do
need ["support"]
everythingA <++> indexA >>= need
metaData <- readMetaDataFor projectDir
metaData <- readMetaDataForDir projectDir
let host = metaValueAsString "rsync-destination.host" metaData
let path = metaValueAsString "rsync-destination.path" metaData
if isJust host && isJust path
then do
let src = publicDir ++ "/"
let dst = intercalate ":" [fromJust host, fromJust path]
cmd "ssh " (fromJust host) "mkdir -p" (fromJust path) :: Action ()
cmd "rsync -a" publicDir $ intercalate ":" [fromJust host, fromJust path] :: Action ()
cmd "rsync -a" src dst :: Action ()
else throw RsyncUrlException
-- | Some constants that might need tweaking
......
......@@ -33,11 +33,11 @@ main =
projectDir <- calcProjectDirectory
let privateDir = projectDir </> "private"
-- Find sources
testFiles <- glob "**/*-test.yaml"
testFiles <- glob "**/*-quest.yaml"
-- Meta data
metaFiles <- glob "**/*-meta.yaml"
-- Calculate targets
let catalog = privateDir </> "complete-test-catalog.pdf"
let catalog = privateDir </> "complete-quest-catalog.pdf"
-- Prepare Mustache templates
let templates = compileTesterTemplates
---
......@@ -55,15 +55,15 @@ main =
--
phony "new-mc" $
do let string = Y.encodePretty Y.defConfig multipleChoiceStationary
liftIO $ B.writeFile "new-mc-test.yaml" string
liftIO $ B.writeFile "new-mc-quest.yaml" string
--
phony "new-ft" $
do let string = Y.encodePretty Y.defConfig fillTextStationary
liftIO $ B.writeFile "new-ft-test.yaml" string
liftIO $ B.writeFile "new-ft-quest.yaml" string
--
phony "new-f" $
do let string = Y.encodePretty Y.defConfig freeStationary
liftIO $ B.writeFile "new-f-test.yaml" string
liftIO $ B.writeFile "new-f-quest.yaml" string
--
phony "clean" $
do removeFilesAfter "." ["private"]
......@@ -90,9 +90,9 @@ renderCatalog :: FilePath -> Templates -> [(Question, FilePath)] -> FilePath ->
renderCatalog projectDir templates questions out =
do let markdown = map (\(q,b) -> (renderMarkdown q,b)) questions
let pandoc = map parseMarkdown markdown
need $ concat $ map extractLocalImagePathes pandoc
need $ concatMap extractLocalImagePathes pandoc
let catalog =
Pandoc nullMeta $ concat $ map (\(Pandoc _ blocks) -> blocks) pandoc
Pandoc nullMeta $ concatMap (\(Pandoc _ blocks) -> blocks) pandoc
let options =
def {writerStandalone = True
,writerTemplate = B.unpack testLatexTemplate
......@@ -133,39 +133,48 @@ shuffleAnswers q =
multipleChoiceStationary :: Question
multipleChoiceStationary =
Question {qstId = "ID"
,qstLecture = 0
,qstTitle = "MULTIPLE CHOICE"
,qstPoints = 5
,qstQuestion = "THE QUESTION?"
,qstAnswer =
MultipleChoice {answChoices = ["RIGHT_ANSWER","WRONG_ANSWER"]
,answCorrectChoices = [True,False]}
,qstDifficulty = Medium
,qstComment = "COMMENT"}
Question
{ qstId = "ID"
, qstLecture = 0
, qstTitle = "MULTIPLE CHOICE"
, qstPoints = 5
, qstQuestion = "THE QUESTION?"
, qstAnswer = MultipleChoice
{ answCorrect = ["ANSWER_1", "ANSWER_2"]
, answIncorrect = ["DISTRACTOR_1", "DISTRACTOR_2"]
}
, qstDifficulty = Medium
, qstComment = "COMMENT"
}
fillTextStationary :: Question
fillTextStationary =
Question {qstId = "ID"
,qstLecture = 0
,qstTitle = "FILL TEXT"
,qstPoints = 5
,qstQuestion = "THE QUESTION?"
,qstAnswer =
FillText {answFillText = "FILL THE ___ IN THE ___."
,answCorrectWords = ["HOLES", "TEXT"]}
,qstDifficulty = Medium
,qstComment = "COMMENT"}
Question
{ qstId = "ID"
, qstLecture = 0
, qstTitle = "FILL TEXT"
, qstPoints = 5
, qstQuestion = "THE QUESTION?"
, qstAnswer = FillText
{ answFillText = "FILL THE ___ IN THE ___."
, answCorrectWords = ["HOLES", "TEXT"]
}
, qstDifficulty = Medium
, qstComment = "COMMENT"
}
freeStationary :: Question
freeStationary =
Question {qstId = "ID"
,qstLecture = 0
,qstTitle = "FREE"
,qstPoints = 5
,qstQuestion = "THE QUESTION?"
,qstAnswer =
Free {answHeightInMm = 20
,answCorrectAnswer = "THE ANSWER."}
,qstDifficulty = Medium
,qstComment = "COMMENT"}
Question
{ qstId = "ID"
, qstLecture = 0
, qstTitle = "FREE"
, qstPoints = 5
, qstQuestion = "THE QUESTION?"
, qstAnswer = FreeForm
{ answHeightInMm = 20
, answCorrectAnswer = "THE ANSWER."
}
, qstDifficulty = Medium
, qstComment = "COMMENT"
}
......@@ -28,6 +28,7 @@ $endif$
$for(css)$
<link rel="stylesheet" href="$css$"/>
$endfor$
<link rel="stylesheet" href="$decker-support-dir$/font-awesome-4.6.3/css/font-awesome.min.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
......
# Aufgabe N: {{Title}}
| | |
|---------------+-------------------|
| Titel | **{{Title}}** |
| Id | {{Id}} |
| Vorlesung | {{Lecture}} |
| Schwierigkeit | {{Difficulty}} |
| Punkte | {{Points}} |
| Kommentar | {{Comment}} |
{{Question}}
\fbox{\begin{minipage}{\textwidth} \hfill \vspace{ {{Answer.HeightInMm}}mm } \end{minipage}}
*Antwort:*
\fbox{\begin{minipage}{\textwidth} {{Answer.CorrectAnswer}} \end{minipage}}
......@@ -11,6 +11,6 @@
{{Question}}
{{#Answer.Choices}}
- {{.}}
{{/Answer.Choices}}
{{Answer.FillText}}
*Antwort:* {{#Answer.CorrectWords}}{{.}}, {{/Answer.CorrectWords}}
......@@ -28,8 +28,9 @@ $for(css)$
<link rel="stylesheet" href="$css$">
$endfor$
$else$
<link rel="stylesheet" href="$decker-css$">
<link rel="stylesheet" href="$decker-support-dir$/sandstone/bootstrap.min.css">
$endif$
<link rel="stylesheet" href="$decker-support-dir$/font-awesome-4.6.3/css/font-awesome.min.css">
<style type="text/css">
.container {
max-width:750px;
......
# Aufgabe N: {{Title}}
| | |
|---------------+-------------------|
| Titel | **{{Title}}** |
| Id | {{Id}} |
| Vorlesung | {{Lecture}} |
| Schwierigkeit | {{Difficulty}} |
| Punkte | {{Points}} |
| Kommentar | {{Comment}} |
{{Question}}
*Antworten:*
{{#Answer.Correct}}
- $\boxtimes$ {{.}}
{{/Answer.Correct}}
{{#Answer.Incorrect}}
- $\square$ {{.}}
{{/Answer.Incorrect}}
......@@ -28,56 +28,71 @@ $for(css)$
<link rel="stylesheet" href="$css$">
$endfor$
$else$
<link rel="stylesheet" href="$decker-css$">
<link rel="stylesheet" href="$decker-support-dir$/sandstone/bootstrap.min.css">
$endif$
<link rel="stylesheet" href="$decker-support-dir$/font-awesome-4.6.3/css/font-awesome.min.css">
<style type="text/css">
.container {
max-width:750px;
margin:0 auto;
}
.container {
max-width:750px;
margin:0 auto;
}
.container .content {
min-height: 750px;
}
.container .content {
min-height: 750px;
}
.page-header small {
white-space:nowrap;
}
.page-header small {
white-space:nowrap;
}
.page-header h1 {
font-size: 180%;
}
.page-header h1 {
font-size: 200%;
}
h1 {
font-size: 150%;
}
h1 {
font-size: 150%;
}
h2 {
font-size: 130%;
}
h2 {
font-size: 130%;
}
h3 {
font-size: 110%;
}
h3 {
font-size: 110%;
}
.container p > img {
width: 100%;
}
.container figure {
padding-left: 3em;
padding-right: 3em;
}
.container h6.post-date {
margin-top: 5px;
margin-bottom: 5px;
}
.container h2.post-title {
margin-top: 10px;
}
.container figure > img {
width: 100%;
border: 1pt solid gray;
}
.container address {
color: #888;
}
address p.date {
float: right;
}
.container figure > figcaption {
padding-top: 0.5em;
font-size: 90%;
text-align: center;
}
.container h6.post-date {
margin-top: 5px;
margin-bottom: 5px;
}
.container h2.post-title {
margin-top: 10px;
}
.container address {
color: #AAA;
}
.container address p.date {
float: right;
}
</style>
$if(math)$
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -55,7 +55,7 @@ body {
.reveal h6 {
margin: 0 0 20px 0;
color: #777;
font-family: 'Roboto Slab' sans-serif;
font-family: 'Roboto' sans-serif;
font-weight: normal;
line-height: 1.3;
letter-spacing: normal;
......@@ -219,7 +219,7 @@ body {
word-wrap: normal;
background: #EEE;
color: #000;
border: 0.1em solid #777;
border: 0.05em solid #777;
}
.reveal table {
......@@ -304,7 +304,7 @@ body {
.reveal section img {
margin: 15px 0px;
/* background: rgba(255, 255, 255, 0.12); */
border: 0.1em solid #777;
/* border: 0.1em solid #777; */
/* box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); */
}
......@@ -384,6 +384,7 @@ body {
.reveal .slide-number {
color: #009;
background-color: rgba(255, 255, 255, 0);
}
.reveal section {
......@@ -539,45 +540,45 @@ body {
}
.reveal section div.box.definition {
padding: 0 0.5em 0 0.5em;
margin: 0 0 0.5em 0;
background-color: #aea;
border: 0.1em solid #8b8;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.5em 0.5em -0.5em;
}
.reveal section div.box.definition h2 {
color: #eee;
background-color: #0c0;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.4em 0.5em -0.4em;
color: #eee;
background-color: #0c0;
}
.reveal section div.box.alert {
padding: 0 0.5em 0 0.5em;
margin: 0 0 0.5em 0;
background-color: #fbb;
border: 0.1em solid #b88;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.5em 0.5em -0.5em;
}
.reveal section div.box.alert h2 {
color: #eee;
background-color: #d00;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.4em 0.5em -0.4em;
color: #eee;
background-color: #d00;
}
.reveal section div.box.equation {
padding: 0 0.5em 0 0.5em;
margin: 0 0 0.5em 0;
background-color: #ddd;
border: 0.1em solid #bbb;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.5em 0.5em -0.5em;
}
.reveal section div.box.equation h2 {
color: #eee;
background-color: #666;
padding: 0 0.5em 0 0.5em;
margin: 0 -0.4em 0.5em -0.4em;
color: #eee;
background-color: #666;
}
.reveal section div.columns-2 {
......@@ -653,7 +654,15 @@ body {
height: 100%;
}
/* Math display */
div.MathJax_Display {
margin-top: 1em;
margin-bottom: 1em;
}
.reveal section span.math.display {
width: 100%;
display: block;
text-align: center;
}
{-# LANGUAGE TemplateHaskell #-}
module Embed
(deckerHelpText, deckerExampleDir, deckerSupportDir, deckTemplate, pageTemplate,
pageLatexTemplate, handoutTemplate, handoutLatexTemplate, testerMultipleChoiceTemplate, testLatexTemplate)
(deckerHelpText, deckerExampleDir, deckerSupportDir, deckTemplate,
pageTemplate, pageLatexTemplate, handoutTemplate,
handoutLatexTemplate, testerMultipleChoiceTemplate,
testerFillTextTemplate, testerFreeFormTemplate, testLatexTemplate)
where
import Data.FileEmbed
......@@ -40,7 +42,15 @@ handoutLatexTemplate =
testerMultipleChoiceTemplate :: B.ByteString
testerMultipleChoiceTemplate =
$(makeRelativeToProject "resource/test-question.md" >>= embedFile)
$(makeRelativeToProject "resource/mc-quest-catalog-template.md" >>= embedFile)
testerFillTextTemplate :: B.ByteString
testerFillTextTemplate =
$(makeRelativeToProject "resource/ft-quest-catalog-template.md" >>= embedFile)
testerFreeFormTemplate :: B.ByteString
testerFreeFormTemplate =
$(makeRelativeToProject "resource/ff-quest-catalog-template.md" >>= embedFile)
testLatexTemplate :: B.ByteString
testLatexTemplate =
......
......@@ -39,7 +39,7 @@ type MacroFunc = [String] -> Attr -> Target -> Format -> Meta -> Inline
embedYoutubeHtml
:: [String] -> Attr -> Target -> Inline
embedYoutubeHtml args attr (vid,_) =
RawInline (Format "HTML")
RawInline (Format "html")
(renderHtml html)
where url =
printf "https://www.youtube.com/embed/%s?iv_load_policy=3&disablekb=1&rel=0&modestbranding=1&autohide=1"
......@@ -68,9 +68,8 @@ embedYoutubeHtml args attr (vid,_) =
p ""
youtube :: MacroFunc
youtube args attr target (Format "html") _ = embedYoutubeHtml args attr target
youtube args attr target (Format "revealjs") _ =
embedYoutubeHtml args attr target
youtube args attr target (Format f) _
| f `elem` ["html","html5","revealjs"] = embedYoutubeHtml args attr target
youtube _ attr (vid,_) _ _ =
Link nullAttr
[Image attr
......@@ -84,6 +83,12 @@ youtube _ attr (vid,_) _ _ =
printf "http://img.youtube.com/vi/%s/maxresdefault.jpg" vid :: String
text = printf "YouTube: %s" vid :: String
fontAwesome :: MacroFunc
fontAwesome _ _ (iconName,_) (Format f) _
| f `elem` ["html","html5","revealjs"] =
RawInline (Format "html") $ "<i class=\"fa fa-" ++ iconName ++ "\"></i>"
fontAwesome _ _ (iconName,_) _ _ = Str $ "[" ++ iconName ++ "]"
metaValue :: MacroFunc
metaValue _ _ (key,_) _ meta =
case splitOn "." key of
......@@ -100,7 +105,8 @@ metaValue _ _ (key,_) _ meta =
type MacroMap = Map.Map String MacroFunc
macroMap :: MacroMap
macroMap = Map.fromList [("meta",metaValue),("youtube",youtube)]
macroMap =
Map.fromList [("meta",metaValue),("youtube",youtube),("fa",fontAwesome)]
readDefault :: Read a
=> a -> String -> a
......
......@@ -29,11 +29,11 @@ data Question =
deriving (Show,Typeable)
data Answer
= MultipleChoice {answChoices :: [String]
,answCorrectChoices :: [Bool]}
= MultipleChoice {answCorrect :: [String]
,answIncorrect :: [String]}
| FillText {answFillText :: String
,answCorrectWords :: [String]}
| Free {answHeightInMm :: Int,
| FreeForm {answHeightInMm :: Int,
answCorrectAnswer :: String}
deriving (Show,Typeable)
......@@ -48,19 +48,23 @@ $(deriveJSON defaultOptions ''Difficulty)
mcKey = typeOf $ MultipleChoice [] []
ftKey = typeOf $ FillText "" []
fKey = typeOf $ Free 0 ""
ffKey = typeOf $ FreeForm 0 ""
type Templates = [(TypeRep,M.Template)]
selectTemplate
:: Templates -> Question -> M.Template
selectTemplate templates question = fromJust $ lookup (typeOf $ qstAnswer question) templates
-- selectTemplate templates question = fromJust $ lookup (typeOf $ qstAnswer question) templates
selectTemplate templates question = case qstAnswer question of
MultipleChoice _ _ -> compileMustacheTemplate testerMultipleChoiceTemplate
FillText _ _ -> compileMustacheTemplate testerFillTextTemplate
FreeForm _ _ -> compileMustacheTemplate testerFreeFormTemplate
compileTesterTemplates :: Templates
compileTesterTemplates =
[(mcKey, compileMustacheTemplate testerMultipleChoiceTemplate)
,(ftKey, compileMustacheTemplate testerMultipleChoiceTemplate)
,(fKey, compileMustacheTemplate testerMultipleChoiceTemplate)]
,(ftKey, compileMustacheTemplate testerFillTextTemplate)
,(ffKey, compileMustacheTemplate testerFreeFormTemplate)]
compileMustacheTemplate :: B.ByteString -> M.Template
compileMustacheTemplate string =
......
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