proper index

This commit is contained in:
Mirek Kratochvil 2023-06-18 14:10:59 +02:00
parent db5847e1ec
commit 15a0543ab3
12 changed files with 171 additions and 23 deletions

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#CCD6DD" d="M31 32c0 2.209-1.791 4-4 4H5c-2.209 0-4-1.791-4-4V4c0-2.209 1.791-4 4-4h22c2.209 0 4 1.791 4 4v28z"/><path fill="#99AAB5" d="M27 24c0 .553-.447 1-1 1H6c-.552 0-1-.447-1-1 0-.553.448-1 1-1h20c.553 0 1 .447 1 1zm-16 4c0 .553-.448 1-1 1H6c-.552 0-1-.447-1-1 0-.553.448-1 1-1h4c.552 0 1 .447 1 1zM27 8c0 .552-.447 1-1 1H6c-.552 0-1-.448-1-1s.448-1 1-1h20c.553 0 1 .448 1 1zm0 4c0 .553-.447 1-1 1H6c-.552 0-1-.447-1-1 0-.553.448-1 1-1h20c.553 0 1 .447 1 1zm0 4c0 .553-.447 1-1 1H6c-.552 0-1-.447-1-1 0-.553.448-1 1-1h20c.553 0 1 .447 1 1zm0 4c0 .553-.447 1-1 1H6c-.552 0-1-.447-1-1 0-.553.448-1 1-1h20c.553 0 1 .447 1 1z"/><path fill="#66757F" d="M31 6.272c-.827-.535-1.837-.579-2.521-.023l-.792.646-1.484 1.211-.1.08-2.376 1.938-11.878 9.686c-.437.357-.793 1.219-1.173 2.074-.378.85-.969 2.852-1.443 4.391-.148.25-1.065 1.846-.551 2.453.52.615 2.326.01 2.568-.076 1.626-.174 3.731-.373 4.648-.58.924-.211 1.854-.395 2.291-.752.008-.006.01-.018.017-.023l11.858-9.666.792-.646.144-.118V6.272z"/><path fill="#D99E82" d="M18.145 22.526s-1.274-1.881-2.117-2.553c-.672-.843-2.549-2.116-2.549-2.116-.448-.446-1.191-.48-1.629-.043-.437.438-.793 1.366-1.173 2.291-.472 1.146-1.276 4.154-1.768 5.752-.083.272.517-.45.503-.21-.01.187.027.394.074.581l-.146.159.208.067c.025.082.05.154.068.21l.159-.146c.187.047.394.084.58.074.24-.014-.483.587-.21.503 1.598-.493 4.607-1.296 5.752-1.768.924-.381 1.854-.736 2.291-1.174.439-.435.406-1.178-.043-1.627z"/><path fill="#EA596E" d="M25.312 4.351c-.876.875-.876 2.293 0 3.168l3.167 3.168c.876.874 2.294.874 3.168 0l3.169-3.168c.874-.875.874-2.293 0-3.168l-3.169-3.168c-.874-.875-2.292-.875-3.168 0l-3.167 3.168z"/><path fill="#FFCC4D" d="M11.849 17.815l3.17 3.17 3.165 3.166 11.881-11.879-6.337-6.336-11.879 11.879z"/><path fill="#292F33" d="M11.298 26.742s-2.06 1.133-2.616.576c-.557-.558.581-2.611.581-2.611s1.951.036 2.035 2.035z"/><path fill="#CCD6DD" d="M23.728 5.935l3.96-3.96 6.336 6.337-3.96 3.96z"/><path fill="#99AAB5" d="M26.103 3.558l.792-.792 6.336 6.335-.792.792zM24.52 5.142l.791-.791 6.336 6.335-.792.792z"/></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#CCD6DD" d="M36 22c0 2.209-1.791 4-4 4H4c-2.209 0-4-1.791-4-4V4c0-2.209 1.791-4 4-4h28c2.209 0 4 1.791 4 4v18z"/><path fill="#5DADEC" d="M4 4h28v18H4z"/><path fill="#CCD6DD" d="M13 26h10v6H13z"/><path fill="#9AAAB4" d="M13 26h10v2H13z"/><path fill="#E1E8ED" d="M36 33c0-1.657-1.343-3-3-3H3c-1.657 0-3 1.343-3 3s1.343 3 3 3h30c1.657 0 3-1.343 3-3z"/><path fill="#F5F8FA" d="M3 32h2v2H3zm4 0h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2zm4 0h2v2h-2zm4 0h2v2h-2zm4 0h2v2h-2zm4 0h2v2h-2z"/></svg>

