#!/bin/bash

# 1. Define the file you want to edit
TARGET_FILE="1.html"

# 2. List the names/strings you want to target (space-separated)
# Feel free to add or change names inside these parentheses
STRINGS=("Diamond" "DFTB+" "DFT-D3" "Exciting" "Gamess" "Gaussian and Gaussview" "Jaguar" "Jalview" "Jmol" )

# 3. Loop through each string and apply the sed change
for item in "${STRINGS[@]}"; do
    # Create a lowercase ID (e.g., "About Us" becomes "about us", then "about-us")
    # This keeps your HTML IDs clean and standard
    LOWERCAL_ID=$(echo "$item" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')

    echo "Processing: $item -> id=\"$LOWERCAL_ID\""

    # For Linux (GNU sed)
    sed -i "s|<h2>$item</h2></a>|<h2 id=\"$LOWERCAL_ID\">$item</h2>|g" "$TARGET_FILE"
    
    # UNCOMMENT BELOW IF ON MAC (and comment out the Linux line above)
    # sed -i '' "s|<h2>$item</h2></a>|<h2 id=\"$LOWERCAL_ID\">$item</h2>|g" "$TARGET_FILE"
done

echo "Done!"
