Beispiel #1
0
        private static void objeProc(StructParseContext context, int linedex, char level)
        {
            MediaLink mlink = MediaStructParse.MediaParser(context, linedex, level);
            SourceCit cit   = (context.Parent as SourceCit);

            cit.Media.Add(mlink);
        }
Beispiel #2
0
        private static void textProc(StructParseContext context, int linedex, char level)
        {
            string    val = GedRecParse.extendedText(context);
            SourceCit cit = (context.Parent as SourceCit);

            cit.Text.Add(val);
        }
Beispiel #3
0
        private static SourceCit CommonParser(ParseContextCommon ctx, int linedex, char level, List <UnkRec> errs)
        {
            SourceCit          cit  = new SourceCit();
            StructParseContext ctx2 = new StructParseContext(ctx, linedex, level, cit); // TODO no record for context!

            string extra;
            string xref;

            parseXrefExtra(ctx.Remain, out xref, out extra);

            cit.Xref = xref;
            if (xref != null && (xref.Trim().Length == 0 || cit.Xref.Contains("@")))  // No xref is valid but not if empty/illegal
            {
                var unk = new UnkRec();
                unk.Error = UnkRec.ErrorCode.InvXref; // TODO {Error = "Invalid source citation xref id"};
                unk.Beg   = ctx.Begline + ctx.Lines.Beg;
                unk.End   = ctx.Endline + ctx.Lines.Beg;
                errs.Add(unk);
            }
            if (!string.IsNullOrEmpty(extra))
            {
                cit.Desc = extra;
            }

            StructParse(ctx2, tagDict);
            ctx.Endline = ctx2.Endline;

            if (!cit.Data && cit.Xref != null && cit.AnyText)
            {
                var unk = new UnkRec();
                unk.Error = UnkRec.ErrorCode.RefSourText; // TODO { Error = "TEXT tag used for reference source citation" };
                unk.Beg   = ctx.Begline + ctx.Lines.Beg;
                unk.End   = ctx2.Endline + ctx.Lines.Beg;
                errs.Add(unk);
            }
            if (cit.Xref == null && cit.Event != null)
            {
                var unk = new UnkRec();
                unk.Error = UnkRec.ErrorCode.EmbSourEven; // TODO { Error = "EVEN tag used for embedded source citation" };
                unk.Beg   = ctx.Begline + ctx.Lines.Beg;
                unk.End   = ctx2.Endline + ctx.Lines.Beg;
                errs.Add(unk);
            }
            if (cit.Xref == null && cit.Page != null)
            {
                var unk = new UnkRec();
                unk.Error = UnkRec.ErrorCode.EmbSourPage; // TODO { Error = "PAGE tag used for embedded source citation" };
                unk.Beg   = ctx.Begline + ctx.Lines.Beg;
                unk.End   = ctx.Endline + ctx.Lines.Beg;
                errs.Add(unk);
            }
            return(cit);
        }
Beispiel #4
0
        private static void concProc(StructParseContext context, int linedex, char level)
        {
            SourceCit cit = (context.Parent as SourceCit);

            cit.Desc += context.Remain;
        }
Beispiel #5
0
        private static void dataProc(StructParseContext context, int linedex, char level)
        {
            SourceCit cit = (context.Parent as SourceCit);

            cit.Data = true;
        }