Cation-exchange porosity tuning in anionic metal-organic frameworks for the selective separation of gases and vapors and for catalysis.