BITPlan / ProfiWiki

Professional SemanticMediaWiki
Apache License 2.0
1 stars 0 forks source link

refactor fontawesome handling #19

Open WolfgangFahl opened 2 months ago

WolfgangFahl commented 2 months ago

The Icons are outdated and that leads to e.g. https://contexts.bitplan.com/index.php/Template:Icon not displaying correctly

WolfgangFahl commented 2 months ago
#!/bin/bash
# WF 2024-08-12
# aided by ChatGPT

# Directory containing SVG files
SVG_DIR="/var/www/fontawesome/svgs/solid"

# MediaWiki page output file
OUTPUT_FILE=/tmp/"icons.wiki"
# Initialize a counter
counter=0
# remove file if it exists
rm $OUTPUT_FILE
# Loop through all SVG files in the directory
for f in "$SVG_DIR"/*.svg
do
  # Get the basename of the file (without the path and extension)
  basename=$(basename "$f" .svg)

  # Append the MediaWiki markup to the output file using cat << EOF
  echo "{{Icon|name=$basename|style=regular|size=48|storemode=subobject}}" >> "$OUTPUT_FILE"

  # Increment the counter
  ((counter++))

  # Add a newline after every 25 icons
  if (( counter % 25 == 0 )); then
    echo "" >> "$OUTPUT_FILE"
  fi
done

echo "Icon MediaWiki markup now at $OUTPUT_FILE"
head $OUTPUT_FILE
WolfgangFahl commented 2 months ago

/var/www/fontawesome/svg# ln -s house.svg home.svg https://contexts.bitplan.com/font-awesome/svg/home.svg