Skip to content

Commit 8e4365e

Browse files
committed
Created Xcode project, added itemizers and code sense additions
1 parent 3444f4d commit 8e4365e

File tree

13 files changed

+2545
-93
lines changed

13 files changed

+2545
-93
lines changed

Code/Itemizers/LTXSectionItem.h

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// LTXSectionItem.h
3+
// Latex
4+
//
5+
// Created by Stefan on 21.04.10.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import <EspressoItemizer.h>
11+
12+
13+
@interface LTXSectionItem : ESBaseItem {
14+
NSString *name;
15+
}
16+
17+
@end
18+

Code/Itemizers/LTXSectionItem.m

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// LTXSectionItem.m
3+
// Latex
4+
//
5+
// Created by Stefan on 21.04.10.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "LTXSectionItem.h"
10+
11+
12+
@implementation LTXSectionItem
13+
14+
- (void)initializeWithCapturedZones:(NSDictionary *)captures recipeInfo:(NSDictionary *)recipeInfo
15+
{
16+
[super initializeWithCapturedZones:captures recipeInfo:recipeInfo];
17+
18+
name = [[[captures objectForKey:@"name"] text] retain];
19+
NSLog(@"captures: %@", captures);
20+
NSLog(@"capture zone: %@", name);
21+
}
22+
23+
- (void)dealloc
24+
{
25+
[name release];
26+
name = nil;
27+
[super dealloc];
28+
}
29+
30+
- (BOOL)transformIntoItem:(LTXSectionItem *)otherItem
31+
{
32+
// Note: the passed argument can actually be any item class, but casting it to this specific class makes it easy to write the transformation code. The default (super) implementation takes care of checking the class, so this is perfectly valid.
33+
if (![super transformIntoItem:otherItem])
34+
return NO;
35+
36+
// Clean up our own old values
37+
[name release];
38+
name = nil;
39+
40+
// Take over the new values from the other item
41+
name = [otherItem->name retain];
42+
43+
return YES;
44+
}
45+
46+
- (BOOL)isDecorator
47+
{
48+
return YES;
49+
}
50+
51+
- (CEItemDecorationType)decorationType
52+
{
53+
return CEItemDecorationDefault;
54+
}
55+
56+
- (NSColor *)backgroundColor
57+
{
58+
return [NSColor yellowColor];
59+
}
60+
61+
- (NSImage *)image
62+
{
63+
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"page_white_go" ofType:@"png"];
64+
NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
65+
[image autorelease];
66+
return image;
67+
}
68+
69+
- (BOOL)isTextualizer
70+
{
71+
return YES;
72+
}
73+
74+
- (NSString *)title
75+
{
76+
return name;
77+
}
78+
@end

CodeSenseLibraries/Latex.xml

