小编And*_*ich的帖子

将协作者添加到分叉的私人存储库

我有免费的 GitHub 帐户并分叉了一个私人仓库。现在我想将协作者添加到我的分支中。但“设置”页面下没有“协作者”选项卡。

免费计划不提供此功能吗?

github

4
推荐指数
1
解决办法
5659
查看次数

将图片插入指定位置

我有一个 Google Apps 脚本,它通过调用 body.replaceText('TextA', 'TextB'); 用一些文本替换模板文档副本中的占位符。

现在我想扩展它以包含图像。有谁知道如何做到这一点?

谢谢你,安德烈

编辑:只是为了弄清楚我的脚本是做什么的。我在电子表格中创建了一个 Google 表单。我创建了一个脚本,该脚本在提交表单时运行,遍历与表单对应的工作表,查找未处理的行,从相应的单元格中获取值并将它们放入 Google 文档的副本中。Google 表单中的某些字段是多行文本字段,这就是 '\r\r' 的来源。

这是我现在想出的一种解决方法,不优雅,但到目前为止它有效:

// replace <IMG src="URL"> with the image fetched from URL
function processIMG_(Doc) {

  var totalElements = Doc.getNumChildren();

  for( var j = 0; j < totalElements; ++j ) {

    var element = Doc.getChild(j);
    var type = element.getType();

    if (type =='PARAGRAPH'){
      var par_text = element.getText();

      var start = par_text.search(new RegExp('<IMG'));
      var end = par_text.search(new RegExp('>'));
      if (start==-1)
        continue;

      // Retrieve an image from the …
Run Code Online (Sandbox Code Playgroud)

google-docs google-docs-api google-apps-script

2
推荐指数
1
解决办法
5286
查看次数