Formation and optical properties of one-dimensional carbon nanostructures: from single-walled carbon nanotubes with given geometry to graphene nanostrips inside them