yuno-proofreader 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/yuno/proofreader/analysis/adjustments.rb +30 -32
- data/lib/yuno/proofreader/analysis/crawler.rb +71 -73
- data/lib/yuno/proofreader/analysis/entries.rb +52 -54
- data/lib/yuno/proofreader/analysis/extractor.rb +162 -164
- data/lib/yuno/proofreader/analysis/graph.rb +86 -88
- data/lib/yuno/proofreader/analysis/judge.rb +80 -82
- data/lib/yuno/proofreader/analysis/judge_prompt.rb +50 -52
- data/lib/yuno/proofreader/analysis/judgments.rb +50 -52
- data/lib/yuno/proofreader/analysis/links.rb +44 -46
- data/lib/yuno/proofreader/analysis/list_order.rb +20 -22
- data/lib/yuno/proofreader/analysis/reasons.rb +44 -43
- data/lib/yuno/proofreader/analysis/report.rb +79 -81
- data/lib/yuno/proofreader/analysis/runner.rb +133 -135
- data/lib/yuno/proofreader/analysis/scorer.rb +97 -99
- data/lib/yuno/proofreader/analysis/settings.rb +65 -67
- data/lib/yuno/proofreader/analysis/signals.rb +77 -79
- data/lib/yuno/proofreader/analysis/structured_data.rb +40 -42
- data/lib/yuno/proofreader/analysis/url_tree.rb +34 -36
- data/lib/yuno/proofreader/analysis/weights.rb +67 -69
- data/lib/yuno/proofreader/audit/agenda.rb +63 -65
- data/lib/yuno/proofreader/audit/agenda_report.rb +44 -46
- data/lib/yuno/proofreader/audit/answers.rb +53 -55
- data/lib/yuno/proofreader/audit/attempt.rb +50 -52
- data/lib/yuno/proofreader/audit/batch.rb +49 -49
- data/lib/yuno/proofreader/audit/batch_report.rb +62 -64
- data/lib/yuno/proofreader/audit/cadence.rb +47 -49
- data/lib/yuno/proofreader/audit/instructions.rb +15 -17
- data/lib/yuno/proofreader/audit/log_fields.rb +16 -18
- data/lib/yuno/proofreader/audit/prompt.rb +118 -120
- data/lib/yuno/proofreader/audit/report.rb +116 -118
- data/lib/yuno/proofreader/audit/runner.rb +150 -152
- data/lib/yuno/proofreader/audit/schemas.rb +49 -0
- data/lib/yuno/proofreader/audit/steps.rb +46 -48
- data/lib/yuno/proofreader/cli/analysis_commands.rb +36 -38
- data/lib/yuno/proofreader/cli/audit_commands.rb +89 -91
- data/lib/yuno/proofreader/cli/command_log.rb +34 -36
- data/lib/yuno/proofreader/cli/flags.rb +33 -35
- data/lib/yuno/proofreader/cli/generate_commands.rb +99 -101
- data/lib/yuno/proofreader/cli/init_command.rb +123 -125
- data/lib/yuno/proofreader/cli/model_commands.rb +35 -37
- data/lib/yuno/proofreader/cli/queue_commands.rb +79 -81
- data/lib/yuno/proofreader/cli/sheet_commands.rb +42 -44
- data/lib/yuno/proofreader/cli.rb +197 -199
- data/lib/yuno/proofreader/config.rb +13 -17
- data/lib/yuno/proofreader/context.rb +45 -50
- data/lib/yuno/proofreader/env_file.rb +52 -56
- data/lib/yuno/proofreader/errors.rb +7 -9
- data/lib/yuno/proofreader/findings/finding.rb +73 -75
- data/lib/yuno/proofreader/findings/matching.rb +21 -23
- data/lib/yuno/proofreader/findings/merger.rb +35 -37
- data/lib/yuno/proofreader/findings/outline.rb +50 -52
- data/lib/yuno/proofreader/findings/plan.rb +14 -16
- data/lib/yuno/proofreader/findings/reconciler.rb +170 -172
- data/lib/yuno/proofreader/findings/source.rb +54 -56
- data/lib/yuno/proofreader/findings/text.rb +24 -26
- data/lib/yuno/proofreader/generate/cache.rb +54 -56
- data/lib/yuno/proofreader/generate/collector.rb +98 -100
- data/lib/yuno/proofreader/generate/describe.rb +18 -20
- data/lib/yuno/proofreader/generate/llm/prompt.rb +50 -52
- data/lib/yuno/proofreader/generate/llm/reader.rb +84 -86
- data/lib/yuno/proofreader/generate/llm/wording.rb +12 -14
- data/lib/yuno/proofreader/generate/llms_builder.rb +36 -38
- data/lib/yuno/proofreader/generate/llms_report.rb +82 -84
- data/lib/yuno/proofreader/generate/llms_txt.rb +99 -101
- data/lib/yuno/proofreader/generate/llms_writer.rb +43 -45
- data/lib/yuno/proofreader/generate/outline.rb +67 -69
- data/lib/yuno/proofreader/generate/passage.rb +41 -43
- data/lib/yuno/proofreader/generate/saved_answer.rb +42 -44
- data/lib/yuno/proofreader/http/client.rb +94 -96
- data/lib/yuno/proofreader/http/net_http_transport.rb +35 -37
- data/lib/yuno/proofreader/http/robots.rb +51 -53
- data/lib/yuno/proofreader/init/ask.rb +45 -47
- data/lib/yuno/proofreader/init/detector.rb +75 -77
- data/lib/yuno/proofreader/init/interview.rb +155 -157
- data/lib/yuno/proofreader/init/parsing.rb +37 -39
- data/lib/yuno/proofreader/init/web.rb +22 -24
- data/lib/yuno/proofreader/llm/client.rb +118 -113
- data/lib/yuno/proofreader/llm/defaults.rb +10 -12
- data/lib/yuno/proofreader/llm/errors.rb +18 -18
- data/lib/yuno/proofreader/llm/factory.rb +34 -36
- data/lib/yuno/proofreader/llm/handoff.rb +86 -88
- data/lib/yuno/proofreader/llm/http_transport.rb +25 -27
- data/lib/yuno/proofreader/llm/json_text.rb +12 -14
- data/lib/yuno/proofreader/llm/provider.rb +49 -51
- data/lib/yuno/proofreader/llm/providers/gemini.rb +111 -111
- data/lib/yuno/proofreader/llm/providers/manual.rb +34 -36
- data/lib/yuno/proofreader/llm/providers.rb +17 -19
- data/lib/yuno/proofreader/llm/types.rb +6 -8
- data/lib/yuno/proofreader/llm/usage.rb +8 -10
- data/lib/yuno/proofreader/log.rb +88 -96
- data/lib/yuno/proofreader/pages/fetcher.rb +53 -55
- data/lib/yuno/proofreader/pages/report.rb +37 -39
- data/lib/yuno/proofreader/pages/snapshot.rb +32 -34
- data/lib/yuno/proofreader/pages/trimmer.rb +23 -25
- data/lib/yuno/proofreader/settings_file.rb +35 -38
- data/lib/yuno/proofreader/site.rb +52 -54
- data/lib/yuno/proofreader/site_reader.rb +122 -124
- data/lib/yuno/proofreader/sitemap/aligner.rb +58 -60
- data/lib/yuno/proofreader/sitemap/importer.rb +19 -21
- data/lib/yuno/proofreader/sitemap/loader.rb +95 -97
- data/lib/yuno/proofreader/sitemap/mismatch.rb +53 -55
- data/lib/yuno/proofreader/sitemap/pairer.rb +171 -173
- data/lib/yuno/proofreader/sitemap/parser.rb +50 -52
- data/lib/yuno/proofreader/sitemap/report.rb +72 -74
- data/lib/yuno/proofreader/store/cells.rb +55 -49
- data/lib/yuno/proofreader/store/gateways/csv.rb +53 -56
- data/lib/yuno/proofreader/store/gateways/google.rb +152 -158
- data/lib/yuno/proofreader/store/memory.rb +60 -64
- data/lib/yuno/proofreader/store/records.rb +18 -20
- data/lib/yuno/proofreader/store/schema.rb +85 -89
- data/lib/yuno/proofreader/store/sheets.rb +132 -145
- data/lib/yuno/proofreader/store/tab_setup.rb +51 -54
- data/lib/yuno/proofreader/version.rb +1 -1
- data/lib/yuno/proofreader.rb +3 -4
- data/proofreader.example.yml +15 -10
- metadata +3 -2
|
@@ -2,28 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
require "yaml"
|
|
4
4
|
|
|
5
|
-
module Yuno
|
|
6
|
-
module
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Texts = Data.define(*KEYS.map(&:to_sym))
|
|
5
|
+
module Yuno::Proofreader
|
|
6
|
+
module Audit
|
|
7
|
+
# The wording of the instructions, read from prompts/instructions.yml.
|
|
8
|
+
module Instructions
|
|
9
|
+
PATH = File.join(__dir__, "prompts", "instructions.yml")
|
|
10
|
+
KEYS = %w[role effort rules site_wide_parts audit_procedure review_procedure].freeze
|
|
11
|
+
Texts = Data.define(*KEYS.map(&:to_sym))
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
module_function
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
def default = @default ||= load
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
def load(path = PATH)
|
|
18
|
+
data = YAML.safe_load_file(path)
|
|
19
|
+
raise Error, "#{path} must hold the instruction texts" unless data.is_a?(Hash)
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
missing = KEYS.select { |key| data[key].to_s.strip.empty? }
|
|
22
|
+
raise Error, "#{path} has no text for: #{missing.join(', ')}" unless missing.empty?
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
end
|
|
24
|
+
Texts.new(**KEYS.to_h { |key| [key.to_sym, data[key].to_s.strip] })
|
|
27
25
|
end
|
|
28
26
|
end
|
|
29
27
|
end
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module Yuno
|
|
4
|
-
module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
COUNTED = %i[added reappeared seen_again closed suppressed].freeze
|
|
3
|
+
module Yuno::Proofreader
|
|
4
|
+
module Audit
|
|
5
|
+
# What the log says about an audited page.
|
|
6
|
+
module LogFields
|
|
7
|
+
COUNTED = %i[added reappeared seen_again closed suppressed].freeze
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
module_function
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
def of(result)
|
|
12
|
+
counts = result.plan ? result.plan.counts : {}
|
|
13
|
+
{ status: result.status, complete: result.complete, dry_run: result.dry_run,
|
|
14
|
+
**COUNTED.to_h { |kind| [kind, counts.fetch(kind, 0)] }, **Llm::Usage.of(result.calls) }
|
|
15
|
+
end
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
# One line for the page, and a warning when the audit was incomplete, with the notes that say why.
|
|
18
|
+
def record(log, result, **extra)
|
|
19
|
+
log.info("page #{result.status}", page: result.page, **of(result), **extra)
|
|
20
|
+
return if result.status == :skipped || result.complete
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
end
|
|
22
|
+
log.warn("audit incomplete", page: result.page, notes: result.notes.join(" | "))
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -1,156 +1,154 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module Yuno
|
|
4
|
-
module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def audit_system
|
|
28
|
-
[shared, section("AUDIT PROCEDURE", @instructions.audit_procedure), steps_section,
|
|
29
|
-
section("OUTPUT FORMAT", audit_format)].join("\n\n")
|
|
30
|
-
end
|
|
3
|
+
module Yuno::Proofreader
|
|
4
|
+
module Audit
|
|
5
|
+
# Builds the text that is sent to a model: the system prompts (what to do and how to answer) and the message
|
|
6
|
+
# for one page. The wording comes from the files in prompts/, and what is specific to the site comes from the
|
|
7
|
+
# site settings. The JSON format of the answers is written here, because the code that reads the answers
|
|
8
|
+
# depends on it.
|
|
9
|
+
class Prompt
|
|
10
|
+
MAX_ISSUES_PER_STEP = 15
|
|
11
|
+
MAX_REVIEW_ISSUES = 40
|
|
12
|
+
JSON_RULE = "Return ONLY valid JSON, with no commentary and no markdown fences, in exactly this shape:"
|
|
13
|
+
ISSUE = '{"language":"%<languages>s","category":"%<category>s","effort":"quick|bigger",' \
|
|
14
|
+
'"original":"<exact text copied from the HTML>","suggested":"<replacement or short instruction>",' \
|
|
15
|
+
'"reason":"<one short sentence in English>"}'
|
|
16
|
+
|
|
17
|
+
attr_reader :steps
|
|
18
|
+
|
|
19
|
+
def initialize(site, steps: Steps.default, instructions: Instructions.default)
|
|
20
|
+
@site = site
|
|
21
|
+
@instructions = instructions
|
|
22
|
+
# With one language there is nothing to compare, so the parity step is left out.
|
|
23
|
+
@steps = site.languages.size < 2 ? steps.reject { |step| step.categories.include?("parity") } : steps
|
|
24
|
+
end
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
def audit_system
|
|
27
|
+
[shared, section("AUDIT PROCEDURE", @instructions.audit_procedure), steps_section,
|
|
28
|
+
section("OUTPUT FORMAT", audit_format)].join("\n\n")
|
|
29
|
+
end
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
raise Error, "No language version of #{fetched.name} could be fetched, so there is nothing to review."
|
|
42
|
-
end
|
|
31
|
+
def review_system
|
|
32
|
+
[shared, section("REVIEW PROCEDURE", @instructions.review_procedure), checklist_section,
|
|
33
|
+
section("OUTPUT FORMAT", review_format)].join("\n\n")
|
|
34
|
+
end
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
# The message for one page. html_limit shortens each version, for showing it on screen.
|
|
37
|
+
def user_message(fetched, html_limit: nil)
|
|
38
|
+
usable = fetched.snapshots.select(&:ok?)
|
|
39
|
+
if usable.empty?
|
|
40
|
+
raise Error, "No language version of #{fetched.name} could be fetched, so there is nothing to review."
|
|
46
41
|
end
|
|
47
42
|
|
|
48
|
-
|
|
43
|
+
notes = [header(fetched, usable), *cut_notes(usable)].join("\n")
|
|
44
|
+
([notes] + usable.map { |snapshot| version(snapshot, html_limit) }).join("\n\n")
|
|
45
|
+
end
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
private
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
def section(title, text) = "## #{title}\n#{text}"
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
def one_line(text) = Findings::Text.collapse(text)
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
[section("ROLE", @instructions.role), *site_sections, section("EFFORT", @instructions.effort),
|
|
58
|
-
section("RULES", @instructions.rules),
|
|
59
|
-
section("SITE-WIDE PARTS", @instructions.site_wide_parts)].join("\n\n")
|
|
60
|
-
end
|
|
53
|
+
# ---- the system prompts ----
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
def shared
|
|
56
|
+
[section("ROLE", @instructions.role), *site_sections, section("EFFORT", @instructions.effort),
|
|
57
|
+
section("RULES", @instructions.rules),
|
|
58
|
+
section("SITE-WIDE PARTS", @instructions.site_wide_parts)].join("\n\n")
|
|
59
|
+
end
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
lines << "Language versions of every page (the first is the default language): #{@site.languages.join(', ')}"
|
|
74
|
-
section("SITE CONTEXT", [*lines, *language_notes].join("\n"))
|
|
75
|
-
end
|
|
61
|
+
def site_sections
|
|
62
|
+
context = @site.context
|
|
63
|
+
[context_section, bulleted("STYLE GUIDE", context.rules), ignore_section,
|
|
64
|
+
bulleted("INTENTIONAL DIFFERENCES", context.intentional_differences)].compact
|
|
65
|
+
end
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
def context_section
|
|
68
|
+
context = @site.context
|
|
69
|
+
facts = { "Website" => @site.website, "What the site is and offers" => context.business,
|
|
70
|
+
"Audience" => context.audience, "Tone" => context.tone }
|
|
71
|
+
lines = facts.reject { |_label, value| value.empty? }.map { |label, value| "#{label}: #{one_line(value)}" }
|
|
72
|
+
lines << "Language versions of every page (the first is the default language): #{@site.languages.join(', ')}"
|
|
73
|
+
section("SITE CONTEXT", [*lines, *language_notes].join("\n"))
|
|
74
|
+
end
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
def language_notes
|
|
77
|
+
notes = @site.language_notes.reject { |_code, note| note.empty? }
|
|
78
|
+
return [] if notes.empty?
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
["Notes on the languages:", *notes.map { |code, note| " #{code}: #{one_line(note)}" }]
|
|
81
|
+
end
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
def bulleted(title, items)
|
|
84
|
+
return if items.empty?
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return if terms.empty?
|
|
86
|
+
section(title, items.map { |item| "• #{one_line(item)}" }.join("\n"))
|
|
87
|
+
end
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
def ignore_section
|
|
90
|
+
terms = @site.context.ignore_terms
|
|
91
|
+
return if terms.empty?
|
|
97
92
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
end
|
|
102
|
-
section("STEPS", body.join("\n\n"))
|
|
103
|
-
end
|
|
93
|
+
list = terms.map { |term| one_line(term) }.join(", ")
|
|
94
|
+
section("IGNORE LIST", "Do not flag these as errors, they are correct as written: #{list}")
|
|
95
|
+
end
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
def steps_section
|
|
98
|
+
body = @steps.map do |step|
|
|
99
|
+
"STEP #{step.number} - #{step.name} (allowed categories: #{step.categories.join(', ')})\n#{step.text}"
|
|
108
100
|
end
|
|
101
|
+
section("STEPS", body.join("\n\n"))
|
|
102
|
+
end
|
|
109
103
|
|
|
110
|
-
|
|
104
|
+
def checklist_section
|
|
105
|
+
list = @steps.map { |step| "#{step.number}) #{step.name}: #{step.text}" }
|
|
106
|
+
section("CHECKLIST (applies to every language)", list.join("\n"))
|
|
107
|
+
end
|
|
111
108
|
|
|
112
|
-
|
|
113
|
-
issue = format(ISSUE, languages: @site.languages.join("|"),
|
|
114
|
-
category: "<one of the allowed categories of that step>")
|
|
115
|
-
"#{JSON_RULE}\n{\"steps\":[{\"step\":1,\"issues\":[#{issue}]}]}\n" \
|
|
116
|
-
"Include one object for EVERY step, in order, even when a step has no issues (use \"issues\":[]). " \
|
|
117
|
-
"Report at most #{MAX_ISSUES_PER_STEP} issues per step."
|
|
118
|
-
end
|
|
109
|
+
# ---- the answer formats ----
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
def audit_format
|
|
112
|
+
issue = format(ISSUE, languages: @site.languages.join("|"),
|
|
113
|
+
category: "<one of the allowed categories of that step>")
|
|
114
|
+
"#{JSON_RULE}\n{\"steps\":[{\"step\":1,\"issues\":[#{issue}]}]}\n" \
|
|
115
|
+
"Include one object for EVERY step, in order, even when a step has no issues (use \"issues\":[]). " \
|
|
116
|
+
"Report at most #{MAX_ISSUES_PER_STEP} issues per step."
|
|
117
|
+
end
|
|
125
118
|
|
|
126
|
-
|
|
119
|
+
def review_format
|
|
120
|
+
categories = (Findings::Finding::CATEGORIES - ["other"]).join("|")
|
|
121
|
+
issue = format(ISSUE, languages: @site.languages.join("|"), category: categories)
|
|
122
|
+
"#{JSON_RULE}\n{\"issues\":[#{issue}]}\nReport at most #{MAX_REVIEW_ISSUES} issues in total."
|
|
123
|
+
end
|
|
127
124
|
|
|
128
|
-
|
|
129
|
-
lines = ["Page: #{fetched.name}", "Versions provided: #{usable.map { |s| s.language.upcase }.join(', ')}."]
|
|
130
|
-
missing = fetched.snapshots.reject(&:ok?).map { |snapshot| snapshot.language.upcase }
|
|
131
|
-
unless missing.empty?
|
|
132
|
-
lines << "Not available this time, so do not report parity issues involving: #{missing.join(', ')}."
|
|
133
|
-
end
|
|
134
|
-
lines.join("\n")
|
|
135
|
-
end
|
|
125
|
+
# ---- the message for a page ----
|
|
136
126
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
def header(fetched, usable)
|
|
128
|
+
lines = ["Page: #{fetched.name}", "Versions provided: #{usable.map { |s| s.language.upcase }.join(', ')}."]
|
|
129
|
+
missing = fetched.snapshots.reject(&:ok?).map { |snapshot| snapshot.language.upcase }
|
|
130
|
+
unless missing.empty?
|
|
131
|
+
lines << "Not available this time, so do not report parity issues involving: #{missing.join(', ')}."
|
|
142
132
|
end
|
|
133
|
+
lines.join("\n")
|
|
134
|
+
end
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
"
|
|
136
|
+
def cut_notes(usable)
|
|
137
|
+
usable.select(&:truncated).map do |snapshot|
|
|
138
|
+
"The #{snapshot.language.upcase} version was cut after #{snapshot.html.length} characters, so its end " \
|
|
139
|
+
"is missing. Do not report problems that may only be caused by the cut."
|
|
147
140
|
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def version(snapshot, html_limit)
|
|
144
|
+
label = snapshot.language.upcase
|
|
145
|
+
"=== #{label} | #{snapshot.url} ===\n#{shown(snapshot.html, html_limit)}\n=== END #{label} ==="
|
|
146
|
+
end
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
def shown(html, limit)
|
|
149
|
+
return html if limit.nil? || html.length <= limit
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
end
|
|
151
|
+
"#{html[0, limit]}\n[... #{html.length - limit} more characters not shown here ...]"
|
|
154
152
|
end
|
|
155
153
|
end
|
|
156
154
|
end
|