Redefine Outline files for Notepad++

 For others moving from NoteTab to Notepad++, you can defined a User-Defined language for outline files, so you can hide and unhide (fold and unfold) individual entries. This is the important part of the NoteTab functionality for outline files.

I’ve added an end-of-outline-entry symbol “End=Entry” that should appear at the end of each entry. I’ve also written a migration program in PHP to insert these end-of-outline-entry symbols automatically into outline files (.otl). I’m using the “.out” extension for the output of this program. These .out files will be “outline” files in Notepad++.

Here is the migration program:

 

<?php

//--------------------------------------------------------------------//
//		Program to migrate .otl files to .out files
//		Springtime Software, David Spector, 10/3/19, public domain.
//--------------------------------------------------------------------//

define("NL","
");
$FileName=GetGetArg();
$PathIn="$FileName.otl";
$PathOut="$FileName.out";
$C=file_get_contents($PathIn,true);
$Lines=explode(NL,$C);

// Delete two header lines
array_shift($Lines);
array_shift($Lines);

$firstLine=true;
$bloat=0;
foreach ($Lines as $n=>$Line)
	{
	$R=preg_match('@^H=@',$Line,$F);
	if ($R && !$firstLine)
		{
		array_splice($Lines,$n+$bloat,0,"End=Entry");
		++$bloat;
		}
	$firstLine=false;
	}

// Terminate last entry
array_splice($Lines,$n+$bloat+1,0,"End=Entry");

$C=implode("\n",$Lines);

$BytesOrFalse=file_put_contents($PathOut,$C);

function GetGetArg()
	{
	foreach ($_GET as $ArgName=>$ArgVal)
		{
		return $ArgName;
		} // Each expected arg
	} // GetGetArg
?>

 Enjoy.


Login or Signup to post a comment

Create a new topic

Start a new topic

Aid4Mail is a trademark licensed to Fookes Software Ltd. Fookes is a registered trademark of Fookes Holding Ltd. All other trademarks and service marks, both marked and not marked, are the property of their respective owners.