Created
February 23, 2015 17:20
-
-
Save arm5077/839fe379ff8c0612b558 to your computer and use it in GitHub Desktop.
Converts a copy-and-pasted table of emails into readable text.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app="formatApp"> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.min.js"></script> | |
<style type="text/css"> | |
body { | |
font-family: Helvetica, sans-serif; | |
} | |
#export { | |
padding: 5px; | |
border: 1px solid #ccc; | |
font-size:11pt; | |
} | |
#input { | |
width:50%; | |
margin-bottom:30px; | |
} | |
.email { | |
padding:10px; | |
background-color: #ccc; | |
margin-bottom:50px; | |
} | |
</style> | |
</head> | |
<body ng-controller="formatController"> | |
<div>Paste the input here:</div> | |
<textarea id="input" ng-model="input" ></textarea> | |
<div>And you'll see the output here!</div> | |
<div id="export" ng-bind-html="format(input)"></div> | |
</body> | |
</html> | |
<script type="text/javascript"> | |
app = angular.module("formatApp", []); | |
app.controller("formatController", ["$scope", "$sce", function($scope, $sce){ | |
$scope.input = "<p>Some html!</p>"; | |
$scope.format = function(input){ | |
input = input.replace(/\n/g, '</div><div class="email">'); | |
return $sce.trustAsHtml("<div class='email'>" + input + "</div>"); | |
} | |
}]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment