Writing Extensions for GEDitCOM

GEDitCOM is a separate genealogy application available on the Mac app store (hopefully coming soon). GEDitCOM has a lot of the features of GEDitCOM II, but it had to remove various advanced features due to security rules imposed on Mac App Store (MAS) apps.

The extensiblity of GEDitCOM II allowing browser styles and extensions is one power feature that has some limits in GEDitCOM. First, MAS apps are not able to launch Python scripts so any extensions written in Python cannot run in GEDitCOM. MAS apps can only use Internal Scripting or AppleScripting. When using AppleScripting, any feature that "tells" the script to use another application will also fail. Browser styles use internally interpreted commands and therefore mostly work in GEDitCOM.

This section explains how you can write browser styles and extensions that run in both GEDitCOM II and GEDitCOM:

Browser Styles in GEDitCOM

Almost all options used when writing browser styles work in both GEDitCOM and GEDitCOM II. Only a few things are needed to make styles that work in both applications:

Extensions in GEDitCOM

You can write scripts to package in an extension for both GEDitCOM II and GEDitCOM. Scripts that will run in GEDitCOM can only be Internal Scripts or AppleScripts. Virtually all options for Internal Scripts are allowed. If testing reveals something that does not work in GEDitCOM or you just want to change behavior of the script depending on application, you can use the following template:

if #appName$ = "GEDitCOM II"
  -- commends for GEDitCOM_II only
else
  -- commands for GEDitCOM only
endif

This template simply makes use of the #appName$ read-only variable.

If you choose to write AppleScripts that work in GEDitCOM, they are subject to the following considerations:

Documentation for both GEDitCOM and GEDitCOM II

When writing browser styles and extensions that run in both GEDitCOM II and GEDitCOM, it is good practice for the documentation to be appropriate for each application. Here are the steps for application-specific documentation:

  1. The <head> element of the help file should include the line
    <link rel="stylesheet" type="text/css" href="helpType.css">
    
  2. The helpType.css cascading style sheet is now a required file in browser styles and extensions. It is automatically added if one is opened that does not have that file (note that automatically adding this file might trigger a warning the first time you save changes. You can ignore the warning and click "Save"). This file is just a place holder; it should not be edited and it cannot be deleted. When a user views documentation is GEDitCOM II or GEDitCOM, the helpType.css file is replaced by an application-specific version. Any changes you make to that file in GEDitCOM Editor will not be used.
  3. Whenever documentation refer's to the user's application by name, replace the name with the following html code:
    <span class="appname"></span>
    
  4. Any part of the documentation that applies only to GEDitCOM II users should be enclosed in the following html block:
    <span class="IIdocs">Anything inserted here before the closing element
    will be visible only when viewing documentation in "GEDitCOM II"
    </span>
    
  5. Any part of the documentation that applies only to GEDitCOM users should be enclosed in the following html block:
    <span class="ASdocs">Anything inserted here before the closing element
    will be visible only when viewing documentation in "GEDitCOM"
    </span>
    
  6. You can use the "Preview Help In → Browser" to test how the documentation will appear to GEDitCOM II users. Or, you can use the "Preview Help In → Browser for GEDitCOM" to see how it will appear to GEDitCOM users (if a preview triggers a warning that the file has been altered by another application, you can click either button).

Work Flow for GEDitCOM Development

GEDitCOM Editor works best when using GEDitCOM II to write browser styles and extensions. It can directly edit browser styles or extensions in the GEDitCOM II application support folders. When changes are made, they can be tested in GEDitCOM II using the "Save and Run" command (or using "Save" command and then using it in GEDitCOM II).

If you do not have GEDitCOM II, GEDitCOM Editor can also be used to write browser styles and extensions, but the work flow for the development process changes. A typical work flow when developing for GEDitCOM is:

  1. Start by either creating a new browser style or extension or by downloading the one you want to change from geditcom.com and save in any convenient location. Open the new or downloaded file in GEDitCOM Editor
  2. When you are ready to test some new edits, save the changes in GEDitCOM Editor. Next, switch to using GEDitCOM and choose the "Intall Extensions..." menu command. Pick the browser style or extension you just saved for the install (you can overwrite any previous version if asked).
  3. In GEDitCOM, choose the newly-installed browser style or extension from the "Extensions" menu for testing. Note: you cannot test with the "Save and Run" command and you must reinstall every time you need to test changes made in GEDitCOM Editor.
  4. If errors occur, return to GEDitCOM Editor, fix the mistakes, and go back to step #2.

Even if you have GEDitCOM II, the above work flow is the process needed to test that a browser style or extension also works in GEDitCOM (which means you would need to have both applications available for full testing).