After

Width:  |  Height:  |  Size: 549 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#FDCB58" d="M31 15c0 1.104-.896 2-2 2H7c-1.104 0-2-.896-2-2V7c0-1.104.896-2 2-2h22c1.104 0 2 .896 2 2v8z"/><path fill="#FDD888" d="M33 19c0 1.104-.896 2-2 2H5c-1.104 0-2-.896-2-2v-8c0-1.104.896-2 2-2h26c1.104 0 2 .896 2 2v8z"/><path fill="#FEE7B8" d="M35 33c0 1.104-.896 2-2 2H3c-1.104 0-2-.896-2-2V15c0-1.104.896-2 2-2h30c1.104 0 2 .896 2 2v18z"/><path fill="#67757F" d="M11 14zm0 0z"/><path fill="#78B159" d="M23 3h-5c-1.104 0-2 .895-2 2v1h2c1.104 0 2 .896 2 2h3c1.104 0 2-.896 2-2V5c0-1.105-.896-2-2-2z"/><path fill="#F18F26" d="M17 7h-5c-1.104 0-2 .896-2 2v1h2c1.104 0 2 .896 2 2h3c1.104 0 2-.896 2-2V9c0-1.104-.896-2-2-2z"/><path fill="#9268CA" d="M13 14c0 1.104-.896 2-2 2H6c-1.104 0-2-.896-2-2v-1c0-1.104.896-2 2-2h5c1.104 0 2 .896 2 2v1z"/></svg>

After

