How to publish Pelican documents with a different file extension? - pelican

I do want to setup pelican in such way that it will allow me to compile static markdown files by keeping their location but changing the compiled file extensions on the destination.
Here is an example:
content/about.md --> output/about.html
content/foo/bar.md --> output/foo/bar.html
Inside config I tried these:
PAGE_URL = '{path}.html'
PAGE_SAVE_AS = '{path}.html'
ARTICLE_URL = '{path}.html'
ARTICLE_SAVE_AS = '{path}.html'
The problem is that the .md part is not removed and that {path} contains the entire path with the filename.
I know that I could use the {slug} and manually enter the slug inside bug that's not cool at all as it would require me to add a slug for each page.

You can try this in your pelican configuration:
FILENAME_METADATA = '(?P<slug>.*)' # use markdown file name as the slug meta
USE_FOLDER_AS_CATEGORY = True # use folder name as posts' category
ARTICLE_URL = '{category}/{slug}.html'
ARTICLE_SAVE_AS = ARTICLE_URL
PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = PAGE_URL
CATEGORY_URL = '{slug}/index.html'
CATEGORY_SAVE_AS = CATEGORY_URL
For details about these variables, see http://docs.getpelican.com/en/3.1.1/settings.html

Related

azure runbook PowerShell script content is not importing in terraform properly in azure automation account

