Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-01-29 19:24:26

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 75

Textpattern bundle for TextMate 2

Hi Destry, … Hi Guys

I didn’t read this whole thread, but this is just to let you know that textile is shipped by default in Textmate2 and maybe the same is true for TM1 as well. ( It just isn’t enabled)

Go to Textmate > Preferences and select Bundles.
This will present you with a list of Bundles, that you want to be enabled in your Bundle Editor.
You click select the Textile Bundle and now you can use it as a document / file Type and it will appear in your Bundle Editor.

In TM1 it was easy to share and install 3rd party bundles, because you could drag your custom Bundle out of the Bundle Editor and ship it to others.
Then double clicking it would automatically install it as a 3rd party bundle in the Bundle Editor. This however no longer works in TM2.
From now on, you can customize this bundle if you wish so, by going to Bundles>Edit Bundles. As you might notice many of the commands and snippet have been changed over to use Ruby, which is a pain in the A.

As far as my own TP Bundle goes, it did not have Textile as far as I can remember.
I do not support the Bundle anymore.
I am not very satisfied with TM2, all my commands do not work.
I recommend to use TM1 which is still sold on the website.

regards, marios.

Last edited by marios2 (2021-01-30 04:12:20)

Offline

#2 2021-01-30 15:09:15

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

marios2 wrote #328402:

textile is shipped by default in Textmate2

Yes, I’m aware. The problem with the standard Textile bundle, however, is that it does not recognize important, contemporary Textile syntax that we (at least I) use in Textpattern, such as block code, endnotes, advanced tables, and so on. The standard grammar also does not provide scopes for specifically targeting inline elements, like embedded code, rather it treats them all the same, as italic. :/

you can customize this bundle if you wish so, by going to Bundles>Edit Bundles.

Yes, the bundles editor is valuable for editing standard bundles and developing new bundles, whether from scratch or via duplication of a bundle from source.

Editing standard bundles is fine if you don’t expect to share the result, because the product of editing them is just delta files, which are not very useful for sharing.

As you might notice many of the commands and snippet have been changed over to use Ruby, which is a pain in the A.

I never bothered looking at all this in the previous version, so I can’t say what it was like, but I take your meaning that it was easier. ;)

In TM1 it was easy to share and install 3rd party bundles, because you could drag your custom Bundle out of the Bundle Editor and ship it to others. Then double clicking it would automatically install it as a 3rd party bundle in the Bundle Editor. This however no longer works in TM2.

This is still pretty easy in TM 2. Maybe not as easy as dragging, but doable. The key directory where delta files and other customized bundles are written to and read from is:

~/Library/Application\ Support/TextMate/Bundles/

When you edit a standard bundle, delta files magically appear there. When you create a bundle from scratch via the editor, same. If you duplicate a bundle from source (copy, fork, clone, whatever) and put the duplicate in that directory, TextMate reads it and all the features appear in the app as expected. If it’s for a language, you want to turn off the standard language in preferences so you don’t have duplicates in the menus confusing you.

I chose to create a new Textile bundle, called ‘tWriter’, initially copied from the standard, and extended the grammar to account for more Textile syntax, as one of many modifications I’m making to the bundle. I also included two custom themes modelled after iA Writer’s light and dark presentation, because that’s the aesthetic I want when using TextMate to write web articles destined for Textpattern.

In fact, the tWriter bundle was conceived and developed for very specific use, as hard as that may be for users of code editors to understand; which is, to replicate the iA Writer experience, but for Textile instead of Markdown. It works fine on it’s own as an extended Textile bundle and theme provider. I’m happy with that.

But I’m even musing over the interesting possibility of converting TextMate to a veritable Textile editor for writers, as iA Writer is but supporting Markdown. In other words, change the menus, the chrome, the features, everything, but in TextMate’s own flexible way via bundles. This would leave all code editing features out entirely, as well all the language bundles not relevant anymore. (Nota, it’s easy to reset TextMate to default install conditions by clearing out a few key places. Just need to save your custom bundles aside somewhere.)

I think that would be an interesting exercise to see how close one could get. The most difficult part, that I certainly could not do, would be coding the prose-specific functionality that iA Writer provides, like focus mode, parts of speech highlighting, and style checker.