Width:  |  Height:  |  Size: 826 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#CCD6DD" d="M14.563 14.414L25.47 3.505l6.961 6.962-10.908 10.908z"/><path fill="#68E090" d="M8.103 34.399C2.5 34 1.5 30.062 1.635 27.932c.322-5.07 15.601-16.551 15.601-16.551l12.517 1.93c.001 0-17.389 21.392-21.65 21.088z"/><path fill="#8899A6" d="M32.326 3.708C29.405.787 26.104-.649 24.954.502c-.013.013-.022.031-.034.044-.006.006-.015.008-.021.014L2.295 23.164c-1.412 1.412-2.19 3.29-2.19 5.288 0 1.997.778 3.875 2.19 5.287 1.413 1.413 3.291 2.19 5.288 2.19 1.998 0 3.875-.777 5.287-2.189l22.604-22.604c.007-.007.009-.016.015-.023.013-.012.03-.02.043-.033 1.151-1.15-.285-4.451-3.206-7.372zM10.75 31.619c-.846.846-1.97 1.311-3.166 1.311s-2.321-.466-3.167-1.312c-.846-.846-1.312-1.97-1.312-3.167 0-1.196.466-2.32 1.311-3.166L25.412 4.29c.622 1.144 1.56 2.394 2.749 3.584 1.189 1.189 2.44 2.127 3.584 2.749L10.75 31.619z"/><path fill="#17BF63" d="M29.196 13.144c-.058.379-2.627.751-5.691.343-3.063-.408-5.482-1.223-5.403-1.82.08-.597 2.627-.751 5.691-.343s5.495 1.224 5.403 1.82zM10.84 23.247c-.31.31-.813.31-1.123 0-.31-.31-.31-.813 0-1.123.31-.31.813-.31 1.123 0 .31.31.31.813 0 1.123zm3.317 2.615c-.507.507-1.328.506-1.835 0-.506-.506-.506-1.328 0-1.834.507-.507 1.328-.506 1.834 0 .507.506.508 1.327.001 1.834zm1.677-5.324c-.476.476-1.25.476-1.726 0s-.476-1.249 0-1.726c.476-.476 1.249-.477 1.725 0 .478.477.478 1.25.001 1.726zm-6.868 8.858c-.581.581-1.524.581-2.105 0-.582-.582-.581-1.524 0-2.105s1.523-.581 2.105 0c.581.581.582 1.523 0 2.105zm11.396-9.158c-.413.413-1.083.413-1.496 0-.413-.413-.412-1.083.001-1.496.414-.414 1.083-.414 1.496-.001.413.414.413 1.083-.001 1.497zm-1.207-4.288c-.27.27-.708.27-.979 0-.27-.27-.27-.708 0-.979.27-.27.708-.271.979 0 .27.271.27.709 0 .979z"/><ellipse transform="rotate(-45.001 30.817 5.223)" fill="#CCD6DD" cx="30.817" cy="5.223" rx="1.184" ry="4.847"/></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -95,6 +95,26 @@ h6 {
font-weight: 300;
}
tbody tr.even {
background: #f8f8f8;
}
table td {
padding: 0.3em;
}
table th {
padding: 0.5em;
border-bottom: 1pt solid #777;
}
blockquote {
border-left: 0.5em solid #eee;
padding-left: 1em;
}
/* the "side" infobox */
.sidebox ol {
padding-left: 1em;
margin: 0;
@ -112,6 +132,8 @@ h6 {
text-align: right;
}
/* search form and related stuff */
.search-form-wrap {
text-align: center;
font-size: 120%;
@ -140,25 +162,68 @@ input.search {
input, button {
font-size: inherit;
font-family: inherit;
height: 2em;
}
/* front page */
.index-cards {
display:flex;
justify-content: center;
flex-wrap: wrap;
align-items: flex-start;
}
.index-card {
border: 1pt solid #777;
box-shadow: 5pt 5pt 10pt #aaa;
border-radius: 1rem;
padding: 0.5rem;
margin: 0.5rem;
width: 6rem;
height: 10rem;
text-align: center;
}
.index-card a {
text-decoration: inherit;
color: #777;
}
.index-card a:hover {
text-decoration: inherit;
color: #0ad;
}
tbody tr.even {
background: #f8f8f8;
.index-card-icon {
width: 4rem;
height: 4rem;
margin: 0.5rem;
display: inline-block;
background-size: contain;
background-repeat: no-repeat;
}
table td {
padding: 0.3em;
.index-icon-admin {
background-image: url('static/emoji/1f5c2.svg');
}
table th {
padding: 0.5em;
border-bottom: 1pt solid #777;
.index-icon-it {
background-image: url('static/emoji/1f5a5.svg');
}
blockquote {
border-left: 0.5em solid #eee;
padding-left: 1em;
.index-icon-lab {
background-image: url('static/emoji/1f9ea.svg');
}
.index-icon-pub {
background-image: url('static/emoji/1f4dd.svg');
}
.index-card-title {
font-family: 'Barlow Condensed', sans-serif;
font-size: 80%;
}
/* layout */
@ -398,6 +463,23 @@ main {
flex-grow: 0;
}
.index-card {
border-radius: 2rem;
padding: 1rem;
margin: 1rem;
width: 9rem;
height: 15rem;
}
.index-card-icon {
width:6rem;
height:6rem;
}
.index-card-title {
font-size: 120%;
}
/* header stuff */
.topbar-unilu {

15
cards/404.md Normal file
View file

@ -0,0 +1,15 @@
---
mount: /404
title: Page not found
search: off
---
# Page not found!
You may have clicked a bad link, or the links between the how-to cards are
broken. If you believe the page should be here, try [searching for
it](/search), or [let us know](/contribute) about the issue.
**If you are not connected to the university network**, the card you are trying
to access may be internal-only, and thus hidden from you. You may [connect to
the VPN](/it/vpn) to fix that.

View file

@ -4,4 +4,8 @@ title: How-To Cards main page
template: index.html
---
# How-To Cards
#### What are How-To Cards?
How-To Cards are a self-documentation resource for the main processes, rules and tasks at LCSB. Everyone can [contribute their knowledge](/about/contribute) to the cards, or publish updates of the existing cards. All information about the how-to cards is [categorized here](/tag/about).
If you need help with the service functionality, please create a request for support by creating a ticket on [ServiceNow](https://service.uni.lu/) using the catalog item *LCSB/BioCore: Application Services*.

View file

@ -2,6 +2,7 @@
mount: /search
title: Search
template: search.html
search: off
---
# Search

29
site.hs
View file

@ -134,7 +134,8 @@ rootUrl fp = (</> unAbsolute fp) <$> use urlBase
-- | Process a single link pointing out from a page.
processLink :: FilePath -> FilePath -> Site String
processLink base l =
if any (l `hasUriScheme`) ["http", "https", "ftp", "mailto"] || take 1 l == "#"
if any (l `hasUriScheme`) ["http", "https", "ftp", "mailto"] || take 1 l ==
"#"
then pure l
else if isAbsolute l
then rootUrl l
@ -346,20 +347,26 @@ renderTags :: Site ()
renderTags = use (htags . to M.keys) >>= traverse_ renderTag
-- | Transform one mounted PageInfo to the base search data
mkSearchData :: FilePath -> PageInfo -> Site Y.Value
mkSearchData :: FilePath -> PageInfo -> Site [Y.Value]
mkSearchData mount pi = do
link <- rootUrl mount
text <- io . runIOorExplode $ writePlain plainWriteOpts (pi ^. pageDoc)
let title = pi ^? pageMeta . key "title" . _String
-- TODO: unify retrieval of tags
let tags = sort $ pi ^.. pageMeta . key "tags" . values . _String . to T.unpack
pure $
Y.object
[ ("link", fromString link)
, ("title", maybe (fromString mount) Y.String title)
, ("tags", Y.array $ map (Y.array . map fromString . splitDirectories) tags)
, ("text", Y.String text)
]
let tags =
sort $ pi ^.. pageMeta . key "tags" . values . _String . to T.unpack
if pi ^? pageMeta . key "search" . _Bool == Just False -- `off` gets parsed as bool
then pure []
else pure $
[ Y.object
[ ("link", fromString link)
, ("title", maybe (fromString mount) Y.String title)
, ( "tags"
, Y.array $
map (Y.array . map fromString . splitDirectories) tags)
, ("text", Y.String text)
]
]
-- | Collect all pages' search data to the file
renderSearchData :: Site ()
@ -369,7 +376,7 @@ renderSearchData = use searchDataOut >>= traverse_ go
ps <- use (pages . to M.assocs) >>= traverse (uncurry mkSearchData)
io $ do
putStrLn $ "S -> " ++ out
AE.encodeFile out $ Y.array ps
AE.encodeFile out $ Y.array (concat ps)
-- | Build the whole site.
main = do

34
templates/bigcards.html Normal file
View file

@ -0,0 +1,34 @@
<div class="index-cards">
<div class="index-card">
<a href="{{root}}tag/admin">
<div class="index-card-icon index-icon-admin"></div>
<div class="index-card-title">
Administrative processes, Staff and Campus
</div>
</a>
</div>
<div class="index-card">
<a href="{{root}}tag/it">
<div class="index-card-icon index-icon-it"></div>
<div class="index-card-title">
Bioinformatics, Computational methods and IT
</div>
</a>
</div>
<div class="index-card">
<a href="{{root}}tag/lab">
<div class="index-card-icon index-icon-lab"></div>
<div class="index-card-title">
Wetlab equipment and processes
</div>
</a>
</div>
<div class="index-card">
<a href="{{root}}tag/publication">
<div class="index-card-icon index-icon-pub"></div>
<div class="index-card-title">
Publications and Responsible Reproducible Research
</div>
</a>
</div>
</div>

View file

@ -3,6 +3,7 @@
<body>
{{> header.html}}
{{> searchform.html}}
{{> bigcards.html}}
{{{body}}}
{{> footer.html}}
</body>

View file

@ -8,7 +8,7 @@
<div id="search_noquery">
<p>Enter a few words into the box above to start the search.</p>
<p>You may use <code>*</code> for wildcard search, and prefixes <code>+</code> for required terms and <code>-</code> for unwanted terms.</p>
<p><strong>Example:</strong> <code>laboratory noteb* +red -code</code> will find information about <em>laboratory notebooks</em> that must also describe something <em>red</em>, but do not contain any mention of <em>code</em>.</p>
<p><strong>Example:</strong> <code>laboratory noteb* +red -code</code> will find cards about <em>laboratory notebooks</em> that must also describe something <em>red</em>, but do not contain any mention of <em>code</em>.</p>
</div>
<div id="search_success" style="display: none">