git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'master' of github.com:jgm/pandoc
30f4492John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+188−185
@@ -543,194 +543,196 @@ doLHSverb = codeWith ("",["haskell"],[]) <$> manyTill (satisfy (/='\n')) (char '
543lit :: String -> LP Inlines
543lit :: String -> LP Inlines
544lit = pure . str
544lit = pure . str
545
545
546−accent :: (Char -> Char) -> Inlines -> LP Inlines
546+accent :: (Char -> String) -> Inlines -> LP Inlines
547accent f ils =
547accent f ils =
548 case toList ils of
548 case toList ils of
549− (Str (x:xs) : ys) -> return $ fromList $ (Str (f x : xs) : ys)
549+ (Str (x:xs) : ys) -> return $ fromList $ (Str (f x ++ xs) : ys)
550 [] -> mzero
550 [] -> mzero
551 _ -> return ils
551 _ -> return ils
552
552
553−grave :: Char -> Char
553+grave :: Char -> String
554−grave 'A' = 'À'
554+grave 'A' = "À"
555−grave 'E' = 'È'
555+grave 'E' = "È"
556−grave 'I' = 'Ì'
556+grave 'I' = "Ì"
557−grave 'O' = 'Ò'
557+grave 'O' = "Ò"
558−grave 'U' = 'Ù'
558+grave 'U' = "Ù"
559−grave 'a' = 'à'
559+grave 'a' = "à"
560−grave 'e' = 'è'
560+grave 'e' = "è"
561−grave 'i' = 'ì'
561+grave 'i' = "ì"
562−grave 'o' = 'ò'
562+grave 'o' = "ò"
563−grave 'u' = 'ù'
563+grave 'u' = "ù"
564−grave c = c
564+grave c = [c]
565−
565+
566−acute :: Char -> Char
566+acute :: Char -> String
567−acute 'A' = 'Á'
567+acute 'A' = "Á"
568−acute 'E' = 'É'
568+acute 'E' = "É"
569−acute 'I' = 'Í'
569+acute 'I' = "Í"
570−acute 'O' = 'Ó'
570+acute 'O' = "Ó"
571−acute 'U' = 'Ú'
571+acute 'U' = "Ú"
572−acute 'Y' = 'Ý'
572+acute 'Y' = "Ý"
573−acute 'a' = 'á'
573+acute 'a' = "á"
574−acute 'e' = 'é'
574+acute 'e' = "é"
575−acute 'i' = 'í'
575+acute 'i' = "í"
576−acute 'o' = 'ó'
576+acute 'o' = "ó"
577−acute 'u' = 'ú'
577+acute 'u' = "ú"
578−acute 'y' = 'ý'
578+acute 'y' = "ý"
579−acute 'C' = 'Ć'
579+acute 'C' = "Ć"
580−acute 'c' = 'ć'
580+acute 'c' = "ć"
581−acute 'L' = 'Ĺ'
581+acute 'L' = "Ĺ"
582−acute 'l' = 'ĺ'
582+acute 'l' = "ĺ"
583−acute 'N' = 'Ń'
583+acute 'N' = "Ń"
584−acute 'n' = 'ń'
584+acute 'n' = "ń"
585−acute 'R' = 'Ŕ'
585+acute 'R' = "Ŕ"
586−acute 'r' = 'ŕ'
586+acute 'r' = "ŕ"
587−acute 'S' = 'Ś'
587+acute 'S' = "Ś"
588−acute 's' = 'ś'
588+acute 's' = "ś"
589−acute 'Z' = 'Ź'
589+acute 'Z' = "Ź"
590−acute 'z' = 'ź'
590+acute 'z' = "ź"
591−acute c = c
591+acute c = [c]
592−
592+
593−circ :: Char -> Char
593+circ :: Char -> String
594−circ 'A' = 'Â'
594+circ 'A' = "Â"
595−circ 'E' = 'Ê'
595+circ 'E' = "Ê"
596−circ 'I' = 'Î'
596+circ 'I' = "Î"
597−circ 'O' = 'Ô'
597+circ 'O' = "Ô"
598−circ 'U' = 'Û'
598+circ 'U' = "Û"
599−circ 'a' = 'â'
599+circ 'a' = "â"
600−circ 'e' = 'ê'
600+circ 'e' = "ê"
601−circ 'i' = 'î'
601+circ 'i' = "î"
602−circ 'o' = 'ô'
602+circ 'o' = "ô"
603−circ 'u' = 'û'
603+circ 'u' = "û"
604−circ 'C' = 'Ĉ'
604+circ 'C' = "Ĉ"
605−circ 'c' = 'ĉ'
605+circ 'c' = "ĉ"
606−circ 'G' = 'Ĝ'
606+circ 'G' = "Ĝ"
607−circ 'g' = 'ĝ'
607+circ 'g' = "ĝ"
608−circ 'H' = 'Ĥ'
608+circ 'H' = "Ĥ"
609−circ 'h' = 'ĥ'
609+circ 'h' = "ĥ"
610−circ 'J' = 'Ĵ'
610+circ 'J' = "Ĵ"
611−circ 'j' = 'ĵ'
611+circ 'j' = "ĵ"
612−circ 'S' = 'Ŝ'
612+circ 'S' = "Ŝ"
613−circ 's' = 'ŝ'
613+circ 's' = "ŝ"
614−circ 'W' = 'Ŵ'
614+circ 'W' = "Ŵ"
615−circ 'w' = 'ŵ'
615+circ 'w' = "ŵ"
616−circ 'Y' = 'Ŷ'
616+circ 'Y' = "Ŷ"
617−circ 'y' = 'ŷ'
617+circ 'y' = "ŷ"
618−circ c = c
618+circ c = [c]
619−
619+
620−tilde :: Char -> Char
620+tilde :: Char -> String
621−tilde 'A' = 'Ã'
621+tilde 'A' = "Ã"
622−tilde 'a' = 'ã'
622+tilde 'a' = "ã"
623−tilde 'O' = 'Õ'
623+tilde 'O' = "Õ"
624−tilde 'o' = 'õ'
624+tilde 'o' = "õ"
625−tilde 'I' = 'Ĩ'
625+tilde 'I' = "Ĩ"
626−tilde 'i' = 'ĩ'
626+tilde 'i' = "ĩ"
627−tilde 'U' = 'Ũ'
627+tilde 'U' = "Ũ"
628−tilde 'u' = 'ũ'
628+tilde 'u' = "ũ"
629−tilde 'N' = 'Ñ'
629+tilde 'N' = "Ñ"
630−tilde 'n' = 'ñ'
630+tilde 'n' = "ñ"
631−tilde c = c
631+tilde c = [c]
632−
632+
633−umlaut :: Char -> Char
633+umlaut :: Char -> String
634−umlaut 'A' = 'Ä'
634+umlaut 'A' = "Ä"
635−umlaut 'E' = 'Ë'
635+umlaut 'E' = "Ë"
636−umlaut 'I' = 'Ï'
636+umlaut 'I' = "Ï"
637−umlaut 'O' = 'Ö'
637+umlaut 'O' = "Ö"
638−umlaut 'U' = 'Ü'
638+umlaut 'U' = "Ü"
639−umlaut 'a' = 'ä'
639+umlaut 'a' = "ä"
640−umlaut 'e' = 'ë'
640+umlaut 'e' = "ë"
641−umlaut 'i' = 'ï'
641+umlaut 'i' = "ï"
642−umlaut 'o' = 'ö'
642+umlaut 'o' = "ö"
643−umlaut 'u' = 'ü'
643+umlaut 'u' = "ü"
644−umlaut c = c
644+umlaut c = [c]
645−
645+
646−dot :: Char -> Char
646+dot :: Char -> String
647−dot 'C' = 'Ċ'
647+dot 'C' = "Ċ"
648−dot 'c' = 'ċ'
648+dot 'c' = "ċ"
649−dot 'E' = 'Ė'
649+dot 'E' = "Ė"
650−dot 'e' = 'ė'
650+dot 'e' = "ė"
651−dot 'G' = 'Ġ'
651+dot 'G' = "Ġ"
652−dot 'g' = 'ġ'
652+dot 'g' = "ġ"
653−dot 'I' = 'İ'
653+dot 'I' = "İ"
654−dot 'Z' = 'Ż'
654+dot 'Z' = "Ż"
655−dot 'z' = 'ż'
655+dot 'z' = "ż"
656−dot c = c
656+dot c = [c]
657−
657+
658−macron :: Char -> Char
658+macron :: Char -> String
659−macron 'A' = 'Ā'
659+macron 'A' = "Ā"
660−macron 'E' = 'Ē'
660+macron 'E' = "Ē"
661−macron 'I' = 'Ī'
661+macron 'I' = "Ī"
662−macron 'O' = 'Ō'
662+macron 'O' = "Ō"
663−macron 'U' = 'Ū'
663+macron 'U' = "Ū"
664−macron 'a' = 'ā'
664+macron 'a' = "ā"
665−macron 'e' = 'ē'
665+macron 'e' = "ē"
666−macron 'i' = 'ī'
666+macron 'i' = "ī"
667−macron 'o' = 'ō'
667+macron 'o' = "ō"
668−macron 'u' = 'ū'
668+macron 'u' = "ū"
669−macron c = c
669+macron c = [c]
670−
670+
671−cedilla :: Char -> Char
671+cedilla :: Char -> String
672−cedilla 'c' = 'ç'
672+cedilla 'c' = "ç"
673−cedilla 'C' = 'Ç'
673+cedilla 'C' = "Ç"
674−cedilla 's' = 'ş'
674+cedilla 's' = "ş"
675−cedilla 'S' = 'Ş'
675+cedilla 'S' = "Ş"
676−cedilla 't' = 'ţ'
676+cedilla 't' = "ţ"
677−cedilla 'T' = 'Ţ'
677+cedilla 'T' = "Ţ"
678−cedilla 'e' = 'ȩ'
678+cedilla 'e' = "ȩ"
679−cedilla 'E' = 'Ȩ'
679+cedilla 'E' = "Ȩ"
680−cedilla 'h' = 'ḩ'
680+cedilla 'h' = "ḩ"
681−cedilla 'H' = 'Ḩ'
681+cedilla 'H' = "Ḩ"
682+cedilla 'o' = "o̧"
683+cedilla 'O' = "O̧"
682−cedilla c = c
684+cedilla c = [c]
683−
685+
684−hacek :: Char -> Char
686+hacek :: Char -> String
685−hacek 'A' = 'Ǎ'
687+hacek 'A' = "Ǎ"
686−hacek 'a' = 'ǎ'
688+hacek 'a' = "ǎ"
687−hacek 'C' = 'Č'
689+hacek 'C' = "Č"
688−hacek 'c' = 'č'
690+hacek 'c' = "č"
689−hacek 'D' = 'Ď'
691+hacek 'D' = "Ď"
690−hacek 'd' = 'ď'
692+hacek 'd' = "ď"
691−hacek 'E' = 'Ě'
693+hacek 'E' = "Ě"
692−hacek 'e' = 'ě'
694+hacek 'e' = "ě"
693−hacek 'G' = 'Ǧ'
695+hacek 'G' = "Ǧ"
694−hacek 'g' = 'ǧ'
696+hacek 'g' = "ǧ"
695−hacek 'H' = 'Ȟ'
697+hacek 'H' = "Ȟ"
696−hacek 'h' = 'ȟ'
698+hacek 'h' = "ȟ"
697−hacek 'I' = 'Ǐ'
699+hacek 'I' = "Ǐ"
698−hacek 'i' = 'ǐ'
700+hacek 'i' = "ǐ"
699−hacek 'j' = 'ǰ'
701+hacek 'j' = "ǰ"
700−hacek 'K' = 'Ǩ'
702+hacek 'K' = "Ǩ"
701−hacek 'k' = 'ǩ'
703+hacek 'k' = "ǩ"
702−hacek 'L' = 'Ľ'
704+hacek 'L' = "Ľ"
703−hacek 'l' = 'ľ'
705+hacek 'l' = "ľ"
704−hacek 'N' = 'Ň'
706+hacek 'N' = "Ň"
705−hacek 'n' = 'ň'
707+hacek 'n' = "ň"
706−hacek 'O' = 'Ǒ'
708+hacek 'O' = "Ǒ"
707−hacek 'o' = 'ǒ'
709+hacek 'o' = "ǒ"
708−hacek 'R' = 'Ř'
710+hacek 'R' = "Ř"
709−hacek 'r' = 'ř'
711+hacek 'r' = "ř"
710−hacek 'S' = 'Š'
712+hacek 'S' = "Š"
711−hacek 's' = 'š'
713+hacek 's' = "š"
712−hacek 'T' = 'Ť'
714+hacek 'T' = "Ť"
713−hacek 't' = 'ť'
715+hacek 't' = "ť"
714−hacek 'U' = 'Ǔ'
716+hacek 'U' = "Ǔ"
715−hacek 'u' = 'ǔ'
717+hacek 'u' = "ǔ"
716−hacek 'Z' = 'Ž'
718+hacek 'Z' = "Ž"
717−hacek 'z' = 'ž'
719+hacek 'z' = "ž"
718−hacek c = c
720+hacek c = [c]
719−
721+
720−breve :: Char -> Char
722+breve :: Char -> String
721−breve 'A' = 'Ă'
723+breve 'A' = "Ă"
722−breve 'a' = 'ă'
724+breve 'a' = "ă"
723−breve 'E' = 'Ĕ'
725+breve 'E' = "Ĕ"
724−breve 'e' = 'ĕ'
726+breve 'e' = "ĕ"
725−breve 'G' = 'Ğ'
727+breve 'G' = "Ğ"
726−breve 'g' = 'ğ'
728+breve 'g' = "ğ"
727−breve 'I' = 'Ĭ'
729+breve 'I' = "Ĭ"
728−breve 'i' = 'ĭ'
730+breve 'i' = "ĭ"
729−breve 'O' = 'Ŏ'
731+breve 'O' = "Ŏ"
730−breve 'o' = 'ŏ'
732+breve 'o' = "ŏ"
731−breve 'U' = 'Ŭ'
733+breve 'U' = "Ŭ"
732−breve 'u' = 'ŭ'
734+breve 'u' = "ŭ"
733−breve c = c
735+breve c = [c]
734
736
735tok :: LP Inlines
737tok :: LP Inlines
736tok = try $ grouped inline <|> inlineCommand <|> str <$> (count 1 $ inlineChar)
738tok = try $ grouped inline <|> inlineCommand <|> str <$> (count 1 $ inlineChar)
@@ -1114,12 +1116,13 @@ complexNatbibCitation mode = try $ do
1114parseAligns :: LP [Alignment]
1116parseAligns :: LP [Alignment]
1115parseAligns = try $ do
1117parseAligns = try $ do
1116 char '{'
1118 char '{'
1117− optional $ char '|'
1119+ let maybeBar = try $ spaces >> optional (char '|')
1120+ maybeBar
1118 let cAlign = AlignCenter <$ char 'c'
1121 let cAlign = AlignCenter <$ char 'c'
1119 let lAlign = AlignLeft <$ char 'l'
1122 let lAlign = AlignLeft <$ char 'l'
1120 let rAlign = AlignRight <$ char 'r'
1123 let rAlign = AlignRight <$ char 'r'
1121 let alignChar = optional sp *> (cAlign <|> lAlign <|> rAlign)
1124 let alignChar = optional sp *> (cAlign <|> lAlign <|> rAlign)
1122− aligns' <- sepEndBy alignChar (optional $ char '|')
1125+ aligns' <- sepEndBy alignChar maybeBar
1123 spaces
1126 spaces
1124 char '}'
1127 char '}'
1125 spaces
1128 spaces
src/Text/Pandoc/Shared.hs+4−3
@@ -1,4 +1,5 @@
1−{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses #-}
1+{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses,
2+ FlexibleContexts #-}
2{-
3{-
3Copyright (C) 2006-2013 John MacFarlane <jgm@berkeley.edu>
4Copyright (C) 2006-2013 John MacFarlane <jgm@berkeley.edu>
4
5
@@ -383,10 +384,10 @@ consolidateInlines (Code a1 x : Code a2 y : zs) | a1 == a2 =
383consolidateInlines (x : xs) = x : consolidateInlines xs
384consolidateInlines (x : xs) = x : consolidateInlines xs
384consolidateInlines [] = []
385consolidateInlines [] = []
385
386
386−-- | Convert list of inlines to a string with formatting removed.
387+-- | Convert pandoc structure to a string with formatting removed.
387-- Footnotes are skipped (since we don't want their contents in link
388-- Footnotes are skipped (since we don't want their contents in link
388-- labels).
389-- labels).
389−stringify :: [Inline] -> String
390+stringify :: Walkable Inline a => a -> String
390stringify = query go . walk deNote
391stringify = query go . walk deNote
391 where go :: Inline -> [Char]
392 where go :: Inline -> [Char]
392 go Space = " "
393 go Space = " "