Exemple #1
0
        private NamesElement GetFirstNamesElementInBibliography()
        {
            // init
            NamesElement result = null;

            // find layout in bibliography
            if (this.Bibliography != null && this.Bibliography.Layout != null)
            {
                // init
                result = this.Bibliography.Layout.GetChildren()
                         .OfType <NamesElement>()
                         .FirstOrDefault();
                if (result != null)
                {
                }
            }

            // done
            return(result);
        }
Exemple #2
0
        private void CompileNested(Scope code, NamesElement owner)
        {
            // validate
            if (this.Name != null || this.EtAl != null || this.Label != null || this.Substitute != null)
            {
                throw new CompilerException(this, "A names element inside a substitute element is not allowed to have any child elements.");
            }

            // invoke
            using (var method = code.AppendMethodInvoke("this.RenderNameGroups", this))
            {
                // variables
                var variables = this.Variable.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                .ToArray();

                // terms
                var terms = variables
                            .Select(x => Utility.GetXmlEnum <TermName>(x))
                            .Select(x => (x == null ? "(TermName?)null" : Compiler.GetLiteral(x.Value)))
                            .ToArray();

                // parameters
                method.AddElement(this);
                method.AddCode(string.Format("new string[]{{{{{0}}}}}", string.Join(",", variables.Select(x => Compiler.GetLiteral(x)))));
                method.AddCode(string.Format("new TermName?[]{{{{{0}}}}}", string.Join(",", terms)));
                method.AddLiteral(null);
                method.AddLiteral(null);
                method.AddLiteral(owner.Prefix);
                method.AddLiteral(owner.Suffix);
                method.AddLiteral(true);
                method.AddContextAndParameters();
                method.AddCode("np");
                method.AddCode("ep");
                method.AddCode("lp");
            }
        }