示例#1
0
        /// <summary>
        /// Quads where <see cref="Quad.Object"/> is
        /// <see cref="Text"/> with specified language.
        /// </summary>
        public static IEnumerable <Quad> IsTypeTextLang(
            this IEnumerable <Quad> self,
            IBasicNodeFactory f,
            params string[] language)
        {
            var nodes = language.Select(x => f.Text("", x));

            return(self.Where(x =>
                              x.Object is Node <Text> txt &&
                              nodes.Any(v => v.Value.Language == txt.Value.Language)));
        }
示例#2
0
 /// <summary>
 /// Creates either a text node or literal node.
 /// </summary>
 public static Node TextOrLiteral(this IBasicNodeFactory self,
                                  ReadOnlySpan <char> value, ReadOnlySpan <char> language)
 => language.IsEmpty ? (Node)self.New(new string(value))
         : self.Text(value, language);