isodoc 1.5.3 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +6 -4
  4. data/Gemfile +2 -2
  5. data/bin/rspec +1 -2
  6. data/isodoc.gemspec +11 -11
  7. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  8. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  9. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  10. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  11. data/lib/isodoc/base_style/all.css +7 -0
  12. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  13. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  14. data/lib/isodoc/base_style/reset.css +7 -0
  15. data/lib/isodoc/base_style/reset.scss +9 -0
  16. data/lib/isodoc/base_style/scripts.html +187 -0
  17. data/lib/isodoc/class_utils.rb +6 -5
  18. data/lib/isodoc/common.rb +2 -0
  19. data/lib/isodoc/convert.rb +30 -17
  20. data/lib/isodoc/css.rb +42 -28
  21. data/lib/isodoc/function/blocks.rb +25 -4
  22. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  23. data/lib/isodoc/function/cleanup.rb +1 -2
  24. data/lib/isodoc/function/form.rb +51 -0
  25. data/lib/isodoc/function/inline.rb +32 -10
  26. data/lib/isodoc/function/references.rb +55 -42
  27. data/lib/isodoc/function/table.rb +1 -0
  28. data/lib/isodoc/function/to_word_html.rb +29 -27
  29. data/lib/isodoc/function/utils.rb +41 -38
  30. data/lib/isodoc/gem_tasks.rb +30 -31
  31. data/lib/isodoc/html_convert.rb +6 -4
  32. data/lib/isodoc/html_function/form.rb +62 -0
  33. data/lib/isodoc/html_function/postprocess.rb +35 -76
  34. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  35. data/lib/isodoc/i18n.rb +33 -31
  36. data/lib/isodoc/pdf_convert.rb +1 -3
  37. data/lib/isodoc/presentation_function/block.rb +26 -11
  38. data/lib/isodoc/presentation_function/inline.rb +60 -111
  39. data/lib/isodoc/presentation_function/math.rb +84 -0
  40. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  41. data/lib/isodoc/version.rb +1 -1
  42. data/lib/isodoc/word_function/body.rb +28 -24
  43. data/lib/isodoc/word_function/footnotes.rb +22 -15
  44. data/lib/isodoc/word_function/inline.rb +6 -0
  45. data/lib/isodoc/word_function/postprocess.rb +16 -6
  46. data/lib/isodoc/xref.rb +10 -11
  47. data/lib/isodoc/xref/xref_counter.rb +31 -15
  48. data/lib/isodoc/xref/xref_gen.rb +28 -22
  49. data/lib/isodoc/xref/xref_sect_gen.rb +22 -20
  50. data/lib/isodoc/xslfo_convert.rb +36 -25
  51. data/spec/assets/html_override.css +1 -0
  52. data/spec/assets/word_override.css +1 -0
  53. data/spec/isodoc/blocks_spec.rb +2599 -2503
  54. data/spec/isodoc/cleanup_spec.rb +1107 -1109
  55. data/spec/isodoc/footnotes_spec.rb +1 -16
  56. data/spec/isodoc/form_spec.rb +156 -0
  57. data/spec/isodoc/i18n_spec.rb +984 -972
  58. data/spec/isodoc/inline_spec.rb +984 -920
  59. data/spec/isodoc/lists_spec.rb +316 -315
  60. data/spec/isodoc/postproc_spec.rb +1692 -1538
  61. data/spec/isodoc/presentation_xml_spec.rb +345 -338
  62. data/spec/isodoc/ref_spec.rb +718 -723
  63. data/spec/isodoc/section_spec.rb +910 -902
  64. data/spec/isodoc/table_spec.rb +566 -556
  65. data/spec/isodoc/terms_spec.rb +252 -256
  66. data/spec/isodoc/xref_spec.rb +3040 -2985
  67. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  68. data/spec/spec_helper.rb +30 -29
  69. metadata +80 -69
  70. data/.rubocop.ribose.yml +0 -65
  71. data/.rubocop.tb.yml +0 -650
