View Single Post
Old 11-27-2015, 12:07 PM   #64
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Hey guys, take a look at Visual Studio's "code snippet" format.

It's xml formatted to contain all relevant metadata plus a "block" that holds the actual code, which in our case would be the script itself. I'll fire up VS and post one so those without VS can see the format. Seems like something similar would be near perfect for sharing scripts with metadata.

Edit: Here's a sample below. As you can see, the file contains all relevant metadata that might be used for browsing or listing. Title, Author, Description, etc, etc. You could click on something like this in Reaper and see all of those details before grabbing or installing a script and the XML code block could hold any kind of code, Lua, whatever... because it also identifies the code in the tags.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>checked</Title>
			<Shortcut>checked</Shortcut>
			<Description>Code snippet for checked block</Description>
			<Author>Microsoft Corporation</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp"><![CDATA[checked
                	   {
                	    CODE GOES HERE
                	   }
                        ]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>
The really cool thing about snippets (unrelated to this) is the shortcut tag. Type the shortcut word or phrase and it will drop the code block in.

Last edited by Lawrence; 11-27-2015 at 12:20 PM.
Lawrence is offline   Reply With Quote