diff options
author | Alan Pearce | 2014-09-24 18:25:02 +0100 |
---|---|---|
committer | Alan Pearce | 2014-09-24 18:25:02 +0100 |
commit | 078d97a2f8ca6da814ff0a6d405d5c375f860185 (patch) | |
tree | 5fe642dd9cfc3ca2372d65102e08277af524a0e1 /src | |
parent | 2b01c9e53ded6e44d75b45fe955f00b79f3ef75e (diff) | |
download | microformats-078d97a2f8ca6da814ff0a6d405d5c375f860185.tar.lz microformats-078d97a2f8ca6da814ff0a6d405d5c375f860185.tar.zst microformats-078d97a2f8ca6da814ff0a6d405d5c375f860185.zip |
Concatenate multiple properties with the same name
Diffstat (limited to 'src')
-rw-r--r-- | src/microformats/parser.clj | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/microformats/parser.clj b/src/microformats/parser.clj index 5786f7c..eee04c4 100644 --- a/src/microformats/parser.clj +++ b/src/microformats/parser.clj @@ -225,11 +225,12 @@ (defn get-mf-properties "Parse children of a microformat, returning a map of properties" [element] - (merge (parse-implied element) - (apply merge (map parse-p (html/select element [(html/attr-starts :class "p-")]))) - (apply merge (map parse-u (html/select element [(html/attr-starts :class "u-")]))) - (apply merge (map parse-dt (html/select element [(html/attr-starts :class "dt-")]))) - (apply merge (map parse-e (html/select element [(html/attr-starts :class "e-")]))))) + (let [cappend (partial merge-with concat)] + (merge (parse-implied element) + (apply cappend (map parse-p (html/select element [(html/attr-starts :class "p-")]))) + (apply cappend (map parse-u (html/select element [(html/attr-starts :class "u-")]))) + (apply cappend (map parse-dt (html/select element [(html/attr-starts :class "dt-")]))) + (apply cappend (map parse-e (html/select element [(html/attr-starts :class "e-")])))))) (defn parse-h "Parse h-* classes within a HTML element." |