Created
November 22, 2013 16:05
-
-
Save jkishner/7602309 to your computer and use it in GitHub Desktop.
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
indent all | |
function actionHere () { | |
var string = op.getLineText(); | |
if (string.charAt(0) == " ") { | |
op.reorg (right, 1); | |
var newline = string.substring(1); | |
op.setLineText(newline); | |
} | |
} | |
var ctheads = 0; | |
op.visitAll (function (headline) { | |
ctheads++; | |
}); | |
ctheads = ctheads - 1; | |
op.firstSummit (); | |
for (var i = 0; i<ctheads; i++) { | |
actionHere (); | |
if (op.hasSubs ()) { | |
op.go (right, 1); | |
} | |
else if (!op.go (down, 1)) { | |
op.go (up, infinity); | |
op.go (left, 1); | |
while (!op.go (down, 1)) { | |
op.go (left, 1); | |
} | |
} | |
} | |
actionHere (); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment