Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raku-community-modules/pod-treewalker
RakuDoc tree walker class
https://github.com/raku-community-modules/pod-treewalker
raku
Last synced: about 1 month ago
JSON representation
RakuDoc tree walker class
- Host: GitHub
- URL: https://github.com/raku-community-modules/pod-treewalker
- Owner: raku-community-modules
- License: artistic-2.0
- Created: 2015-11-15T18:00:44.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-10-07T19:22:25.000Z (about 1 year ago)
- Last Synced: 2024-05-02T00:34:47.129Z (8 months ago)
- Topics: raku
- Language: Raku
- Homepage:
- Size: 45.9 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Actions Status](https://github.com/raku-community-modules/Pod-TreeWalker/actions/workflows/test.yml/badge.svg)](https://github.com/raku-community-modules/Pod-TreeWalker/actions)
NAME
====Pod::TreeWalker - Walk a Pod tree and generate an event for each node
SYNOPSIS
========```raku
use Pod::TreeWalker;my $to-html = Pod::To::HTML.new(...);
Pod::TreeWalker.new( :listener($to-html) ).walk-pod($=pod);
```DESCRIPTION
===========This class provides an API for walking a pod tree (as provided by `$=pod`). Each node in the tree will trigger one or more events. These events cause methods to be called on a listener object that you provide. This lets you do something with a Pod document without having to know much about the underlying tree structure of Pod.
METHODS
=======new
---```raku
my $walker = Pod::TreeWalker.new( :listener($object) )
```The constructor expects a single named argument `:listener`. This object must implement the [Pod::TreeWalker::Listener](Pod::TreeWalker::Listener) API.
walk-pod
--------```raku
$walker.walk-pod($pod);
```This method walks through a pod tree starting with the top node in `$pod`. You can provide either an array of pod nodes (as stored in `$=pod`) or a single top-level node (such as `$=pod[0]`).
text-content-of
---------------```raku
say $walker.text-contents-of($pod)
```Given a `Pod::Block` of any sort, this method recursively descends the blocks contents and returns the concatenation of all the plain text that it finds.
AUTHOR
======Dave Rolsky
COPYRIGHT AND LICENSE
=====================Copyright 2015 - 2018 Dave Rolsky
Copyright 2019 - 2022 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.