예제 #1
0
 public static String WriteLinkDefault(
     this LitOptions LO,
     MDLinkLine link
     )
 {
     return(String.Format(@"[{0}]: # {{{1}}}", link.Link, link.Tag));
 }
예제 #2
0
        public static String WriteNotesLinkDefault(
            this LitOptions LO,
            LitNovel novel,
            LitRef reference
            )
        {
            var retVal = new MDLinkLine();

            retVal.Link = "Reference";
            if (reference is LitChar)
            {
                retVal.Tag = "Character";
            }
            else if (reference is LitPlace)
            {
                retVal.Tag = "Place";
            }
            else if (reference is LitMyth)
            {
                retVal.Tag = "Myth";
            }
            else if (reference is LitObject)
            {
                retVal.Tag = "Object";
            }
            else
            {
                retVal.Tag = "Reference";
            }
            return(retVal.ToString());
        }
예제 #3
0
        public static String WriteElmTagEXDefault(
            this LitOptions LO,
            LitElm elm
            )
        {
            var link = new MDLinkLine {
                Link = "TreeTag",
                Tag  = elm.TreeTag.Tag
            };
            var linkString = LO.WriteLink(link);

            return(String.Format(@"/\v^#.*(\n*{0})@=", SanitizeForRegex(linkString)));
        }
예제 #4
0
        public static MDLinkLine ParseLinkDefault(this LitOptions LO, String s)
        {
            var retVal = new MDLinkLine();
            var match  = System.Text.RegularExpressions.Regex.Match(s, @"^\[([^\]]*)\]: # {([^}]*)}$");

            if (!match.Success)
            {
                return(null);
            }
            else
            {
                try {
                    retVal.Link = match.Groups[1].Value;
                    retVal.Tag  = match.Groups[2].Value;
                }
                catch {
                    return(null);
                }
            }
            return(retVal);
        }