I’m using JAMA style. Citations in text are superscripted numerals Inside of periods and commas…however, AMA style is numerals OUTSIDE of commas and periods. I have tried to update the style. I have tried to edit the style. I dont see anywhere in editing the style to correct the positioning of the superscript outside of periods and commas.
There is no way apart from ensuring that you place your citations in the appropriate position in the context of punctuation.
An alternative is to create a complicated macro that would search and replace the position of the citations based on the presence of a }, or }. in an unformated document. Or search for these occurrences and move the punctuation mark manually to precede the citation.
But I would note that publishing houses have such scripts for their editors to perform these to conform with in-house rules quite efficiently. I have never had a paper rejected for a misplace period, have you?