Skip to content

Commit

Permalink
update scripts to generate html; something changed on new laptop...
Browse files Browse the repository at this point in the history
these will be replace by new version of vocab codes from iSamples.
  • Loading branch information
smrgeoinfo committed Dec 17, 2023
1 parent 8b59afe commit cd71103
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
21 changes: 21 additions & 0 deletions scripts/generate_specTypeExt_docs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Write-Host "start"
$SCRIPT_FOLDER = (Get-Item $MyInvocation.MyCommand.Path).Directory.FullName
$SOURCE_BASE = "../../../iSamples/metadata_profile_earth_science/vocabulary/"
$SOURCES = @("earthenv_specimen_type.ttl")
$DEST_FOLDER = "../../../iSamples/metadata_profile_earth_science/docs/"

# Create destination folder if it doesn't exist
New-Item -ItemType Directory -Force -Path $DEST_FOLDER | Out-Null

foreach ($src in $SOURCES) {
$fname = [System.IO.Path]::ChangeExtension($src, "md")
Write-Host ("Generating {0}..." -f $fname)
# call via conda to get the correct python env
& "C:\Users\smrTu\miniconda3\Scripts\conda.exe" run -n quarto python ("{0}\vocab2md.py" -f $SCRIPT_FOLDER) ("{0}{1}" -f $SOURCE_BASE, $src) | Out-File -FilePath ("{0}{1}" -f $DEST_FOLDER, $fname)
# Assuming quarto is in the system PATH
quarto render ("{0}{1}" -f $DEST_FOLDER, $fname) --to html
}

Write-Host "Done. "
# run in the C:\Users\smrTu\OneDrive\Documents\GithubC\smrgeoinfo\vocabulary\scripts directory
# powershell generate_specTypeExt_docs.ps1
9 changes: 3 additions & 6 deletions scripts/generate_specTypeExt_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
#
#
echo "start"

SCRIPT_FOLDER="$(dirname ${0})"
SOURCE_BASE="../../../iSamples/vocabularies/src/extensions/"
SOURCES=( "specimenTypeExtension.ttl" )
DEST_FOLDER="../../../iSamples/vocabularies/src/extensions/html/"
SOURCE_BASE="../../../iSamples/metadata_profile_earth_science/vocabulary/"
SOURCES=( "earthenv_specimen_type.ttl" )
DEST_FOLDER="../../../iSamples/metadata_profile_earth_science/docs/"
mkdir -p "${DEST_FOLDER}"
for src in ${SOURCES[@]}; do
fname="${src%%.*}.md"
echo "Generating ${fname}..."
python "${SCRIPT_FOLDER}/vocab2md.py" "${SOURCE_BASE}${src}" > "${DEST_FOLDER}${fname}"
quarto render "${DEST_FOLDER}${fname}" --to html
done

echo "Done. Type 'exit' to close window. "

# this is just to keep the window open to see the console output and any error messages
powershell

0 comments on commit cd71103

Please sign in to comment.