How to rename meta data entries in Quarto Book - quarto

I am using Quarto Book for writing an online Book for my students on scientific writing skills (see www.politik-wissenschaft.at).
I want to add the bibliographic entry of this book at the start site (index.qmd / index.html). I used the abstract option for doing that. This works fine, but the title of this meta data entry is now called "Zusammenfassung" (i.e., abstract).
Is there a way to change this title to "How to cite", for example?
Furthermore, after updating Quarto CLI to 1.2.313 this information ("Zusammenfassung") is not only printed on the index.html file, but on the head of all other sites as well. How can I switched that off, so that these meta data information is only shown at the start site (i.e., index.html).

You can change the meta data using template-partials. Add the following to your _quarto.yml file:
template-partials:
- title-block.html
And create the title-block.html file (see here the original file) and change the abstract-title to your liking:
<header id="title-block-header">
<h1 class="title">$title$</h1>
$if(subtitle)$
<p class="subtitle">$subtitle$</p>
$endif$
$for(author)$
<p class="author">$author$</p>
$endfor$
$if(date)$
<p class="date">$date$</p>
$endif$
$if(abstract)$
<div class="abstract">
<div class="abstract-title">How to Cite </div>
$abstract$
</div>
$endif$
</header>
Different Option:
add a css file and change the text via css (usually not recommended):
styles.css
div.abstract-title {
visibility: hidden;
}
div.abstract-title:before {
content: "How to cite";
visibility: visible;
}

Related

Changing on which slide the `toc` appears in RevealJs slides using Quarto

I am using Quarto to produce some revealjs slides and would like the table of contents to appear on an arbitrary slide rather than immediately after the title slide. Is there a way of achieving this?
Any help appreciated!
We can place the table of contents at an arbitrary slide at an arbitrary place with the help of RevealJs Partials toc-slide.html. I have modified it a bit and also used javascript (in toc-add.html) to change the TOC position. Note that, using RevealJs partials requires Quarto version 1.2 at least.
Suppose we want to add the TOC in the overview slide, so we create an HTML div as a placeholder for the TOC as follows,
```{=html}
<div id='toc'></div>
```
and then using javascript, we can fetch the TOC generated by quarto and replace the <div id='toc'></div> with the TOC.
quarto-revealjs.qmd
---
title: "Controlling TOC"
format:
revealjs:
toc: true
template-partials:
- toc-slide.html
include-after-body: toc-add.html
---
## Quarto
Quarto enables you to weave together content and executable code into a
finished presentation.
## Overview
This is the overview slide.
```{=html}
<div id='toc'></div>
```
This slide contain the contents that we going to discuss and hopyfully things
wiil make sense :).
## Code
You can embed code like this:
```{r}
#| echo: true
1 + 1
```
toc-slide.html
<section id="$idprefix$TOC">
<nav id="toc-nav" role="doc-toc" style="padding-top: 5px; padding-bottom: 5px;">
$if(toc-title)$
<h3 id="$idprefix$toc-title">$toc-title$</h3>
$endif$
$table-of-contents$
</nav>
</section>
toc-add.html
<script>
let placeholder = document.querySelector("div#toc");
let toc = document.querySelector("#toc-nav");
let toc_slide = document.querySelector("section#TOC");
let toc_clone = toc.cloneNode(true);
placeholder.replaceWith(toc_clone);
toc_slide.remove();
</script>
Rendered Output (in slide overview mode)

Carrying style IDs/names from HTML to .docx?

Is it possible to somehow tell pandoc to carry the names of styles from original HTML to .docx?
I understand that in order to tune the actual styles, I should be using reference.docx file generated by pandoc. However, reference.docx is limited to what styles it has to: headings, body text, block text, etc.
I'd like to:
specify "myStyle" style in the input HTML (via a "class" attribute, via any other HTML attribute or even via a filter code written in Lua),
<html>
<body>
<p>Hello</p>
<p class="myStyle">World!</p>
</body>
</html>
add a custom "myStyle" to reference.docx using Word,
run a html->docx conversion an expect pandoc generate a paragraph element with "myStyle" (instead of BodyText, which I believe it sets by default), so the end result looks like this (contents of word/document.xml inside the resulting output.docx was cut for brevity):
<w:p>
<w:pPr>
<w:pStyle w:val="BodyText" />
</w:pPr>
<w:r>
<w:txml:space="preserve">Hello</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="myStyle" />
</w:pPr>
<w:r>
<w:txml:space="preserve">World!</w:t>
</w:r>
</w:p>
There's some evidence styleId can be passed around, but I don't really understand it and am unable to find any documentation about it.
Doc on filtering in Lua states you can access attrs when manipulating a pandoc.div, but it says nothing about whether any of the attrs will be interpreted by pandoc in any meaningful way.
Finally, found what I needed – Custom styles. It's limited, but better than what I arrived earlier, and of course much better than nothing at all :)
I'll leave a step-by-step guide here in case anyone stumbles upon a similar question.
First, generate a reference.docx file like this:
pandoc --print-default-data-file reference.docx > styles.docx
Then open the file in MS Word (I was using a macOS version) you'll see this:
Click the "New style..." button on the right, and create a style to your liking. In my case I made change the style of text to be bold, in blue color:
Since I am converting from HTML to DOCX, here's my input.html:
<html>
<body>
<div>Page 1</div>
<div custom-style="eugene-is-testing">Page 2</div>
<div>Page 3</div>
</body>
</html>
Run:
pandoc --standalone --reference-doc styles.docx --output output.docx input.html
Finally, enjoy the result:

Anchor tag not working

For this website ( http://carbondirect.net/ ) on the homepage, bottom right I want Sewage Odor Control to link to the page Activated Carbon and jump to the Sewage Odor Control section, but it is not working. It links to the Activated Carbon page, ignoring the anchor.
Based on some research, I tried adding this CSS, but it is still not working:
#sewage-odor-control {
position: fixed;
z-index: 10001;
display: inline-block;
}
Did I do anything obviously wrong? If you are able to take a look, thank you.
Here is the relevant code from your site:
<div class="et_pb_toggle et_pb_toggle_close">
<h5 class="et_pb_toggle_title">SEWAGE ODOR CONTROL</h5>
<div class="et_pb_toggle_content clearfix">
<span><a id="sewage-odor-control"></a></span>
Wet wells and sewage-pumping stations need to be vented to atmosphere, the vapor that is exchanged is contaminated with H2S and mercaptan. They are highly odorous, pungent and extremely objectionable. Specialist impregnated carbon are used to remove H2S to the level below the odor threshold value. The patented products (US patent#6,858,192) invented by our factory are unique catalytic activated carbon not only with high capacity on absorption, but also hazard free during the handling and disposal of spent carbon.</p>
<p>IMP-KOH, HiCOR
</div> <!-- .et_pb_toggle_content -->
</div> <!-- .et_pb_toggle -->
A couple weird things going on:
Line #5: have a closing </p>, but no opening <p>
Line #6: have an opening <p>, but no closing <\p>
Also, your anchor is not 'visible' when you first go to the site because the section is toggled closed (et_pb_toggle_close), so maybe that is causing a problem. What happens if you add the anchor the the header (which is readily visible)?
<h5 id="sewage-odor-control" class="et_pb_toggle_title">SEWAGE ODOR CONTROL</h5>
The only thing you need is adding id="sewage-odor-control" to the target element:
<div id="sewage-odor-control" class="et_pb_toggle et_pb_toggle_close">

Angular Material: how to set background-color (without CSS)

I'm developing a pure Material Design application using Angular Material framework.
However, I don't understand how to set containers' background colors (e.g. a login form with a blue background).
I could do it using CSS of course but I wonder if there's a built-in directive / theme option to do this.
I am pretty sure I have seen this somewhere in the docs, but I cant find it now. You have to do two different things:
set .backgroundPalette('indigo') same way as you set primary theme
create container
I have check it on 0.8.1 version of angular-material and it works ok.
Feel free to ask, if you have any additional questions.
For example:
app.config(function ($mdThemingProvider) {
$mdThemingProvider
.theme('default')
.primaryPalette('indigo')
.accentPalette('pink')
.warnPalette('red')
.backgroundPalette('blue-grey');
});
and in your template:
<md-content>
<p>Some text</p>
</md-content>
You can set any color from the palette with md-colors directive.
https://material.angularjs.org/1.1.4/api/directive/mdColors
The format will be [?theme]-[palette]-[?hue]-[?opacity] where ? means optional parameter.
But from my experience you have to specify the theme even if it's default:
<md-button md-colors="{color: 'default-red-A100', 'background': 'default-primary-600'}">Button</md-button>
On a sidenote, ignoring the "without css" part of the question, I see that the Material Angular creators uses plain old css to create a background color, see this codepen (you also find this via the Getting Started section: "Fork a codepen").
html
<div id="content" ng-view flex> </div>
css
.demo #content {
background-color: rgb(255, 244, 220);
padding:30px;
font-weight:600;
border: 1px solid #aeaeae;
border-top:none;
}

MediaWiki Scribunto extension's "Listen" module not generating expected HTML

I have a MediaWiki installation (1.23) with the Scribunto extension and Module:Listen. I try to invoke this module from an article like so:
{{Listen
|filename = Noise.ogg
|title = Noise
|description = Some noise
}}
This generates the little infobox, but the embedded sound player itself does not appear. I looked at the generated HTML, and the module is just making a second ordinary href to the file:
<div class="haudio">
<div style="padding:2px 0;">Noise</div>
<div style="padding-right:4px;">File:Noise.ogg</div>
<div class="description" style="padding:2px 0 0 0;">Some noise</div></div>
Rather than the second href to the file, I'd expect to see a or similar. Am I missing some template or Lua module?
You need to have TimedMediaHandler installed for the sound player to show up!

Resources