On periodic waves for sine- and sinh-Gordon equations