Пример #1
0
def test_page_spanning_rewrite():
    n = Splicer().splice_this_into_next(Ref("Meilah 19b:1"))
    assert n._needs_rewrite(Ref("Meilah 19b:41-20a:5"))
    assert n._rewrite(Ref("Meilah 19b:41-20a:5")) == Ref("Meilah 19b:40-20a:5")

    n = Splicer().insert_blank_segment_after(Ref("Meilah 19b:1"))
    assert n._needs_rewrite(Ref("Meilah 19b:41-20a:5"))
    assert n._rewrite(Ref("Meilah 19b:41-20a:5")) == Ref("Meilah 19b:42-20a:5")
Пример #2
0
def test_page_spanning_range():
    n = Splicer().insert_blank_segment_after(Ref("Chagigah 20b:13"))
    assert n._needs_rewrite(Ref("Chagigah 20b:14-21a:1"))
    assert n._rewrite(Ref("Chagigah 20b:14-21a:1")) == Ref("Chagigah 20b:15-21a:1")

    n = Splicer().splice_this_into_next(Ref("Chagigah 20b:13"))
    assert n._needs_rewrite(Ref("Chagigah 20b:14-21a:1"))
    assert n._rewrite(Ref("Chagigah 20b:14-21a:1")) == Ref("Chagigah 20b:13-21a:1")
Пример #3
0
def test_page_spanning_rewrite():
    n = Splicer().splice_this_into_next(Ref("Meilah 19b:1"))
    assert n._needs_rewrite(Ref("Meilah 19b:41-20a:5"))
    assert n._rewrite(Ref("Meilah 19b:41-20a:5")) == Ref("Meilah 19b:40-20a:5")

    n = Splicer().insert_blank_segment_after(Ref("Meilah 19b:1"))
    assert n._needs_rewrite(Ref("Meilah 19b:41-20a:5"))
    assert n._rewrite(Ref("Meilah 19b:41-20a:5")) == Ref("Meilah 19b:42-20a:5")
Пример #4
0
def test_join_rewrite():
    n = Splicer().splice_next_into_this(Ref("Shabbat 45b:11"))
    assert n._needs_rewrite(Ref("Shabbat 45b:15"))
    assert n._needs_rewrite(Ref("Shabbat 45b:12"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:9"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 45b"))
    assert not n._needs_rewrite(Ref("Shabbat 44b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 46b:11"))

    assert not n._needs_rewrite(Ref("Rif Shabbat 45b:15"))

    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15:2"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:9"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:11"),
                                commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 44b:11"),
                                commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 46b:11"),
                                commentary=True)

    assert n._rewrite(Ref("Shabbat 45b:15")) == Ref("Shabbat 45b:14")
    assert n._rewrite(Ref("Shabbat 45b:12")) == Ref("Shabbat 45b:11")

    assert n._rewrite(Ref("Rashi on Shabbat 45b:15:1"),
                      commentary=True) == Ref("Rashi on Shabbat 45b:14:1")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:15"),
                      commentary=True) == Ref("Rashi on Shabbat 45b:14")
    assert n._rewrite(
        Ref("Rashi on Shabbat 45b:12:1"), commentary=True) == Ref(
            "Rashi on Shabbat 45b:11:2")  # There's already one comment on 11
Пример #5
0
def test_insert():
    n = Splicer().insert_blank_segment_after(Ref("Shabbat 25b:11"))
    n.report()
Пример #6
0
def test_sheet_cleanup():
    n = Splicer().splice_next_into_this(Ref("Shabbat 25b:11"))
    n._report = True
    n._find_sheets()
    n._clean_sheets()
Пример #7
0
def test_es_cleanup():
    n = Splicer().splice_next_into_this(Ref("Shabbat 65a:11"))
    n._report = True
    n._clean_elastisearch()
Пример #8
0
def test_report():
    n = Splicer().splice_next_into_this(Ref("Shabbat 25b:11"))
    n.report()
    if live:
        tc.save()
    else:
        print u"Changing text to {}".format(tc.text)

#These will need some manual work afterwards
to_split = [
    "Nedarim.25b.9",
    "Sukkah 20b:29",  # Hadrans in parens, joined at end of other line:
    "Sukkah 29b:5",
    "Chagigah 11b:6",  # Joined at end of other line:
    "Chagigah 20b:13",
    "Zevachim 15b:17",
]
for r in to_split:
    s = Splicer().insert_blank_segment_after(Ref(r))
    #s._save_text_only = True
    s._rebuild_toc = False
    s._refresh_states = True
    if live:
        s.execute()
    else:
        print u"Adding blank segment after {}".format(r)
    review_map(s)

