Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: java/org/chromium/distiller/MarkupParser.java

Issue 1705123002: Add support for Schema.org/Recipe Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: wychen's comments addressed Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: java/org/chromium/distiller/MarkupParser.java
diff --git a/java/org/chromium/distiller/MarkupParser.java b/java/org/chromium/distiller/MarkupParser.java
index 52de355eb583c3b166216d2d8cfa7cd1ee539bfe..f4dac20c0c9bcac3402443c541b4feb24573abda 100644
--- a/java/org/chromium/distiller/MarkupParser.java
+++ b/java/org/chromium/distiller/MarkupParser.java
@@ -89,6 +89,11 @@ public class MarkupParser {
* Returns true if page owner has opted out of distillation.
*/
public boolean optOut();
+
+ /**
+ * Returns the markup body of the document, empty string if none.
+ */
+ public String getStructuredData();
}
/**
@@ -217,6 +222,14 @@ public class MarkupParser {
return article;
}
+ public String getStructuredData() {
+ String content = "";
+ for (int i = 0; i < mAccessors.size() && content.isEmpty(); i++) {
+ content = mAccessors.get(i).getStructuredData();
+ }
+ return content;
+ }
+
public boolean optOut() {
boolean optOut = false;
for (int i = 0; i < mAccessors.size() && !optOut; i++) {

Powered by Google App Engine
This is Rietveld 408576698