Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 1ce72bee authored by Marc Coiffier's avatar Marc Coiffier
Browse files

Output quoted characters as-is when generating Markdown from CaPriCon, to...

Output quoted characters as-is when generating Markdown from CaPriCon, to preserve the correct newline count
parent a1950241
......@@ -116,16 +116,16 @@ htmlQuote = fromString . foldMap qChar . toString
qChar '"' = """
qChar c = [c]
stringWords :: IsCapriconString str => str -> [str]
stringWords x = [w | (True,w) <- stringWordsAndSpaces x]
stringWords x = [w | (True,w) <- stringWordsAndSpaces True x]
stringWordsAndSpaces :: IsCapriconString str => str -> [(Bool,str)]
stringWordsAndSpaces = map (second fromString) . fromBlank id . toString
stringWordsAndSpaces :: IsCapriconString str => Bool -> str -> [(Bool,str)]
stringWordsAndSpaces unquoteStrings = map (second fromString) . fromBlank id . toString
where fromBlank k (c:t) | c `elem` [' ', '\t', '\r', '\n'] = fromBlank (k.(c:)) t
| c == '"' = (False,k ""):fromQuote id t
| otherwise = (False,k ""):fromWChar (c:) t
fromBlank k "" = [(False,k "")]
fromQuote k ('"':t) = (True,'"':k "\""):fromBlank id t
fromQuote k ('\\':c:t) = fromQuote (k.(qChar c:)) t
fromQuote k ('\\':c:t) | unquoteStrings = fromQuote (k.(qChar c:)) t
where qChar 'n' = '\n' ; qChar 't' = '\t' ; qChar x = x
fromQuote k (c:t) = fromQuote (k.(c:)) t
fromQuote k "" = [(True,'"':k "\"")]
......@@ -541,7 +541,7 @@ outputComment c = (runExtraState $ do outputText =~ (\o t -> o (commentText+t)))
| otherwise = \x -> x
in withSpans ("<span class=\"symbol\" data-symbol-name=\""+qw+"\">"+qw+"</span>")
else w
| (isWord,w) <- stringWordsAndSpaces str]
| (isWord,w) <- stringWordsAndSpaces False str]
wrapStart isP nlines hasExamples =
let hide = if isP then "hideparagraph" else "hidestache"
......
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