to_merge = [
    "Zevachim.66a.23",  # merge into previous 22
    "Zevachim.83a.37",  # merge into previous 36
    "Bava_Batra.176b.6",  # Slika on last line (and next 3)
    "Bekhorot 61a:47",
    "Arakhin 34a:30",
Пример #10
0
def test_es_cleanup():
    n = Splicer().splice_next_into_this(Ref("Shabbat 65a:11"))
    n._report = True
    n._clean_elastisearch()
Пример #11
0
def test_report():
    n = Splicer().splice_next_into_this(Ref("Shabbat 25b:11"))
    n.report()
Пример #12
0
def test_insert_rewrite():
    n = Splicer().insert_blank_segment_after(Ref("Shabbat 45b:11"))
    assert n._needs_rewrite(Ref("Shabbat 45b:15"))
    assert n._needs_rewrite(Ref("Shabbat 45b:12"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:9"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 45b"))
    assert not n._needs_rewrite(Ref("Shabbat 44b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 46b:11"))

    assert not n._needs_rewrite(Ref("Rif Shabbat 45b:15"))

    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15:2"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:9"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:11"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 44b:11"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 46b:11"), commentary=True)

    assert n._rewrite(Ref("Shabbat 45b:15")) == Ref("Shabbat 45b:16")
    assert n._rewrite(Ref("Shabbat 45b:12")) == Ref("Shabbat 45b:13")

    assert n._rewrite(Ref("Rashi on Shabbat 45b:15:1"), commentary=True) == Ref("Rashi on Shabbat 45b:16:1")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True) == Ref("Rashi on Shabbat 45b:16")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True) == Ref("Rashi on Shabbat 45b:13:1")
Пример #13
0
def test_join_rewrite():
    n = Splicer().splice_next_into_this(Ref("Shabbat 45b:11"))
    assert n._needs_rewrite(Ref("Shabbat 45b:15"))
    assert n._needs_rewrite(Ref("Shabbat 45b:12"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:9"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 45b"))
    assert not n._needs_rewrite(Ref("Shabbat 44b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 46b:11"))

    assert not n._needs_rewrite(Ref("Rif Shabbat 45b:15"))

    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15:2"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:9"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:11"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 44b:11"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 46b:11"), commentary=True)

    assert n._rewrite(Ref("Shabbat 45b:15")) == Ref("Shabbat 45b:14")
    assert n._rewrite(Ref("Shabbat 45b:12")) == Ref("Shabbat 45b:11")

    assert n._rewrite(Ref("Rashi on Shabbat 45b:15:1"), commentary=True) == Ref("Rashi on Shabbat 45b:14:1")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True) == Ref("Rashi on Shabbat 45b:14")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True) == Ref("Rashi on Shabbat 45b:11:2")  # There's already one comment on 11
Пример #14
0
def test_insert():
    n = Splicer().insert_blank_segment_after(Ref("Shabbat 25b:11"))
    n.report()
Пример #15
0
def test_splice_mode_equivalence():
    n = Splicer().splice_next_into_this(Ref("Shabbat 45b:11"))
    assert n == Splicer().splice_this_into_next(Ref("Shabbat 45b:11"))
    assert n == Splicer().splice_prev_into_this(Ref("Shabbat 45b:12"))
    assert n == Splicer().splice_this_into_prev(Ref("Shabbat 45b:12"))
Пример #16
0
def test_sheet_cleanup():
    n = Splicer().splice_next_into_this(Ref("Shabbat 25b:11"))
    n._report = True
    n._find_sheets()
    n._clean_sheets()
Пример #17
0
def test_insert_rewrite():
    n = Splicer().insert_blank_segment_after(Ref("Shabbat 45b:11"))
    assert n._needs_rewrite(Ref("Shabbat 45b:15"))
    assert n._needs_rewrite(Ref("Shabbat 45b:12"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:9"))
    assert not n._needs_rewrite(Ref("Shabbat 45b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 45b"))
    assert not n._needs_rewrite(Ref("Shabbat 44b:11"))
    assert not n._needs_rewrite(Ref("Shabbat 46b:11"))

    assert not n._needs_rewrite(Ref("Rif Shabbat 45b:15"))

    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:15:2"), commentary=True)
    assert n._needs_rewrite(Ref("Rashi on Shabbat 45b:12:1"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:9"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b:11"),
                                commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 45b"), commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 44b:11"),
                                commentary=True)
    assert not n._needs_rewrite(Ref("Rashi on Shabbat 46b:11"),
                                commentary=True)

    assert n._rewrite(Ref("Shabbat 45b:15")) == Ref("Shabbat 45b:16")
    assert n._rewrite(Ref("Shabbat 45b:12")) == Ref("Shabbat 45b:13")

    assert n._rewrite(Ref("Rashi on Shabbat 45b:15:1"),
                      commentary=True) == Ref("Rashi on Shabbat 45b:16:1")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:15"),
                      commentary=True) == Ref("Rashi on Shabbat 45b:16")
    assert n._rewrite(Ref("Rashi on Shabbat 45b:12:1"),
                      commentary=True) == Ref("Rashi on Shabbat 45b:13:1")
    tc.text = standard_mishnah_start + u" " + tc.text
    if live:
        tc.save()
    else:
        print u"Changing text to {}".format(tc.text)

#These will need some manual work afterwards
to_split = ["Nedarim.25b.9",
    "Sukkah 20b:29", # Hadrans in parens, joined at end of other line:
    "Sukkah 29b:5",
    "Chagigah 11b:6", # Joined at end of other line:
    "Chagigah 20b:13",
    "Zevachim 15b:17",
]
for r in to_split:
    s = Splicer().insert_blank_segment_after(Ref(r))
    #s._save_text_only = True
    s._rebuild_toc = False
    s._refresh_states = True
    if live:
        s.execute()
    else:
        print u"Adding blank segment after {}".format(r)
    review_map(s)

to_merge = ["Zevachim.66a.23", # merge into previous 22
    "Zevachim.83a.37", # merge into previous 36
    "Bava_Batra.176b.6",  # Slika on last line (and next 3)
    "Bekhorot 61a:47",
    "Arakhin 34a:30",
    "Keritot 28b:37"]