Quoting the exact portion of sec 54ec relevant to the query-
'(2) Where the long-term specified asset is transferred or converted (otherwise than by transfer) into money at any time within a period of three years from the date of its acquisition, the amount of capital gains arising from the transfer of the original asset not charged under section 45 on the basis of the cost of such long-term specified asset as provided in clause (a) or, as the case may be, clause (b) of subsection (1) shall be deemed to be the income chargeable under the head Capital gains relating to longterm
capital asset of the previous year in which the long-term specified asset is transferred or converted (otherwise than by transfer) into money.
Explanation.In a case where the original asset is transferred and the assessee invests the whole or any part of the capital gain received or accrued as a result of transfer of the original asset in any long-term specified asset and such assessee takes any loan or advance on the security of such specified asset, he shall be deemed to have converted (otherwise than by transfer) such specified asset into money on thedate on which such loan or advance is taken'
Hope this would clear everything