From 5999223c4e651332cd662cbcb54784f24c6e2fcb Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 8 Nov 2011 22:51:04 -0500 Subject: [PATCH] [#5] Added sub/sup support for vars in documentation --- doc/interactive.js | 13 +++++++++++++ doc/manual.css | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/doc/interactive.js b/doc/interactive.js index 1a2bf5e..15baf17 100644 --- a/doc/interactive.js +++ b/doc/interactive.js @@ -49,6 +49,19 @@ jqueryCheck( function() { hljs.highlightBlock( element, ' ' ); } ); + + // quick-n-dirty sub and super script impl (it is by no means perfect) + $( 'var:contains("\\")' ).each( function() + { + var $this = $( this ); + + $this.html( + $this.html().replace( /(\\.*)$/, '
$1
' ) + .replace( /\\_([^ \\]+)/, '$1' ) + .replace( /\\\^([^ \\]+)/, '$1' ) + .replace( /(<\/su[bp]>/, '$1 class="left">' ) + ); + } ); } ); } ); diff --git a/doc/manual.css b/doc/manual.css index 188c614..0223b6f 100644 --- a/doc/manual.css +++ b/doc/manual.css @@ -43,6 +43,27 @@ var { font-family: monospace; } +var div { + position: relative; + display: inline; +} + +var sub, var sup { + font-size: 0.75em; +} + +sup.left { + position: absolute; + left: 0px; + top: -0.75em; +} + +sub.left { + position: absolute; + left: 0px; + bottom: -0.2em; +} + .float { border: 1px solid #babdb6; padding: 0px;