baby frontend soundin good

master
Bel LaPointe 2022-02-08 09:39:20 -07:00
parent 3a246f8b38
commit d01a933b73
4 changed files with 63 additions and 4 deletions

View File

@ -37,11 +37,16 @@ gitlab() (
local url="$1" local url="$1"
local url_path="${url#http*://gitlab*.net/}" local url_path="${url#http*://gitlab*.net/}"
local project="${url_path%%/-/*}" local project="${url_path%%/-/*}"
local project="${project%%/tree/*}"
local root="${url_path#*$project}" local root="${url_path#*$project}"
local root="${root#*/-/}" local root="${root#*/-}"
local root="${root#tree/}" if [ "$root" != "${root#/tree}" ]; then
local root="${root#blob/}" root="${root#/tree}"
local root="${root#*/}" root="/${root#/*/}"
fi
local root="${root#/blob}"
local root="${root#/}"
log project=$project, root=$root, url=$url
echo "$project" echo "$project"
echo "$root" echo "$root"
} }

View File

@ -47,6 +47,9 @@ EOF
} }
test_url_to_project_root() { test_url_to_project_root() {
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/tree/master | grep -q '^data-store/orchestration/runbooks$'
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/tree/master | tail -n 1 | grep ^$
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'data-store/orchestration/runbooks' gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'data-store/orchestration/runbooks'
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'Alerts/rems/README.md' gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'Alerts/rems/README.md'

View File

@ -44,6 +44,7 @@ each() {
source ./cache.sh source ./cache.sh
set -e set -e
set -o pipefail set -o pipefail
log() { echo "> $*" >&2; }
} }
if [ "$0" == "$BASH_SOURCE" ]; then if [ "$0" == "$BASH_SOURCE" ]; then

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
<script src="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js"></script>
<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">
</header>
<body>
<textarea id="my-text-area">
# initial
value
</textarea>
</body>
<footer>
<script>
const easyMDE = new EasyMDE({
autoDownloadFontAwesome: true,
autofocus: true,
autosave: {
enabled: false,
},
element: document.getElementById('my-text-area'),
forceSync: true,
indentWithTabs: false,
initialValue: "# initial\nvalue",
showIcons: ["code", "table"],
spellChecker: false,
sideBySideFullscreen: false,
tabSize: 3,
previewImagesInEditor: true,
insertTexts: {
image: ["![](", ")"],
link: ["[](", ")"],
},
lineNumbers: true,
uploadImage: true,
imageUploadEndpoint: "/api/v0/media", // POST wants {data: {filePath: "/..."}}
imagePathAbsolute: true,
renderingConfig: {
codeSyntaxHighlighting: true,
},
})
function logValue() {
console.log(easyMDE.value())
}
logValue()
</script>
</footer>
</html>