Editorial Workflows

Fountain Preview

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Shows an HTML preview of Fountain documents. The first time the workflow is run, the `screenplain` module (by Martin Vilcans) is downloaded from GitHub, which is then used to do the conversion.

Shared by: @olemoritz

Comments: Comment Feed (RSS)

linuz90 — 02 Jun 2014
This doesn't work anymore, is there an alternative?
other_other — 10 Jun 2014
Ran into same problem when trying to hack it together with the recent sidebar previews. Outside my limited coding ability to fix or rewrite from ground up.
anonymous — 23 Jul 2014
This worked great for me, but on the iPhone the preview is zoomed in. iPad it looks great. Is there a way to adjust size?

+ Add Comment

Workflow Preview
Check if a file is open... ?
Run the block if
File Name
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
No Document Selected
…End If
Run Python Script ?
Source Code
import editor
import workflow

try:
	import screenplain
except ImportError:
	print 'Installing screenplain module (this is only required once)...'
	import urllib
	import zipfile
	import shutil
	import os
	
	url = 'https://codeload.github.com/vilcans/screenplain/zip/master'
	urllib.urlretrieve(url, 'screenplain.zip')
	with zipfile.ZipFile('screenplain.zip', 'r') as z:
		z.extractall()
	target_dir = os.path.join(editor.get_workflows_path(), 'screenplain')
	shutil.move('screenplain-master/screenplain', target_dir)
	os.remove('screenplain.zip')
	shutil.rmtree('screenplain-master')
	import screenplain
	print 'Done.'

import screenplain.parsers.fountain as fountain
from screenplain.export.html import to_html
from StringIO import StringIO
s = StringIO(editor.get_text())
screenplay = fountain.parse(s)
output = StringIO()
from screenplain.export.html import convert
convert(screenplay, output, bare=False)
html_out = output.getvalue()
workflow.set_output(html_out)
Show HTML ?
HTML
Input
Title
Fountain
Base URL
None