Esempio n. 1
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. 2
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. 3
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. 4
0
def read_code(preread, stream, indentation, parser, options):
    language = read_line(stream, eof_is_error=True).strip()
    if not language:
        language = None
    read = read_until_string(stream, "```", use_escape=True,
                             eof_is_error=True).strip()
    stream.read(3)  # skip
    return CodeBuilder(read, language=language)
Esempio n. 5
0
def read_image_sizecase(preread, stream, indentation, parser, options=dict()):
    read1 = read_media_query(stream, use_escape=True,
                             eof_is_error=True).strip()
    read_whitespace(stream)
    read2 = read_line(stream, use_escape=True, eof_is_error=True).strip()
    if read2:
        return ImageSizeCaseAdapter(Sizes(width=read2, media=read1))
    else:
        return ImageSizeCaseAdapter(Sizes(width=read1))
Esempio n. 6
0
def read_image_typecase(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream, use_escape=True, eof_is_error=False)
    return ImageTypeCaseAdapter(read1)
Esempio n. 7
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. 8
0
def read_image_link(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    return ImageLinkAdapter(fix_path(read1, options=options))
Esempio n. 9
0
def read_image_title(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    return ImageTitleAdapter(read1)
Esempio n. 10
0
def read_video_thumbnail(preread, stream, indentation, parser, options=dict()):
    read1 = read_line(stream).strip()
    return VideoThumbnailAdapter(read1)
Esempio n. 11
0
def read_quotation_cite(preread, stream, indentation, parser, options):
    line = read_line(stream)
    cite = None
    if line:
        cite = line.strip()
    return QuotationCiteAdapter(cite=cite)