Home Download Buy Blog Forum Support

Textile - show headings using show_overlay

Textile - show headings using show_overlay

Postby mhb on Thu Jan 26, 2012 9:44 pm

Hi

Is there a way to get show_overlay to show textile headings? In a similar way to textmate’s 'go to symbol'?

Thanks
Mark
mhb
 
Posts: 2
Joined: Thu Jan 26, 2012 9:16 pm

Re: Textile - show headings using show_overlay

Postby mhb on Mon Jan 30, 2012 3:33 am

Okay, discovered how to get goToSymbol working for Textile.

Did some reading at the following links about showInSymbolList and symbolTransformation.
http://manual.macromates.com/en/preferences_items.html
http://manual.macromates.com/en/navigation_overview#customizing_the_list.html

The TextMate "Symbol List: Heading" for Textile was missing from the Sublime Textile directory. After tweaking the regex, I ended up putting the following into "Packages/Textile/Symbol List - Heading.tmPreferences".

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>name</key>
  <string>Symbol List: Heading</string>
  <key>scope</key>
  <string>text.html.textile markup.heading.textile</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>1</integer>
    <key>symbolTransformation</key>
    <string>
    s/\s*$//;       # strip spaces
    s/^\s*//;
    s/^(h[1-6])\.(.*)$/$1$2/;
    s/^h1//;        # indent headers
    s/^h2/ /;
    s/^h3/  /;
    s/^h4/   /;
    s/^h5/    /;
    s/^h6/     /;
  </string>
  </dict>
  <key>uuid</key>
  <string>a849a69b-4f44-46f6-afec-030e65224b0f</string>
</dict>
</plist>


Basically I trimmed down the spacing and (naively) replaced the following
Code: Select all
    s/(^(h[1-6])([<>=()]+)?)(\([^)]*\)|{[^}]*})*(\.)/$2/;


with
Code: Select all
  s/^(h[1-6])\.(.*)$/$1$2/;


Cheers
Mark
mhb
 
Posts: 2
Joined: Thu Jan 26, 2012 9:16 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 28 guests