1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Short-circuit ToC for Markdown.

Later on we’ll want to define tables of contents for markup elements, but we don’t have a way to express their semantic role yet.
This commit is contained in:
Rob Rix 2017-06-07 20:02:42 -04:00
parent 95924c1ba0
commit ec25974df2

View File

@ -60,6 +60,7 @@ diffBlobPairs renderer = fmap toS . distributeFoldMap (diffBlobPair renderer) .
diffBlobPair :: DiffRenderer output -> Both SourceBlob -> Task output
diffBlobPair renderer blobs = case (renderer, effectiveLanguage) of
(ToCDiffRenderer, Just Language.Python) -> run (\ source -> parse pythonParser source >>= decorate (declarationAlgebra (Proxy :: Proxy Python.Error) source) . hoistCofree (weaken :: Union fs a -> Union (Declaration.Method ': fs) a)) diffLinearly (renderToC blobs)
(ToCDiffRenderer, Just Language.Markdown) -> pure mempty
(ToCDiffRenderer, _) -> run (\ source -> parse syntaxParser source >>= decorate (syntaxDeclarationAlgebra source)) diffTerms (renderToC blobs)
(JSONDiffRenderer, Just Language.Python) -> run (parse pythonParser) diffLinearly (renderJSONDiff blobs)
(JSONDiffRenderer, _) -> run (decorate identifierAlgebra <=< parse syntaxParser) diffTerms (renderJSONDiff blobs)