Post-Processing on the Mac

From DPWiki
Jump to: navigation, search
Attention yellow.png Warning

Much of the information in this article is outdated. If you have the knowledge and experience to update it, please do so, and remove this warning when you feel the information is up-to-date. Sharon (talk) 17:33, 2 February 2017 (EST)


Guiguts

Guiguts is able to run on Mac OS X. Installing it is fairly lengthy, but there are step-by-step instructions, written by dcortesi, here. Advantages of GuiGuts include its rewrapping capability, which understands DP's poetry and block quote markup; lots of built-in checks such as word-frequency and scannos; tailor-made handling of footnotes, page numbering etc.; ASCII table formatting; and HTML autogeneration. It also provides a graphical interface for Gutcheck, Jeebies, Tidy etc., for those who don't like using the command line. PPers who use GuiGuts on Mac OS X and are willing to talk others through installation hang out in this thread in the forums.

Not using GuiGuts

Some PPers prefer not to install GuiGuts. It is still necessary to install GutCheck, and Jeebies (from the same site) is also a good idea. You will run these from the command line, in Terminal.app (which is found in the Utilities subfolder of your Applications folder).

Text Editors

Even if you do use GuiGuts, it is often useful to have another text editor, particularly one that will highlight syntax when you are working on the HTML version. Apple's TextEdit isn't a good idea, since it can't handle regular expressions, and it will try to save your file as RTF if you give it half a chance. Good editors include

  • SubEthaEdit (the older free version is fine). It highlights HTML and CSS syntax (among others), includes a very useful HTML previewer, has a drop-down menu that will jump you to headings and anchors in your document, and its Search has a "Find All" button that gives you a window where you can quickly scan your eye over all instances of your search term in the document. Its regular expressions lack the uppercasing and number-adjusting features of GuiGuts however, and it also doesn't rewrap. It can convert the file encodings, and line-endings (although there are faster ways to do the latter). SubEthaEdit is also a "collaborative text editor", i.e. several users connected via the internet can work on a document simultaneously. One day we may try this as a form of Gropping.
  • BBEdit is a bit expensive, but it is one of the premier Mac text processors. Its features include "grep pattern matching, search and replace across multiple files, function navigation and syntax coloring for numerous source code languages, FTP and SFTP open and save, AppleScript, Perl and Mac OS X Unix scripting support, glossary support, and a complete set of HTML tools." (from the website). It will handle rewrapping, though you have to do it manually to skip poetry and blockquotes. (Or, you can make an AppleScript to do it for you.) It will also change line endings on the fly. You can run gutcheck and jeebies from within BBEdit, and it has it's own HTML Tidy command.
  • BBEdit's free cousin TextWrangler has a subset of BBEdit's capabilities, but still includes HTML syntax coloring, regular expressions, on-the-fly file format changes. It does not have the nifty HTML tools like link checking, syntax checking or HTML Tidy that BBEdit has.
  • TextMate (not free) is a highly-functional text processor, with extensions and updates coming rather rapidly. For DP work, it features HTML syntax coloring, line-ending and character-set encoding changes on save, HTML preview, regular expressions, code completion, etc. It also is scriptable and programmable; one can also record macros. TextMate uses the online W3C validator for HTML syntax checking.
  • MacVim (free) perfect if you're coming from Unix/Linux, and are used to vim or vi. Probably difficult to adapt to when you don't know vim from other platforms. All kind of syntax highlighting.

HTML Tidy

