inserting references before or after comma or period in manuscript

some kind of automation is needed in reference styles so that references are added either before or after a period or comma in a sentence.