Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override metadata #6

Open
robsonsobral opened this issue Jul 8, 2016 · 15 comments
Open

Override metadata #6

robsonsobral opened this issue Jul 8, 2016 · 15 comments

Comments

@robsonsobral
Copy link

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!

@antons
Copy link
Collaborator

antons commented Jul 9, 2016

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

@metawops
Copy link

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).

@mb21
Copy link

mb21 commented Jul 4, 2017

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...

@onebigclownshoe
Copy link
Collaborator

@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.

@onebigclownshoe
Copy link
Collaborator

@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

@mb21
Copy link

mb21 commented Jul 5, 2017

@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...

@ahnesbitt
Copy link

+1

@PDXIII
Copy link

PDXIII commented Nov 22, 2017

Any news on this one?

@onebigclownshoe
Copy link
Collaborator

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

@jasonhibbs
Copy link

jasonhibbs commented May 13, 2018

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 👌

@zyv
Copy link

zyv commented Jan 14, 2020

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!

@onebigclownshoe
Copy link
Collaborator

@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.

@maxwelt99
Copy link

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.

@antons
Copy link
Collaborator

antons commented Jan 5, 2023

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.

@stebrech
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests