p = 'frontend/src/components/QuestionReadingLinks.jsx'
s = open(p).read()

s = s.replace('''            className="question-reading-chip">
            <span aria-hidden="true">▤</span>
            {link.section_title || link.title}
          </ArticleLink>''',
'''            className="question-reading-chip">
            <span aria-hidden="true">▤</span>
            {/* The article's name, then the section — never the section on its
                own. A chip reading "Treatment" tells a learner nothing about
                where it goes; "Eczema · Treatment" names the subject first and
                still lands them on the right heading. */}
            {link.title}
            {link.section_title && (
              <span className="question-reading-chip-section"> · {link.section_title}</span>
            )}
          </ArticleLink>''')

s = s.replace('''              {link.title}{link.section_title ? ` — ${link.section_title}` : ''}''',
'''              {link.title}{link.section_title ? ` — ${link.section_title}` : ''}''')
open(p, 'w').write(s)
print('chips done')
