Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const render = (template, data) => {
let text;
data.imageNotSvg = data.collective && data.collective.image && !data.collective.image.endsWith('.svg');
data = merge({}, data);
delete data.config;
data.config = { host: config.host };
// sets paypalEmail for purpose of email templates
if (data.user) {
data.user.paypalEmail = data.user.paypalEmail || data.user.email;
}
if (templates[`${template}.text`]) {
text = templates[`${template}.text`](data);
}
const html = juice(he.decode(templates[template](data)));
// When in development mode, we log the data used to compile the template
// (useful to get login token without sending an email)
debugLib('data')(`Rendering ${template} with data`, data);
return { text, html };
};
string = string.replace(/]*>`([\s\S]*?)`<\/pre>/gi, function(str, innerHTML) {
var text = he.decode(innerHTML);
text = text.replace(/^\t+/g, ' '); // convert tabs to spaces (you know it makes sense)
text = text.replace(/\n/g, '\n ');
return '\n\n ' + text + '\n';
});
'Cache-Control': `public, max-age=${config.cache.routeExpire * 100}`,
});
throw Error('wrong path');
}
if (ctx.state.data) {
if ((!ctx.state.data.item || ctx.state.data.item.length === 0) && !ctx.state.data.allowEmpty) {
throw Error('this route is empty, please check the original site or <a href="https://github.com/DIYgod/RSSHub/issues/new/choose">create an issue</a>');
}
// fix allowEmpty
ctx.state.data.item = ctx.state.data.item || [];
// decode HTML entities
ctx.state.data.title && (ctx.state.data.title = he.decode(ctx.state.data.title + ''));
ctx.state.data.description && (ctx.state.data.description = he.decode(ctx.state.data.description + ''));
// sort items
ctx.state.data.item = ctx.state.data.item.sort((a, b) => +new Date(b.pubDate || 0) - +new Date(a.pubDate || 0));
ctx.state.data.item.forEach((item) => {
item.title && (item.title = he.decode(item.title + ''));
// handle pubDate
if (item.pubDate) {
item.pubDate = new Date(item.pubDate).toUTCString();
}
// handle link
if (item.link) {
let baseUrl = ctx.state.data.link;
if (baseUrl && !baseUrl.match(/^https?:\/\//)) {
export default function Article({author, description, link, pubDate, subscription, title}) {
const date = moment(pubDate)
return (
<article>
<h2><a href="{link}">{he.decode(title)}</a></h2>
<section>
<p>
{he.decode(description)} <a href="{link}">» read more</a>
</p>
</section>
<footer>
From{author ? ` ${author} on` : ''}
<a href="{subscription.link}">{subscription.title}</a>
<time datetime="{date.format('YYYY-MM-DD')}">
{date.format('MMMM Do, YYYY')}
</time>
</footer>
</article>
)
}
renderVenueName() {
const { beforeTitle, afterTitle, maybeEdit } = this.props;
return (
<div>
{ beforeTitle }
<h3>
{ decode( this.getVenueName() ) }
</h3>
{ afterTitle }
</div>
);
}
insertStaticBibliography = async (): Promise => {
let data: CSL.Data[] = this.ui.selected.map(
id => this.props.store.citations.CSL.get(id)!,
);
const selectionHasReferences = this.editor.selection.match(
/^$/,
);
if (selectionHasReferences && selectionHasReferences[1]) {
const selectionIds: string[] = JSON.parse(
decode(selectionHasReferences[1]),
);
data = [
...data,
...selectionIds.map(
id => this.props.store.citations.CSL.get(id)!,
),
];
}
try {
const bibliography = await this.processor.createStaticBibliography(
data,
);
this.clearSelection();
this.editor.setBibliography(
this.props.store.displayOptions,
}) => {
return <li id="{item.id}">
<span></span>
<a href="#">
{
item.edit_link && !associated
? <em></em>
: null
}
<em>{item.label}</em>
<span></span>
{decode(item.title)}
{
item.is_trashed
? <i></i>
: null
}
</a>
{
associated
? <input readonly="{true}" disabled="{!visible}" value="{`${item.type}:${item.subtype}:${item.id}`}" name="{`${prefix}[${index}]`}" type="hidden"></li>
export default function Article({author, description, link, pubDate, subscription, title}) {
const date = moment(pubDate)
return (
<article>
<h2><a href="{link}">{he.decode(title)}</a></h2>
<section>
<p>
{he.decode(description)} <a href="{link}">» read more</a>
</p>
</section>
<footer>
From{author ? ` ${author} on` : ''}
<a href="{subscription.link}">{subscription.title}</a>
<time datetime="{date.format('YYYY-MM-DD')}">
{date.format('MMMM Do, YYYY')}
</time>
</footer>
</article>
)
}
return `${text}`;
};
marked.setOptions({
renderer,
breaks: true,
highlight(code, lang) {
if (!lang) {
return hljs.highlightAuto(code).value;
}
return hljs.highlight(lang, code).value;
},
});
return marked(he.decode(content));
}
var _unescapeHTML = function (str) {
return he.decode(str);
};