File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
src/Development/IDE/Spans Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ library
6262 focus,
6363 ghc-trace-events,
6464 Glob,
65- haddock-library >= 1.8 && < 1.11 ,
65+ haddock-library >= 1.8 && < 1.12 ,
6666 hashable,
6767 hie-compat ^>= 0.3.0.0 ,
6868 hls-plugin-api ^>= 1.5 ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import GHC.Generics
2323
2424import GHC
2525
26+ import Data.Bifunctor (second )
2627import Development.IDE.GHC.Compat
2728import Development.IDE.GHC.Orphans ()
2829import Development.IDE.GHC.Util
@@ -179,8 +180,12 @@ haddockToMarkdown (H.DocHeader (H.Header level title))
179180
180181haddockToMarkdown (H. DocUnorderedList things)
181182 = ' \n ' : (unlines $ map ((" + " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
182- haddockToMarkdown (H. DocOrderedList things)
183- = ' \n ' : (unlines $ map ((" 1. " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
183+ haddockToMarkdown (H. DocOrderedList things) =
184+ #if MIN_VERSION_haddock_library(1,11,0)
185+ ' \n ' : (unlines $ map ((\ (num, str) -> show num ++ " . " ++ str) . second (trimStart . splitForList . haddockToMarkdown)) things)
186+ #else
187+ ' \n ' : (unlines $ map ((" 1. " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
188+ #endif
184189haddockToMarkdown (H. DocDefList things)
185190 = ' \n ' : (unlines $ map (\ (term, defn) -> " + **" ++ haddockToMarkdown term ++ " **: " ++ haddockToMarkdown defn) things)
186191
Original file line number Diff line number Diff line change @@ -2393,6 +2393,34 @@ haddockTests
23932393 , " "
23942394 ]
23952395 )
2396+ , testCase " ordered list" $ checkHaddock
2397+ (unlines
2398+ [ " may require"
2399+ , " different precautions:"
2400+ , " "
2401+ , " 1. Use @{\\ -\\ # NOINLINE foo \\ #-\\ }@ as a pragma on any function @foo@"
2402+ , " that calls 'unsafePerformIO'. If the call is inlined,"
2403+ , " the I\\ /O may be performed more than once."
2404+ , " "
2405+ , " 2. Use the compiler flag @-fno-cse@ to prevent common sub-expression"
2406+ , " elimination being performed on the module."
2407+ , " "
2408+ ]
2409+ )
2410+ (unlines
2411+ [ " "
2412+ , " "
2413+ , " may require"
2414+ , " different precautions: "
2415+ , " 1. Use `{-# NOINLINE foo #-}` as a pragma on any function `foo` "
2416+ , " that calls `unsafePerformIO` . If the call is inlined,"
2417+ , " the I/O may be performed more than once."
2418+ , " "
2419+ , " 2. Use the compiler flag `-fno-cse` to prevent common sub-expression"
2420+ , " elimination being performed on the module."
2421+ , " "
2422+ ]
2423+ )
23962424 ]
23972425 where
23982426 checkHaddock s txt = spanDocToMarkdownForTest s @?= txt
You can’t perform that action at this time.
0 commit comments