<commit_before>import * as path from 'path'

import * as xjs from 'extrajs-dom'
import {Processor} from 'template-processor'

import {Hyperlink} from '../interfaces'


const template: HTMLTemplateElement = xjs.HTMLTemplateElement
  .fromFileSync(path.join(__dirname, '../../src/tpl/list-social.tpl.html')) // NB relative to dist // TODO use `xjs.HTMLUListElement.templateSync()`
  .node

interface OptsType {
  /** any other class(es) to add to the `<ul>` */
	classes?: string;
}

/**
 * A `<ul>` list of social media links.
 * @param   frag the template content to process
 * @param   data an array of links
 * @param   opts additional processing options
 */
function instructions(frag: DocumentFragment, data: Hyperlink[], opts: OptsType): void {
  new xjs.HTMLUListElement(frag.querySelector('ul') !)
    .replaceClassString('{{ listclasses }}', opts.classes || '')
    .populate(function (f: DocumentFragment, d: Hyperlink) {
      new xjs.HTMLAnchorElement(f.querySelector('a') !)
        .replaceClassString('{{ name }}', d.name || '')
        .href(d.url)
      f.querySelector('slot') !.textContent = d.text
    }, data)
}

export default new Processor(template, instructions)<commit_msg>use `xjs.HTMLUListElement` template for list-social.tpl.ts<commit_after>import * as xjs from 'extrajs-dom'
import {Processor} from 'template-processor'

import {Hyperlink} from '../interfaces'


const template: HTMLTemplateElement = xjs.HTMLUListElement.templateSync()
	.exe(function () {
		new xjs.HTMLUListElement(this.content().querySelector('ul') !).addClass('o-List o-Flex c-SocialList {{ listclasses }}')
		new xjs.HTMLLIElement(this.content().querySelector('template') !.content.querySelector('li') !)
			.addClass('o-List__Item o-Flex__Item c-SocialList__Item')
			.attr({
				itemprop : 'sameAs',
				itemscope: '',
				itemtype : 'http://schema.org/WebPageElement',
			})
			.innerHTML(`
				<a class="c-SocialList__Link h-Block c-SocialList__Link--{{ name }}" href="{{ url }}" itemprop="url">
					<slot class="h-Hidden" itemprop="text">{{ text }}</slot>
				</a>
			`)
	})
	.node

interface OptsType {
  /** any other class(es) to add to the `<ul>` */
	classes?: string;
}

/**
 * A `<ul>` list of social media links.
 * @param   frag the template content to process
 * @param   data an array of links
 * @param   opts additional processing options
 */
function instructions(frag: DocumentFragment, data: Hyperlink[], opts: OptsType): void {
  new xjs.HTMLUListElement(frag.querySelector('ul') !)
    .replaceClassString('{{ listclasses }}', opts.classes || '')
    .populate(function (f: DocumentFragment, d: Hyperlink) {
      new xjs.HTMLAnchorElement(f.querySelector('a') !)
        .replaceClassString('{{ name }}', d.name || '')
        .href(d.url)
      f.querySelector('[itemprop="text"]') !.textContent = d.text
    }, data)
}

export default new Processor(template, instructions)
{'fraction_non_alphanumeric': 0.15907522429261559, 'fraction_numerical': 0.0, 'mean_word_length': 4.032986111111111, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4793250', 'n_tokens_mistral': 943, 'n_tokens_neox': 904, 'n_words': 227}