I imagine each of these would be created as their own bundle and added that way, much like Txp plugins. The menu changes, and so forth should already be possible by what core bundles exist.

Like I said, though, that’s just curious musing. I’m happy with my tWriter bundle.

I do not support the Bundle anymore. I am not very satisfied with TM2, all my commands do not work. I recommend to use TM1 which is still sold on the website.

Would you mind making the bundle available? I suspect it could be made to work, though I would not bother looking at it until I had other tasks checked off my to-do list. If anything, it might give insights as to how to create a new TM 2 language bundle for .txp files. If you’re not on GitHub, I could start a repo for it. I think such a bundle would be useful for Textpattern theme package development, especially.

Last edited by Destry (2021-01-30 15:30:11)

Offline

#3 2021-01-30 15:36:40

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

Destry wrote #328421:

Would you mind making the bundle available? . . . I think such a bundle would be useful for Textpattern theme package development, especially.

On the other hand, a TextMate bundle for .txp files could be obsolete soon.

I guess it would just depend on where people like to manage their theme packages.

Offline

#4 2021-01-30 17:15:01

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 75

Re: Textpattern bundle for TextMate 2

Destry wrote #328421:

Would you mind making the bundle available? I suspect it could be made to work, though I would not bother looking at it until I had other tasks checked off my to-do list. If anything, it might give insights as to how to create a new TM 2 language bundle for .txp files. If you’re not on GitHub, I could start a repo for it. I think such a bundle would be useful for Textpattern theme package development, especially.

Yes, Destry, … I can do that. I Just have to search for it on some old disks that I have. This will take a few days though. In the meantime let me read this thread through, …

rgrds, marios

Last edited by marios2 (2021-01-30 17:17:42)

Offline

#5 2021-01-30 21:08:42

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 75

Re: Textpattern bundle for TextMate 2

Ok, so I finally figured out how to export a bundle. You open the bundle editor and in the left bundle pane you command click on the bundle you wish to export and voila.
Now double clicking on the bundle should basically install it in your bundle editor.

( TM has become so cryptic and many features are hidden under the hood )

Here is the file for everyone to experiment.

( I have added a few snippets that are useful for tag generation )

BTW , great work there Destry, with the Textile Plugin.

rgrds, marios

Last edited by marios2 (2021-01-30 21:11:16)

Offline

#6 2021-01-31 13:15:38

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

marios2 wrote #328431:

open the bundle editor . . . command click on the bundle you wish to export.
Now double clicking on the bundle should install it in your bundle editor.

Good find.

It took me a while to figure out how to create a new bundle from the editor, or a bundle item. There’s no + or Create New Bundle button to make it clear, not even a clear action in the main menu. The trick, in fact is just Cmd + N, which is no different than starting a new file when not in the context of the bundle editor, but you have to be in the editor context to bring up the Create New Item control.

The bad default usability jives with the sorry state of documentation, which is deplorable. It’s one of those projects where someone needs to independently write docs for the application (and I don’t mean in the TextMate wiki, which hasn’t been touched since 2012). That would be a popular website. Fill it full of advertising and you might get rich. Then again, I don’t think TextMate is as popular as it once was. :/

That said, TM works. Just have to know how to grab the bull by the horns. And that you can customize it however you want is still a boon on the market. Though I don’t really know what comparisons to make with competing text editors anymore. I stopped caring about code editors long ago.

Here is the file for everyone to experiment.

Thanks for digging it up. (Curious website, that File Bin. A time-limited service. Kinda cool.)

great work there Destry, with the Textile Plugin.

Still work-in-progress, but I’ll share it when I get there. I’m still getting my head around what scopes are available and how to write clever regular expressions.

Last edited by Destry (2021-01-31 13:26:52)

Offline

#7 2021-01-31 15:09:38

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

marios2 wrote #328431:

Here is the file for everyone to experiment.

I just loaded it and it seems to work fine. I didn’t try double clicking the package; rather, I just unzipped the bundle and move the bundle to the custom working directory and everything appeared as it should.

The only problem I see so far, Marios, is that many of the key combinations for your menu actions are not unique. That would have to be fixed, but I’ve not looked into defining key combinations before, so I wouldn’t know what to suggest. I don’t know where to conveniently look to see what key combinations are already used by the application, etc. My advice would be, anywhere you can’t create a unique key combo for a command, just don’t provide one. Make users have to use the menu instead.

