Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Aug 20, 2018
1 parent 5551c5a commit 366c49c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
25 changes: 22 additions & 3 deletions core/src/main/java/lucee/runtime/functions/string/NewLine.java
Expand Up @@ -22,10 +22,29 @@
package lucee.runtime.functions.string;

import lucee.runtime.PageContext;
import lucee.runtime.ext.function.Function;
import lucee.runtime.exp.FunctionException;
import lucee.runtime.exp.PageException;
import lucee.runtime.ext.function.BIF;
import lucee.runtime.op.Caster;

public final class NewLine extends BIF {

private static final long serialVersionUID = -5537738458169706L;
private static final String NL=System.getProperty("line.separator");

public final class NewLine implements Function {
public static String call(PageContext pc) {
return "\n";
return call(pc,true);
}

public static String call(PageContext pc, boolean includeCROnWindows) {
return includeCROnWindows?NL:"\n";
}

@Override
public Object invoke(PageContext pc, Object[] args) throws PageException {
if(args.length==0) return call(pc,true);
if(args.length==1) return call(pc, Caster.toBooleanValue(args[0]));

throw new FunctionException(pc, "NewLine", 0, 1, args.length);
}
}
7 changes: 7 additions & 0 deletions core/src/main/java/resource/fld/core-cfml.fld
Expand Up @@ -1531,6 +1531,13 @@ You can find a list of all available timezones in the Lucee administrator (Setti
<name>newLine</name>
<class>lucee.runtime.functions.string.NewLine</class>
<description>returns a new line</description>
<argument>
<name>includeCROnWindows</name>
<type>boolean</type>
<required>No</required>
<default>true</default>
<description>On windows computer include Carriage Return.</description>
</argument>
<return>
<type>string</type>
</return>
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="core" basedir="." name="Lucee" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

<property name="version" value="5.3.1.42-SNAPSHOT"/>
<property name="version" value="5.3.1.43-SNAPSHOT"/>

<path id="maven-ant-tasks.classpath" path="../ant/lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>5.3.1.42-SNAPSHOT</version>
<version>5.3.1.43-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 366c49c

Please sign in to comment.