Skip to content

need help of usage #24

@BH1SCW

Description

@BH1SCW

Here is some part of my html file:

{
 778                                       "name": "div",
 779                                       "variant": "normal",
 780                                       "classes": [
 781                                         "pl-3"
 782                                       ],
 783                                       "children": [
 784                                         {
 785                                           "name": "a",
 786                                           "variant": "normal",
 787                                           "attributes": {
 788                                             "href": "/rpms/asciidoc"
 789                                           },
 790                                           "children": [
 791                                             {
 792                                               "name": "div",
 793                                               "variant": "normal",
 794                                               "children": [
 795                                                 {
 796                                                   "name": "strong",
 797                                                   "variant": "normal",
 798                                                   "children": [
 799                                                     "rpms/asciidoc"
 800                                                   ]
 801                                                 }
 802                                               ]
 803                                             }
 804                                           ]
 805                                         },
 806                                         {
 807                                           "name": "div",
 808                                           "variant": "normal",
 809                                           "attributes": {
 810                                             "data-toggle": "tooltip",
 811                                             "title": " Text based document generation "
 812                                           },
 813                                           "children": [
 814                                             {
 815                                               "name": "small",
 816                                               "variant": "normal",
 817                                               "children": [
 818                                                 "Text based document generation"
 819                                               ]
 820                                             }
 821                                           ]
 822                                         }
 823                                       ]
 824                                     }
 825                                   ]
 826                                 },

I can get href : /rpms/asciidoc using following code:

    let hrefs = iter.filter_map(|item| match item {
        Node::Element(ref element) if element.name == "a" => element.attributes["href"].clone(),
        _ => None,
    });

but I also want to get this line: " Text based document generation "

I try this but not work, could you tell me how to modify it?

    let hrefs = iter.filter_map(|item| match item {
        Node::Element(ref element) if element.name == "div" => element.attributes["title"].clone(),
        _ => None,
    });

Thanks so much

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions