我有以下由inkscape生成的SVG
文件。正如你所看到的,XML的格式非常混亂。首先,在我的設置中,我選擇了「使用選項卡字符」,但該文件不包含製表符。許多其他事情也是錯誤的,例如/><g
和><path
。SVG的代碼格式在IntelliJ IDEA中不起作用
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="105.83467"
height="105.83467"
viewBox="0 0 99.220001 99.220001"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg2"
inkscape:version="0.92.1 r15371"
sodipodi:docname="activity_template.svg"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs11" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1676"
inkscape:window-height="1117"
id="namedview9"
showgrid="false"
inkscape:zoom="5.7699913"
inkscape:cx="2.3719576"
inkscape:cy="60.109287"
inkscape:window-x="0"
inkscape:window-y="298"
inkscape:window-maximized="0"
inkscape:current-layer="svg2"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" /><g
id="Background"
transform="translate(-0.4542549,-0.33174549)" /><g
id="Pictograms"
transform="translate(-0.4542549,-0.33174549)"><path
d="M 99.167833,18.811353 81.549745,0.77689213 c -0.19,-0.19 -0.501274,-0.36095895 -0.771274,-0.36127448 L 2.1282745,0.32370588 C 1.5682749,0.32305146 0.392628,1.5090001 0.39298039,2.059 l 0.0612745,95.634902 c 3.5239e-4,0.55 1.05274521,1.857486 1.61274511,1.857843 l 96.053823,0.06128 c 0.55,3.5e-4 1.613083,-1.001471 1.612746,-1.857843 l -0.03064,-77.84554 c -1.02e-4,-0.259999 -0.345098,-0.918284 -0.535096,-1.098289 z m -4.04848,-0.222549 -13.773431,-0.06127 0.06127,-13.7347055 z M 96.937,96.939 H 3.067 V 3.059 h 75.85 v 17.02 c 0,0.55 0.45,1 1,1 h 17.02 z"
id="path6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccsssssssscccccccccsscc" /></g><g
id="Guides"
transform="translate(-0.4542549,-0.33174549)" /><path
id="path3021"
d="m 88.804011,52.081722 c -4.779066,-1.280811 -5.862105,-12.487045 -1.941764,-14.749867 1.285092,-0.744856 2.281658,-1.801354 2.940042,-3.019664 -1.019682,-3.718289 -4.499102,-9.07526 -6.46227,-11.457944 -1.434918,-0.06678 -2.90237,0.261128 -4.237975,1.032525 -4.276503,2.470868 -13.117176,-4.137805 -11.800407,-9.056426 0.411811,-1.536801 0.194348,-3.400653 -0.141266,-4.489685 -2.430628,-1.2568381 -8.186569,-2.9477474 -12.461359,-3.366408 -0.921224,0.6703706 -1.976009,2.2910752 -2.386965,3.83815 -1.394679,5.201152 -12.431394,5.957139 -14.798666,1.85786 -0.790233,-1.36985 -2.245699,-2.645524 -3.251684,-3.0650415 -2.765385,0.8381785 -8.774749,4.3218805 -11.205378,6.3329915 0.167807,1.424646 0.200341,3.079596 1.017115,4.492254 2.36556,4.100135 -4.04106,13.217346 -9.10009,11.862051 -1.664368,-0.445202 -3.410928,-0.318491 -4.835572,0.267977 -1.1737914,2.599291 -2.9503161,9.454537 -3.1181228,12.219923 0.3356134,0.754274 2.3364504,2.078748 3.9366088,2.506826 6.886067,1.845874 6.940006,11.944241 1.95118,14.824352 -1.409233,0.814205 -2.616414,1.944332 -3.1189784,3.369833 0.8381784,2.681482 4.2062984,8.576976 6.3852174,11.091508 1.424644,0.166951 3.079595,-0.198628 4.49311,-1.016258 4.455438,-2.574462 13.366317,3.479421 11.860337,9.101802 -0.391264,1.463171 -0.174656,3.002541 0.0762,4.511946 3.352709,1.424644 9.417722,3.42891 12.770432,3.345007 1.089031,-1.005988 1.761115,-2.407516 2.143816,-3.838154 1.318481,-4.921188 12.202801,-6.49138 14.774695,-2.035941 0.718316,1.245708 1.724299,2.428061 2.897234,3.098431 3.51966,-1.005984 9.707103,-4.468281 11.804687,-6.6472 0.08219,-1.591595 -0.517119,-2.921206 -1.261975,-4.214002 -2.77994,-4.810744 3.714008,-13.23447 9.053857,-11.802976 1.462316,0.390408 3.054767,0.258559 4.396364,-0.0762 1.172934,-2.93405 3.118121,-8.175441 3.452022,-12.533277 -1.172933,-1.340742 -2.285937,-1.970016 -3.830443,-2.384396 z m -16.2704,3.250826 C 69.274222,67.504527 56.765774,74.725351 44.595508,71.465108 32.426953,68.203151 25.206129,55.692134 28.466373,43.521011 31.726618,31.349889 44.235066,24.128208 56.40362,27.389309 c 12.169409,3.2611 19.391091,15.770404 16.129991,27.943239 z"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill-rule:evenodd" /></svg>
所以,我想重新格式化我.svg
文件,但是當我在的IntelliJ IDEA做 「重新格式化代碼」(按Ctrl + Shift + L),沒有任何反應。
我試着去「文件類型」並重新分配.svg
文件到XML
文件類型,沒有區別。
我試過將.svg
文件重命名爲.xml
,沒有什麼區別。
如果我做「自動縮進線」(Ctrl + Alt + I),當前行實際上是用製表符正確縮進的,所以如果我爲每行執行此操作,我至少可以正確縮進整個文件,但沒有其他格式化問題是固定的。
我該如何讓IntelliJ IDEA重新格式化我的.svg
文件?
Inkscape中增加了這個屬性的所有文本元素。這是一種行爲,我沒有找到任何可能改變。儘管如此,這是我第一次看到它的根源。您可能需要查看Inkscape的配置文件夾(查看設置 - >系統以查找用戶/全局配置的位置)。有一些文件'模板/默認。 .svg'用於在啓動時初始化空文件。也許這個屬性已經潛入其中。你需要編輯它們/手動設置一個本地的。 –
ccprog
https://www.w3.org/TR/SVG/struct.html#XMLSpaceAttribute –
@ccprog非常感謝您的見解,我會研究這一點。 –