function insertRisk()

in misc/RRACodeMaster.js [97:118]


function insertRisk(title1, color1) {
  var doc = DocumentApp.getActiveDocument();
  var c = doc.getCursor();
  var style = {};
  style[DocumentApp.Attribute.FOREGROUND_COLOR] = color1;
  style[DocumentApp.Attribute.FONT_FAMILY] = 'Open Sans';
  style[DocumentApp.Attribute.FONT_SIZE] = 10;
  style[DocumentApp.Attribute.BOLD] = true;
  style[DocumentApp.Attribute.UNDERLINE] = false;

  
  var txt = c.getSurroundingText();
  //c.insertText(title1);
  //var cpos_start = c.getSurroundingTextOffset();
  //var cpos_end = cpos_start + title1.length-1;
  // Override position so that its always at the start of the string, so that we can parse it properly
  cpos_start = 0;
  cpos_end = title1.length-1;
  txt.insertText(cpos_start, title1+' '); //add extra spacing for convenience
  txt.setLinkUrl(cpos_start, cpos_end, 'https://wiki.mozilla.org/Security/Standard_Levels');
  txt.setAttributes(cpos_start, cpos_end, style);
}