string lhsInsertReplace(string next)
 {
     if (MarkDown)
     {
         return("[");
     }
     return(LegHelpers.GetChangeDeliminator(true) + LegHelpers.GetChangeAnchor(next));
 }
 string lhsRemove(string next)
 {
     if (MarkDown)
     {
         return("...");
     }
     return(". . . ." + LegHelpers.GetChangeAnchor(next));
 }
Exemplo n.º 3
0
        public override void WriteTo(HTMLBase parent, int depth, AmendmentBuilder builder)
        {
            var act = this.Law;
            var LHS = new HTMLHelpers.Objects.Span(HierarchyId, $"LegDS LegLHS LegP{depth}No")
            {
                RawText = $"({Number})"
            };
            var RHS = new HTMLHelpers.Objects.Span(cls: $"LegDS LegRHS LegP{depth}Text")
            {
                RawText = getAmendedText(builder)
            };
            var p = new HTMLHelpers.Objects.Paragraph(null, null, $"LegClearFix LegP{depth}Container")
            {
                Children =
                {
                    LHS, RHS
                }
            };

            parent.Children.Add(p);
            if (RepealedById.HasValue)
            {
                var next = builder.GetNextNumber(new ThingAmendment(this, RepealedById.Value, AmendType.Repeal));
                RHS.RawText = builder.TextOnly ? "..." : ". . . ." + LegHelpers.GetChangeAnchor(next);
                return;
            }
            else if (Substituted != null)
            {
                parent.Children.RemoveAt(parent.Children.Count - 1); // remove p, since we'll refer to the substituted
                Substituted.New.Register(Parent);
                Substituted.New.Number         = Number;
                Substituted.New.SubstituedById = Substituted.GroupId;
                Substituted.New.WriteTo(parent, depth, builder);
                return;
            }
            else if (SubstituedById.HasValue && Parent.SubstituedById != SubstituedById)
            {
                var next = builder.GetNextNumber(new ThingAmendment(this, SubstituedById.Value, AmendType.Substitute));
                LHS.RawText = (builder.TextOnly ? "" : $"{LegHelpers.GetChangeDeliminator(true)}{LegHelpers.GetChangeAnchor(next)}") + $"({Number})";
            }
            else if (InsertedById.HasValue && Parent.InsertedById != InsertedById)
            {
                var next = builder.GetNextNumber(new ThingAmendment(this, InsertedById.Value, AmendType.Insert));
                LHS.RawText = (builder.TextOnly ? "" : $"{LegHelpers.GetChangeDeliminator(true)}{LegHelpers.GetChangeAnchor(next)}") + $"({Number})";
            }
            foreach (var child in Children)
            {
                child.WriteTo(parent, depth + 1, builder);
            }
            if (!builder.TextOnly && (
                    (InsertedById.HasValue && Parent.InsertedById != InsertedById)
                    ||
                    (SubstituedById.HasValue && Parent.SubstituedById != SubstituedById)
                    )
                )
            {
                var last = parent.Children[^ 1];