Just added a new recipe for one of the hidden gems in Lucee.
Alas, we can’t do an example on docs, as the docs don’t support escaping the backticks, if someone is interested in getting that escaping working, that would be awesome (@bennadel you’re our resident regex junkie??)
& arguments.code
& '</script>' & Chr(10);
return rawCode & highlighted;
}
return highlighted;
}
// PRIVATE HELPERS
private any function _getNextHighlight( required string text, required string startPos=1 ) {
var referenceRegex = "```([a-zA-Z\+]+)?\n(.*?)\n```";
var match = ReFind( referenceRegex, arguments.text, arguments.startPos, true );
var found = match.len[1] > 0;
var result = {};
if ( !found ) {
return;
}
var precedingContent = match.pos[1] == 1 ? "" : Trim( Left( arguments.text, match.pos[1]-1 ) );
var matchIsWithinCodeBlock = precedingContent.endsWith( "<pre>" ) || precedingContent.endsWith( "<code>" );
Some background on the proposal, a very long old thread which started it all, opinions all over the place, but we ended up adding it and it’s great
We are currently considering the following options for “tag island” inside cfscript:
Three ticks surrounding the tag island, e.g. `` <h1>html code</h1> ` ```
Double braces, e.g. {{ <h1>html code</h1> }}
Triple braces, e.g. {{{ <h1>html code</h1> }}}
Add an html tag, e.g. html { <h1>html code</h1> }
Surround the tags with <cfml> and </cfml>
Thoughts and ideas welcomed.
See also [LDEV-1324] - Lucee
3 Likes
I would like to give you a little advice: add the creation date to the recipes. I often look for new documentation, but I have to check Github to see if there is anything new.
Sorry for taking the liberty.
Thank you!
yeah good call, it’s a bit more complicated due to git n all and the way the source documents for the function / tag documents all work
but for the recipes it’s simpler as the are all a single document
1 Like
making progress, able to read the git log using jgit to get back the newest and update recipes!
2 Likes
Very impressed by
new Git()
Thank you for considering my advice.
that’s the java class, not a Lucee function!
repository.close();
} catch ( any e ) {
throw( message="Failed to enumerate commits: " & e.message, cause=e );
}
return files;
}
// returns all the dates for commits
private function getAllDatesforFile( repository, filePath ){
var Git = new Git( repository );
var commits = [];
var logCmd = git.log().addPath( replace( arguments.filePath, "\", "/", "all" ) );
var commitIter = logCmd.call().iterator();
while ( commitIter.hasNext() ) {
var commit = commitIter.next();
commits.append(
new Date( javacast( "long", commit.getCommitTime() * 1000 ) )
); // getName() returns the commit hash
}
return commits;
1 Like