예제 #1
0
        public static String ReferenceHeader(this LitRef reference)
        {
            var TagHeader = new MDHeader()
            {
                HeaderLevel = 1,
                Text        = reference.Tags.First().Tag
            };

            return(TagHeader.ToString());
        }
예제 #2
0
        public static List <String> WriteNotesCharLinesDefault(
            this LitOptions LO,
            LitNovel novel,
            LitChar character
            )
        {
            var retVal  = new List <String>();
            var AllElms = novel.AllElms();

            //Show actor instances
            var actorHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Actor in"
            };

            retVal.Add(actorHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(s => s.Actors.Contains(character))
                .Select(s => s.TreeTag.ToHyperlink())
                );

            //Show speaker instances
            var speakerHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Speaker in"
            };

            retVal.Add(speakerHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.Speakers.Contains(character))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            //Show mentions
            var characterHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Mentioned in"
            };

            retVal.Add(characterHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.References.Contains(character))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            return(retVal);
        }
예제 #3
0
        public static String WriteNotesHeaderDefault(
            this LitOptions LO,
            LitNovel novel,
            LitRef reference
            )
        {
            var TagHeader = new MDHeader()
            {
                HeaderLevel = 1,
                Text        = reference.Tags.First().Tag
            };

            return(TagHeader.ToString());
        }
예제 #4
0
        public static List <String> WriteNotesObjectLinesDefault(
            this LitOptions LO,
            LitNovel novel,
            LitObject obj
            )
        {
            var retVal  = new List <String>();
            var AllElms = novel.AllElms();

            //Show speaker instances
            var itemHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Speaker in"
            };

            retVal.Add(itemHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.Items.Contains(obj))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            //Show mentions
            var objectHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Mentioned in"
            };

            retVal.Add(objectHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.References.Contains(obj))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            return(retVal);
        }
예제 #5
0
        public static List <String> WriteNotesMythLinesDefault(
            this LitOptions LO,
            LitNovel novel,
            LitMyth myth
            )
        {
            var retVal  = new List <String>();
            var AllElms = novel.AllElms();

            //Show actor instances
            var eventHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Event of"
            };

            retVal.Add(eventHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.Events.Contains(myth))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            //Show mentions
            var mythHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Mentioned in"
            };

            retVal.Add(mythHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.References.Contains(myth))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            return(retVal);
        }
예제 #6
0
        public static List <String> WriteNotesPlaceLinesDefault(
            this LitOptions LO,
            LitNovel novel,
            LitPlace place
            )
        {
            var retVal  = new List <String>();
            var AllElms = novel.AllElms();

            //Show actor instances
            var locationHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Location of"
            };

            retVal.Add(locationHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(s => s.Locations.Contains(place))
                .Select(s => s.TreeTag.ToHyperlink())
                );

            //Show mentions
            var placeHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Mentioned in"
            };

            retVal.Add(placeHeader.ToString());
            retVal.AddRange(
                AllElms
                .Where(e => e.References.Contains(place))
                .Select(e => e.TreeTag.ToHyperlink())
                );

            return(retVal);
        }
예제 #7
0
        /// <summary>
        /// Default implementaiton for parsing a line into a MDHeader object.
        /// </summary>
        /// <param name="line"></param>
        /// <returns>The MDHeader object, or null if the parse failed</returns>
        public static MDHeader ParseHeaderDefault(
            this LitOptions LO,
            String line
            )
        {
            var retVal = new MDHeader();
            var match  = System.Text.RegularExpressions.Regex.Match(line, @"^(#+)([^#].*)$");

            if (!match.Success)
            {
                return(null);
            }
            else
            {
                try {
                    retVal.HeaderLevel = match.Groups[1].Value.Length;
                    retVal.Text        = match.Groups[2].Value.Trim();
                }
                catch {
                    return(null);
                }
            }
            return(retVal);
        }
예제 #8
0
        public static List <String> WriteNotesTagsDefault(
            this LitOptions LO,
            LitNovel novel,
            LitRef reference
            )
        {
            var retVal = new List <string>();

            var tagsHeader = new MDHeader()
            {
                HeaderLevel = 2,
                Text        = "Tags"
            };

            retVal.Add(tagsHeader.ToString());

            //Place the tags in the header
            foreach (var tag in reference.Tags)
            {
                retVal.Add(tag.Tag);
            }

            return(retVal);
        }