Great upgrade Ole. Was well worth waiting for.
Posts made by peterh86
RE: Editorial v1.2 is now up on the Apple App Store... Go get it!
RE: How to share functions between Editorial workflows
Check out sub-workflows. If you have a sub-workflow with a Python script then you can use it in several workflows. Just as you want.
RE: Total beginner
Yes, I agree with rvojta, jump in.
I Google my questions, with python at the start, to find how others do it. First I find a python script that does approximately what I want, using Google or by searching this forum or the extra workflows website. Then I change the script bit by bit, googling all the way. I think python is so complicated that you can't learn it in the usual way and then write scripts from scratch.
RE: .pdf links from a website
Yes, but i can't help in detail. It probably requires a workflow with just a Python script.
Given the webpage address, you'd use
Requeststo get the webpage html, then search for links ending in
Requeststo download the pdfs as well.
Other ways to convert Markdown/HTML to PDF in iOS
I've been experimenting with workflows to convert Markdown/HTML to PDF, using a CSS and wanting to set page breaks. Here's what I found:
Using a cloud service - Docverter
The free services usually have limited features, though Docverter seemed promising. I wrote a workflow to use It, based on Caleb McDaniel's Pythonista script here http://wcm1.web.rice.edu/pandoc-on-ios.html. Docverter supports @page, page breaks, page-break-after:avoid (to keep headings on the same page as the following paragraph) and links in a displayed PDF are live.
Sadly it always lost the last few sentences I sent it, and my Python/internet skills are not good enough to find where the problem is. I found other problems:
- Caleb's script sent the CSS and markdown as two files, but I found this was not reliable. I converted to HTML, with a CSS, so I only needed to send one file. even so, it occasionally failed.
- There are only a couple of fonts available, presumably for copyright reasons, though you can use @fontface to send other font files.
- I couldn't see how to hyphenate, so either the right margin is very ragged, or you justify it and get terrible gaps in the text.
- It doesn't handle images wider that the print area well (does not scale down properly)
Using an iOS HTML converter app
There are many apps to convert HTML to PDF. The support seems to be for CSS2.1, so you can' t use @page but you can use page breaks. Unfortunately all apps seem to have a bug with page-break-before:always and most have a bug with page-break-before:always (insert two page breaks), so most aren't suitable. I used:
- PDF-Converter (Readdle) as described here http://editorial-app.appspot.com/workflow/5660638047109120/vHXf1o0Is1o (in the webbrowser.open, change rhttp to pdfhttp). The top and bottom margins are a bit small for a printed page. And since iOS 7, this only gives me US paper size, which I don't want. I think it is arrogant of a developer not to allow for A4 paper as well.
- PDF This Page (Julian Yap) This is what I use now. The top and bottom margins are better, and you can select US or A4 pages. My workflow for this is here: http://editorial-app.appspot.com/workflow/5789374323097600/pWAw-_K2jfY
Neither of these apps let you add a header or footer, or set the top and bottom margins and you can't hyphenate. Page-break-after:avoid doesn't work and links in a displayed PDF are not live. Images do work well.
So, I'm still looking for the perfect app for this.
RE: Other ways to convert Markdown/HTML to PDF in iOS
Now the best way is to use Ulysses for iPad. It adjusts the width of the whitespace between words and between letters so the PDF looks great; CSS-based PDF converters usually don't do this. And it handles images easily.
Later versions of Ulysses will have an X-callback scheme, so maybe we can send Markdown from Editorial to be converted to PDF.
I don't like the available styles much, so I wrote a workflow so I can edit them on the iPad:
RE: Pandoc flavoured markdown preview
A possible workflow:
- A python script to remove the YAML and convert between Editorial and Pandoc Markdown.
- Call the action
Convert markdown to HTMLor
Convert multimarkdown to HTML
- Add a custom CSS if you want.
- Call the action
Show HTMLto see the preview.
It all happens within Editorial, offline. However I don't know Pandoc markdown, and this might be too simple for what you want. Another however, if you asked then perhaps writing Python is not what you want to do.
Problems with Multimarkdown fenced code
Multimarkdownturned on in settings. I type some fenced code like this:
empty line three backticks code line 1 code line 2 three backticks empty line
The syntax highlighting always shows me a code block, as I expect. But Editorial's preview and the output from the action
Convert Multimarkdownhave two problems:
- I see
code line 1 code line 2all on the same line, because returns (new-lines) are ignored.
- If there is an empty line anywhere in the fenced code block, the fenced code is treated as normal markdown, not fenced code.
These problems are caused by Multimarkdown wrapping the fenced code with
<pre><code>. And if there is an empty line in the fenced code, it puts a
- I see
RE: LaTex In Editorial
... and with
free beer, Editorial would be the greatest text editor in the universe.
This doesn't answer your question, but here's a workflow that uses the iOS app texpad to do LaTeX from markdown: http://editorial-app.appspot.com/workflow/5245394703351808/W5YhtQWbp0g
It's a bit crude, you need to manually paste the LaTeX into texpad, but the result is superb. All done on your iPad.
RE: Would it be possible to use editorial to make a static site generator
I made a workflow to make a static website: http://editorial-app.appspot.com/workflow/6453713958862848/81eiZlBdpKA
This is a onepage website, needs modifying to be multipage.
Also Google for the Python code I based this on: Nicoletta by Roberto Alsina.
RE: generating control characters for printer
Editorial is unicode underneath, so it handles all characters fine, including control characters. The problem is entering the control character, because you can't with the standard iOS keyboards.
There are a number of (free) iOS character map apps that let you select a Unicode character and copy it, so you can paste it into editorial. The character appears in editorial as 2 or 3 tiny letters, like SOH or whatever. I have the app
CharacterMap, but I just noticed that this doesn't seem to work with iOS 8, so I'll need to replace it. Make sure the character map app you get has the ASCII control characters in it, some are just subsets.
Another approach is to find a third-party iOS 8 keyboard app that has control characters, I imagine programmers keyboards might let you type control characters directly into editorial. But I guess programmers don't use control characters much these days.
RE: Is REQUESTS the right approach for what I'm trying to do?
I wouldn't try to write this from scratch, I'd Google for similar code and change it to suit. There is a Python FTP client for Editorial at:
though you might find it hard to see the code if you don't have Editorial.
RE: Editorial Root Folder?
I'm not sure of all this, but here goes:
The iPad drive has a top directory with subdirectories and subsubdirectories and so on, just like a Linux or windows hard drive partition. Each app has one of these subdirectories as its 'root' directory, plus whatever subsubdirectories it creates in there (to store its local files).
I think that when you jailbreak an iPad you can have access to all of these directories.
However, for an unjailbroken iPad, iOS restricts what an app can do outside its 'root' directory. IOS is based around apps, not around files like most other operating systems. This is why you need to 'open in' a file to allow another app to use it. So, the idea of plugging an iPad into a PC, as an external drive, and seeing all the directories in the iPad is foreign to iOS. I think that when you do this, you actually see your photos. All this is for security, and I'm pleased that it works like this.
Maybe iTunes on a PC lets you see all directories, but I have never used this. Also, some iOS file-ttransfer apps let you see the app's file directory and any subdirectories on a PC. For example the app Documents uses WebDAV to present its directories on a PC, where you can read, copy and delete files on the iPad. But only Document's files.
RE: Editorial Root Folder?
I use the scratchpad or a python script in a workflow to run short sequences of Python code to change and list directories, then delete files. I use
os.remove. It's not pythonistic but it gets the job done.
Is this what you mean?
RE: Get file contents of several Dropbox files
You need a python script. Check out python functions
os.walk, or (better to grab your .md files)
glob.glob. You then need a loop to read the files that these functions return.
http://editorial-app.appspot.com/workflow/6453713958862848/81eiZlBdpKA (in the last action)
glob.globto find all .md files in a Dropbox folder, then has a loop to read them and join them together. You could use it as an example and modify it.