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

Proper documentation #10

Open
2 of 3 tasks
janwirth opened this issue Jan 13, 2015 · 15 comments
Open
2 of 3 tasks

Proper documentation #10

janwirth opened this issue Jan 13, 2015 · 15 comments
Assignees

Comments

@janwirth
Copy link
Collaborator

  • API (phpRuntime options)
  • Tests
  • Contributing
@janwirth
Copy link
Collaborator Author

I suppose using this platform for documentation.
It features GitHub integration.

@ivankravchenko
Copy link
Member

I'm not sure how rtfd platform can bring a value for now.
Describe in more detail this and what is essential in 'Contributing' section.

@janwirth
Copy link
Collaborator Author

I guess you are right about the rtfd platform, that would be overkill as this is mostly jade. Yet still we have to document the phpRuntime options, and how functions are called inside tags.

Contributing is mainly to keep a consistent quality standard throughout this library:
https://github.com/jenius/accord/blob/master/contributing.md

@ivankravchenko
Copy link
Member

Of course, PHP runtime code, extractor code, detailed options and usage should be well documented.
Thanks for pointing on well-formed 'Contributing' section.

@OnkelTem
Copy link

Meanwhie, would you explain what exactly jade2php generates?

Rendering this simple template:

doctype html
html(lang!="$language")
  head
    !=$head

using: ./bin/jade2php --pretty --omit-php-runtim --omit-php-extractor html.jade
results to:

<?php error_reporting(E_ALL & ~E_NOTICE);function attr($name, $value = true, $escaped = true) {if (!empty($value)) {echo " $name=\"$value\""
;}}function attrs() {$args = func_get_args();$attrs = array();foreach ($args as $arg) {foreach ($arg as $key => $value) {if ($key == 'class'
) {if (!isset($attrs[$key])) $attrs[$key] = array();$attrs[$key] = array_merge($attrs[$key], is_array($value) ? $value : explode(' ', $value
));} else {$attrs[$key] = $value;}}}foreach ($attrs as $key => $value) {if ($key == 'class') {attr_class($value);} else {attr($key, $value);
}}}function attr_class() {$classes = array();$args = func_get_args();foreach ($args as $arg) {if (empty($arg) || is_array($arg) && count($ar
g) == 0) continue;$classes = array_merge($classes, is_array($arg) ? $arg : array($arg));}$classes = array_filter($classes);if (count($classe
s) > 0) attr('class', join(' ', $classes));}function add() {$result = '';$args = func_get_args();$concat = false;foreach ($args as $arg) {if
 ($concat || is_string($arg)) {$concat = true;$result .= $arg;} elseif (is_numeric($arg)) {if ($result === '') $result = 0;$result += $arg;}
}return $result;}?><!DOCTYPE html><html lang="$language"><head><?= $$head ?></head></html>

UPDATE

Fixed "--omit-php-runtim" in command line, now the output is much nicer:

<!DOCTYPE html><html lang="$language"><head><?= $$head ?></head></html>

but still I don't get how to make it look like:

<!DOCTYPE html>
  <html lang="<?php echo $language?>">
    <head>
      <?php echo $head ?>
    </head>
  </html>

i.e.:

  1. with newlines and proper indentation
  2. with <?php tags and echo (or print) instead of <?=
  3. with resolved attributes

Thanks in advance!

@ivankravchenko
Copy link
Member

1, 2. this is --pretty-related, #14.
3. What do you mean at "resolved attributes"? Could you mind to describe at code level with input and output?

@janwirth
Copy link
Collaborator Author

@OnkelTem
you should write jade in the regular syntax, e.g. your $variable must not have a sigil (the dollar sign). Just go with variable. Jade2Php will then automatically wrap your variable inside the htmlspecialchars() function.

@OnkelTem
Copy link

Guys, I'm trying to figure out the difference between jade-php and jade2php.
Form the source code point of view, while jade-php is 30-lines jade's Compile-callback implementation, jade2php is huge. Would you explain jade2php purpose and idea?

@FranzSkuffka
I see, ok :)

@ivankravchenko
Copy link
Member

jade2php strives to be as compatible with original jade code as possible, while jade-php don't.
I made and used jade2php to write interoperable code (can be used with original Jade and with PHP).
HTML output is also byte-to-byte same as with usage of original Jade preprocessor.

While writing jade-php-ish Jade code, you can't use it without jade-php.

@ivankravchenko
Copy link
Member

One more important part – jade2php is extensively unit-tested.
There also some edge cases and work to do, but I could say that jade2php is ready to be used (and open for contributions).

@kevindice
Copy link

I might be interested in helping document this.

@ivankravchenko
Copy link
Member

@kevindice, you're welcome. Let do this via usual Fork → Pull Request?

@janwirth janwirth self-assigned this Nov 11, 2015
@janwirth
Copy link
Collaborator Author

janwirth commented Apr 4, 2016

@ivankravchenko I just created http://pug2php.netlify.com/ which is a small demo app. What do you think?

@kevindice Are you still interested in creating a documentation?

Repo: https://github.com/FranzSkuffka/pug2php-www
@ivankravchenko do you want me to transfer this to se7ensky?

@dsifford
Copy link

dsifford commented May 1, 2016

So I'm interested in the gulp plugin.. Unfortunately there is no documentation whatsoever for it (not even a readme.md).

Am I able to pass args using gulp?

@dsifford
Copy link

dsifford commented May 1, 2016

Scratch my last... Read through the source file and it looks like the options should be given in camelCase rather than kebab-case...

Docs would still be handy though.

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

5 participants