iainc / iA-Writer-Templates

Preview, create PDFs, and print documents in your own style with templates in iA Writer.

Home Page:https://ia.net/writer/templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Override metadata

robsonsobral opened this issue · comments

Hi!

I'm not sure this is the right place to open a feature request. Please, forgive me if I'm at the wrong place.

Can you, please, allow us to override data-title, data-author and data-date?

My suggestion:


---
title: "foo"
author: "bar"
date: 2016-07-07

---

It's important that the date follows an international standard.

Thank you!

This is a right place for a feature request! We’d like to do support metadata for templates in a future update.

I second that. I love that you support MultiMarkdown – but then please do support its meta tags, too!
I use MMD's meta tags Title, Author & Date in all of my documents and I'd love to build my own iA Writer template where I can reference to this MMD meta data.
If this is implemented I'll pay the €10 (currently I'm testing the 14-days demo version).

I was wondering whether there was any update on this... are you still considering improving iA Writer Templates or is this going the way of the iA Writer Pro? (I sure hope it doesn't...)

Or if templates are going to stay but no new features to be added, I'll invest the time to try to hack "it in by extracting metadata from data-document on ia-writer-change"...

P.S. we need something like this to put in addresses for our letters...

@mb21 Our next release isn't focused on templates. We still intend on improving them and their interaction with metadata though. They aren't going anywhere and will be more flexible in the future.

@mb21 P.S. You can currently use the <address> element and style that differently in your template's CSS:

screen shot 2017-07-05 at 18 14 34

@onebigclownshoe thanks! especially with CSS-pseudo-elements this seems to work quite well. We'll have to change our design a bit though and move the address down vertically below the header...

Any news on this one?

We'll be looking into a template-focused release next year. Currently we're focused on iA Writer 5 for Mac.

I could just about bear to use sentence title case in a file name, but I’m not able to put a colon on the title page because it’s not allowed in the file name, so I’d really like to see this.

Adding more custom meta like [data-meta="subtitle"] would be 👌

So is there currently a way to set metadata to appear in an exported PDF with iA Writer, specifically at least title and author? Thanks!

@zyv It is not possible to use MultiMarkdown metadata for this yet, no. But you can use the data- attributes for these specific items in your template.

I suggest a workaround until the feature is added:

  1. Set CSS-variables in a style-tag in your Markdown document.
#variables
<style>
  :root{
    --example: "information of choice";
  }
</style>
  1. Add a tag with a special class or id in the template.
    <span class="example"></span>

  2. Add the content of the variable via CSS.

.example{
  content: var(--example);
}

The result will be:
<span class="example>information of choice</span>

I hope this could help someone.

Some good news: it’s possible to override both title and author since iA Writer 6.0. Overriding date is not yet supported, but it’s high on our priority list.

Until the metadata feature will be released, I tried different workarounds for the footer and title template. But nothing works. Maybe someone can point me into the right direction.

I tried it with a script like that:

let getMetadata = function () {
  let getSubtitle = document.getElementById("getSubtitle").innerHTML;
  let subtitle = document.getElementById("subtitle");
  subtitle.innerHTML = getSubtitle;

  let getVersion = document.getElementById("getVersion").innerHTML;
  let version = document.getElementById("version");
  version.innerHTML = getVersion;

  let getCustomer = document.getElementById("getCustomer").innerHTML;
  let customer = document.getElementById("customer");
  customer.innerHTML = getCustomer;

  let getProject = document.getElementById("getProject").innerHTML;
  let project = document.getElementById("project");
  project.innerHTML = getProject;
};

// Wait for the 'ia-writer-change' event before acting
document.body.addEventListener("ia-writer-change", function () {
  getMetadata();
});

Or with CSS variables in the template

<style>
  #project::after {
    content: var(--variable-project);
  }
</style><tr>
  <th>Kunde:</th>
  <td><span id="customer"></span></td>
</tr>

and add a style tag into the document

<style>
:root {
  --variable-project: "ProjektXYZ";
}
</style>

I guess the title and footer template cannot reach the body of the markdown content. Any ideas?