Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force urls to lowercase #83

Open
gregzawadzki opened this issue Mar 16, 2019 · 6 comments
Open

force urls to lowercase #83

gregzawadzki opened this issue Mar 16, 2019 · 6 comments

Comments

@gregzawadzki
Copy link

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?

@gregzawadzki
Copy link
Author

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

@gregzawadzki
Copy link
Author

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

@onigoetz
Copy link
Contributor

Haha, love the license in your gist :)

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

@onigoetz
Copy link
Contributor

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

@gregzawadzki
Copy link
Author

gregzawadzki commented Mar 18, 2019

@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

@gregzawadzki
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants