Logo Search packages:      
Sourcecode: rapple version File versions  Download package

rpl_wk_status rpl_mod_tidy_init ( void   ) 

Create master configuration for tidy module. Doing this once per workflow is chiefly of benefit if the configuration is being read from a file.

Definition at line 55 of file mod_tidy.c.

References rpl_cfg_get_ds_basedir(), rpl_cfg_get_trf_tidy_config(), rpl_log_warn(), rpl_me_free(), rpl_message_get(), and rpl_str_concat().

Referenced by rpl_mod_tidy_configure().

{
      rpl_wk_status status = RPL_WK_OK;
      rpl_str_t msg;

      /* define error and output directories */
      terr_dir = rpl_str_concat(rpl_cfg_get_ds_basedir(), "/", RPL_DS_TERR_DIR, RPL_STR_EOC);
      tout_dir = rpl_str_concat(rpl_cfg_get_ds_basedir(), "/", RPL_DS_TOUT_DIR, RPL_STR_EOC);

    /* set up tidy internals */
    config = tidyCreate();

    /* use an external tidy config file if one is available */
    tidyCfgFile = rpl_cfg_get_trf_tidy_config();
    if ((tidyCfgFile != NULL) && tidyFileExists(tidyCfgFile))
    {
        if(tidyLoadConfig(config, rpl_cfg_get_trf_tidy_config()) != 0)
        {
            msg = rpl_message_get("TIDY_CONFIG_FAILED",rpl_cfg_get_trf_tidy_config(), RPL_EOM);
            rpl_log_warn(msg);
                  rpl_me_free(msg);
                  status = RPL_WK_WARN;
        }
    } else {
        /* configure tidy */
        tidyOptSetBool(config,TidyXhtmlOut,yes);
        tidyOptSetBool(config,TidyMark,no);
            tidyOptSetBool(config,TidyNumEntities, yes);
        /* specific MS Word measures */
        tidyOptSetBool(config,TidyWord2000,yes);
        tidyOptSetBool(config,TidyMakeBare,yes);
        tidyOptSetBool(config,TidyMakeClean,yes);
        tidyOptSetBool(config,TidyDropPropAttrs,yes);
        /* options that simplify XSLT processing */
        tidyOptSetBool(config,TidyEncloseBodyText,yes);
            tidyOptSetValue(config, TidyDoctype, "omit");
    }

      return status; 
}


Generated by  Doxygen 1.6.0   Back to index