You are expected to address any errors or warnings found by the HTML Tidy program. Allowing it to tidy your file is generally discouraged: your code should be legible (which Tidy output from default settings isn't) and preferably wrapped the same as your text version. However, it can be very useful to tidy small sections of code, such as tables or nested lists. For this, the Mac OS X program TidyService is helpful. You can just select a chunk of your code, and choose Tidy Markup from the services menu in whatever editor you are using. You should make a TidyService.conf file containing

doctype: strict
enclose-block-text: yes
enclose-text: yes
indent: auto

and place it in your home directory. Rather annoyingly, TidyService sends its errors and warnings to Console.app, so if you're checking the whole file you might want to have that open and use Undo to revert the changes to your code. But I mainly use it for tidying small sections such as tables, for which its indentation is really helpful.

Page-Image Viewers

  • Apple's Preview.app (in your Applications folder) works perfectly well. If you select all the page images at once and open them in Preview, they will open in a single window with a drawer at the side showing thumbnails. This helps you to scroll to the image you want, and also to cast your eye down looking for missed thought breaks. GuiGuts can be configured to open the page image in Preview.
  • GraphicConverter (see below) can also be used as your page image viewer. If you press cmd-rightarrow when you have one page image open, it will close it and open the next image in the folder. GuiGuts can also be configured to use this.
  • If you set your Finder windows to View As Columns then you can look at thumbnails of your images without having to open them in Preview. This is useful if you're just scanning for top-of-page line breaks and missing thought breaks.
    If this doesn't seem to work, when you're in a window with images, go to View > Show View Options and make sure Show Preview Column is ticked. When you have an image selected, then a column should appear to the right with a thumbnail of the image. You may have to click on the disclosure triangle to show it.
  • display from ImageMagick (free for MacOSX), handles all formats. The convert program can create G4 TIFF files (smaller than PNG) by using the option -compress group4.

Processing Illustrations

  • GIMP is free, and runs on Mac OS X under X11 (which you will already have installed if you're using Guiguts).
  • GraphicConverter is shareware.
  • ImageMagick see above

Both of these are powerful image manipulation programs. GraphicConverter also can batch process images (more useful if you're interested in Content Providing). GIMP might too, but only if you're good at scripting. (?) The Guide to Image Processing includes instructions on using GIMP.

For PNG illustrations, you can save on filesize by crushing. PNGCrusher is a nice (free) drag-and-drop version for those who dislike using the command line.

Browsers

It's a very good idea to view your HTML versions in as many browsers as you can. Such as Safari, Firefox, Opera ... and the (no longer supported) mac version of IE, if you still have it. (You can still get it from Download.com if you really want it.) Also, use the Submit your Project for Preview thread to ask Windows users to tell you if they see anything amiss. This is important, as IE6 for windows can behave strangely.

Uploading the project

Line endings

You should change the line-endings to Windows line endings, i.e. \r\n, rather than mac (\r) or unix (\n).

  • If you installed the Apple Developer Tools (i.e. there's a folder on your HD with a picture of a hammer on it, labelled "Developer" -- you'll definitely have it if you're using GG) then you already have command-line unix2dos. Just type unix2dos myfile.txt in a Terminal window (after going to the correct folder).
  • Your text editor may be able to change the line endings for you.
  • If you're using command-line zip, it'll convert line endings for you if you use the -l option. Be careful only to apply this option to files that actually contain real linebreaks (such as .txt and .html), and NOT to illustrations! (so, for example, you can do zip -lrv9 myfile.zip myfile.txt myfile.html; zip -rv9 myfile.zip images/).

Removing hidden files

There is often Mac OS X hidden file called .DS_Store, that isn't wanted when you upload your project. To remove it, in Terminal, type the following:

cd /dp/pp/bookname
rm .DS_Store
cd images
rm .DS_Store

zip

You'll need to upload projects as a zip file.

  • If you installed the Apple Developer Tools (i.e. there's a folder on your HD with a picture of a hammer on it, labelled "Developer"—you'll definitely have it if you're using GG) then you already have command-line zip. Just type (for example) zip -rv9 myfile.zip myfile.txt myfile.html images/.
  • If you're using any form of DropZip (in the StuffIt family), set your preferences to "Ignore Finder desktop files." Invisible files such as DS_Store will be left out of your zip file.