git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Add basic support for hyphenat package (#3603)
a29fa15schrieveslaach
src/Text/Pandoc/Readers/LaTeX.hs+13−1
@@ -518,7 +518,7 @@ inlineCommands = M.fromList $
518 , ("textmd", extractSpaces (spanWith ("",["medium"],[])) <$> tok)
518 , ("textmd", extractSpaces (spanWith ("",["medium"],[])) <$> tok)
519 , ("textrm", extractSpaces (spanWith ("",["roman"],[])) <$> tok)
519 , ("textrm", extractSpaces (spanWith ("",["roman"],[])) <$> tok)
520 , ("textup", extractSpaces (spanWith ("",["upright"],[])) <$> tok)
520 , ("textup", extractSpaces (spanWith ("",["upright"],[])) <$> tok)
521− , ("texttt", (code . stringify . toList) <$> tok)
521+ , ("texttt", ttfamily)
522 , ("sout", extractSpaces strikeout <$> tok)
522 , ("sout", extractSpaces strikeout <$> tok)
523 , ("textsuperscript", extractSpaces superscript <$> tok)
523 , ("textsuperscript", extractSpaces superscript <$> tok)
524 , ("textsubscript", extractSpaces subscript <$> tok)
524 , ("textsubscript", extractSpaces subscript <$> tok)
@@ -671,6 +671,15 @@ inlineCommands = M.fromList $
671 , ("hypertarget", braced >> tok)
671 , ("hypertarget", braced >> tok)
672 -- siuntix
672 -- siuntix
673 , ("SI", dosiunitx)
673 , ("SI", dosiunitx)
674+ -- hyphenat
675+ , ("bshyp", lit "\\\173")
676+ , ("fshyp", lit "/\173")
677+ , ("dothyp", lit ".\173")
678+ , ("colonhyp", lit ":\173")
679+ , ("hyp", lit "-")
680+ , ("nohyphens", tok)
681+ , ("textnhtt", ttfamily)
682+ , ("nhttfamily", ttfamily)
674 ] ++ map ignoreInlines
683 ] ++ map ignoreInlines
675 -- these commands will be ignored unless --parse-raw is specified,
684 -- these commands will be ignored unless --parse-raw is specified,
676 -- in which case they will appear as raw latex blocks:
685 -- in which case they will appear as raw latex blocks:
@@ -682,6 +691,9 @@ inlineCommands = M.fromList $
682 , "pagebreak"
691 , "pagebreak"
683 ]
692 ]
684
693
694+ttfamily :: PandocMonad m => LP m Inlines
695+ttfamily = (code . stringify . toList) <$> tok
696+
685mkImage :: PandocMonad m => [(String, String)] -> String -> LP m Inlines
697mkImage :: PandocMonad m => [(String, String)] -> String -> LP m Inlines
686mkImage options src = do
698mkImage options src = do
687 let replaceTextwidth (k,v) = case numUnit v of
699 let replaceTextwidth (k,v) = case numUnit v of
test/command/hyphenat.mdnew file+49
@@ -0,0 +1,49 @@
1+```
2+% pandoc -f latex -t native
3+electromagnetic\hyp{}endioscopy
4+^D
5+[Para [Str "electromagnetic-endioscopy"]]
6+```
7+
8+```
9+% pandoc -f latex -t native
10+C\colonhyp\bshyp{}Windows\bshyp
11+^D
12+[Para [Str "C:\173\\\173Windows\\\173"]]
13+```
14+
15+```
16+% pandoc -f latex -t native
17+\fshyp{}usr\fshyp{}share\fshyp
18+^D
19+[Para [Str "/\173usr/\173share/\173"]]
20+```
21+
22+```
23+% pandoc -f latex -t native
24+\fshyp{}home\fshyp{}schrieveslaach\fshyp\dothyp{}m2
25+^D
26+[Para [Str "/\173home/\173schrieveslaach/\173.\173m2"]]
27+```
28+
29+```
30+% pandoc -f latex -t native
31+\nohyphens{Pneumonoultramicroscopicsilicovolcanoconiosis}
32+^D
33+[Para [Str "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
34+```
35+
36+```
37+% pandoc -f latex -t native
38+\textnhtt{Pneumonoultramicroscopicsilicovolcanoconiosis}
39+^D
40+[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
41+```
42+
43+```
44+% pandoc -f latex -t native
45+\nhttfamily{Pneumonoultramicroscopicsilicovolcanoconiosis}
46+^D
47+[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
48+```
49+