changeset 1190:db7d31f4089a

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 23 Feb 2018 15:48:15 -0700
parents 73d754b1889f
children dada70cb57c1
files src/luan/host/Util.luan src/luan/modules/parsers/LuanToString.java
diffstat 2 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
diff -r 73d754b1889f -r db7d31f4089a src/luan/host/Util.luan
--- a/src/luan/host/Util.luan	Fri Feb 23 01:40:04 2018 -0700
+++ b/src/luan/host/Util.luan	Fri Feb 23 15:48:15 2018 -0700
@@ -1,10 +1,10 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local do_file = Luan.do_file or error()
+local stringify = Luan.stringify or error()
 local Io = require "luan:Io.luan"
 local String = require "luan:String.luan"
 local lower = String.lower or error()
-local encode = String.encode or error()
 local Hosting = require "luan:host/Hosting.luan"
 
 java()
@@ -22,9 +22,7 @@
 function Util.write_password(domain,password)
 	local dir = Hosting.sites_dir..lower(domain)
 	Io.schemes.file(dir.."/info.luan").write_text( %>
-return {
-	password = "<%=encode(password)%>"
-}
+return <%= stringify{password=password} %>
 <%	)
 	local sha1 = MessageDigest.getInstance("SHA1").digest(password.getBytes())
 	local encoded = Base64.getEncoder().encodeToString(sha1)
diff -r 73d754b1889f -r db7d31f4089a src/luan/modules/parsers/LuanToString.java
--- a/src/luan/modules/parsers/LuanToString.java	Fri Feb 23 01:40:04 2018 -0700
+++ b/src/luan/modules/parsers/LuanToString.java	Fri Feb 23 15:48:15 2018 -0700
@@ -35,7 +35,9 @@
 			return;
 		}
 		if( obj instanceof String ) {
-			toString((String)obj,sb);
+			sb.append( '"' );
+			sb.append( Luan.stringEncode((String)obj) );
+			sb.append( '"' );
 			return;
 		}
 		if( obj instanceof LuanTable ) {
@@ -49,12 +51,6 @@
 		sb.append( '>' );
 	}
 
-	private void toString(final String s,StringBuilder sb) {
-		sb.append( '"' );
-		sb.append( Luan.stringEncode(s) );
-		sb.append( '"' );
-	}
-
 	private void toString(LuanTable tbl,StringBuilder sb,int indented) throws LuanException {
 		List list = tbl.asList();
 		Map map = tbl.rawMap();