How do I force Pelican to suppress generation of category files? - pelican

I don't want Pelican 3.6 to generate:
/author/
/category/
/tag/
/archives.html
/authors.html
/categories.html
/tags.html
DIRECT_TEMPLATES can be set to suppress some of the index files:-
# DIRECT_TEMPLATES = ['index', 'categories', 'authors', 'archives']
DIRECT_TEMPLATES = ['index']
Omitting tag metadata in source content files will prevent generation of the tag folder and index; omitting author metadata and the AUTHOR setting will prevent generation of the author folder and index.
But it seems that suppressing category isn't so simple. I've tried setting DEFAULT_CATEGORY to an empty string, but this results in errors and no output for sources with no category metadata:-
Skipping <some_file>: could not find information about 'NameError: category'
I've also tried removing the relevant template files from the theme being used, but this merely causes them to be replaced with the matching template in the built-in "simple" theme.
Am I missing an established method of suppressing category generation?

The URL settings documentation has a long list of settings, including several […]_SAVE_AS settings. Directly below the URL settings table is a note that answers your question: for any page type that you do not want generated, set the corresponding […]_SAVE_AS setting to ''. For example, to suppress individual category page generation, add this setting:
CATEGORY_SAVE_AS = ''

Related

In Docusaurus, is there can I preserve capitalization in anchors created from headings in docs?

I'm using Docusaurus to publish documentation for an open source library's API. The headings of my source markdown files correspond to the names of methods and properties for classes in the library. This all works fine.
However, the anchors that are created in the HTML are all lowercase. I want them to respect the capitalization used in the markdown file.
For example, this markdown header:
###.doSomething()
Generates the following HTML:
<h3>
<a aria-hidden="true" tabindex="-1" class="..." id="dosomething"></a>.
<code>.doSomething()</code>
<a class="..." href="#dosomething" title="...">#</a>
</h3>
As you can see, camelCase is transformed to lowercase. I would like to keep capitalization intact. Is it possible?
P.S. The markdown files are automatically generated from jsdoc comments. In jsdoc, links to a method or properties include capitalization.
TL;DR
Inside your project, navigate to the directory node_modules > github-slugger;
Open the index.js file;
Remove the line if (!maintainCase) string = string.toLowerCase()
The function will become something like this:
function slugger (string, maintainCase) {
if (typeof string !== 'string') return ''
// if (!maintainCase) string = string.toLowerCase() <-- remove this!
return string.trim()
.replace(specials, '')
.replace(emoji(), '')
.replace(whitespace, '-')
}
IMPORTANT!
If you update the docusaurus, you may need to apply this change again;
It may be necessary to edit the doc to see the changes, because of cache. Here I edited the doc file and it worked;
You must restart the docusaurus service after you make this change. And probably needs to clear the cache with npm cache clear --force;
Also, I think you should delete the folder .docusaurus to force the rebuild of all documents.
RESULT
The .md file:
---
id: intro
---
# Random title
### WriNTinG with CaSeS
test 1
### .doAnotherThink()
test 3
### .doCamelCaseWithSeveralLETTERS()
test 3
ROADMAP
I must say that this one was hard. First I tried to track down the anchor tags, then the description. Eventually I found about the github-slugger, and looked like that was the way.
But once I made the changes, nothing had happened to the document! So after hours trying, I gave up… Then, just for curiosity, I decide to see what the slug function did to the document, by adding a second header with the same name. And — luck! — it kept the original case.
It turns out that you can simply use explicit IDs to solve this issue: https://docusaurus.io/docs/next/markdown-features/headings#explicit-ids

How to apply metadata to all files in a content directory

