I am a student teacher and currently on placement. Along with a lot of teaching, I have to do a mountain of paperwork that requires the use of badly made standard templates.
What I was hoping to do was to use a text editor like drafts to type out my lesson plans etc then export them into the templates that I can then send away.
I’ve seen that there are different tags that can be put into draft templates to insert the first paragraph or a whole draft into a template but I can’t seem to find a way to break up the document more.
I don’t have to use drafts it is just the text editor I use at the moment. I have a Mac also if it can’t be done on IOS.
The end file doesn’t have to be in any specific file format. As long as it is printable from a windows PC. If it can be a word doc then thats a bonus but not a necessity.
The point would be not to use it to fill in an existing template, but to generate a fresh document that matches the layout you require.
Here’s some MultiMarkdown showing how a table would look when the Draft content is converted to HTML. You could trigger a custom Shortcut to convert that into a PDF as @RosemaryOrchard suggested.
… but the tabular layout in the template isn’t simple.
As such, perhaps converting to a more tailored HTML layout would be better?
Here’s what I’m thinking. You could enter the content into your Draft under pre-configured headings; Drafts can even populate a template for you to give you those headings. Then using a custom Drafts action you could extract each section and insert those into some pre-built HTML (contained in the action), which could then trigger the custom Shortcut to create a PDF (again, from the same action), and you could even specify a naming convention and perhaps where to save, or straight to the share sheet.
As an example approach, if you wrote the content in Markdown with your sections labelled as level 1 Markdown headings, you could split the draft content by “#” and then effectively ignore the first line (assume you keep your initial template’s standard order), and then that goes on to populate your HTML content.
Hopefully you know enough about Drafts and Shortcuts to do this yourself, but if you feel that you do need more of a walkthrough example of this let me know and I’ll look at putting something together.
Your certainly right about the mark down table. I have tried it before and it quickly got confusing for me unfortunately.
Your second idea seems like it could work really well! What I have done so far is convert the word doc into HTML and I can identify the points at which each section of text would need to go from drafts. However I don’t know how to code an action in drafts to split up the text by heading and then insert it into the HTML.
If you would be able to help it would be very much appreciated.
Here’s what I put together. I actually think it turned out pretty much complete, but if not, hopefully it will be a solid starting point for you.
First of all here are two Drafts (specifically Drafts 5) actions that are intended to run against an empty draft. They just insert a block of text at the current cursor position.
Next are the two bits of automation that process the content of a templated draft. First is the Drafts action that extracts the data and builds the HTML. Second is the Shortcuts custom shortcut that the Drafts action calls to create and share the PDF. Make sure you have the Shortcuts shortcut installed before you try running the Drafts action.
Shortcuts: HTML2PDF - Make, View, Share - this is what generates the output file. You can tailor this to put the PDF in your preferred destination.
The Drafts action parses the draft content and splits the sections based on the level 1 Markdown headings. It uses the heading and the section content to generate Drafts template tags, which can then be referenced in other places. Once the tags are generated, the HTML is generated using those placeholder tags (I fixed a few formatting issues that came through from the original template, so it should look even cleaner than the original with any luck).
At this point the Drafts action shows a preview. you can disable this once you are happy with the results.
After selecting continue, the Drafts action will trigger the Shortcuts custom shortcut, and will pass in the HTML.
The custom shortcut will convert the HTML to rich text and convert that into a margined PDF. It has to be portrait is the only restriction here. The shortcut includes another preview; again you can disable it if you wish.
Hopefully others will also be able to make use of the principles and general approach to streamline generating other standardised content. I can see it being a good way to produce certificates, reports (like yours), (basic) invoices and the like.
Loved this article. Thanks so much for posting it. Would it be possible for sylumer to convert the thinking behind it into a screen capture movie to show us lesser mortals how we might adapt this technique? I can see it being very useful to a lot of people.
What is it that doesn’t make sense right now from what’s outlined above?
When you say convert the thinking behind it into a screen capture, what do you mean by that? At the moment I think the process is quite clear … but it came from me so that’s hardly surprising that I think that. I’m just trying to get my head around what it is that people might(?) want to see.
Oh, and I am most assuredly a mere mortal; so definitely on the same level as lesser mortals.