<commit_before>package org.jbake.util;

import org.jbake.app.Crawler.Attributes;
import org.jbake.app.configuration.JBakeConfiguration;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.util.Map;

/**
 * 
 * @author <NAME>
 *
 */
public class HtmlUtil {

	/**
	 * Image paths are specified as w.r.t. assets folder. This function prefix site host to all img src except 
	 * the ones that starts with http://, https://.
	 * 
	 * If image path starts with "./", i.e. relative to the source file, then it first replace that with output file directory and the add site host.
	 * 
	 * @param fileContents	Map representing file contents
	 * @param configuration Configuration object
	 */
    public static void fixImageSourceUrls(Map<String, Object> fileContents, JBakeConfiguration configuration){
    	
    	String htmlContent = fileContents.get(Attributes.BODY).toString();

    	boolean prependSiteHost = configuration.getImgPathPrependHost();
        String siteHost = configuration.getSiteHost();
        String rootPath = fileContents.get(Attributes.ROOTPATH).toString();
    	String uri = fileContents.get(Attributes.URI).toString();
    	
    	if (fileContents.get(Attributes.NO_EXTENSION_URI) != null){
    		uri = fileContents.get(Attributes.NO_EXTENSION_URI).toString();<commit_msg>Removed unused variable.<commit_after>package org.jbake.util;

import org.jbake.app.Crawler.Attributes;
import org.jbake.app.configuration.JBakeConfiguration;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.util.Map;

/**
 * 
 * @author <NAME>
 *
 */
public class HtmlUtil {

	/**
	 * Image paths are specified as w.r.t. assets folder. This function prefix site host to all img src except 
	 * the ones that starts with http://, https://.
	 * 
	 * If image path starts with "./", i.e. relative to the source file, then it first replace that with output file directory and the add site host.
	 * 
	 * @param fileContents	Map representing file contents
	 * @param configuration Configuration object
	 */
    public static void fixImageSourceUrls(Map<String, Object> fileContents, JBakeConfiguration configuration){
    	
    	String htmlContent = fileContents.get(Attributes.BODY).toString();

    	boolean prependSiteHost = configuration.getImgPathPrependHost();
        String siteHost = configuration.getSiteHost();
    	String uri = fileContents.get(Attributes.URI).toString();
    	
    	if (fileContents.get(Attributes.NO_EXTENSION_URI) != null){
    		uri = fileContents.get(Attributes.NO_EXTENSION_URI).toString();
{'fraction_non_alphanumeric': 0.10369265199552406, 'fraction_numerical': 0.0, 'mean_word_length': 3.957486136783734, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5931705', 'n_tokens_mistral': 792, 'n_tokens_neox': 753, 'n_words': 216}