public String SaveOutput(ITextRender output) { //String help = output.GetContent(); PropertyCollection pc = output.getContentBlocks(true, reporting.format.reportOutputFormatName.textMdFile); String mainPath = ""; foreach (Object key in pc.Keys) { String k = key.toStringSafe(); String content = pc[key].ToString(); String fn = GetFilename(k); /* * String fn = filename; * * if (k != nameof(templateFieldSubcontent.main)) * { * fn = fn + "_" + k.getCleanFilepath(); * } * fn = fn.ensureEndsWith(".txt"); */ if (k == nameof(templateFieldSubcontent.main)) { mainPath = fn; } folder.SaveText(content, fn, Data.enums.getWritableFileMode.overwrite, "Reference for " + scopeType.Name + " [" + k + "]", true); } return(mainPath); }
public basicDocumentPageDefinitionSet GetOutput(ITextRender output) { basicDocumentPageDefinitionSet dict = new basicDocumentPageDefinitionSet(); PropertyCollection pc = output.getContentBlocks(true, reporting.format.reportOutputFormatName.textMdFile); String mainPath = ""; foreach (Object key in pc.Keys) { String k = key.toStringSafe(); String content = pc[key].ToString(); String fn = GetFilename(k); /* * String fn = filename; * * if (k != nameof(templateFieldSubcontent.main)) * { * fn = fn + "_" + k.getCleanFilepath(); * } * fn = fn.ensureEndsWith(".txt"); */ if (k == nameof(templateFieldSubcontent.main)) { mainPath = fn; dict.mainPath = mainPath; } basicDocumentPageDefinition page = new basicDocumentPageDefinition() { content = content, filepath = fn, name = k }; dict.Add(page); //folder.SaveText(content, fn, Data.enums.getWritableFileMode.overwrite, "Reference for " + scopeType.Name + " [" + k + "]", true); } dict.helpContext = this; return(dict); }
public void createNewFile(IRenderExecutionContext context, IMetaContentNested oldScope) { ITextRender render = sourceRender.outputRender; string ext = format.getDefaultExtension(); string filename = (oldScope.name + filenameSufix).getFilename(ext); string filepath = context.directoryScope.FullName.add(filename, "\\"); // String folderPath = context.data.getProperString(oldScope.path, templateFieldBasic.path_folder, templateFieldBasic.document_path, templateFieldBasic.documentset_path); PropertyCollection content_blocks = render.getContentBlocks(true, format); IMetaContentNested sc = (IMetaContentNested)oldScope; string codeOutput = template; try { IConverterRender cr = (IConverterRender)render; reportLinkCollectionSet menu = new reportLinkCollectionSet(); reportLinkToolbar toolbar = new reportLinkToolbar(); // sc.GetLinkCollection((deliveryInstance)context, format, sourceRender.levelsOfNewDirectory, false); // <---------- MENU ---------------------------- if (oldScope is metaPage) { metaPage oldScope_metaPage = (metaPage)oldScope; menu.Add("Document set", oldScope_metaPage.menu_documentSetMenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory)); menu.Add("Document", oldScope_metaPage.menu_documentmenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory)); menu.Add("Page", oldScope_metaPage.menu_pagemenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory)); menu.Add("Root", oldScope_metaPage.menu_rootmenu.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory)); toolbar = oldScope_metaPage.toolbar_pagetools; } string menuRender = menu.RenderSetAsDropDowns(cr.converter); content_blocks.add(templateFieldSubcontent.html_mainnav, menuRender, false); // <---------------- TOOL BAR if (toolbar != null) { if (toolbar.Any()) { string toolbarRender = toolbar.CompileLinkCollection(context as deliveryInstance, format, levelsOfNewDirectory).RenderAsToolbar(cr.converter); content_blocks.add(templateFieldSubcontent.html_toolbar, toolbarRender, false); } } // <---------------- LINKS // codeOutput = codeOutput.CompileLinksInTemplate(context as deliveryInstance, format, levelsOfNewDirectory); } catch (Exception ex) { throw new aceReportException("Auto-menu creation : " + ex.Message + " Automenu creation for " + oldScope.path); } if (context is deliveryInstance) { deliveryInstance contextDeliveryInstance = (deliveryInstance)context; contextDeliveryInstance.unit.blockBuilder.BuildDynamicNavigationTemplates(contextDeliveryInstance, content_blocks); } codeOutput = codeOutput.applyToContent(false, content_blocks);// openBase.openFileToString(tempfile.FullName, true, false); codeOutput = codeOutput.applyToContent(false, context.data); codeOutput = codeOutput.CompileLinksInTemplate(context as deliveryInstance, format, levelsOfNewDirectory); codeOutput = codeOutput.Replace("..//", "../"); codeOutput = codeOutput.Replace(" href=\"/", " href=\""); //var savedfile = codeOutput.saveStringToFile(filepath, imbSCI.Cores.enums.getWritableFileMode.overwrite, Encoding.UTF8); context.saveFileOutput(codeOutput, filepath, getFolderPathForLinkRegistry(context), description); //IDocScriptExecutionContext docContext = context as IDocScriptExecutionContext; //docContext.linkRegistry[context.directoryScope.FullName].AddLink(filename, "", filepath); }