In official letters, registration documents and common usage one can often see unbalanced quotation marks, e.g.
ОАО «Корпорация «Комета» - two opening quotes followed by only one closing quote.
I would like to automate correct placement of quotation marks. For instance, given a sentence
Газета "Правда" сообщила, что Иванов, возглавлявший ОАО "Корпорация "Ромашка", уходит в отставку.
that has five quotation marks
the quotation marks 1,3, and 4 are opening and the marks 2, and 5, are closing.
In general terms, I would like to understand if unbalanced quotation marks make correct usage? Is this specific to the Russian language?
As for the implementation details, it seems that the choice of opening and closing quotation marks in the Russian language follows a simple rule:
If a quotation mark follows a space or a punctuation mark, then it must be a closing quote, otherwise it is an opening quote.
Is this rule correct?