I’m going to look at your scopes and regex a while, because that’s what interests me at the moment.

Progress!

===

Addendum:

I also notice in your grammar that you define file types as: .txpml, .txfml, .txaml, .html

The Textpattern tag syntax is recognized fairly well (probably need a custom theme to match your scopes better), but the HTML syntax is not recognized at all (I tried various standard themes). And we definitely want to add .txp, which is what is used in the Txp theme packages.

Seems to me the only file type you need to define is .txp. Then we add a custom theme in the bundle for Textpattern use that also recycles HTML scopes from the existing HTML language grammar.

Along the same lines, I don’t know if by defining a file type as .txp it conflicts with your scopes namespace (whatever it’s called), for example:

variable.attribute.value.known.txp

But if that does conflict, then I would change the namespace to ‘textpattern’, for example:

variable.attribute.value.known.textpattern

Again, I think it would be good to get this into a repo where it’s easy to get eyes on it and make changes productively. That way people can clone it from the repo directly to TextMate’s working directory and make easy updates as changes are made.

2 cents

===

Addendum 2:

Your grammar file has an odd space in the name, Textpattern .tmLanguage

I find it helps me get a better handle on bundles over all by looking directly in packages on disk as well as in the editor; especially since the directory names in the editor don’t exactly match with how they’re named on disk, which confused the hell out of me for a while.

~/Library/Application\ Support/TextMate/Bundles/

Last edited by Destry (2021-01-31 15:53:13)

Offline

#8 2021-01-31 19:14:00

marios2
Member
From: Germany
Registered: 2019-07-31
Posts: 75

Re: Textpattern bundle for TextMate 2

Destry wrote #328443:

I just loaded it and it seems to work fine. I didn’t try double clicking the package; rather, I just unzipped the bundle and move the bundle to the custom working directory and everything appeared as it should.

Syntax hilighting and commands don’t!

The only problem I see so far, Marios, is that many of the key combinations for your menu actions are not unique. That would have to be fixed, but I’ve not looked into defining key combinations before, so I wouldn’t know what to suggest. I don’t know where to conveniently look to see what key combinations are already used by the application, etc. My advice would be, anywhere you can’t create a unique key combo for a command, just don’t provide one. Make users have to use the menu instead.

Textmate follows the general guidelines of the MAC OS Universe for key combinations in general.
(What this usually means is, that the key combinations are basically the same, regardless what Application you use. I remember, there was a TextMate cheat sheet for those. My suggestion is, to check the HTML bundle, and have a look, how those are handled there.
In case there is the same key equivalent ( or tab trigger ) assigned to two bundle items, TM will present you with a pop-up menu to select/click.

I’m going to look at your scopes and regex a while, because that’s what interests me at the moment.

For the regex problem, may be “this” would help? ( I mean, just as a reference )

To test a regular expression on a txp sample form or page just do cmd F and in the pop up box tick the regular expression option and then left bottom click on find all.

I also notice in your grammar that you define file types as: .txpml, .txfml, .txaml, .html

txpml was meant for pages, txfml for forms and txaml for code in articles. ( But this can basically go out of the window,.. agree)

The Textpattern tag syntax is recognized fairly well (probably need a custom theme to match your scopes better), but the HTML syntax is not recognized at all (I tried various standard themes). And we definitely want to add .txp, which is what is used in the Txp theme packages.

Well, I don’t know exactly. It did work with TM1. maybe this is what injections are for. But what you basically want, is a pattern matching that catches all the word boundaries, for example the beginning and the end of certain words. (b stands for boundary)
For instance \bcat\b will match the word cat but not cats.

Seems to me the only file type you need to define is .txp. Then we add a custom theme in the bundle for Textpattern use that also recycles HTML scopes from the existing HTML language grammar.

Exactly. This is how it is supposed to work, if you include the namespaces.

Again, I think it would be good to get this into a repo where it’s easy to get eyes on it and make changes productively. That way people can clone it from the repo directly to TextMate’s working directory and make easy updates as changes are made.

Agreed.

Your grammar file has an odd space in the name, Textpattern .tmLanguage

Good catch.

I find it helps me get a better handle on bundles over all by looking directly in packages on disk as well as in the editor; especially since the directory names in the editor don’t exactly match with how they’re named on disk, which confused the hell out of me for a while.

I have never been able to find those file on disk using the operating system, not even with TM built-in file browser. I guess they are only visible within the shell.

In general, I would recommend to use the old XHTML or markdown bundle as a Template for the language grammar, since the HTML starts with injections and I have no Idea what those are and how to configure them.
Basically, you want to include the namespaces for php, css, html, js and maybe also for xml at the beginning.
( Also you need a pattern matching for short codes and custom short codes like you have with

<if::article_id>

)

It also would make sense to use the Bundle Development Bundle to use all the plist code snippets and so on.

I have noticed, that the html bundle contains variables in the form of $2, … I wonder what those are.

BTW, one small question, do you have your commands working in TM2? In my installation none do.

rgrds, marios.

Last edited by marios2 (2021-02-01 19:36:36)

Offline

#9 2021-02-01 07:58:22

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

I think we need a forum moderator to break this thread off at here to a new thread for ‘Textpattern bundle for TextMate 2’.

Offline

#10 2021-02-01 08:19:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,593
Website GitHub Twitter

Re: Textpattern bundle for TextMate 2

Destry wrote #328454:

I think we need a forum moderator to break this thread off at here to a new thread for ‘Textpattern bundle for TextMate 2’.

done


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#11 2021-02-01 09:18:20

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

marios2 wrote #328449:

For the regex problem…

lol. Wow, thanks. ;)

