Skip to content

Commit

Permalink
Add most data from depreacted.json to taginfo.json (close #5995)
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Mar 20, 2019
1 parent f3c68a3 commit 20e2be8
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 11 deletions.
25 changes: 25 additions & 0 deletions build_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const YAML = require('js-yaml');
const fieldSchema = require('./data/presets/schema/field.json');
const presetSchema = require('./data/presets/schema/preset.json');
const suggestions = require('name-suggestion-index').names;
const deprecated = require('./data/deprecated.json').dataDeprecated;

// fontawesome icons
const fontawesome = require('@fortawesome/fontawesome-svg-core');
Expand Down Expand Up @@ -418,6 +419,30 @@ function generateTaginfo(presets, fields) {
});
});

_forEach(deprecated, function(elem) {
var old = elem.old;
var oldKeys = Object.keys(old);
if (oldKeys.length === 1) {
var oldKey = oldKeys[0];
var tag = { key: oldKey };

var oldValue = old[oldKey];
if (oldValue !== '*') tag.value = oldValue;
var replacementStrings = [];
for (var replaceKey in elem.replace) {
var replaceValue = elem.replace[replaceKey];
if (replaceValue === '$1') replaceValue = '*';
replacementStrings.push(replaceKey + '=' + replaceValue);
}
var description = '🄳';
if (replacementStrings.length > 0) {
description += ' ➜ ' + replacementStrings.join(' + ');
}
tag.description = [description];
coalesceTags(taginfo, tag);
}
});

_forEach(taginfo.tags, function(elem) {
if (elem.description)
elem.description = elem.description.join(', ');
Expand Down
Loading

0 comments on commit 20e2be8

Please sign in to comment.