Commits

Frank Bennett  committed 71158dd

Add option to hack around browser thin-non-breaking space limitations

  • Participants
  • Parent commits 05d54b2

Comments (0)

Files changed (3)

File src/formatters.js

 
 CSL.getSafeEscape = function(state) {
     if (["bibliography", "citation"].indexOf(state.tmp.area) > -1) {
-        return CSL.Output.Formats[state.opt.mode].text_escape;
+        if (state.opt.development_extensions.thin_non_breaking_space_html_hack && state.opt.mode === "html") {
+            return function (txt) {
+                return CSL.Output.Formats.html.text_escape(txt)
+                    .replace(/\u202f/g, '<span style="white-space:nowrap">&thinsp;</span>');
+            }
+        } else {
+            return CSL.Output.Formats[state.opt.mode].text_escape;
+        }
     } else {
         return function (txt) { return txt; };
     }

File src/state.js

     this.development_extensions.wrap_url_and_doi = false;
     this.development_extensions.allow_force_lowercase = false;
     this.development_extensions.handle_parallel_articles = false;
+    this.development_extensions.thin_non_breaking_space_html_hack = false;
 
     this.nodenames = [];
 

File src/testing_stdrhino.js

     this.style.opt.development_extensions.static_statute_locator = true;
     this.style.opt.development_extensions.clobber_locator_if_no_statute_section = true;
     this.style.opt.development_extensions.handle_parallel_articles = true;
+    //this.style.opt.development_extensions.thin_non_breaking_space_html_hack = true;
     //this.style.opt.development_extensions.wrap_url_and_doi = true;
     var langParams = {
         persons:["translit"],