+107-29
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,120 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<codesense version="1.0">
33
<set name="net.texasexpat.latex.simple">
4-
<completion string="maketitle" />
5-
<completion string="hline" />
6-
<completion string="newline" />
7-
<completion string="noindent" />
8-
<completion string="medskip" />
9-
<completion string="par" />
10-
<completion string="large" />
11-
<completion string="small" />
12-
<completion string="noindent" />
4+
<completion string="\maketitle" />
5+
<completion string="\hline" />
6+
<completion string="\newline" />
7+
<completion string="\noindent" />
8+
<completion string="\medskip" />
9+
<completion string="\par" />
10+
<completion string="\large" />
11+
<completion string="\small" />
12+
<completion string="\noindent" />
13+
<completion string="\appendix" />
14+
<completion string="\frontmatter" />
15+
<completion string="\mainmatter" />
16+
<completion string="\backmatter" />
17+
<completion string="\listoffigures" />
18+
<completion string="\rightarrow" />
19+
<completion string="\le" />
20+
<completion string="\ge" />
21+
<completion string="\neq" />
22+
<completion string="\forall" />
23+
<completion string="\in" />
24+
<completion string="\notin" />
25+
<completion string="\exists" />
26+
<completion string="\nexists" />
27+
<completion string="\choose" />
28+
<completion string="\infty" />
29+
<completion string="\mathcal" />
30+
<completion string="\Leftrightarrow" />
31+
<completion string="\leftrightarrow" />
32+
<completion string="\item " />
33+
<completion string="\begin{itemize}" />
34+
<completion string="\end{itemize}" />
35+
<completion string="\begin{enumerate}" />
36+
<completion string="\end{enumerate}" />
37+
<completion string="\begin{eqnarray}" />
38+
<completion string="\end{eqnarray}" />
39+
<completion string="\begin{algorithmic}" />
40+
<completion string="\end{algorithmic}" />
41+
<completion string="\STATE " />
42+
<completion string="\gets" />
43+
<completion string="\ENDIF" />
44+
<completion string="\ELSE" />
45+
<completion string="\ENDWHILE" />
46+
<completion string="\ENDFOR" />
1347
</set>
14-
48+
49+
<set name="net.texasexpat.latex.simple.intext">
50+
<completion string="$" />
51+
<completion string="$\rightarrow$" />
52+
<completion string="$\ge$" />
53+
<completion string="$\neq$" />
54+
<completion string="$\in$" />
55+
</set>
56+
1557
<set name="net.texasexpat.latex.functions">
1658
<behavior>
1759
<append-dynamic>
1860
<matched-suffix>(\s*:{)|[^:]</matched-suffix>
1961
<transform-into>{${0:arg}}</transform-into>
2062
</append-dynamic>
2163
</behavior>
22-
<completion string="begin" />
23-
<completion string="end" />
24-
<completion string="textbf" />
25-
<completion string="emph" />
26-
<completion string="textsc" />
27-
<completion string="usepackage" />
28-
<completion string="section" />
29-
<completion string="subsection" />
30-
<completion string="subsubsection" />
31-
<completion string="chapter" />
32-
<completion string="part" />
33-
<completion string="title" />
34-
<completion string="author" />
35-
<completion string="ref" />
36-
<completion string="label" />
37-
<completion string="bibliographystyle" />
38-
<completion string="paragraph" />
39-
<completion string="cite" />
40-
<completion string="usepackage" />
64+
<completion string="\begin" />
65+
<completion string="\end" />
66+
<completion string="\textbf" />
67+
<completion string="\emph" />
68+
<completion string="\textsc" />
69+
<completion string="\usepackage" />
70+
<completion string="\section" />
71+
<completion string="\subsection" />
72+
<completion string="\subsubsection" />
73+
<completion string="\chapter" />
74+
<completion string="\part" />
75+
<completion string="\title" />
76+
<completion string="\subtitle" />
77+
<completion string="\author" />
78+
<completion string="\ref" />
79+
<completion string="\label" />
80+
<completion string="\bibliographystyle" />
81+
<completion string="\paragraph" />
82+
<completion string="\cite" />
83+
<completion string="\usepackage" />
84+
<completion string="\subparagraph" />
85+
<completion string="\input" />
86+
<completion string="\underline" />
87+
<completion string="\overline" />
88+
<completion string="\textit" />
89+
<completion string="\mathbb" />
90+
<completion string="\textnormal" />
91+
<completion string="\text" />
92+
<completion string="\log" />
93+
<completion string="\Delta" />
94+
<completion string="\IF" />
95+
<completion string="\WHILE" />
96+
<completion string="\FOR" />
97+
<completion string="\FORALL" />
4198
</set>
99+
100+
<set name="net.texasexpat.latex.functions.binary">
101+
<behavior>
102+
<append-dynamic>
103+
<matched-suffix>(\s*:{)|[^:]</matched-suffix>
104+
<transform-into>{${1:arg}}{${2:arg}}</transform-into>
105+
</append-dynamic>
106+
</behavior>
107+
<completion string="\sum_" />
108+
<completion string="\frac" />
109+
</set>
110+
111+
<set name="net.texasexpat.latex.functions.binaryalt">
112+
<behavior>
113+
<append-dynamic>
114+
<matched-suffix>(\s*:{)|[^:]</matched-suffix>
115+
<transform-into>{${1:arg}}_{${2:arg}}</transform-into>
116+
</append-dynamic>
117+
</behavior>
118+
<completion string="\underbrace" />
119+
</set>
42120
</codesense>

CodeSenseProviders/Latex.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
<completions>net.texasexpat.latex.simple</completions>
77
<completions>net.texasexpat.latex.functions</completions>
8-
<complete-match>[\?\$a-zA-Z0-9-_\>]+</complete-match>
8+
<completions>net.texasexpat.latex.functions.binary</completions>
9+
<completions>net.texasexpat.latex.functions.binaryalt</completions>
10+
<completions>net.texasexpat.latex.simple.intext</completions>
11+
<complete-match>[\?\$\\a-zA-Z0-9-_\>\-]+</complete-match>
912
</provider>
1013

1114
</codesense>

English.lproj/InfoPlist.strings

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Localized versions of Info.plist keys */
2+

Icons/page_white_go.png

612 Bytes
Loading

Info.plist

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleName</key>
10+
<string>${PRODUCT_NAME}</string>
11+
<key>CFBundleIconFile</key>
12+
<string></string>
13+
<key>CFBundleIdentifier</key>
14+
<string>com.yourcompany.${PRODUCT_NAME:rfc1034Identifier}</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundlePackageType</key>
18+
<string>BNDL</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>CFBundleShortVersionString</key>
24+
<string>1.0</string>
25+
<key>NSPrincipalClass</key>
26+
<string></string>
27+
</dict>
28+
</plist>

Itemizers/Itemizers.xml

+29-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
<?xml version="1.0"?>
22
<itemizer>
33
<recipe name="structural.header.section">
4-
<selector>section > section:capture(name)</selector>
4+
<class>LTXSectionItem</class>
5+
<start-selector>section > section:capture(name)</start-selector>
6+
<end-selector>section > section:capture(name)</end-selector>
7+
<subrecipes>
8+
<include-root-recipes/>
9+
</subrecipes>
510
</recipe>
6-
<recipe name="structural.header.tertiary">
7-
<selector>sub > tertiary:capture(name)</selector>
11+
<recipe name="structural.header.sub">
12+
<class>ESBaseItem</class>
13+
<start-selector>sub > sub:capture(name)</start-selector>
14+
<end-selector>sub > sub:capture(name)</end-selector>
15+
<subrecipes>
16+
<include-root-recipes/>
17+
</subrecipes>
18+
</recipe>
19+
<recipe name="structural.header.subsub">
20+
<class>ESBaseItem</class>
21+
<start-selector>subsub > subsub:capture(name)</start-selector>
22+
<end-selector>subsub > subsub:capture(name)</end-selector>
23+
<subrecipes>
24+
<include-root-recipes/>
25+
</subrecipes>
26+
</recipe>
27+
<recipe name="structural.header.input">
28+
<class>ESBaseItem</class>
29+
<selector>input > input:capture(name)</selector>
30+
</recipe>
31+
<recipe name="structural.header.paragraph">
32+
<class>ESBaseItem</class>
33+
<selector>paragraph > paragraph:capture(name)</selector>
834
</recipe>
935
</itemizer>

0 commit comments

Comments
 (0)