ouchdb蒲团文档编辑器-我可以自定义缩进规则吗? [英] couchdb futon document editor - can I customize the indentation rules?

查看:143
本文介绍了ouchdb蒲团文档编辑器-我可以自定义缩进规则吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我要自定义foton文档编辑器的缩进规则,该在哪里以及如何做?

Suppose that I want to customize the indentation rules of the foton document editor, where and how can I do that?

我会详细说明。

照片编辑器的文档布局如下:
(对我而言,这完全令人讨厌)

The foton editor lays out document like this: (which to my flavor is completely annoying)

{
   "_id": "1326017821636",
   "_rev": "2-51ab614953437181a24f1c073fbc6201",
   "doc_type": 0,
   "step": 2,
   "data": {
       "map1": {
           "attr1": 73031,
           "attr2": "strval"
       },
       "map2": {
           "att1": 52001,
           "att2": "strval"
       },
       "mapmap": {
           "map": {
               "id11": {
                   "id": "id11",
                   "attr": "attr",
                   "attr2": 2222
               },
               "id1211": {
                   "id": "id1211",
                   "attr": "attr",
                   "attr2": 2222
               }
           }
       }
   }
}

您可能会问我想更改什么?似乎很标准。
好​​吧,我不是标准人。根据我的观察,许多标准是任意发展的,缺乏思想。此外,如果我是标准追随者,那么我不是在问定制;)

And what would I want to change, you may ask? It seems pritty standard. Well, I'm not a standard person. To my observations many standards evolved arbitrarily and suffer lack of thought. Besides, if I was a standard-follower I was not asking about customization ;)

很快-
-3个空格制表符缩进。为什么是3?不是2而不是4。只有3个?大声笑
-块形成-打开块会在破旧的地方画一条线
-逗号在错误的一侧

Shortly - - 3 spaces tab indent. Why 3? not 2 and not 4. just 3? LOL - block formation - opening a block draws down a line in the worng place - commas are in the wrong side

所以我想要它就像这样:
(我什至拥有执行此操作的JS代码,我只需要放置位置的帮助

So I want it to be like this: (and I even have the JS code that does it, I just need help in where to put it)

{ "_id"      : "1326017821636"
, "_rev"     : "2-51ab614953437181a24f1c073fbc6201"
, "doc_type" : 0
, "step"     : 2
, "data"     : 
    { "map1" : 
        { "attr1" : 73031
        , "attr2" : "strval"
        }
    , "map2" :
        { "att1" : 52001
        , "att2" : "strval"
        }
    , "mapmap" : 
        { "map" : 
            { "id11"   : 
                 { "id"    : "id11"
                 , "attr"  : "attr"
                 , "attr2" : 2222
                 }
            }
        ,   { "id1122" : 
                 { "id"    : "id11"
                 , "attr"  : "attr"
                 , "attr2" : 2222
                 }
            }
        }
    }
}

为什么我要这样做?
-看起来更表格化。同一对象/数组的所有语法缩写都在同一列
中(将逗号放在语句的错误一侧)
-不会重复使用,也不会浪费空行
-仅以开始- block是一种边缘情况(相反,您有一个开始一个块的情况和一个结束一个块的情况以及每行的一个情况)。

Why I do it this way? - it looks more tabular. All syntax scuffold of same object/array are in the same column (who placed the comma in the wrong side of the statement anyway) - no redunand wasted empty lines - only the start-block is an edge case (opposed to in the other way you have a case for begining a block and a case for ending a block and a case for every line).

如果我可以执行缩进,并且foton每次验证文档时都不会破坏它们,那会很好。但是,既然如此,我就需要进入这种机制,并用我自己的一个替换它的压头。

It would have been fine if I could perform my indentations and the foton will not ruin them everytime it validates the document. But, since it does, I need to get into this mechanism and replace it's indentor with one of my own.

任何方向?

PS:
如果您知道此处的答案-您可能知道此问题的答案:
couchdb蒲团文档编辑器-我可以自定义文档验证部分吗?

推荐答案

同样,在快速浏览之后,您可能想要在这里查看:

Again, after a quick browse, this is where you might want to look:

https://github.com/apache/couchdb/blob/ master / share / www / script / futon.browse.js#L899

您将在本地沙发上找到一个相应的/ share / www / script文件夹实例,如果您想进行实时编辑。

You will have a corresponding /share/www/script folder on your local couchdb instance if you want to play around editing it live.

这篇关于ouchdb蒲团文档编辑器-我可以自定义缩进规则吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