static void test_parse(void) { const char *inputCSS = DFHashTableLookup(utgetdata(),"input.css"); if (inputCSS == NULL) { DFBufferFormat(utgetoutput(),"input.css not defined"); return; } CSSSheet *styleSheet = CSSSheetNew(); CSSSheetUpdateFromCSSText(styleSheet,inputCSS); char *text = CSSSheetCopyText(styleSheet); DFBufferFormat(utgetoutput(),"%s",text); free(text); DFBufferFormat(utgetoutput(), "================================================================================\n"); char *cssText = CSSSheetCopyCSSText(styleSheet); DFBufferFormat(utgetoutput(),"%s",cssText); free(cssText); CSSSheetRelease(styleSheet); }
static void test_setHeadingNumbering(void) { const char *inputCSS = DFHashTableLookup(utgetdata(),"input.css"); if (inputCSS == NULL) { DFBufferFormat(utgetoutput(),"CSS_setHeadingNumbering: input.css not defined"); return; } if (utgetargc() < 1) { DFBufferFormat(utgetoutput(),"CSS_setHeadingNumbering: expected 1 argument"); return; } CSSSheet *styleSheet = CSSSheetNew(); CSSSheetUpdateFromCSSText(styleSheet,inputCSS); int on = !strcasecmp(utgetargv()[0],"true"); CSSSheetSetHeadingNumbering(styleSheet,on); char *cssText = CSSSheetCopyCSSText(styleSheet); DFBufferFormat(utgetoutput(),"%s",cssText); free(cssText); CSSSheetRelease(styleSheet); }
int testCSS(const char *filename, DFError **error) { char *input = DFStringReadFromFile(filename,error); if (input == NULL) { DFErrorFormat(error,"%s: %s",filename,DFErrorMessage(error)); return 0; } CSSSheet *styleSheet = CSSSheetNew(); CSSSheetUpdateFromCSSText(styleSheet,input); char *text = CSSSheetCopyText(styleSheet); printf("%s",text); free(text); printf("================================================================================\n"); char *cssText = CSSSheetCopyCSSText(styleSheet); printf("%s",cssText); free(cssText); CSSSheetRelease(styleSheet); free(input); return 1; }
int WordConverterConvertToHTML(WordConverter *converter, DFError **error) { converter->haveFields = Word_simplifyFields(converter->package); Word_mergeRuns(converter->package); if (converter->package->document == NULL) { DFErrorFormat(error,"document.xml not found"); return 0; } DFNode *wordDocument = DFChildWithTag(converter->package->document->docNode,WORD_DOCUMENT); if (wordDocument == NULL) { DFErrorFormat(error,"word:document not found"); return 0; } WordAddNbsps(converter->package->document); WordFixLists(converter); CSSSheetRelease(converter->styleSheet); converter->styleSheet = WordParseStyles(converter); WordObjectsCollapseBookmarks(converter->objects); WordObjectsScan(converter->objects); WordObjectsAnalyzeBookmarks(converter->objects,converter->styles); WordGetData get; get.conv = converter; DFNode *abstract = WordDocumentLens.get(&get,wordDocument); DFAppendChild(converter->html->docNode,abstract); Word_postProcessHTMLDoc(converter); HTMLAddExternalStyleSheet(converter->html,"reset.css"); char *cssText = CSSSheetCopyCSSText(converter->styleSheet); HTMLAddInternalStyleSheet(converter->html,cssText); free(cssText); return 1; }