How to allow inline code in unghosted master pages?

In SharePoint inline code is allowed in pages as long as the page remains ghosted (not customized). But when e.g. master pages are edited using SharePoint Designer they will become unghosted (customized). To allow unghosted master pages to contain inline code, a PageParserPath element must be added to the web.config file, as shown in the example below:

    <PageParserPath VirtualPath="/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />