Difference between revisions of "Web-Markup-VimTips"

From KRayWiki
Jump to navigation Jump to search
(Copy from PmWiki)
 
(Initial conversion to MediaWiki markup.)
 
Line 1: Line 1:
!! Editing FAQ
+
= Editing FAQ =
!!! How do I change unquoted attribute values to quoted values?
+
 
* This colon command changes unquoted numeric attribute values to quoted values \\
+
<blockquote>
  [@g/./s/=\([0-9]*\)\([ >]\)/="\1"\2/g@]
+
 
!!! How do I switch HTML or XHTML tag and attribute names to lowercase?
+
== How do I change unquoted attribute values to quoted values? ==
 +
 
 +
* This colon command changes unquoted numeric attribute values to quoted values
 +
*:<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1en 1en; padding: 1ex; white-space: pre;"><nowiki>g/./s/=\([0-9]*\)\([ >]\)/="\1"\2/g</nowiki></div>
 +
 
 +
== How do I switch HTML or XHTML tag and attribute names to lowercase? ==
 +
 
 
* Use the following colon commands in a vim editor after making sure that all attribute values are quoted.  Attributes without quotes are not modified.
 
* Use the following colon commands in a vim editor after making sure that all attribute values are quoted.  Attributes without quotes are not modified.
** Entities \\
+
** Entities
  [@%s/<\/\?\zs\(\w\+\)\ze[ >]/\L\1/g@]
+
**:<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1en 1en; padding: 1ex; white-space: pre;"><nowiki>%s/<\/\?\zs\(\w\+\)\ze[ >]/\L\1/g</nowiki></div>
** Attributes \\
+
** Attributes
  [@%s/\(<[^>]*\)\@<=\<\(\a*\)\ze=['"]/\L\2/g@]
+
**:<div style="background-color: #EEEEEE; border: dashed; border-width: 1px; font-family: courier; margin: 1en 1en; padding: 1ex; white-space: pre;"><nowiki>%s/\(<[^>]*\)\@<=\<\(\a*\)\ze=['"]/\L\2/g</nowiki></div>
!!! Where can I find lists of character entities?
+
 
* [[http://www.elizabethcastro.com/html/extras/entities.html|HTML/XHTML Entities]]
+
== Where can I find lists of character entities? ==
 +
 
 +
* [http://www.elizabethcastro.com/html/extras/entities.html HTML/XHTML Entities]
 +
 
 +
</blockquote>
 +
 
 +
[[Category:Web]]
 +
[[Category:Web-Markup]]

Latest revision as of 05:40, 3 January 2018

Editing FAQ

How do I change unquoted attribute values to quoted values?

  • This colon command changes unquoted numeric attribute values to quoted values
    g/./s/=\([0-9]*\)\([ >]\)/="\1"\2/g

How do I switch HTML or XHTML tag and attribute names to lowercase?

  • Use the following colon commands in a vim editor after making sure that all attribute values are quoted. Attributes without quotes are not modified.
    • Entities
      %s/<\/\?\zs\(\w\+\)\ze[ >]/\L\1/g
    • Attributes
      %s/\(<[^>]*\)\@<=\<\(\a*\)\ze=['"]/\L\2/g

Where can I find lists of character entities?