I have a content directory called foo and I want all files under that directory to have an extra metadata item foovar: default, unless explicitly overridden in the file header. I think I'm supposed to do this with EXTRA_PATH_METADATA, but I can't figure out what incantation it wants.
(for my current use case I'm trying to apply template: sometemplate within this dir, but I'm interested in solving the general case as it would make several related headaches go away)
I think what you're looking for is actually DEFAULT_METADATA. Check out this portion of the documentation:
DEFAULT_METADATA = {}
The default metadata you want to use for all articles and pages.
So, in your case it might look something like this in your config file:
DEFAULT_METADATA = {'foovar': 'default'}
Then to assign your custom template(s), see this portion of the documentation.
This wasn't possible at the time I asked. I've since sent the devs a PR adding support, and it's been merged to master. Presumably it will go out in the next release. It makes EXTRA_PATH_METADATA recursive, so you can apply settings to a subdir like this:
EXTRA_PATH_METADATA = {'dirname/subdir': {'status': 'hidden'}}

Global variables in Intellij templates

I am trying to create some variables similar to the predefined ones that come with the IntelliJ templating system. I am looking to create a variable called $MY_NAME_AND_EMAIL where I can define it once and then reference it in different templates. Is this possible?
I have tried creating an include called AuthorName.txt:
#set($MY_NAME_AND_EMAIL = "Name <email#example.com>")
Then, in one of my templates, I put the following line at the top:
#parse("AuthorName.txt")
Further down the file, I use ${MY_NAME_AND_EMAIL} in the header. However, when I create a new file base on that template, it still prompts me for the name and email field, even though I set it in an include file and added the #parse directive. What am I doing wrong?

sphinx remove chapter title in my pdf with latexpdf?

I generate a documentation from rst to pdf with latexpdf and sphinx.
How can I remove chapter title before every chapter?
-----------
CHAPTER ONE
-----------
As noted in the sphinx documentation you can change the latex_documents documentclass to a howto documentclass, which will get rid of the "Chaper" before your section. However, this will also change formatting slightly for the whole build.
documentclass: Normally, one of 'manual' or 'howto' (provided by Sphinx). Other document classes can be given, but they must include the “sphinx” package in order to define Sphinx’ custom LaTeX commands. “howto” documents will not get appendices. Also, howtos will have a simpler title page.
Just edit your conf.py and change manual to howto.
latex_documents = [
('index', 'foo.tex', u'foo Documentation',
u'bar', 'howto'),
]
As for the Chapter titles, from the Sphinx documentation and LaTeX customization:
Inclusion of the “fncychap” package (which makes fancy chapter
titles), default '\usepackage[Bjarne]{fncychap}' for English
documentation, '\usepackage[Sonny]{fncychap}' for internationalized
docs (because the “Bjarne” style uses numbers spelled out in English).
Other “fncychap” styles you can try include “Lenny”, “Glenn”, “Conny”
and “Rejne”. You can also set this to '' to disable fncychap.
latex_elements = {
'fncychap': '\\usepackage[Conny]{fncychap}',
# ...
}
Also, I was trying to search for how to remove the Title page, and a search brought me here, so I thought I'd add my answer here.
To remove the title page, just set the following options:
latex_elements = {
'maketitle': '', # No Title Page
# ...
}

Content Organizer Rule Creation Issue

I am using the Content Organizer feature to move documents of a specific content type into a specific folder in a document library in the same site. I created a content organizaer rule with a property setting that uses the property testcolumn. Testcolumn is a site column defined as a lookup to column on a custom List, testlist, and then added to a site content type. The items in this list are displayed in the Value dropdown list and I can select the specific value I want to use for this rule.
The problem is that I can create and save rules provided that there are no more than 19 items in the testlist list. When I have 20 items in the testlist, it looks like the rule was saved by the UI. If I open the rule and go to edit it, the Value for the testcolumn property is (None). If I look at the item in powershell, the Value property is equal to '0' and not the ID of the item I saved in the UI. If I delete a record in the testlist so that the total number of items drops below 20, I can save the rule without issue. I have tried different combinaitions of items in the list in case it was a text issue, but when I have 20 items or more in the list, the rule is not saved.
I have looked at the ULS logs and it states the "Routing Engine: UpdateRule() has successfully updated the rule, rule.Name=TestRule1" when I save the rule.
Thanks for your help.
The answer is partially listed here. Looks like the page renders the control differently if the number of items is 20 or greater. The content organizer rule creation page does not handle this change and does not show any error when saving the information.
I was able to get around this limitation in the UI by adding the rules through code during my feature creation event. A link to creating rules through code is here.