quote markdown fixes

merge-requests/208/head
fatchan 5 years ago
parent a5205ac480
commit b868bb52ce
  1. 2
      helpers/markdown.js
  2. 7
      models/frontend/board.js

@ -14,7 +14,7 @@ module.exports = (board, thread, text) => {
const quote = lines[j].match(quoteRegex); const quote = lines[j].match(quoteRegex);
if (quote) { if (quote) {
const quotenum = quote[0].substring(2); const quotenum = quote[0].substring(2);
lines[j] = lines[j].replace(quote[0], `<a class='quote' href='/${board}/thread/${thread}/${quote}#${quote}'>&gt;&gt;${quotenum}</a>`); lines[j] = lines[j].replace(quote[0], `<a class='quote' href='/${board}/thread/${thread}#${quotenum}'>&gt;&gt;${quotenum}</a>`);
continue; continue;
} }
//replace greentexts //replace greentexts

@ -5,8 +5,10 @@ const Posts = require(__dirname+'/../../db-models/posts.js');
module.exports = async (req, res) => { module.exports = async (req, res) => {
//get the recently bumped thread & preview posts //get the recently bumped thread & preview posts
let threads; let threads;
let pages;
try { try {
threads = await Posts.getRecent(req.params.board, req.params.page); threads = await Posts.getRecent(req.params.board, req.params.page || 1);
pages = Math.ceil((await Posts.getPages(req.params.board)) / 10);
} catch (err) { } catch (err) {
return next(err); return next(err);
} }
@ -14,6 +16,7 @@ module.exports = async (req, res) => {
//render the page //render the page
res.render('board', { res.render('board', {
csrf: req.csrfToken(), csrf: req.csrfToken(),
threads: threads || [] threads: threads || [],
pages: pages
}); });
} }

Loading…
Cancel
Save