Skip to content

Commit

Permalink
bump version and format
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasRu committed Aug 24, 2023
1 parent d760da3 commit d619f5b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HtmlHelper.cfc (Vers. 0.9.3)
# HtmlHelper.cfc (Vers. 0.9.4)

---

Expand Down
8 changes: 4 additions & 4 deletions cftasks/generateStaticHTML.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ component {
fileSystemUtil.createMapping( "components", basePath & "components" );
print.boldCyanLine( "Map 'components' created." );
cfhttp(
method = "GET",
method = "GET",
charset = "utf-8",
url = "http://localhost:8080/",
result = "result"
url = "http://localhost:8080/",
result = "result"
) {
}

print.boldCyanLine( "Retrieving http to http://localhost:8080" );
htmlHelperService = new components.HtmlHelper();
resultFinal = result.filecontent.replacenocase( "If you want to see an enhanced version of this page, please visit <a href=""https://andreasru.github.io/cfml-htmlhelper/"">https&##x3a;&##x2f;&##x2f;andreasru.github.io&##x2f;cfml-htmlhelper&##x2f;</a>", "", "ALL" );
resultFinal = result.filecontent.replacenocase( "If you want to see an enhanced version of this page, please visit <a href=""https://andreasru.github.io/cfml-htmlhelper/"">https&##x3a;&##x2f;&##x2f;andreasru.github.io&##x2f;cfml-htmlhelper&##x2f;</a>", "", "ALL" );
print.boldCyanLine( "Minifying content" );
minifiedfilecontent = htmlHelperService.minifyHtml( resultFinal );
print.boldCyanLine( "CfContent minified" );
Expand Down
62 changes: 31 additions & 31 deletions components/HtmlHelper.cfc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
component output=false {
component output = false {

/**********************************************************
* HTMLHelper.cfc Version 0.9.4:
Expand All @@ -14,19 +14,19 @@ component output=false {

public function init() {
local.service = {
"version" : "0.9.4",
"debug" : false,
"demarkerStart" : "_1.",
"demarkerEnd" : "_2.",
"debugResult" : function( htmlstring, label="", regexForDump ){
// if set to debug force output!
if( service.debug ){
writeoutput("<hr>" & label & ":");
if(structKeyExists(arguments, "regexForDump")){
dump( htmlstring.reMatch( arguments.regexForDump ) );
}
writeoutput("<pre style='font-size:0.6rem;border:1px solid red;'><code>" & encodeForHTML( htmlstring ) & "</code></pre>" );
}
"version" : "0.9.4",
"debug" : false,
"demarkerStart": "_1.",
"demarkerEnd" : "_2.",
"debugResult" : function( htmlstring, label = "", regexForDump ) {
// if set to debug force output!
if( service.debug ) {
writeOutput( "<hr>" & label & ":" );
if( structKeyExists( arguments, "regexForDump" ) ) {
dump( htmlstring.reMatch( arguments.regexForDump ) );
}
writeOutput( "<pre style='font-size:0.6rem;border:1px solid red;'><code>" & encodeForHTML( htmlstring ) & "</code></pre>" );
}
},
"reduceArrayAndReplaceString": function( arrayWithElements, contentString, replaceWith ) {
replaceWith = arguments.replaceWith;
Expand All @@ -37,57 +37,57 @@ component output=false {
"stripMultlineComments": function( htmlcontent ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="stripMultlineComments",regexForDump= "(\s)+\/\*(.|\n)*?\*\/" );
service.debugResult( htmlstring = result, label = "stripMultlineComments", regexForDump = "(\s)+\/\*(.|\n)*?\*\/" );

stringsToRemove.append( result.reMatch( "(\s)+\/\*(.|\n)*?\*\/" ), true );
result = service.reduceArrayAndReplaceString( stringsToRemove, result, "" );
service.debugResult( htmlstring=result, label="Result" );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"stripSingleLineComments": function( htmlcontent ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="stripSingleLineComments",regexForDump="(\s)+(?:\/\/)(.*?)[\r|\n]" );
service.debugResult( htmlstring = result, label = "stripSingleLineComments", regexForDump = "(\s)+(?:\/\/)(.*?)[\r|\n]" );
stringsToRemove.append( result.reMatch( "(\s)+(?:\/\/)(.*?)[\r|\n]" ), true );
result = service.reduceArrayAndReplaceString( stringsToRemove, result, chr(10) );
service.debugResult( htmlstring=result, label="Result" );
result = service.reduceArrayAndReplaceString( stringsToRemove, result, chr( 10 ) );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"stripHtmlComments": function( htmlcontent ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="stripHtmlComments",regexForDump="<!--.*?-->" );
service.debugResult( htmlstring = result, label = "stripHtmlComments", regexForDump = "<!--.*?-->" );
stringsToRemove.append( result.reMatch( "<!--.*?-->" ), true );
result = service.reduceArrayAndReplaceString( stringsToRemove, result, "" );
service.debugResult( htmlstring=result, label="Result" );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"compressBlankSpaces": function( htmlcontent ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="compressBlankSpaces" );
service.debugResult( htmlstring = result, label = "compressBlankSpaces" );
stringsToRemove.append( result.reMatch( "[ \t]+" ), true ); // compress spaces/tabs to single spaces
result = service.reduceArrayAndReplaceString( stringsToRemove, result, " " ).reReplace( "\s+[\n\r]", chr(10), "ALL" );
service.debugResult( htmlstring=result, label="Result" );
result = service.reduceArrayAndReplaceString( stringsToRemove, result, " " ).reReplace( "\s+[\n\r]", chr( 10 ), "ALL" );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"compressNewLines": function( htmlcontent, replaceWith ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="compressNewLines" );
service.debugResult( htmlstring = result, label = "compressNewLines" );

stringsToRemove.append( result.reMatch( "[\n\r]+" ), true ); // compress spaces/tabs to single spaces
result = service.reduceArrayAndReplaceString( stringsToRemove, result, arguments.replaceWith );
service.debugResult( htmlstring=result, label="Result" );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"stripEmptySpacesBetweenHtmlElements": function( htmlcontent, replaceWith ) {
stringsToRemove = [];
result = arguments.htmlcontent;
service.debugResult( htmlstring=result, label="stripEmptySpacesBetweenHtmlElements" );
service.debugResult( htmlstring = result, label = "stripEmptySpacesBetweenHtmlElements" );
stringsToRemove.append( result.reMatch( ">\s+<" ), true ); // compress spaces/tabs to single spaces
result = service.reduceArrayAndReplaceString( stringsToRemove, result, arguments.replaceWith );
service.debugResult( htmlstring=result, label="Result" );
service.debugResult( htmlstring = result, label = "Result" );
return result;
},
"encodeTrustedHtml": function( required string htmlString ) {
Expand Down Expand Up @@ -154,7 +154,7 @@ component output=false {
if( argStripHtmlComments ) {
result = service.stripHtmlComments( result );
}

if( argStripScriptAndCssComments ) {
result = service.stripMultlineComments( result );
result = service.stripSingleLineComments( result );
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="theme-color" content="&#x23;017f8e"><meta name="description" content="HtmlHelper.cfc: minifyHtml() to get rid of CFML generated whitespace, or use encodeTrustedHtml() to encode HTML of a trusted source that has unencoded characters in inner Html"><meta name="robots" content="index,follow"><meta itemprop="name" content="minifyHtml() and encodeTrustedHtml() | A basic Html Helper Component for CFML"><meta property="og:url" content="https://andreasru.github.io/cfml-htmlhelper/"><meta property="og:title" content="minifyHtml() and encodeTrustedHtml() | A basic Html Helper Component for CFML"><meta property="og:type" content="website"><meta property="og:site_name" content="A basic Html Helper Component for CFML"><meta property="og:description" content="HtmlHelper.cfc: minifyHtml() to get rid of CFML generated whitespace, or use encodeTrustedHtml() to encode HTML of a trusted source that has unencoded characters in inner Html"><title>HtmlHelper.cfc&#x3a; minifyHtml&#x28;&#x29; &amp; encodeTrustedHtml&#x28;&#x29; in your CFML Projects</title><link rel="stylesheet" href="libs/normalizecss/normalize.min.css"><link rel="stylesheet" href="libs/highlightjs/highlightjs_styles_default.min.css"><link rel="stylesheet" href="libs/highlightjs/highlightjs_atom-one-dark.min.css"><link rel="stylesheet" href="libs/main.css"><link rel="stylesheet" href="libs/open-sans.css"></head><body><span id="forkongithub"><a href="https://github.com/andreasRu/cfml-htmlhelper"> Fork me on GitHub</a></span><h1>HtmlHelper.cfc &#x28;Vers. 0.9.3&#x29;</h1><hr /><p><strong><em>Minify your CFML generated HTML at runtime&#x21;</em></strong></p><p></p><h2>A simple basic CFML component to</h2><blockquote><ul><li><strong>minify CFML generated html</strong> content</li><li><strong>encode trusted HTML</strong> content containing non-compliant&#x2f;unescaped characters like e.g. &euro;, &uuml;, &ouml;, &szlig;, etc. within a tags inner HTML</li></ul></blockquote><h3>1. minifyHtml&#x28; string html required &#x29;</h3><h4>Converts a whitespace poluted HTML block like this</h4><pre><code> &lt;!DOCTYPE html&gt;
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="theme-color" content="&#x23;017f8e"><meta name="description" content="HtmlHelper.cfc: minifyHtml() to get rid of CFML generated whitespace, or use encodeTrustedHtml() to encode HTML of a trusted source that has unencoded characters in inner Html"><meta name="robots" content="index,follow"><meta itemprop="name" content="minifyHtml() and encodeTrustedHtml() | A basic Html Helper Component for CFML"><meta property="og:url" content="https://andreasru.github.io/cfml-htmlhelper/"><meta property="og:title" content="minifyHtml() and encodeTrustedHtml() | A basic Html Helper Component for CFML"><meta property="og:type" content="website"><meta property="og:site_name" content="A basic Html Helper Component for CFML"><meta property="og:description" content="HtmlHelper.cfc: minifyHtml() to get rid of CFML generated whitespace, or use encodeTrustedHtml() to encode HTML of a trusted source that has unencoded characters in inner Html"><title>HtmlHelper.cfc&#x3a; minifyHtml&#x28;&#x29; &amp; encodeTrustedHtml&#x28;&#x29; in your CFML Projects</title><link rel="stylesheet" href="libs/normalizecss/normalize.min.css"><link rel="stylesheet" href="libs/highlightjs/highlightjs_styles_default.min.css"><link rel="stylesheet" href="libs/highlightjs/highlightjs_atom-one-dark.min.css"><link rel="stylesheet" href="libs/main.css"><link rel="stylesheet" href="libs/open-sans.css"></head><body><span id="forkongithub"><a href="https://github.com/andreasRu/cfml-htmlhelper"> Fork me on GitHub</a></span><h1>HtmlHelper.cfc &#x28;Vers. 0.9.4&#x29;</h1><hr /><p><strong><em>Minify your CFML generated HTML at runtime&#x21;</em></strong></p><p></p><h2>A simple basic CFML component to</h2><blockquote><ul><li><strong>minify CFML generated html</strong> content</li><li><strong>encode trusted HTML</strong> content containing non-compliant&#x2f;unescaped characters like e.g. &euro;, &uuml;, &ouml;, &szlig;, etc. within a tags inner HTML</li></ul></blockquote><h3>1. minifyHtml&#x28; string html required &#x29;</h3><h4>Converts a whitespace poluted HTML block like this</h4><pre><code> &lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;title&gt;Hot CFML Page &amp; content&lt;/title&gt;
&lt;meta charset="utf-8"&gt;
Expand Down

0 comments on commit d619f5b

Please sign in to comment.