@@ -0,0 +1,154 @@
1
+ term_def_boilerplate:
2
+ scope: Сфера применения
3
+ symbolsabbrev: Символы и сокращенные термины
4
+ abbrev: Сокращенные термины
5
+ symbols: Символы
6
+ table_of_contents: Содержание
7
+ introduction: Введение
8
+ foreword: Предисловие
9
+ abstract: Реферат
10
+ acknowledgements: Подтверждения
11
+ termsdef: Термины и определения
12
+ termsdefsymbolsabbrev: Термины, определения, символы и сокращенные термины
13
+ termsdefsymbols: Термины, определения и символы
14
+ termsdefabbrev: Термины, определения и сокращенные термины
15
+ normref: Нормативные ссылки
16
+ bibliography: Библиография
17
+ clause: Пункт
18
+ annex: Дополнение
19
+ appendix: Приложение
20
+ no_terms_boilerplate: |
21
+ <p>Термины и определения не перечислены в этом документе.</p>
22
+ internal_terms_boilerplate: |
23
+ <p>Для целей этого документа
24
+ применяются следующие термины и определения.</p>
25
+ norm_with_refs_pref:
26
+ Следующие документы упоминаются в тексте таким образом,
27
+ что некоторая часть или все их содержание являются требованиями
28
+ настоящего документа. Для датированных ссылок применяют только указанное издание.
29
+ Для недатированных ссылок применяют последнее издание
30
+ указанного документа (включая любые поправки).
31
+ norm_empty_pref:
32
+ Нет нормативных ссылок в этом документе.
33
+ external_terms_boilerplate: |
34
+ <p>Для целей этого документа применяются
35
+ термины и определения, данные в %.</p>
36
+ internal_external_terms_boilerplate: |
37
+ <p>Для целей этого документа применяются
38
+ термины и определения, данные в % и следующие.</p>
39
+ term_defined_in: "[термин, определенный в %]"
40
+ note: ПРИМЕЧАНИЕ
41
+ note_xref: Примечание
42
+ termnote: Примечание % к определению
43
+ list: Список
44
+ figure: Рисунок
45
+ formula: Формула
46
+ inequality: Формула
47
+ table: Таблица
48
+ requirement: Требование
49
+ recommendation: Рекомендация
50
+ permission: Разрешение
51
+ key: Условные обозначения
52
+ example: ПРИМЕР
53
+ example_xref: Пример
54
+ where: где
55
+ wholeoftext: Текст полностью
56
+ draft_label: проект
57
+ inform_annex: информативное
58
+ norm_annex: нормативное
59
+ modified: изменен
60
+ deprecated: НЕ РЕКОМЕНДУЕТСЯ
61
+ source: ИСТОЧНИК
62
+ and: и
63
+ all_parts: Все части
64
+ month_january: Январь
65
+ month_february: Февраль
66
+ month_march: Март
67
+ month_april: Апрель
68
+ month_may: Май
69
+ month_june: Июнь
70
+ month_july: Июль
71
+ month_august: Август
72
+ month_september: Сентябрь
73
+ month_october: Октябрь
74
+ month_november: Ноябрь
75
+ month_december: Декабрь
76
+ obligation: Обязательство
77
+ subject: Тема
78
+ inherits: Наследует
79
+ admonition: {
80
+ danger: Опасность,
81
+ warning: Предупреждение,
82
+ caution: Предостережение,
83
+ important: Важно,
84
+ safety precautions: Меры безопасности
85
+ }
86
+ locality: {
87
+ section: Раздел,
88
+ clause: Пункт,
89
+ part: Часть,
90
+ paragraph: Абзац,
91
+ chapter: Глава,
92
+ page: Стр.,
93
+ table: Таблица,
94
+ annex: Дополнение,
95
+ figure: Рисунок,
96
+ example: Пример,
97
+ note: Примечание,
98
+ formula: Формула
99
+ }
100
+ inflection:
101
+ Пункт:
102
+ sg: Пункт
103
+ pl: Пункты
104
+ Дополнение:
105
+ sg: Дополнение
106
+ pl: Дополнения
107
+ Приложение:
108
+ sg: Приложение
109
+ pl: Приложения
110
+ Примечание:
111
+ sg: Примечание
112
+ pl: Примечания
113
+ "Примечание % к записи":
114
+ sg: Примечание % к записи
115
+ pl: Примечания % к записи
116
+ Список:
117
+ sg: Список
118
+ pl: Списки
119
+ Рисунок:
120
+ sg: Рисунок
121
+ pl: Рисунки
122
+ Формула:
123
+ sg: Формула
124
+ pl: Формулы
125
+ Таблица:
126
+ sg: Таблица
127
+ pl: Таблицы
128
+ Требование:
129
+ sg: Требование
130
+ pl: Требования
131
+ Рекомендация:
132
+ sg: Рекомендация
133
+ pl: Рекомендации
134
+ Разрешение:
135
+ sg: Разрешение
136
+ pl: Разрешения
137
+ Пример:
138
+ sg: Пример
139
+ pl: Примеры
140
+ Часть:
141
+ sg: Часть
142
+ pl: Части
143
+ Раздел:
144
+ sg: Раздел
145
+ pl: Разделы
146
+ Абзац:
147
+ sg: Абзац
148
+ pl: Абзацы
149
+ Глава:
150
+ sg: Глава
151
+ pl: Главы
152
+ "Стр.":
153
+ sg: Стр.
154
+ pl: Стр.
@@ -108,6 +108,13 @@ a.FootnoteRef + a.FootnoteRef:before {
108
108
  content: ", ";
109
109
  vertical-align: super; }
110
110
 
111
+ .addition {
112
+ color: blue; }
113
+
114
+ .deletion {
115
+ color: red;
116
+ text-decoration: line-through; }
117
+
111
118
  #standard-band {
112
119
  background-color: #0AC442; }
113
120
 
@@ -38,3 +38,10 @@ br.section {
38
38
  br.pagebreak {
39
39
  page-break-before: always;
40
40
  mso-special-character: line-break; }
41
+
42
+ span.addition {
43
+ color: blue; }
44
+
45
+ span.deletion {
46
+ color: red;
47
+ text-decoration: line-through; }
@@ -34,3 +34,11 @@ br.section
34
34
  br.pagebreak
35
35
  {page-break-before:always;
36
36
  mso-special-character:line-break;}
37
+
38
+ span.addition {
39
+ color: blue;
40
+ }
41
+ span.deletion {
42
+ color: red;
43
+ text-decoration: line-through;
44
+ }
@@ -107,3 +107,10 @@ div.document-stage-band, div.document-type-band {
107
107
  a.FootnoteRef + a.FootnoteRef:before {
108
108
  content: ", ";
109
109
  vertical-align: super; }
110
+
111
+ .addition {
112
+ color: blue; }
113
+
114
+ .deletion {
115
+ color: red;
116
+ text-decoration: line-through; }
@@ -132,3 +132,12 @@ a.FootnoteRef + a.FootnoteRef:before {
132
132
  content: ", ";
133
133
  vertical-align: super;
134
134
  }
135
+
136
+ .addition {
137
+ color: blue;
138
+ }
139
+
140
+ .deletion {
141
+ color: red;
142
+ text-decoration: line-through;
143
+ }
@@ -0,0 +1,187 @@
1
+ <script>
2
+ $("#toc").on('click', 'li', function(e) {
3
+ $(this).parent().find('li.toc-active').removeClass('toc-active');
4
+ $(this).addClass('toc-active');
5
+ });
6
+ </script>
7
+
8
+ <script>
9
+ //TOC toggle animation
10
+ $('#toggle').on('click', function(){
11
+ if( $('nav').is(':visible') ) {
12
+ $('nav').animate({ 'left': '-353px' }, 'slow', function(){
13
+ $('nav').hide();
14
+ });
15
+ $('body').animate({ 'margin-left': '0' }, 'slow');
16
+ }
17
+ else {
18
+ $('nav').show();
19
+ $('nav').animate({ 'left': '0px' }, 'slow');
20
+ $('body').animate({ 'margin-left': '298px' }, 'slow');
21
+ }
22
+ });
23
+ </script>
24
+
25
+ <script>
26
+ // Scroll to top button
27
+ window.onscroll = function() {scrollFunction()};
28
+
29
+ function scrollFunction() {
30
+ if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
31
+ document.getElementById("myBtn").style.display = "block";
32
+ } else {
33
+ document.getElementById("myBtn").style.display = "none";
34
+ }
35
+ }
36
+
37
+ // When the user clicks on the button, scroll to the top of the document
38
+ function topFunction() {
39
+ document.body.scrollTop = 0;
40
+ document.documentElement.scrollTop = 0;
41
+ }
42
+ </script>
43
+
44
+ <script>
45
+ /*
46
+ $(document).ready(function() {
47
+ $('[id^=toc]').each(function ()
48
+ {
49
+ var currentToc = $(this);
50
+ var url = window.location.href;
51
+ currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "'></a>");
52
+ });
53
+ });
54
+ */
55
+ </script>
56
+
57
+ <script>
58
+ document.querySelectorAll('*|svg a').forEach(function(item) {
59
+ var loc = item.getAttribute('href');
60
+ if (loc !== null && loc.startsWith('#')) {
61
+ item.setAttribute('href', location.pathname + loc);
62
+ }
63
+ });
64
+ </script>
65
+
66
+
67
+ <script>
68
+
69
+ // jQuery Inline Footnotes v1.0.3
70
+ // Copyright (c) 2011 Vesa Vänskä, released under the MIT License.
71
+
72
+ // Generated by CoffeeScript 1.6.1
73
+ (function() {
74
+
75
+ (function($) {
76
+ $.inlineFootnote = function(el, options) {
77
+ var _this = this;
78
+ this.el = $(el);
79
+ this.el.data("inlineFootnote", this);
80
+ this.initialize = function() {
81
+ this.options = $.extend({}, $.inlineFootnote.defaultOptions, options);
82
+ this.footnoteId = this.el.attr("href").match(/#(.*)/)[1];
83
+ if (this.footnoteId) {
84
+ this.el.mouseenter(this.openBox);
85
+ return $("body").mousemove(this.closeBox);
86
+ }
87
+ };
88
+ this.openBox = function(event) {
89
+ var footnoteContent, linkOffset;
90
+ if (!_this.box) {
91
+ footnoteContent = $("[id='" + _this.footnoteId + "']").children().filter(":not('" + _this.options.hideFromContent + "')");
92
+ linkOffset = _this.el.offset();
93
+ _this.box = $("<div />", {
94
+ id: _this.options.boxId,
95
+ html: footnoteContent.clone().find(_this.options.hideFromContent).remove().end(),
96
+ css: {
97
+ position: "absolute",
98
+ top: linkOffset.top,
99
+ left: linkOffset.left + _this.el.outerWidth()
100
+ }
101
+ }).appendTo("body");
102
+ return _this.positionBox();
103
+ }
104
+ };
105
+ this.closeBox = function(event) {
106
+ if (_this.box) {
107
+ if (_this.isHoveringFootnote(event)) {
108
+ clearTimeout(_this.closeTimeout);
109
+ return _this.closeTimeout = null;
110
+ } else {
111
+ if (!_this.closeTimeout) {
112
+ return _this.closeTimeout = setTimeout((function() {
113
+ _this.box.remove();
114
+ return _this.box = null;
115
+ }), _this.options.hideDelay);
116
+ }
117
+ }
118
+ }
119
+ };
120
+ this.isHoveringFootnote = function(event) {
121
+ return this.box.is(event.target) || $(event.target).closest(this.box).length > 0 || event.target === this.el[0];
122
+ };
123
+ this.positionBox = function() {
124
+ var boxHorizontalPadding, boxLeft, boxWidth, linkLeftOffset, windowWidth;
125
+ boxHorizontalPadding = parseInt(this.box.css("padding-left")) + parseInt(this.box.css("padding-right"));
126
+ linkLeftOffset = this.el.offset().left;
127
+ windowWidth = $(window).width();
128
+ if ((windowWidth / 2) > linkLeftOffset) {
129
+ boxLeft = linkLeftOffset + 20;
130
+ boxWidth = windowWidth - boxLeft - boxHorizontalPadding - this.options.boxMargin * 2;
131
+ if (boxWidth > this.options.maximumBoxWidth) {
132
+ boxWidth = this.options.maximumBoxWidth;
133
+ }
134
+ } else {
135
+ boxWidth = linkLeftOffset - boxHorizontalPadding - this.options.boxMargin * 2;
136
+ if (boxWidth > this.options.maximumBoxWidth) {
137
+ boxWidth = this.options.maximumBoxWidth;
138
+ }
139
+ boxLeft = linkLeftOffset - boxWidth - this.options.boxMargin * 2;
140
+ }
141
+ return this.box.css({
142
+ width: boxWidth,
143
+ left: boxLeft
144
+ });
145
+ };
146
+ return this.initialize();
147
+ };
148
+ $.inlineFootnote.defaultOptions = {
149
+ boxMargin: 20,
150
+ hideDelay: 200,
151
+ hideFromContent: "[rel=footnote]",
152
+ maximumBoxWidth: 500,
153
+ boxId: "footnote_box"
154
+ };
155
+ return $.fn.inlineFootnote = function(options) {
156
+ return this.each(function() {
157
+ return new $.inlineFootnote(this, options);
158
+ });
159
+ };
160
+ })(jQuery);
161
+
162
+ }).call(this);
163
+ </script>
164
+
165
+ <script>
166
+ $(function() {
167
+ $("[rel=footnote]").inlineFootnote();
168
+ });
169
+ </script>
170
+ <script>
171
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
172
+ //
173
+ // AnchorJS - v4.2.2 - 2020-04-20
174
+ // https://www.bryanbraun.com/anchorjs/
175
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
176
+ //
177
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
178
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
179
+ // @license-end
180
+ </script>
181
+ <script>
182
+ anchors.options = {
183
+ placement: 'left'
184
+ };
185
+ anchors.add('h1, h2, h3, h4');
186
+ </script>
187
+
@@ -4,18 +4,19 @@ module IsoDoc
4
4
  from = date.at(ns("./from"))
5
5
  to = date.at(ns("./to"))
6
6
  on = date.at(ns("./on"))
7
- return date.text unless (from || on || to)
7
+ return date.text unless from || on || to
8
8
  return on.text if on
9
+
9
10
  ret = "#{from.text}&ndash;"
10
11
  ret += to.text if to
11
12
  ret
12
13
  end
13
14
 
14
15
  def ns(xpath)
15
- xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1").
16
- gsub(%r{::([a-zA-z])}, "::xmlns:\\1").
17
- gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1").
18
- gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1")
16
+ xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1")
17
+ .gsub(%r{::([a-zA-z])}, "::xmlns:\\1")
18
+ .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1")
19
+ .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1")
19
20
  end
20
21
 
21
22
  def liquid(doc)
data/lib/isodoc/common.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require_relative "./function/blocks"
2
2
  require_relative "./function/cleanup"
3
+ require_relative "./function/form"
3
4
  require_relative "./function/inline"
4
5
  require_relative "./function/lists"
5
6
  require_relative "./function/references"
@@ -15,6 +16,7 @@ module IsoDoc
15
16
  class Common
16
17
  include Function::Blocks
17
18
  include Function::Cleanup
19
+ include Function::Form
18
20
  include Function::Inline
19
21
  include Function::Lists
20
22
  include Function::References