Skip to content

Commit 6f1eeac

Browse files
committed
Add constants for configuring WordPress content
1 parent 4b44e9d commit 6f1eeac

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Audio from the meeting is available as well (link provided below).
6767
----------------------------------------------------------------
6868
{{{content}}}`;
6969

70+
// Mustache template - vars: gDate, formattedItems, content
7071
const GPLUS_BODY = `*JSON-LD CG Meeting Summary for {{gDate}}*
7172
7273
We discussed {{formattedItems}}.
@@ -79,9 +80,14 @@ https://json-ld.github.io/minutes/{{gDate}}/
7980
8081
#w3c #json-ld`;
8182

83+
// Mustache template - vars: message, gDate
8284
const TWITTER_BODY = `JSON-LD CG discusses {{message}}:
8385
https://json-ld.github.io/minutes/{{gDate}}/ #w3c #json-ld`;
8486

87+
// Mustache template - vars: gDate
88+
const WORDPRESS_TITLE = 'JSON-LD CG Meeting Minutes for {{gDate}}';
89+
// Location of date-based minutes folders; MUST end in a forward slash
90+
const MINUTES_BASE_URL = 'https://json-ld.github.io/minutes/'
8591

8692
/************************* Utility Functions *********************************/
8793
function postToWordpress(username, password, content, callback) {
@@ -97,12 +103,12 @@ function postToWordpress(username, password, content, callback) {
97103
wpSummary = wpSummary.substring(
98104
wpSummary.indexOf('<dl>'), wpSummary.indexOf('</dl>') + 5);
99105
wpSummary = wpSummary.replace(/href=\"#/g,
100-
'href="https://json-ld.github.io/minutes/' + gDate + '/#');
106+
'href="' + MINUTES_BASE_URL + gDate + '/#');
101107
wpSummary = wpSummary.replace(/href=\"audio/g,
102-
'href="https://json-ld.github.io/minutes/' + gDate + '/audio');
108+
'href="' + MINUTES_BASE_URL + gDate + '/audio');
103109
wpSummary = wpSummary.replace(/<div><audio[\s\S]*\/audio><\/div>/g, '');
104110
wpSummary += '<p>Detailed minutes and recorded audio for this call are ' +
105-
'<a href="https://json-ld.github.io/minutes/' + gDate +
111+
'<a href="' + MINUTES_BASE_URL + gDate +
106112
'/">available in the archive</a>.</p>';
107113

108114
// calculate the proper post date
@@ -446,7 +452,7 @@ async.waterfall([ function(callback) {
446452
console.log('scrawl: Creating new blog post.');
447453
}
448454
var content = {
449-
post_title: 'JSON-LD CG Meeting Minutes for ' + gDate,
455+
post_title: Mustache.render(WORDPRESS_TITLE, {gDate}),
450456
post_content: scrawl.generateMinutes(gLogData, 'html', gDate, haveAudio)
451457
};
452458

@@ -460,7 +466,7 @@ async.waterfall([ function(callback) {
460466
prompt.get({
461467
properties: {
462468
username: {
463-
description: 'Enter the JSON-LD WordPress username',
469+
description: 'Enter the WordPress username',
464470
pattern: /^.{4,}$/,
465471
message: 'The username must be at least 4 characters.',
466472
'default': 'msporny'

0 commit comments

Comments
 (0)