<commit_before>import { dest, task, parallel, src } from 'gulp';
import * as path from 'path';

const markdown = require('gulp-markdown');
const transform = require('gulp-transform');
const hljs = require('highlight.js');
import * as rename from 'gulp-rename';

const markdownOptions = {
  // Add syntax highlight using highlight.js
  highlight: (code: string, language: string): string => {
    if (language) {
      // highlight.js expects "typescript" written out, while Github supports "ts".
      const lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
      return hljs.highlight(lang, code).value;
    }

    return code;
  }
};
const LINK_PATTERN = /(<a[^>]*) href="([^"]*)"/g;
const IMG_PATTERN = /(<img[^>]*) src="([^"]*)"/g;
const PRE_PATTERN = /(<pre[^>]*)/g;
const START_COMMENT_PATTERN = /(<!-- start-enclose-content -->)/g;
const END_COMMENT_PATTERN = /(<!-- end-enclose-content -->)/g;


task('docs-guides', () => {
  return src('docs/guides/**/!(README.md)')
    .pipe(markdown(markdownOptions))
    .pipe(transform('utf8', transformMarkdownFiles))
    // tslint:disable-next-line:no-shadowed-variable
    .pipe(rename(function (path: rename.ParsedPath) {
      path.extname = '.html';
    }))
    .pipe(dest('src/assets/docs/guides'));
});
task('docs-dev', () => {
  return src('docs/dev/**/!(README.md)')
    .pipe(markdown(markdownOptions))
    .pipe(transform('utf8', transformMarkdownFiles))
    // tslint:disable-next-line:no-shadowed-variable
    .pipe(rename(function (path: rename.ParsedPath) {
      path.extname = '.html';
    }))
    .pipe(dest('src/assets/docs/dev'));
});
task('docs-img', () => {
  return src('docs/img/**')
    .pipe(dest('src/assets/docs/img'));
});

task('docs', parallel(['docs-guides', 'docs-dev', 'docs-img']));

/**
 * Transforms the Markdown files
 * @param {Buffer} buffer The buffer of the file
 */
function transformMarkdownFiles(content: string, file: any): Buffer | string {
<commit_msg>fix(gulp/tasks/docs): update destination of generated docs<commit_after>import { dest, task, parallel, src } from 'gulp';
import * as path from 'path';

const markdown = require('gulp-markdown');
const transform = require('gulp-transform');
const hljs = require('highlight.js');
import * as rename from 'gulp-rename';

const markdownOptions = {
  // Add syntax highlight using highlight.js
  highlight: (code: string, language: string): string => {
    if (language) {
      // highlight.js expects "typescript" written out, while Github supports "ts".
      const lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
      return hljs.highlight(lang, code).value;
    }

    return code;
  }
};
const LINK_PATTERN = /(<a[^>]*) href="([^"]*)"/g;
const IMG_PATTERN = /(<img[^>]*) src="([^"]*)"/g;
const PRE_PATTERN = /(<pre[^>]*)/g;
const START_COMMENT_PATTERN = /(<!-- start-enclose-content -->)/g;
const END_COMMENT_PATTERN = /(<!-- end-enclose-content -->)/g;

const docsAssetsPath = 'projects/rss-reader/src/assets/docs';

task('docs-guides', () => {
  return src('docs/guides/**/!(README.md)')
    .pipe(markdown(markdownOptions))
    .pipe(transform('utf8', transformMarkdownFiles))
    // tslint:disable-next-line:no-shadowed-variable
    .pipe(rename((path: rename.ParsedPath) => {
      path.extname = '.html';
    }))
    .pipe(dest(`${docsAssetsPath}/guides`));
});
task('docs-dev', () => {
  return src('docs/dev/**/!(README.md)')
    .pipe(markdown(markdownOptions))
    .pipe(transform('utf8', transformMarkdownFiles))
    // tslint:disable-next-line:no-shadowed-variable
    .pipe(rename((path: rename.ParsedPath) => {
      path.extname = '.html';
    }))
    .pipe(dest(`${docsAssetsPath}/dev`));
});
task('docs-img', () => {
  return src('docs/img/**')
    .pipe(dest(`${docsAssetsPath}/img`));
});

task('docs', parallel(['docs-guides', 'docs-dev', 'docs-img']));

// TODO(EdricChan03): Understand how this code actually works.
function transformMarkdownFiles(content: string, file: any): Buffer | string {

{'fraction_non_alphanumeric': 0.2041479260369815, 'fraction_numerical': 0.0014992503748125937, 'mean_word_length': 4.0864040660736975, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, 'https://': 0, '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': '629700', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1333, 'n_words': 267}