just some random stuff
This commit is contained in:
		
							parent
							
								
									d794e88bdc
								
							
						
					
					
						commit
						e43d612e3d
					
				
					 5 changed files with 63 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,10 @@
 | 
			
		|||
% id = "treehouse"
 | 
			
		||||
- # liquidex's treehouse
 | 
			
		||||
<span class="oops-you-seem-to-have-gotten-stuck">
 | 
			
		||||
    <strong>achievement unlocked: <i>I don't want anything to do with this bullshit</i><br></strong>
 | 
			
		||||
    …either that, or you folded the entire tree by accident.<br>
 | 
			
		||||
    feel free to go back any time by clicking here.
 | 
			
		||||
</span>
 | 
			
		||||
 | 
			
		||||
    % id = "01H8V556P1PND8DQ73XBTZZJH7"
 | 
			
		||||
    - welcome! make yourself at home
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -219,6 +219,7 @@ pub fn regenerate(paths: &Paths<'_>) -> anyhow::Result<()> {
 | 
			
		|||
    info!("loading config");
 | 
			
		||||
    let mut config = Config::load(paths.config_file)?;
 | 
			
		||||
    config.site = std::env::var("TREEHOUSE_SITE").unwrap_or(config.site);
 | 
			
		||||
    config.autopopulate_emoji(&paths.static_dir.join("emoji"))?;
 | 
			
		||||
 | 
			
		||||
    info!("cleaning target directory");
 | 
			
		||||
    let _ = std::fs::remove_dir_all(paths.target_dir);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,8 @@
 | 
			
		|||
use std::{collections::HashMap, path::Path};
 | 
			
		||||
use std::{collections::HashMap, ffi::OsStr, path::Path};
 | 
			
		||||
 | 
			
		||||
use anyhow::Context;
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
use walkdir::WalkDir;
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone, Deserialize, Serialize)]
 | 
			
		||||
pub struct Config {
 | 
			
		||||
| 
						 | 
				
			
			@ -28,4 +29,31 @@ impl Config {
 | 
			
		|||
        let string = std::fs::read_to_string(path).context("cannot read config file")?;
 | 
			
		||||
        toml_edit::de::from_str(&string).context("error in config file")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn is_emoji_file(path: &Path) -> bool {
 | 
			
		||||
        path.extension() == Some(OsStr::new("png")) || path.extension() == Some(OsStr::new("svg"))
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn autopopulate_emoji(&mut self, dir: &Path) -> anyhow::Result<()> {
 | 
			
		||||
        for file in WalkDir::new(dir) {
 | 
			
		||||
            let entry = file?;
 | 
			
		||||
            if entry.file_type().is_file() && Self::is_emoji_file(entry.path()) {
 | 
			
		||||
                if let Some(emoji_name) = entry.path().file_stem() {
 | 
			
		||||
                    let emoji_name = emoji_name.to_string_lossy();
 | 
			
		||||
                    if !self.emoji.contains_key(emoji_name.as_ref()) {
 | 
			
		||||
                        self.emoji.insert(
 | 
			
		||||
                            emoji_name.into_owned(),
 | 
			
		||||
                            entry
 | 
			
		||||
                                .path()
 | 
			
		||||
                                .strip_prefix(dir)
 | 
			
		||||
                                .unwrap_or(entry.path())
 | 
			
		||||
                                .to_string_lossy()
 | 
			
		||||
                                .into_owned(),
 | 
			
		||||
                        );
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -244,3 +244,31 @@ img.emoji {
 | 
			
		|||
    max-height: 1.375em;
 | 
			
		||||
    vertical-align: bottom;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Funny joke */
 | 
			
		||||
 | 
			
		||||
@keyframes hello-there {
 | 
			
		||||
    0% {
 | 
			
		||||
        opacity: 0%;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    70% {
 | 
			
		||||
        opacity: 0%;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    100% {
 | 
			
		||||
        opacity: 70%;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.oops-you-seem-to-have-gotten-stuck {
 | 
			
		||||
    margin-top: 16px;
 | 
			
		||||
    display: none;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    opacity: 0%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#index\:treehouse>details:not([open])>summary .oops-you-seem-to-have-gotten-stuck {
 | 
			
		||||
    display: inline;
 | 
			
		||||
    animation: 4s hello-there forwards;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,4 +9,3 @@ author = "liquidex"
 | 
			
		|||
"dawd3/repo" = "https://github.com/liquidev/dawd3"
 | 
			
		||||
 | 
			
		||||
[emoji]
 | 
			
		||||
hueh = "hueh.png"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue