<commit_before>const admin = require('firebase-admin');
const moment = require('moment-timezone');
const _ = require('lodash');
const RSS = require('rss');
const debug = require('debug')('bluesense:rss*');

module.exports = () => new Promise((resolve, reject) => {
  let feed = new RSS({
    title: 'BlueSense Hourly Data',
    description: 'Hourly summurized data of BlueSense',
    feed_url: 'https://bluesense.skyzh.xyz/feed',
    site_url: 'https://bluesense.skyzh.xyz',
  //image_url: 'http://example.com/icon.png',
  //docs: 'http://example.com/rss/docs.html',
    managingEditor: '<EMAIL> (Sky Zhang)',
    webMaster: '<EMAIL> (Sky Zhang)',
    copyright: '2017 Sky Zhang',
    language: 'en',
  //categories: [],
    pubDate: new Date(Date.now()),
    ttl: '60'
  });
  
  const feed_item = (key, data) => {
    feed.item({
      title:  `Reported on ${moment(data.time * 1000).tz('Asia/Shanghai').format('LLLL')}`,
      description: `
        <b>Temperature</b>: ${_.round(data.tc, 2)}°C, 
        <b>Humidity</b>: ${_.round(data.hum, 2)}%, 
        <b>Pressure</b>: ${_.round(data.pressure)} Pa, 
        <b>PM10</b>: ${_.round(data.pm10, 2)} µg/m3, 
        <b>PM2.5</b>: ${_.round(data.pm25, 2)} µg/m3
       `,
      url: `https://bluesense.skyzh.xyz/charts/hourly/?data=${key}`, // link to the item
      guid: `https://bluesense.skyzh.xyz/charts/hourly/?data=${key}`, // optional - defaults to url
  //  categories: ['Category 1','Category 2','Category 3','Category 4'], // optional - array of item categories
      author: '<EMAIL> (<NAME>)', // optional - defaults to feed author property
      date: moment(data.time * 1000).tz('Asia/Shanghai').format('LLLL'), // any format that js Date can parse.
    });
  };
  
  let feed_data = admin.database().ref('/stat/hourly').orderByKey().limitToLast(100);
  feed_data.once('value').then(snapshot => {
    let __data = [];
    snapshot.forEach(childSnapshot => { __data.push([childSnapshot.key, childSnapshot.val()]); });<commit_msg>Add line break in RSS<commit_after>const admin = require('firebase-admin');
const moment = require('moment-timezone');
const _ = require('lodash');
const RSS = require('rss');
const debug = require('debug')('bluesense:rss*');

module.exports = () => new Promise((resolve, reject) => {
  let feed = new RSS({
    title: 'BlueSense Hourly Data',
    description: 'Hourly summurized data of BlueSense',
    feed_url: 'https://bluesense.skyzh.xyz/feed',
    site_url: 'https://bluesense.skyzh.xyz',
  //image_url: 'http://example.com/icon.png',
  //docs: 'http://example.com/rss/docs.html',
    managingEditor: '<EMAIL> (<NAME>)',
    webMaster: '<EMAIL> (<NAME>)',
    copyright: '2017 Sky Zhang',
    language: 'en',
  //categories: [],
    pubDate: new Date(Date.now()),
    ttl: '60'
  });
  
  const feed_item = (key, data) => {
    feed.item({
      title:  `Reported on ${moment(data.time * 1000).tz('Asia/Shanghai').format('LLLL')}`,
      description: `
        <b>Temperature</b>: ${_.round(data.tc, 2)}°C, &nbsp;<br>
        <b>Humidity</b>: ${_.round(data.hum, 2)}%, &nbsp;<br>
        <b>Pressure</b>: ${_.round(data.pressure)} Pa, &nbsp;<br>
        <b>PM10</b>: ${_.round(data.pm10, 2)} µg/m3, &nbsp;<br>
        <b>PM2.5</b>: ${_.round(data.pm25, 2)} µg/m3
       `,
      url: `https://bluesense.skyzh.xyz/charts/hourly/?data=${key}`, // link to the item
      guid: `https://bluesense.skyzh.xyz/charts/hourly/?data=${key}`, // optional - defaults to url
  //  categories: ['Category 1','Category 2','Category 3','Category 4'], // optional - array of item categories
      author: '<EMAIL> (<NAME>)', // optional - defaults to feed author property
      date: moment(data.time * 1000).tz('Asia/Shanghai').format('LLLL'), // any format that js Date can parse.
    });
  };
  
  let feed_data = admin.database().ref('/stat/hourly').orderByKey().limitToLast(100);
  feed_data.once('value').then(snapshot => {
    let __data = [];
    snapshot.forEach(childSnapshot => { __data.push([childSnapshot.key, childSnapshot.val()]); });
{'fraction_non_alphanumeric': 0.21021318790282598, 'fraction_numerical': 0.017352503718393655, 'mean_word_length': 3.4783573806881245, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 47, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1726795', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1366, 'n_words': 284}