From: Matt McCutchen Date: Tue, 8 Sep 2020 00:16:14 +0000 (-0400) Subject: Import SuperbChemistry version 2.1 X-Git-Url: https://mattmccutchen.net/superbchemistry/superbchemistry.git/commitdiff_plain/de16a29a63f3776841af849a99dc65e1aa509ca2 Import SuperbChemistry version 2.1 Modification time: 2007-02-05 20:21:05 -0500 --- diff --git a/SuperbChemistry-test.odt b/SuperbChemistry-test.odt index a1cf54a..3802718 100644 Binary files a/SuperbChemistry-test.odt and b/SuperbChemistry-test.odt differ diff --git a/extension/SuperbChemistry/Main.xba b/extension/SuperbChemistry/Main.xba index 33ccbd1..3b0640e 100644 --- a/extension/SuperbChemistry/Main.xba +++ b/extension/SuperbChemistry/Main.xba @@ -1,6 +1,6 @@ -' Matt McCutchen's SuperbChemistry for OpenOffice, version 2 +' Matt McCutchen's SuperbChemistry for OpenOffice, version 2.1 ' ' Applies superscript and subscript formatting to chemical formulas in text. ' @@ -72,12 +72,13 @@ sub FormatDocument ' for further processing. If the replacement text could use ' backreferences, this would be easier. -' Tag candidate quantity/charges following symbols or ). -SuperbReplace(ThisComponent, "([A-Z][a-z]?|[\])}])[0-9]*[-+−]", "&@g@", 0) - -' Disqualify + and - in compound words, etc. -SuperbReplace(ThisComponent, "@g@[[({A-Za-z0-9<>]", "@G@&", 0) -SuperbReplace(ThisComponent, "@G@@g@", "", 0) +' Tag candidate charges following symbols or ), but not in compound words, etc. +' Acceptable next character. (Has to be before end of line to avoid matching @g@ tag itself.) +SuperbReplace(ThisComponent, "([A-Z][a-z]?|[\])}])[0-9]*[-+−][^[({A-Za-z0-9<>]", "&@G@", 0) +' Retag in front. +SuperbReplace(ThisComponent, ".@G@", "@g@&", 0) +' End of line. +SuperbReplace(ThisComponent, "([A-Z][a-z]?|[\])}])[0-9]*[-+−]$", "&@g@", 0) ' O and )]} grab a single digit as quantity. SuperbReplace(ThisComponent, "[\])}O][0-9]", "&@n@", 0)