Skip to content

Commit

Permalink
Merge pull request #28 from obelisk/emoji-gen-fix
Browse files Browse the repository at this point in the history
remove emojis after parse for text slides
  • Loading branch information
obelisk authored Jul 24, 2024
2 parents d823590 + 42f8958 commit 848d36c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/presentation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ impl Presentation {
authentication_key: DecodingKey,
title: String,
) -> Self {
// Create a default 10s ratelimiter
// Create a default 5s ratelimiter
let ratelimiter = Arc::new(Ratelimiter::new());
ratelimiter.add_ratelimit("10s".to_string(), Arc::new(TimeLimiter::new(10)));
ratelimiter.add_ratelimit("5s".to_string(), Arc::new(TimeLimiter::new(5)));

/*
ratelimiter.add_ratelimit(
Expand Down
13 changes: 10 additions & 3 deletions tools/obsidian-directed-graph-exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
STATE_POLL = "STATE_POLL"

# Regexes
EMOJIS_REGEX = r'^Emojis:\s*(.*)$'
NEXT_SLIDE_REGEX = r'Next Slide:\s*\[\[(.*?)\]\]'
FONT_SCALE_REGEX = r'^Font Scale: (.*)$'

Expand Down Expand Up @@ -213,9 +214,11 @@ def parse_md_file(md_dir: str, file_path: str, index: int) -> Slide:
content = file.read()

# Parse out possible emojis
emojis_match = re.search(r'^Emojis:\s*(.*)$', content, re.MULTILINE)
emojis_match = re.search(EMOJIS_REGEX, content, re.MULTILINE)
emojis = emojis_match.group(1).split(",") if emojis_match else []
emojis = [e.strip() for e in emojis]
# Remove Emojis tag now that it's parsed
content = re.sub(EMOJIS_REGEX, '', content, flags=re.MULTILINE)

# Parse out possible poll
maybe_poll = parse_contents_for_poll(content)
Expand Down Expand Up @@ -536,11 +539,15 @@ def main():
if args.gen_images:
print(f"Generation {len(slides)} images...")
for slide in slides:
print(f"{int(count/len(slides)*100)}% ", end="")
print(f"{int(count/len(slides)*100)}% {count} ", end="")
count += 1
# Export slide image
if args.gen_images:
generate_slide_image(slide, md_dir, output_dir)
try:
generate_slide_image(slide, md_dir, output_dir)
except Exception as e:
print(f"Error rendering slide {slide.title}")
exit(1)
# Serialize and resolve all polls and linked slides by name to index with slide_map
slides_json.append(slide.export(slide_map))

Expand Down
2 changes: 1 addition & 1 deletion web/present.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
var reaction = document.createElement('span');
reaction.innerText = emoji;
if (size == 1) {
reaction.style = "font-size: 50px";
reaction.style = "font-size: 30px";
} else {
reaction.style = "font-size: 10px";
}
Expand Down
2 changes: 1 addition & 1 deletion web/styles/present.css
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ body {

.poll-result-label-count{font-size: 30px;color: #000;}

.poll-result-label{color: #000;margin-right: 30px;font-size: 33px;}
.poll-result-label{color: #000;margin-right: 20px;font-size: 31px;}

.poll-result-bar-container{width: 100%;}

Expand Down

0 comments on commit 848d36c

Please sign in to comment.