Fixed unwanted lower case characters bug when processing :ref: and :chap: directives.