I have created azure automation account using terraform. I have save my existing runbook PowerShell script files in local. I have successfully uploaded all the script files at one time while creation of automation account with below code:
resource "azurerm_automation_runbook" "example" {
for_each = fileset("Azure_Runbooks/", "*")
name = split(".", each.key)[0]
location = var.location
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.example.name
log_verbose = var.log_verbose
log_progress = var.log_progress
runbook_type = var.runbooktype
content = each.value
}
After running the terraform apply command, all the script files are uploading successfully to the automation account but the content of the PowerShell script is not getting uploaded. I have checked the runbooks in the automation account but there is not content inside the file. I am seeing only the name of the file.
Can some one please help me with above issue.
You assuming fileset(path, pattern) returns the contents of the file as each.value, but that is not the case. The each.value is just the file name.
You need something like:
resource "azurerm_automation_runbook" "example" {
for_each = fileset("Azure_Runbooks/", "*")
name = split(".", each.key)[0]
location = var.location
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.example.name
log_verbose = var.log_verbose
log_progress = var.log_progress
runbook_type = var.runbooktype
content = file(format("%s%s", "Azure_Runbooks/", each.value)
}
I hope this helps.
I have fixed the issue with correct code:
resource "azurerm_automation_runbook" "example" {
for_each = fileset("Azure_Runbooks/", "*")
name = split(".", each.key)[0]
location = var.location
resource_group_name = var.resource_group
automation_account_name = azurerm_automation_account.example.name
log_verbose = var.log_verbose
log_progress = var.log_progress
runbook_type = var.runbooktype
content = file(format("%s%s" , "Azure_Runbooks/" , each.key))
}
Thanks #YoungGova for your help.

Multipart file does not take the variable for the file name

I am trying to use the multipart file with the file as a variable, my feature looks like below
Feature: Test feature
Background:
* def JavaUtil = Java.type('com.intuit.karate.demo.util.JavaUtil')
* def file = JavaUtil.createBatchFile("1003");
# Scenario: test one
# * print " this is the first test: "
* url appUrl + '/api/partner/v1/bulk/'
* print 'file :', file
Given path 'jobs', jobId, 'batches'
And multipart file newBatchInfo = { read: file}
When method post
Then status 200
When the code executes the file has the right value but the multipart file does not accept the file variable which has the absolute path.
Is this the right usage? If there are some docs around this, can someone point me. Thanks.
This is my output
There is a file: prefix, which you can use in cases like this, where you generate a file. I recommend you generate files into target when using Maven for e.g.
Refer docs: https://github.com/intuit/karate#reading-files
Also note that you should use embedded expressions:
* def file = 'file:' + JavaUtil.createBatchFile("1003")
# ...
* And multipart file newBatchInfo = { read: '#(file)' }

Trac html Notifications

I am setting up Trac, on windows. I used a Bitnami installer. It is the newest stable version 1.2.3. I have a lot of stuff setup, including notifications, but I want to see HTML notifications. The plain text emails look wierd.
I did add the TracHtmlNotificationPlugin. Before doing that I was not getting emails with the default_format.email set to text/html.
Now I get the emails but they are still in plain text.
This is my trac.ini notification section. Let me know if I am missing something.
[notification]
admit_domains = domain.com
ambiguous_char_width = single
batch_subject_template = ${prefix} Batch modify: ${tickets_descr}
default_format.email = text/html
email_sender = HtmlNotificationSmtpEmailSender
ignore_domains =
message_id_hash = md5
mime_encoding = base64
sendmail_path =
smtp_always_bcc =
smtp_always_cc =
smtp_default_domain =
smtp_enabled = enabled
smtp_from = trac#domain.com
smtp_from_author = disabled
smtp_from_name =
smtp_password =
smtp_port = 25
smtp_replyto =
smtp_server = smtp.domain.com
smtp_subject_prefix =
smtp_user =
ticket_subject_template = ${prefix} #${ticket.id}: ${summary}
use_public_cc = disabled
use_short_addr = disabled
use_tls = disabled
I have my domain replaced in the real file.
Like I said I get emails now, just not html emails.
Edit:
I changed back the setting and now
Trac[web_ui] ERROR: Failure sending notification on change to ticket #7: KeyError: 'class'
Edit 2:
Fixed the error by putting the htmlnotification_ticket.html file (from the plugin) into the templates directory.

Google Drive List All Folders and Files [duplicate]

This question already has answers here:
List all files and folder in google drive
(2 answers)
Closed 2 years ago.
Hi I'm looking for a way to get a list for all my folders, sub folders and files from my google drive. I would like it to create a spreadsheet in my drive that outputs:
-All folders names, all sub folder names, all files names and there id (if not the id the url or both). Optional if it is possible output the description
Ive tried the code display on this post that works but it only gives me the file name and link in the parent folder only but I would like all mention information.
if someone knows the correct full code?
// replace your-folder below with the folder for which you want a listing
function listFolderContents() {
var foldername = 'your-folder';
var folderlisting = 'listing of folder ' + foldername;
var folders = DriveApp.getFoldersByName(foldername)
var folder = folders.next();
var contents = folder.getFiles();
var ss = SpreadsheetApp.create(folderlisting);
var sheet = ss.getActiveSheet();
sheet.appendRow( ['name', 'link'] );
var file;
var name;
var link;
var row;
while(contents.hasNext()) {
file = contents.next();
name = file.getName();
link = file.getUrl();
sheet.appendRow( [name, link] );
}
};
Execute this URI request which I generated from the Drive API explorer:
https://www.googleapis.com/drive/v3/files?fields=files%2CincompleteSearch%2Ckind%2CnextPageToken
It will return all your files and the its metada - complete info, which is found in File Resource properties.

Latex how I add local file pdf path \bibliographystyle{natdin}

I have a latex file with bib text file. I have the problem that I would like to add on my literatur add my local pdf path so that when i have my pdf file I can open it direktly from my local hard drive.
Latex:
\bibliographystyle{natdin}
\bibliography{Literatur}
example in my file "Literatur.bib":
#article{myarticle,
author = {my autor},
year = {2016},
title = {my title},
url = {http://myarticle.org/myarticle.pdf},
urldate = {08.12.2016},
file = {...\\myfolder\\12341234.pdf:pdf}
}
What I get:
my autor, 2016, my title, http://myarticle.org/myarticle.pdf
What I want:
my autor, 2016, my title, http://myarticle.org/myarticle.pdf, 12341234.pdf
You can use the note field to hold an external href link, like so:
#article{myarticle,
author = {my autor},
year = {2016},
title = {my title},
url = {http://myarticle.org/myarticle.pdf},
urldate = {08.12.2016},
note = {\href{run:../myfolder/12341234.pdf}{12341234.pdf}},
}
Note the corrected path format. The result will be like this: