Skip to content

Commit

Permalink
Add subsites for Cabal, GHC, GHCup and stack
Browse files Browse the repository at this point in the history
Fixes #378
  • Loading branch information
haglobah committed Oct 13, 2024
1 parent dc7a43c commit 945d88e
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 64 deletions.
27 changes: 27 additions & 0 deletions message-index/cabal/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: The Haskell Error Index | Cabal
---

<h2>Welcome</h2>

<p>
This site describes error messages that can be returned by <a href="https://www.haskell.org/cabal/">Cabal</a>, including both errors and warnings.
Every error and warning has a code that Cabal emits when you run into it—you can look them up below.
</p>

<p>
So far, $messageCount$ Cabal errors and warnings are documented here.
If you encounter a message that is not yet documented, please
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
Pull requests with additional examples and improved explanations for
existing messages are also very welcome, as are
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
</p>

<p>
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
</p>

$partial("templates/messages.html")$
27 changes: 27 additions & 0 deletions message-index/ghc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: The Haskell Error Index | GHC
---

<h2>Welcome</h2>

<p>
This site describes error messages that can be returned by <a href="https://www.haskell.org/ghc/">GHC</a>, including both errors and warnings.
Every error and warning has a code that GHC emits when you run into it—you can look them up below.
</p>

<p>
So far, $messageCount$ GHC errors and warnings are documented here.
If you encounter a message that is not yet documented, please
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
Pull requests with additional examples and improved explanations for
existing messages are also very welcome, as are
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
</p>

<p>
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
</p>

$partial("templates/messages.html")$
27 changes: 27 additions & 0 deletions message-index/ghcup/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: The Haskell Error Index | GHCup
---

<h2>Welcome</h2>

<p>
This site describes error messages that can be returned by <a href="https://www.haskell.org/ghcup/">GHCup</a>, including both errors and warnings.
Every error and warning has a code that GHCup emits when you run into it—you can look them up below.
</p>

<p>
So far, $messageCount$ GHCup errors and warnings are documented here.
If you encounter a message that is not yet documented, please
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
Pull requests with additional examples and improved explanations for
existing messages are also very welcome, as are
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
</p>

<p>
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
</p>

$partial("templates/messages.html")$
47 changes: 1 addition & 46 deletions message-index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ <h2>Welcome</h2>
These codes can be looked up below for further information.
</p>

<p>
Other Haskell-related tools are welcome to add their own messages to the index. Please contact
<a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">the Haskell Foundation</a>
or <a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a>
to begin the process.
</p>

<p>
So far, $messageCount$ errors and warnings are documented here.
If you encounter a message that is not yet documented, please
Expand All @@ -34,42 +27,4 @@ <h2>Welcome</h2>
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
</p>

<h2>The Messages</h2>

<script src="/js/tablefilter.js"></script>

$partial("templates/message-list.html")$

<script>
var filtersConfig = {
base_path: '/wrong-on-purpose/',
auto_filter: {
delay: 75 //milliseconds
},
single_filter: true
};
var tf = new TableFilter(document.querySelector('.message-list'), filtersConfig);
tf.init();

var input = document.querySelector('.single_flt');

if (input) {
input.setAttribute("placeholder", "🔍 Type here to filter ...");
input.focus();

//Autofill the search from the URL
let url = new URL(document.location.href);
let query = url.searchParams.get('q');
if(query !== null)
{
input.setAttribute('value',query)
//Move cursor to end
input.setSelectionRange(query.length,query.length);

//Make sure that the list gets filtered as if the query had been typed manually
input.dispatchEvent(new KeyboardEvent('keyup'));

}
}

</script>
$partial("templates/messages.html")$
41 changes: 24 additions & 17 deletions message-index/site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,11 @@ main = hakyll $ do
>>= applyAsTemplate ctx
>>= loadAndApplyTemplate "templates/default.html" ctx

match "index.html" $ do
route idRoute
compile $ do
messages <- loadAll ("messages/*/index.md" .&&. hasNoVersion)
let bread = breadcrumbCtx []
indexCtx =
mconcat
[ listField "messages" (messageCtx <> defaultContext) (pure messages),
bread,
constField "messageCount" (show (length messages)),
defaultContext
]

getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
match "index.html" $ compileFilteredIndex ""
match "cabal/index.html" $ compileFilteredIndex "Cabal-"
match "ghc/index.html" $ compileFilteredIndex "GHC-"
match "ghcup/index.html" $ compileFilteredIndex "GHCup-"
match "stack/index.html" $ compileFilteredIndex "S-"

-- Needed for flagInfo below
match "warning-sets/warning-sets-9.5.txt" $ do
Expand Down Expand Up @@ -185,6 +173,25 @@ main = hakyll $ do

--------------------------------------------------------------------------------

compileFilteredIndex :: String -> Rules ()
compileFilteredIndex prefix = do
route idRoute
compile $ do
messages <- loadAll (fromGlob ("messages/" <> prefix <> "*/index.md") .&&. hasNoVersion )
let bread = breadcrumbCtx []
indexCtx =
mconcat
[ listField "messages" (messageCtx <> defaultContext) (pure messages),
bread,
constField "messageCount" (show (length messages)),
defaultContext
]

getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls

-- | The file extensions to be shown in example lists
exampleExtensions :: NonEmpty String
exampleExtensions = "hs" :| ["yaml", "cabal"]
Expand Down
27 changes: 27 additions & 0 deletions message-index/stack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: The Haskell Error Index | Stack
---

<h2>Welcome</h2>

<p>
This site describes error messages that can be returned by <a href="https://docs.haskellstack.org/en/stable/">Stack</a>, including both errors and warnings.
Every error and warning has a code that Stack emits when you run into it—you can look them up below.
</p>

<p>
So far, $messageCount$ Stack errors and warnings are documented here.
If you encounter a message that is not yet documented, please
<a href="https://github.com/haskellfoundation/error-message-index/issues">open an issue</a> or
<a href="https://github.com/haskellfoundation/error-message-index/pulls">submit a pull request with documentation</a>.
Pull requests with additional examples and improved explanations for
existing messages are also very welcome, as are
<a href="https://github.com/haskellfoundation/error-message-index/issues?q=is%3Aissue+is%3Aopen+label%3Acss">improvements to the generated site</a>.
</p>

<p>
This site is a project of <a href="https://haskell.foundation" target="_blank" rel="noopener noreferrer">The Haskell Foundation</a>.
Please <a href="https://haskell.foundation/contact/" target="_blank" rel="noopener noreferrer">get in touch</a> if you have feedback or if you'd like to get involved!
</p>

$partial("templates/messages.html")$
39 changes: 38 additions & 1 deletion message-index/templates/messages.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
$body$
<h2>The Messages</h2>

<script src="/js/tablefilter.js"></script>

$partial("templates/message-list.html")$

<script>
var filtersConfig = {
base_path: '/wrong-on-purpose/',
auto_filter: {
delay: 75 //milliseconds
},
single_filter: true
};
var tf = new TableFilter(document.querySelector('.message-list'), filtersConfig);
tf.init();

var input = document.querySelector('.single_flt');

if (input) {
input.setAttribute("placeholder", "🔍 Type here to filter ...");
input.focus();

//Autofill the search from the URL
let url = new URL(document.location.href);
let query = url.searchParams.get('q');
if(query !== null)
{
input.setAttribute('value',query)
//Move cursor to end
input.setSelectionRange(query.length,query.length);

//Make sure that the list gets filtered as if the query had been typed manually
input.dispatchEvent(new KeyboardEvent('keyup'));

}
}

</script>

0 comments on commit 945d88e

Please sign in to comment.