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];
public Table WithHeaderColumn(HTMLBase html) { if (HeaderRow == null) { this.Children.Add(new TableRow()); } HeaderRow.Children.Add(new TableHeader(null) { Children = { html } }); return(this); }
public override void WriteTo(HTMLBase parent, int depth, AmendmentBuilder builder) { // not used. throw new NotImplementedException(); }
public override void WriteTo(HTMLBase parent, int depth, AmendmentBuilder builder) { if (Group) { parent.Children.Add(new Div(cls: "LegClearPblock")); parent.Children.Add(new H2(cls: "LegPblock") { Children = { new Span(cls: "LegPblockTitle") { RawText = getAmendedText(builder) } } }); return; } var LHS = new Span(cls: $"LegDS LegP{depth}No") { RawText = Number }; var RHS = new Span(cls: $"LegDS LegP{depth}GroupTitle") { RawText = getAmendedText(builder) }; var header = new H3($"section-{Number}", $"LegClearFix LegP{depth}Container{(Number == "1" ? "First" : "")}") { Children = { new Anchor("", id: AnchorText), LHS, RHS } }; parent.Children.Add(header); if (RepealedById.HasValue) { var amend = Law.AmendmentReferences[RepealedById.Value]; 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) { var amend = Law.AmendmentReferences[InsertedById.Value]; var next = builder.GetNextNumber(new ThingAmendment(this, InsertedById.Value, AmendType.Insert)); LHS.RawText = (builder.TextOnly ? "" : $"{LegHelpers.GetChangeDeliminator(true)}{LegHelpers.GetChangeAnchor(next)}") + $"{Number}"; } var children = new List <TextualLawThing>(); children.AddRange(Children); foreach (var child in children.OrderBy(x => x.Number, new NumberComparer())) { child.WriteTo(parent, depth + 1, builder); } if (!builder.TextOnly && ( InsertedById.HasValue || SubstituedById.HasValue ) ) { var last = parent.Children[^ 1];