Пример #1
0
        public List <string> FileNameInMediaFolder(long mid, string strIn, bool includeRemote = false)
        {
            List <string> returnList = new List <string>();
            List <string> stringList = new List <string>();
            JsonObject    model      = collection.Models.Get(mid);

            int type = (int)model.GetNamedNumber("type");

            if ((type == (int)ModelType.CLOZE) && strIn.Contains("{{c"))
            {
                stringList = ExpandClozes(strIn);
            }
            else
            {
                stringList.Add(strIn);
            }

            string str;

            foreach (string s in stringList)
            {
                str = LaTeX.MungeQA(s, collection);
                MatchCollection matches;
                foreach (Regex p in RegExps)
                {
                    matches = p.Matches(str);
                    foreach (Match m in matches)
                    {
                        string fName   = m.Groups["fname"].Value;
                        bool   isLocal = !remoteRegex.IsMatch(fName.ToLowerInvariant());
                        if (isLocal || includeRemote)
                        {
                            returnList.Add(fName);
                        }
                    }
                }
            }
            return(returnList);
        }
Пример #2
0
 public override object RunFilter(object arg, params object[] args)
 {
     return(LaTeX.MungeQA((string)arg, (Collection)args[4]));
 }