diff --git a/aio/src/styles/2-modules/_guides.scss b/aio/src/styles/2-modules/_guides.scss new file mode 100644 index 0000000000..db656ac923 --- /dev/null +++ b/aio/src/styles/2-modules/_guides.scss @@ -0,0 +1,6 @@ +.reviewed { + color: lighten($darkgray, 10); + @include font-size(13); + font-style: italic; + text-align: right; +} \ No newline at end of file diff --git a/aio/src/styles/2-modules/_modules-dir.scss b/aio/src/styles/2-modules/_modules-dir.scss index d55755d566..1c48725103 100644 --- a/aio/src/styles/2-modules/_modules-dir.scss +++ b/aio/src/styles/2-modules/_modules-dir.scss @@ -18,6 +18,7 @@ @import 'errors'; @import 'features'; @import 'filetree'; + @import 'guides'; @import 'heading-anchors'; @import 'hr'; @import 'images'; diff --git a/aio/tools/transforms/content-package/tag-defs/reviewed.js b/aio/tools/transforms/content-package/tag-defs/reviewed.js new file mode 100644 index 0000000000..bcbe6bd18c --- /dev/null +++ b/aio/tools/transforms/content-package/tag-defs/reviewed.js @@ -0,0 +1,21 @@ +/** + * @reviewed + * + * Use this tag-def to indicate the date when this document was last reviewed. + * The date-string will be passed to the `Date()` constructor. + */ +module.exports = function(createDocMessage) { + return { + name: 'reviewed', + transforms(doc, tag, value) { + if (!/^\d{4}-\d{1,2}-\d{1,2}/.test(value.trim())) { + throw new Error(createDocMessage( + `Tag Error: @${tag.tagName} tag is missing the required date in the form "yyyy-mm-dd" but got "${value}"\n`, + doc)); + } + return { + date: new Date(value), + }; + } + }; +}; diff --git a/aio/tools/transforms/templates/content.template.html b/aio/tools/transforms/templates/content.template.html index 58d0baf52d..81c975493c 100644 --- a/aio/tools/transforms/templates/content.template.html +++ b/aio/tools/transforms/templates/content.template.html @@ -3,12 +3,13 @@ {% set relativePath = doc.fileInfo.relativePath %} {% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %} {% if '/' in relativePath or 'docs.md' in relativePath %} - + {% endif %} {% block content %}
-{$ doc.description | marked $} + {$ doc.description | marked $} + {% if doc.reviewed %}
Last reviewed on {$ doc.reviewed.date.toDateString() $}
{% endif %}
{% endblock %} \ No newline at end of file