daux.io icon indicating copy to clipboard operation
daux.io copied to clipboard

force urls to lowercase

Open seigieu opened this issue 5 years ago • 6 comments

One thing, that irritates me the most... maybe i miss something, are URL's with uppercase letters and spaces in names... As for catalog I can just _ and it will be migrated into space when displaying name and its ok.

But If I have structure, where folder is only a container that rolls down, i have no control over its name, meaning that I have to name folder with uppercase letters to have them uppercase on menu... but that makes uppercase links... any way to force urls lowercase?

seigieu avatar Mar 16 '19 15:03 seigieu

PS: And a way to remove łąćźś etc. :)

seigieu avatar Mar 16 '19 16:03 seigieu

seems im too impatient... examples in docs could be extended... https://gist.github.com/seigieu/5cc599fbed512f607a73bcb84921b176

seigieu avatar Mar 16 '19 17:03 seigieu

Haha, love the license in your gist :)

I'll see if it makes sense to include this by default in daux, probably yes :)

onigoetz avatar Mar 17 '19 09:03 onigoetz

By the way, you're correct, there is no control over the urls for folders currently, other then the way you did it

onigoetz avatar Mar 17 '19 09:03 onigoetz

@onigoetz This solution made me some problems... acually changed it to this:

public function manipulateTree(Root $root) {
		$this->parseDirectory($root);
    }
	
	private function parseDirectory(\Todaymade\Daux\Tree\Directory $object) {
		foreach($object->getEntries() as $tempname => $val) {
			if($val instanceof \Todaymade\Daux\Tree\Directory) {
				$name_path = $val->getPath().'/.name';
				if(file_exists($name_path)) {
					$newname = trim(file_get_contents($name_path));
					echo "Name override detected ({$name_path}): '{$val->getTitle()}' -> '{$newname}'\r\n";
					$val->setTitle($newname);
				}
				$this->parseDirectory($val);
				
			}
		}
	}

Best one I came up so far with :) works like a charm, one from link became problematic when checking for references [link internakl](../Test/test.md) etc. I'm not into symphony thing and no time to learn your code and structure atm, so only fast solutions for me.

Same license as file above :P

seigieu avatar Mar 18 '19 13:03 seigieu

PS: my aim was acually to have control over folder names in menu, started from wrong side :)

seigieu avatar Mar 18 '19 13:03 seigieu