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

Message about dockerized Texy #44

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.gitattributes export-ignore
.gitignore export-ignore
.github export-ignore
.travis.yml export-ignore
tests export-ignore
*.sh eol=lf
16 changes: 16 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- bug report? yes/no
- feature request? yes/no
- version: ?.?.? <!-- exact release version, for bug reports -->

### Description
...

### Steps To Reproduce
... If possible a minimal demo of the problem ...

<!--
REMEMBER, AN ISSUE IS NOT THE PLACE TO ASK QUESTIONS. We will be happy to help you on forum https://forum.texy.info

A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report.
Feature requests are welcome. Explain your intentions. It's up to you to make a strong case to convince the project's developers of the merits of this feature.
-->
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- bug fix? yes/no <!-- #issue numbers, if any -->
- new feature? yes/no
- BC break? yes/no

<!--
Describe your changes here to communicate to the maintainers why we should accept this pull request.

Please add new tests to show the fix or feature works.

Thanks for contributing!
-->
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# Install Nette Code Checker
- travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-progress
script:
- php temp/code-checker/src/code-checker.php --short-arrays -i windows-1250.html -i windows-1250.texy
- php temp/code-checker/src/code-checker.php --short-arrays


- stage: Code Coverage
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@
"autoload": {
"classmap": ["src/"],
"files": ["src/texy.php"]
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}
30 changes: 17 additions & 13 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
How to contribute & use the issue tracker
=========================================

The issue tracker is the preferred channel for bug reports, features requests
and submitting pull requests, but please respect the following restrictions:
Texy welcomes your contributions. There are several ways to help out:

* Please **do not** use the issue tracker for personal support requests (use
[Texy forum](https://forum.texy.info) or [Stack Overflow](http://stackoverflow.com)).
* Create an issue on GitHub, if you have found a bug
* Write test cases for open bug issues
* Write fixes for open bug/feature issues, preferably with test cases included
* Contribute to the documentation

* Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
Issues
------

* Use the GitHub **issue search** &mdash; check if the issue has already been
reported.
Please **do not use the issue tracker to ask questions**. We will be happy to help you
on [Texy forum](https://forum.texy.info).

A good **bug report** shouldn't leave others needing to chase you up for more
A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report.

**Feature requests** are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature.

We welcome **pull requests**. If you'd like to contribute, please take a moment
to [read the guidelines](https://nette.org/en/contributing) in order to make
the contribution process easy and effective for everyone involved.
Contributing
------------

Thanks!
The best way to propose a feature is to discuss your ideas on [Texy forum](https://forum.texy.info) before implementing them.

Please do not fix whitespace, format code, or make a purely cosmetic patch.

Thanks! :heart:
3 changes: 1 addition & 2 deletions examples/1-2-3 start/demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
$texy = new Texy();

// other OPTIONAL configuration
$texy->encoding = 'windows-1250'; // disable UTF-8
$texy->imageModule->root = 'images/'; // specify image folder
$texy->allowed['phrase/ins'] = true;
$texy->allowed['phrase/del'] = true;
Expand All @@ -27,7 +26,7 @@


// echo formated output
header('Content-type: text/html; charset=' . $texy->encoding);
header('Content-type: text/html; charset=utf-8');
echo '<link rel="stylesheet" type="text/css" media="all" href="style.css" />';
echo '<title>' . $texy->headingModule->title . '</title>';
echo $html;
Expand Down
4 changes: 2 additions & 2 deletions examples/cache/mytexy.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public function process($text, $useCache = true)
$cacheFile = $this->cachePath . $md5 . '.html';
$content = is_file($cacheFile) ? unserialize(file_get_contents($cacheFile)) : null;
if ($content) { // read from cache
list($html, $this->styleSheet, $this->headingModule->title) = $content;
list($html, $this->headingModule->title) = $content;

} else { // doesn't exists
$html = parent::process($text);
file_put_contents($cacheFile,
serialize([$html, $this->styleSheet, $this->headingModule->title])
serialize([$html, $this->headingModule->title])
);
}

Expand Down
7 changes: 4 additions & 3 deletions examples/syntax highlighting/demo-geshi.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function blockHandler(Texy\HandlerInvocation $invocation, $blocktype, $content,
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');

// save generated stylesheet
$texy->styleSheet .= $geshi->get_stylesheet();
global $styleSheet
$styleSheet .= $geshi->get_stylesheet();

$content = $geshi->parse_code();

Expand All @@ -76,15 +77,15 @@ function blockHandler(Texy\HandlerInvocation $invocation, $blocktype, $content,
$texy->addHandler('block', 'blockHandler');

// prepare CSS stylesheet
$texy->styleSheet = 'pre { padding:10px } ';
$styleSheet = 'pre { padding:10px } ';

// processing
$text = file_get_contents('sample.texy');
$html = $texy->process($text); // that's all folks!

// echo Geshi Stylesheet
header('Content-type: text/html; charset=utf-8');
echo '<style type="text/css">' . $texy->styleSheet . '</style>';
echo '<style type="text/css">'. $styleSheet . '</style>';
echo '<title>' . $texy->headingModule->title . '</title>';
// echo formated output
echo $html;
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Texy! [![Buy me a coffee](https://files.nette.org/images/coffee1s.png)](https:

[![Downloads this Month](https://img.shields.io/packagist/dm/texy/texy.svg)](https://packagist.org/packages/texy/texy)
[![Build Status](https://travis-ci.org/dg/texy.svg?branch=master)](https://travis-ci.org/dg/texy)
[![Coverage Status](https://coveralls.io/repos/github/dg/texy/badge.svg?branch=master)](https://coveralls.io/github/dg/texy?branch=master)
[![Latest Stable Version](https://poser.pugx.org/dg/texy/v/stable)](https://github.com/dg/texy/releases)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/dg/texy/blob/master/license.md)

Expand All @@ -27,3 +28,9 @@ Refer to the 'examples' directory for examples. Texy documentation is
available on the homepage https://texy.info.

If you like Texy, **[please make a donation now](https://nette.org/make-donation?to=texy)**. Thank you!


Dockerized Texy service
-----------------------

I am not quite sure how to contact the Texy community anywhere else, so herebe I am letting you know that I created a [Docker image with Texy converter](https://hub.docker.com/r/ondrazizka/texy-service/tags/).
2 changes: 2 additions & 0 deletions src/Texy/DTD.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,5 @@
$dtd['th'][0] += ['nowrap' => 1, 'bgcolor' => 1, 'width' => 1, 'height' => 1];

// missing: FRAMESET, FRAME, BGSOUND, XMP, ...

return $dtd;
6 changes: 0 additions & 6 deletions src/Texy/HandlerInvocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,4 @@ public function getTexy()
{
return $this->parser->getTexy();
}


/** @deprecated */
public function free()
{
}
}
18 changes: 0 additions & 18 deletions src/Texy/HtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,6 @@ final public function &__get($name)
}


/**
* Overloaded setter for element's attribute.
* @param string attribute name
* @param array value
* @return self
*/
/*
final public function __call($m, $args)
{
if (count($args) !== 1) {
throw new \InvalidArgumentException("Just one argument is required.");
}
$this->attrs[$m] = $args[0];
return $this;
}
*/


/**
* Special setter for element's attribute.
* @param string path
Expand Down
8 changes: 0 additions & 8 deletions src/Texy/Modules/BlockModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ public function pattern(Texy\BlockParser $parser, array $matches)
}


// for backward compatibility
public function outdent($s)
{
trigger_error('Use Texy\Helpers::outdent()', E_USER_WARNING);
return Helpers::outdent($s);
}


/**
* Finish invocation.
* @return HtmlElement|string|false
Expand Down
10 changes: 7 additions & 3 deletions src/Texy/Modules/FigureModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct($texy)
$texy->registerBlockPattern(
[$this, 'pattern'],
'#^\[\* *+([^\n' . Patterns::MARK . ']{1,1000})' . Patterns::MODIFIER . '? *+(\*|(?<!<)>|<)\]' // [* urls .(title)[class]{style} >]
. '(?::(' . Patterns::LINK_URL . '|:))?? ++\*\*\* ++(.{0,2000})' . Patterns::MODIFIER_H . '?()$#mUu',
. '(?::(' . Patterns::LINK_URL . '|:))??(?: ++\*\*\* ++(.{0,2000}))?' . Patterns::MODIFIER_H . '?()$#mUu',
'figure'
);
}
Expand Down Expand Up @@ -102,8 +102,12 @@ public function solve(Texy\HandlerInvocation $invocation, Texy\Image $image, Tex
$mod->decorate($texy, $el);

$el[0] = $elImg;
$el[1] = new Texy\HtmlElement('p');
$el[1]->parseLine($texy, ltrim($content));

$content = ltrim($content);
if ($content) {
$el[1] = new Texy\HtmlElement('p');
$el[1]->parseLine($texy, $content);
}

$class = $this->class;
if ($hAlign) {
Expand Down
4 changes: 2 additions & 2 deletions src/Texy/Modules/ImageModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function patternImage(Texy\LineParser $parser, array $matches)
*/
public function addReference($name, Image $image)
{
$image->name = Texy\Utf::strtolower($name);
$image->name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name;
$this->references[$image->name] = $image;
}

Expand All @@ -146,7 +146,7 @@ public function addReference($name, Image $image)
*/
public function getReference($name)
{
$name = Texy\Utf::strtolower($name);
$name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name;
if (isset($this->references[$name])) {
return clone $this->references[$name];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Texy/Modules/LinkModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function patternUrlEmail(LineParser $parser, array $matches, $name)
*/
public function addReference($name, Link $link)
{
$link->name = Texy\Utf::strtolower($name);
$link->name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name;
$this->references[$link->name] = $link;
}

Expand All @@ -202,7 +202,7 @@ public function addReference($name, Link $link)
*/
public function getReference($name)
{
$name = Texy\Utf::strtolower($name);
$name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name;
if (isset($this->references[$name])) {
return clone $this->references[$name];

Expand Down
Loading