private void ProcessChildNodes(string projectId, string bookId, Delta newDelta, XElement elem, string curChapter, ref string curRef, ref int nextNoteId) { foreach (XNode node in elem.Nodes()) { switch (node) { case XElement e: switch (e.Name.LocalName) { case "verse": string verse = (string)e.Attribute("number"); SegmentEnded(newDelta, curRef); curRef = $"verse_{curChapter}_{verse}"; newDelta.InsertVerse(verse, GetAttributes(e)); break; case "char": newDelta.InsertChar(e.Value, GetAttributes(e), curRef); break; case "note": var noteDelta = new Delta(); string tempRef = null; ProcessChildNodes(projectId, bookId, noteDelta, e, curChapter, ref tempRef, ref nextNoteId); newDelta.InsertNote(nextNoteId, noteDelta, GetAttributes(e), curRef); nextNoteId++; break; default: LogUnknownElement(projectId, bookId, e); break; } break; case XText text: newDelta.InsertText(text.Value, curRef); break; } } }
public static Delta InsertChar(this Delta delta, string text, string style, string segRef = null) { return(delta.InsertChar(text, new { style = style }, segRef)); }