Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTMC

This tool is for merging HTML files by replacing elements in the index.html file that contain a path attribute with the contents of another HTML file using the path that is given in the path attribute.

## Usage To use the tool, simply run the following command in your terminal:

$ cargo run

This will merge the contents of merge.html into index.html, replacing any element in index.html that has a path attribute with the contents of the corresponding element in merge.html.

This will replace any elements in the index.html that contain a path="" attribute with the contents of the file given in the path attribute.

Example

Suppose you have an index.html file that looks like this:

<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <div path="./header.html"></div>
    <div path="../content/content.html"></div>
    <div path="../footer/footer.html"></div>
  </body>
</html>

And you have the following header.html, content.html, and footer.html files:

<!-- header.html -->
<header>
  <h1>Welcome to My Website!</h1>
</header>

<!-- content.html -->
<main>
  <p>This is the main content of my website.</p>
</main>

<!-- footer.html -->
<footer>
  <p>&copy; 2023 My Company, Inc.</p>
</footer>

This will replace the div elements in index.html with the contents of the corresponding HTML files, resulting in a merged index.html file that looks like this:

<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <header>
      <h1>Welcome to My Website!</h1>
    </header>
    <main>
      <p>This is the main content of my website.</p>
    </main>
    <footer>
      <p>&copy; 2023 My Company, Inc.</p>
    </footer>
  </body>
</html>

Contributing

If you'd like to contribute to the HTML merger tool, please fork this repository and submit a pull request with your changes.

license

The HTML merger tool is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages