예제 #1
0
        public Template(string template, ITemplateService templateService)
        {
            _templateService = templateService;
            _templateService.AssertValidity(template);

            _hasNeighborhoods = Regex.Matches(template, TemplateVariables.NeighborhoodLoop).Count == 1;

            template        = _templateService.Clean(template);
            _templateString = template;

            // The for loops are the separators.
            var parts = SplitTemplateIntoParts(template);

            PreparePartsToBeTransformedInRegex(parts);

            _neighborhoodRegex = CreateNeighborHoodRegex(parts);
            _cityRegexes       = CreateCityRegexes(parts);
        }