Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cheat sheet generator tweaks, more macros.
  • Loading branch information
Marc Liyanage committed Jan 30, 2010
1 parent 61b26e7 commit 7d14fae
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
51 changes: 47 additions & 4 deletions Marc.xctxtmacro
Expand Up @@ -10,15 +10,15 @@
BasedOn = objc;
IsMenuItem = YES;
Name = "String Literal";
TextString = "@\"<#!statements!#>\"";
TextString = "@\"<#!string!#>\"";
OnlyAtBOL = NO;
},
{
Identifier = objc.log.0arg;
BasedOn = objc;
IsMenuItem = YES;
Name = "NSLog() Call";
TextString = "NSLog$(PreFunctionArgsSpacing)($(InFunctionArgsSpacing)@\"<#!statements!#>\"$(InFunctionArgsSpacing));";
TextString = "NSLog$(PreFunctionArgsSpacing)($(InFunctionArgsSpacing)@\"<#!message!#>\"$(InFunctionArgsSpacing));";
CompletionPrefix = log;
OnlyAtBOL = YES;
IncludeContexts = ( "xcode.lang.objc.block" );
Expand All @@ -32,7 +32,7 @@
BasedOn = objc;
IsMenuItem = YES;
Name = "NSLog() Call 1 Argument";
TextString = "NSLog$(PreFunctionArgsSpacing)($(InFunctionArgsSpacing)@\"<#message#> %@\", <#!statements!#>$(InFunctionArgsSpacing));";
TextString = "NSLog$(PreFunctionArgsSpacing)($(InFunctionArgsSpacing)@\"<#message#> %@\", <#!argument!#>$(InFunctionArgsSpacing));";
CompletionPrefix = log1;
OnlyAtBOL = YES;
IncludeContexts = ( "xcode.lang.objc.block" );
Expand All @@ -49,7 +49,50 @@
c.block.if,
c.block.ifelse,
);
TextString = "$(Statement)$(BlockSeparator)\n\t<#!statements!#>\n";
TextString = "$(Statement)$(BlockSeparator)\n\t<#!statement!#>;\n";
},
{
Identifier = objc.method;
Name = "Method Definition";
IsMenuItem = NO;
BasedOn = objc;
TextString = "$(Declaration)$(BlockSeparator)\n{\n\t<#!statements!#>\n}";
IncludeContexts = ( "objc" );
},
{
Identifier = objc.method.void;
Name = "Method Definition - void no Parameters";
IsMenuItem = YES;
BasedOn = objc.method;
Declaration = "- (void)<#method name#>";
CycleList = (
objc.method.void,
objc.method.generic,
objc.method.nsstring,
);
},
{
Identifier = objc.method.generic;
Name = "Method Definition - Generic Method";
IsMenuItem = YES;
BasedOn = objc.method;
Declaration = "- (<#return type#>)<#method name#>:(<#parameter type 1#>)<#parameter name 1#>";
},
{
Identifier = objc.method.nsstring;
Name = "Method Definition - NSString Return Value";
IsMenuItem = YES;
BasedOn = objc.method;
CompletionPrefix = ms;
Declaration = "- (NSString *)<#method name#>";
},
{
Identifier = objc.method.parameter;
Name = "Method Parameter";
IsMenuItem = YES;
BasedOn = objc.method;
TextString = "<#description#>:(<#type#>)<#name#>";
},

)

File renamed without changes.
16 changes: 8 additions & 8 deletions xctxtmacro2html.xslt
Expand Up @@ -17,6 +17,7 @@
.code {
font-family: monospace;
white-space: pre;
font-size: 9pt;
}

td.shortcut {
Expand All @@ -29,14 +30,14 @@
}

td {
border: 1px solid #aaa;
border: 1px solid #ddd;
}

th {
background-color: #aaa;
background-color: #ddd;
text-align: left;
color: white;
border: 1px solid #aaa;
border: 1px solid #999;
padding-right: 10px;
}

table {
Expand Down Expand Up @@ -68,7 +69,7 @@
<td><xsl:value-of select="string[preceding-sibling::key[1][. = 'Name']]"/></td>
<td class='code'><xsl:value-of select="string[preceding-sibling::key[1][. = 'CompletionPrefix']]"/></td>
<td class='shortcut'><xsl:value-of select="@shortcut"/></td>
<td><xsl:apply-templates select = 'array[preceding-sibling::key[1][. = "CycleList"]]/string'/></td>
<td><xsl:apply-templates select = 'array[preceding-sibling::key[1][. = "CycleList"]]/string' mode='cyclelist'/></td>
<!--
<td class='code'>
<xsl:apply-templates select='string[preceding-sibling::key[1][. = "TextString"]]'/>
Expand All @@ -78,9 +79,8 @@

</xsl:template>

<xsl:template match='array[preceding-sibling::key[1][. = "CycleList"]]/string'>
<xsl:variable name="currentId" select="./text()" />
<xsl:value-of select="//dict[string[preceding-sibling::key[1][. = 'Identifier']] = $currentId]/string[preceding-sibling::key[1][. = 'Name']]"/><br/>
<xsl:template match='string' mode='cyclelist'>
<xsl:value-of select="//dict[string[preceding-sibling::key[1][. = 'Identifier']] = current()]/string[preceding-sibling::key[1][. = 'Name']]"/><br/>
</xsl:template>


Expand Down

0 comments on commit 7d14fae

Please sign in to comment.