예제 #1
0
        internal PM.Bibliography PostProcessBibliography(DE.Style style, PM.Bibliography bibliography)
        {
            if (bibliography != null)
            {
                _overridesBibliography.ForEach(x => bibliography = x.PostProcess(style, bibliography));
            }

            return(bibliography);
        }
        public PM.Bibliography PostProcess(DE.Style style, PM.Bibliography bibliography)
        {
            if (bibliography != null && bibliography.Values != null)
            {
                List <string> replacedValues = new List <string>();
                foreach (string value in bibliography.Values)
                {
                    string replacedValue = value;
                    foreach (KeyValuePair <string, string> mapping in _mappings)
                    {
                        if (!string.IsNullOrEmpty(replacedValue) &&
                            !string.IsNullOrEmpty(mapping.Key) &&
                            !string.IsNullOrEmpty(mapping.Value))
                        {
                            replacedValue = replacedValue.Replace(mapping.Key, mapping.Value);
                        }
                    }
                    replacedValues.Add(replacedValue);
                }
                bibliography.Values = replacedValues;
            }

            return(bibliography);
        }
        private async Task <DM.Bibliography> CreateBibliographyAsync(DE.Style style, DE.Format format, List <DM.ContentItem> contentItems)
        {
            ExpandoObject         request     = new ExpandoObject();
            List <PM.ContentItem> requestList = new List <PM.ContentItem>();

            requestList.AddRange(contentItems.Select((x, i) => PF.CiteProcFactory.Build(i.ToString(), x)));
            requestList = _overrideManager.PreProcessBibliography(style, requestList);
            requestList.ForEach(x => request.TryAdd(x.ID, x));
            using (StringAsTempFile file = new StringAsTempFile(GetContents(), CancellationToken.None))
            {
                string result = await NodeServices.InvokeAsync <string>(file.FileName,
                                                                        GetLibrary(),
                                                                        PL.Locale.GetLocale(),
                                                                        PD.Definition.GetDefinition(style),
                                                                        PF.CiteProcFactory.Build(format),
                                                                        JObject.Parse(request.ToSerializedJSON()));

                PM.Bibliography bibliography = JsonConvert.DeserializeObject <PM.Bibliography>(result);
                bibliography.ProcessExceptions();
                bibliography = _overrideManager.PostProcessBibliography(style, bibliography);
                DM.Bibliography response = PF.CiteProcFactory.Build(bibliography);
                return(response);
            }
        }
 public PM.Bibliography PostProcess(DE.Style style, PM.Bibliography bibliography)
 {
     return(bibliography);
 }