Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sitemap_treemaker

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemap_treemaker

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sitemap Treemaker

... 'cause all the clever names are taken, probably.

Problem: I've got a basic sitemap.xml. It looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
      http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

      <url><loc>http://someplace.org/</loc><changefreq>always</changefreq><priority>0.5</priority></url>
      <url><loc>http://someplace.org/about-someplace/</loc><changefreq>always</changefreq><priority>0.5</priority></url>
      <url><loc>http://someplace.org/about-someplace/board-of-directors/</loc><changefreq>always</changefreq><priority>0.5</priority></url>
    </urlset>

I need to build a tree out of all of these clearly hierarchal links. So, I do this:


    sitemap_tree = SitemapTreemaker.new('http://someplace.org/sitemap.xml')
    sitemap_tree.tree

tree returns a Tree::TreeNode from the library RubyTree. I can now take that tree and do something useful with it, maybe. Or, I could just print a pretty diagram:

    sitemap_tree = SitemapTreemaker.new('http://someplace.org/sitemap.xml')
    sitemap_tree.print_tree_diagram

    #=>
    * root
    |---+ about-someplace
    |    |---> board-of-directors

## TODO

_???_

I'm sure there are other things that will need to happen in this gem. As I use it more, I'm sure it'll get fleshed out. If you've got ideas, send them to me by writing them with a thick black marker on the label on a Dogfish Head 90 Minute IPA and mailing it to me or something. If you're also from Indiana, or one of the other states that Dogfish Head no longer serves... I don't know. Email me, or whatever.

Also, pull requests are welcomed. Prepare for poor response times, though.

FAQs

Package last updated on 27 Jun 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc