Skip to content

floriancargoet/html-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-patch

Work in progress

Patches HTML files with DOM-oriented rules.

Simple example

Input file:

<html>
  <head>
    <title>Simple rules</title>
  </head>
  <body>
    <p class="remove-me">Remove me</p>
    <p class="give-me-children">
      <span>First</span>
    </p>
  </body>
</html>

Rules:

<rules>
  <remove selector="p.remove-me" />
  <append selector="p.give-me-children">
    <span>Second</span>
    <span>Third</span>
  </append>
</rules>

Output:

<html>
  <head>
    <title>Simple rules</title>
  </head>
  <body>

    <p class="give-me-children">
      <span>First</span>

    <span>Second</span>
    <span>Third</span>
  </p>
  </body>
</html>

Known issues

  • not enough commands
  • rules must be valid XML (cannot contain <br> but <br/> is fine)
  • formatting

About

Patches HTML files with DOM-oriented rules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published