Commit 350a2389 authored by santiaago's avatar santiaago
Browse files

add google prettify #83

needed to add a directive and extra code -_-
because angularjs, prettify and boostrap do not work well together..
parent ebc6a7b1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ angular.module('tinygraphs', [
    'tinygraphs.view1',
    'tinygraphs.view2',
    'tinygraphs.version',
    'tinygraphs.holder'
    'tinygraphs.holder',
    'tinygraphs.prettify'
]).
    config(['$routeProvider', function($routeProvider) {
	$routeProvider.otherwise({redirectTo: '/'});
+17 −0
Original line number Diff line number Diff line
'use strict' 

angular.module('tinygraphs.prettify.prettify-directive', [])

.directive('prettyprint', function(){
    return{
	restrict: 'C',
	link: function postLink(scope, element, attrs){
	    element.html(prettyPrintOne(replaceText(element.html())));
	}
    };
});

function replaceText(str){
    var str1 = String(str);
    return str1.replace(/\n/g,"<br/>");
};
+5 −0
Original line number Diff line number Diff line
'use strict'

angular.module('tinygraphs.prettify', [
    'tinygraphs.prettify.prettify-directive'
]);
+12 −2
Original line number Diff line number Diff line
@@ -29,12 +29,21 @@
    <link href="assets/css/examples.css" rel="stylesheet">
    <link href="assets/css/editor.css" rel="stylesheet">
    <link href="assets/css/footer.css" rel="stylesheet">
    
    <script src="//google-code-prettify.googlecode.com/svn/loader/prettify.js"></script>
    <script src="//google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/img/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/img/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/img/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="assets/img/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="assets/img/favicon.png" />
    <!-- use this so that prettify style and boostrap style work together. -->
    <style type="text/css">
      pre.prettyprint {
      border: 1px solid #ccc;
      margin-bottom: 0;
      padding: 9.5px;
      }
    </style>
  </head>
  <body>
    <div class="tinygraphs-browsehappy" ng-include="'partials/browsehappy.html'"></div>
@@ -88,7 +97,8 @@
      <script src="components/version/interpolate-filter.js"></script>
      <script src="components/holder/holder.js"></script>
      <script src="components/holder/holder-directive.js"></script>

      <script src="components/prettify/prettify.js"></script>
      <script src="components/prettify/prettify-directive.js"></script>
      <!-- Bootstrap core JavaScript
	   ================================================== -->
      <!-- Placed at the end of the document so the pages load faster -->