Esempio n. 1
0
def read_link(preread, stream, parser, options):
    read1 = read_until(stream, "]", use_escape=True).strip()  # [...]
    stream.get()
    if stream.peek() == "(":
        stream.get()
        read2 = read_until(stream, ")", use_escape=True).strip()  # (...)
        stream.get()
        return make_link(read1, fix_path(read2))
    else:
        lnode = LinkNode(href=read1, target="_blank")
        return make_link(read1, fix_path(read1))
Esempio n. 2
0
def read_audio(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    audio = AudioBuilder()
    if read1:
        source = AudioSource(src=fix_path(read1))
        audio.add_source(source)
    return audio
Esempio n. 3
0
def read_audio_src(preread, stream, indentation, parser, options=dict()):
    read1 = read_until(stream, "\n ").strip()
    read_whitespace(stream)
    read2 = read_line(stream).strip()
    source = AudioSource(
        src=fix_path(read1),
        type=read2 if read2 else None)
    return AudioSourceAdapter(source)
Esempio n. 4
0
def read_video(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    video = VideoBuilder()
    if read1:
        path = fix_path(read1)
        source = VideoSource(src=path)
        video.add_source(source)
    return video
Esempio n. 5
0
def read_image(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    return ImageBuilder(src=fix_path(read1, options=options))
Esempio n. 6
0
def read_image_srccase(preread, stream, indentation, parser, options=dict()):
    src = read_until(stream, " ", use_escape=True, eof_is_error=True).strip()
    read_whitespace(stream)
    width = read_srcset_case(stream)
    return ImageSrcCaseAdapter(Srcset(src=fix_path(src), width=width))
Esempio n. 7
0
def read_image_link(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    return ImageLinkAdapter(fix_path(read1, options=options))