pattern matching… catches all the word boundaries, for example the beginning and the end of certain words. (b stands for boundary). For instance \bcat\b will match the word cat but not cats.

Thanks for that bit of insight. That might help me with a different objective I have with trying to filter for wrapping Textile punctuation.

do you have your commands working in TM2? In my installation none do.

I have only tried a few by clicking the action from the menu. I don’t try the key commands because so many are the same for different actions that I don’t think they would work like that anyway.

Examples:

This works…
Bundles > Textpattern > Tag Automation > Attribute Name

This seems to work, though it’s not the result I expected (I’m thinking contents lists at tops of articles)…
Bundles > Textpattern > Tag Automation > Generate TOC

It just seems to wrap every line in li tags.

This kind of works…
Bundles > Textpattern > Navigation Commands > Go to Txp Tag

I thought it would open the tag reference page for that tag, but it just opens a window called ‘Currently Active Tags’ with nothing in it. The plurality on ‘tags’ there confuses me, for one thing, when the action is singular.

This does not work…
Bundles > Textpattern > Tag Automation > Insert Open/Close Tag with Current Word

It gives a pop up window…

Failure running “Insert Open/Close Tag with Current Word”.

Insert Open/Close Tag with Current Word:10: syntax error, unexpected :, expecting keyword_then or , or ; or \n when single_no_arg: <#{tag} />

Insert Open/Close Tag with Current Word:11: syntax error, unexpected keyword_when, expecting end-of-input when single: <#{tag} $1/>

There are a lot of menu actions, though. I don’t know what most of them are for. I guess those would be described in the documentation, though I have not looked there yet.

So, I think a lot of the actions may not be very intuitive at first, or may not even be necessary against how things can be done in Txp these days. (For example, I can easily create custom ToCs with soo_toc plugin and a shortcode, so just targeting short-tags would be the aim, I’d think.)

It’s a little tedious, in fact, to find a specific action in the menu. I think unless someone had memorized all working key combinations, they would just type tag syntax rather than use any actions. But it just depends… maybe you want to whittle them down to a few really important actions instead of every possible thing. And probably want to avoid too many submenus, or any submenus. ;)

This is what I did in my Textile bundle. I made the assumption that people using TextMate to write Textile articles for Textpattern would already know how to use most syntax like breathing, so I removed all the needless 20 or so actions except four, and I’d like to add a few new ones for advanced tables and endnotes, but I’m not there yet.

Last edited by Destry (2021-02-01 20:10:04)

Offline

#12 2021-02-01 09:18:55

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,742
Website

Re: Textpattern bundle for TextMate 2

colak wrote #328455:

done

Thankie!

Offline

Board footer

Powered by FluxBB