Editorial Workflows

Simple File Transclusion

unlisted 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: It is only the function to insert the contents of another file.

Sample:
Some text

{{./path/to/another.md}}

Some text

---

See also:
http://fletcher.github.io/MultiMarkdown-5/transclusion.html

Shared by: @hals_pg

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8
import editor
import re
import os
import console
import dialogs

rgx = re.compile('\{\{(.+?)\}\}')
current_document = editor.get_text().split('\n')

for num, line in enumerate(current_document):
	if rgx.match(line):
		current_document[num] = editor.get_file_contents(rgx.match(line).group(1), 'dropbox')
	else:
		pass

dialogs.share_text('\n'.join(current_document))