-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipe_parser.dart
39 lines (34 loc) · 1.29 KB
/
recipe_parser.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
library recipe_parser;
import 'package:flutter/material.dart' show visibleForTesting;
import 'package:html/dom.dart' show Document, Element;
import '../job_logs/job_log.dart';
import '../models/ingredient.dart';
import '../models/ingredient_parsing_result.dart';
import '../models/recipe_parsing_job.dart';
import '../models/recipe_parsing_result.dart';
import 'parsing_helper.dart';
part 'bianca_zapatka_parser.dart';
part 'chefkoch_parser.dart';
part 'eat_this_parser.dart';
part 'kptncook_parser.dart';
part 'nora_cooks_parser.dart';
part 'wordpress_parser.dart';
/// Interface for all recipe parsers.
// ignore: one_member_abstracts, we define a common interface for all recipe parsers
abstract class RecipeParser {
/// Creates a new [RecipeParser].
const RecipeParser();
/// Parses a [Document] from a website to a recipe using the passed
/// [RecipeParsingJob].
///
/// The [RecipeParsingJob] contains the url of the website and the amount of
/// servings the recipe should be adjusted to.
/// The [Document] is the parsed html document of the website.
///
/// The [RecipeParsingResult] that is returned contains the parsed recipe or
/// an error message if the recipe couldn't be parsed.
RecipeParsingResult parseRecipe(
Document document,
RecipeParsingJob recipeParsingJob,
);
}