On 12/12/16 8:03 PM, Moacir wrote:
> Hey all,
>
> I'm very, very close to being able to achieve the convergence of keeping
> one mmd file that becomes both my course website and syllabus pdf that
> is also decoupled from each instance of a course, but I had a bunch of
> questions, etc., about how to maybe better use the metadata:
>
> 1. Metadata don't seem to be available to transcluded files. I think FTP
> has mentioned in other threads that that is the point—transclusion
> doesn't care if the file exists or not, so it shouldn't send more
> information to it. That would be useful, though, because now, for
> example, I have:
>
> <!-- \iffalse -->
> {{sections/navbar.html}}
> <!-- \fi-->
>
> to create a navbar for the website, but that html file needs to be
> edited by hand (or by jquery in the htmlfooter metadata) to feed in
> values like "title" for the navbar-brand.
Not sure I follow. Transclusion happens first -- making one big
document. At that point, the same metadata applies to the entire
document, regardless of which transcluded file the source started in.
Separately, the metadata in a file that *is transcluded by another file*
is ignored. One can only have one set of metadata.
> 2. Metadata aren't available in certain places in the markdown syntax.
> I'd like to do something like this:
>
> ---
> githuburl:
http://github.com/some/repo
>
> ...
>
> For more information, please see [the github repo]([%githuburl]).
>
> Neither that, nor
>
> [the github repo]: [%githuburl]
>
> yield the value for that key. I'm trying to figure out how to do that in
> post-processing, but I think it'd be a useful thing to do, because while
> boilerplate ("please see...") doesn't change from course to course, the
> url to the syllabus repo will. Being able to control that wholly in the
> metadata would be great.
True -- metadata variables are only parsed in the same places that any
Markdown syntax is parsed. Which does not include inside URLs. This is
standard Markdown/MultiMarkdown behavior. I don't anticipate changing this.
The "proper" approach here would be to store your link references in
separate files -- that way you can transclude the specific link
definitions needed, e.g.:
Link to the [project page].
One file can include:
[project page]:
http://foo.bar/project1
Another can include
[project page]:
http://foo.bar/project2
> 3. There's no way for me to access the metadata in javascript
>
> At least not that I can think of. I would've liked to have at the end of
> my file something like:
>
> <!-- \iffalse -->
> <script>
> $('#navbar-brand').text("[%title]");
> </script>
> <!--\fi-->
>
> But of course mmd just goes past it. If I do <script markdown=1>, then a
> whole different series of issues follows (htmlization of quotes), and I
> still don't get to access the value in [%title].
You're on your own with Javascript. ;) But again, Markdown, and
therefore MMD, doesn't screw with the contents of <scripts>.
> 4. mmd2tex latexifies the metadata, too.
>
> This is surely a feature, but it was an unexpected one. I suspected that
> I could define githuburl as above and expect it to be available as
> \def\githuburl{
http://github.com/some/repo} and not as http:/\slash
>
github.com\slash ...
Not sure what you're asking for here. MMD has to convert metadata into
the proper "character escaping" for the output format, with a few
exceptions that are handled in the code. You can always modify this
behavior however you like in the source and compile your own custom version.
> I've gotten around most of these w/ post-processing, but I was wondering
> if these might not be things to think about for future releases. As it
> is, mmd is great, and I've found it playing a buch bigger role in my
> life now that I understand how to manipulate the metadata better (esp in
> latex templates and htmlheader and htmlfooter).
Glad it's been helpful... I realize that there are a few edge cases
where someone needs something that truly can't be done in MMD (it's
nowhere near turing complete. ;) But I do feel it can do the vast
majority of things for the vast majority of users (within reason).
Fletcher
--
Fletcher T. Penney
fletche...@gmail.com