-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from nfdi4plants/image-index
Image index
- Loading branch information
Showing
5 changed files
with
574 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: Image Index crawler | ||
layout: none | ||
date: 2023-09-26 | ||
author: | ||
- name: Dominik Brilhaus | ||
github: https://github.com/brilator | ||
orcid: https://orcid.org/0000-0001-9021-3197 | ||
--- | ||
|
||
Note, this is just a quick and dirty crawler to list all images and add them to the _ImageIndex.md | ||
|
||
# Crawl images and add to _imageIndex.md | ||
|
||
```bash | ||
cd src/docs/img | ||
``` | ||
|
||
```bash | ||
|
||
find . -type f > .tmp_all-files | ||
grep -v '.pptx' .tmp_all-files > .tmp_all-images-only | ||
sed 's|^./|/docs/img/|g' .tmp_all-images-only > .tmp_all-images-absolute | ||
|
||
rm -f _test.md | ||
|
||
while IFS= read -r img; | ||
do | ||
if [ $(grep -c "$img" _ImageIndex.md) -eq 0 ] | ||
then | ||
|
||
echo '<a href="'$img'" target="_blank"><img src="'$img'" width="50px" alt="'$img'"/></a> | <a href="'$img'" target="_blank">https://nfdi4plants.org/nfdi4plants.knowledgebase'$img'</a> | | ' >> _ImageIndex.md | ||
fi | ||
done < .tmp_all-images-absolute | ||
|
||
rm .tmp_all-* | ||
|
||
|
||
grep -v "_ImageIndex" _ImageIndex.md > tmpfile && mv tmpfile _ImageIndex.md | ||
grep -v ".DS_Store" _ImageIndex.md > tmpfile && mv tmpfile _ImageIndex.md | ||
|
||
|
||
``` |
Oops, something went wrong.