const fs = require('fs');

let content = fs.readFileSync('index.html', 'utf8');

// fix CSS
content = content.replace('href="styles.css"', 'href="speciality/styles.css"');

// fix image paths
content = content.replace(/src="\.\.\/Assets\//g, 'src="Assets/');

// fix location folder links
const locations = [
  'porur', 'kundrathur', 'gerugambakkam', 'ramapuram', 
  'iyyappanthangal', 'mugalivakkam', 'kolapakkam', 
  'anakaputhur', 'thiruverkadu', 'kattupakkam', 'maduravoyal'
];

locations.forEach(loc => {
    const rx = new RegExp('href="' + loc + '/', 'g');
    content = content.replace(rx, 'href="speciality/' + loc + '/');
});

fs.writeFileSync('../speciality.html', content);
console.log('Saved to ../speciality.html');
