User:RailML Coord Common/Tools: Difference between revisions

From railML 2 Wiki
Jump to navigation Jump to search
(created page)
 
No edit summary
Line 1: Line 1:
Check indentation:
== Formatting checks ==
awk "BEGINFILE {indent=0} /^ *<\/[^>]+>$/ {indent=indent-2} /^ / { here=match($0, /</)-1 ; if (indent != here) print FILENAME, \":\", FNR, \":\", $0} /^ *<[^/!][^>]*[^/]>$/ { indent=here+2 }" *.xsd
In compliance with [[Dev:Syntactic_Guidelines]]


Xpath for empty nodes:
=== Find and remove tabulators ===
//*[text() and not(normalize-space()) and not(*)]
\t
 
=== Xpath for empty nodes ===
//*[text() and not(normalize-space()) and not(*)]
 
=== Lines not ending with a tag ===
[^>]$
 
=== Lines not starting with a tag ===
^ *[^ <]
 
=== Check indentation ===
"BEGINFILE { indent=0 } /^ *<\/[^>]+>$/ { indent=indent-2 } /[^ ]/ { here=match($0, /</)-1 ; if (indent != here) print FILENAME, \":\", FNR, \":\", $0 } /^ *<[^/!?][^>]*[^/]>$/ { indent=here+2 }" *.xsd

Revision as of 21:57, 10 July 2021

Formatting checks

In compliance with Dev:Syntactic_Guidelines

Find and remove tabulators

\t

Xpath for empty nodes

//*[text() and not(normalize-space()) and not(*)]

Lines not ending with a tag

[^>]$

Lines not starting with a tag

^ *[^ <]

Check indentation

"BEGINFILE { indent=0 } /^ *<\/[^>]+>$/ { indent=indent-2 } /[^ ]/ { here=match($0, /</)-1 ; if (indent != here) print FILENAME, \":\", FNR, \":\", $0 } /^ *<[^/!?][^>]*[^/]>$/ { indent=here+2 }" *.xsd