Bloom.Book.HtmlDom.AddStylesheetFromAnotherBook C# (CSharp) Method

AddStylesheetFromAnotherBook() public static method

public static AddStylesheetFromAnotherBook ( HtmlDom sourceBookDom, HtmlDom targetBookDom ) : void
sourceBookDom HtmlDom
targetBookDom HtmlDom
return void
        public static void AddStylesheetFromAnotherBook(HtmlDom sourceBookDom, HtmlDom targetBookDom)
        {
            var addedModifiedStyleSheets = new List<string>();
            //This was refactored from book, where there was these notes:
            //     NB: at this point this code can't handle the "userModifiedStyles" from children, it'll ignore them (they would conflict with each other)
            //     NB: at this point custom styles (e.g. larger/smaller font rules) from children will be lost.

            //At this point, this addedModifiedStyleSheets is just used as a place to track which stylesheets we already have
            foreach(string sheetName in sourceBookDom.GetTemplateStyleSheets())
            {
                if(!addedModifiedStyleSheets.Contains(sheetName))
                    //nb: if two books have stylesheets with the same name, we'll only be grabbing the 1st one.
                {
                    addedModifiedStyleSheets.Add(sheetName);
                    targetBookDom.AddStyleSheetIfMissing(sheetName);
                }
            }
        }