Esempio n. 1
0
        public Span Handle(IList <Token> tokens, Options options)
        {
            RepeaterMonthName month       = null;
            int           day             = 0;
            IList <Token> remainingTokens = null;

            if (tokens.Count > 3)
            {
                month           = tokens[2].GetTag <RepeaterMonthName>();
                day             = tokens[3].GetTag <ScalarDay>().Value;
                remainingTokens = tokens.Take(2).ToList();
            }
            else
            {
                month           = tokens[1].GetTag <RepeaterMonthName>();
                day             = tokens[2].GetTag <ScalarDay>().Value;
                remainingTokens = tokens.Take(1).ToList();
            }

            var now = options.Clock();

            if (Time.IsMonthOverflow(now.Year, (int)month.Value, day))
            {
                return(null);
            }
            return(Utils.HandleMD(month, day, remainingTokens, options));
        }
Esempio n. 2
0
        static ITag ScanMonthNames(Token token, Options options)
        {
            ITag tag = null;

            MonthPatterns.ForEach(item =>
            {
                if (item.Pattern.IsMatch(token.Value))
                {
                    tag = new RepeaterMonthName(item.Month);
                    return;
                }
            });
            return(tag);
        }
Esempio n. 3
0
 static ITag ScanMonthNames(Token token, Options options)
 {
     ITag tag = null;
     MonthPatterns.ForEach(item =>
         {
             if (item.Pattern.IsMatch(token.Value))
             {
                 tag = new RepeaterMonthName(item.Month);
                 return;
             }
         });
     return tag;
 }