Skip to content

Commit 2deb4e0

Browse files
Move hyperlight.php into src and autoload it
Change all direct references to it to load vendor/autoload.php instead. And make the calls more consistent.
1 parent 083154f commit 2deb4e0

File tree

10 files changed

+19
-17
lines changed

10 files changed

+19
-17
lines changed

collect-filetypes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4-
require('hyperlight.php');
4+
require_once 'vendor/autoload.php';
55

66
// Parse the languages/ subdirectory and compile a filetypes list that is
77
// considered by `hyperlight_file` to automatically recognize filetypes.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
},
1818
"files": [
1919
"src/array_peek.php",
20-
"src/preg_helper.php"
20+
"src/preg_helper.php",
21+
"src/hyperlight.php"
2122
]
2223
},
2324
"require": {}

doc/faq/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php require('../../hyperlight.php'); ?>
2-
<!DOCTYPE html
1+
<?php require_once '../../vendor/autoload.php'; ?>
2+
<!DOCTYPE html
33
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
44
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
55

doc/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php require('../hyperlight.php'); ?>
2-
<!DOCTYPE html
1+
<?php require_once '../vendor/autoload.php'; ?>
2+
<!DOCTYPE html
33
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
44
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
55

doc/user-guide/code1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php require('path/to/hyperlight.php'); ?>
1+
<?php require_once 'path/to/vendor/autoload.php'; ?>
22
<html>
33
<head>
44
<title>Very simple test for Hyperlight</title>

doc/user-guide/index.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
<?php define('HYPERLIGHT_SHORTCUT', true); require('../../hyperlight.php'); ?>
2-
<!DOCTYPE html
1+
<?php
2+
define('HYPERLIGHT_SHORTCUT', true);
3+
require_once '../../vendor/autoload.php';
4+
?>
5+
<!DOCTYPE html
36
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
47
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
58

@@ -53,7 +56,7 @@
5356
<p>The whole visual appearance of the highlighted code in Hyperlight is based on a few simple <acronym>CSS</acronym> rules. The strength of Hyperlight lies in the fact that these rules are controlled by class names that are the same across all language definitions, thereby making it easy to adapt one theme for all languages.</p>
5457
<p>At the same time, a finer degree of control might be needed because one size doesn’t fit all. This is possible in three ways. First, language definitions can define <em>mappings</em> between different class names. Secondly, rules can be combined and nested. Lastly, if all else fails, code is also tagged with a language-specific class name. This can be used to establish a specific rule for one language only. Of course, these should be used sparingly because they make it much harder to develop colour themes that are usable across all language definitions. We will examine all these techniques in due course.</p>
5558
<a id="the-theme-file"></a><h4>The Theme File</h4>
56-
<p>A theme is just a <acronym>CSS</acronym> stylesheet that defines a set of rules based on class names. Therefore, in order to write a theme you need to know the rudiments of <acronym>CSS</acronym>. To limit the scope of the styles and make the theme definitions interoperate nicely with other, existing styles, it’s recommended that you prefix all theme-specific rules with <?php hy('.source-code', 'css', 'code'); ?>.</p>
59+
<p>A theme is just a <acronym>CSS</acronym> stylesheet that defines a set of rules based on class names. Therefore, in order to write a theme you need to know the rudiments of <acronym>CSS</acronym>. To limit the scope of the styles and make the theme definitions interoperate nicely with other, existing styles, it’s recommended that you prefix all theme-specific rules with <?php hy('.source-code', 'css', 'code'); ?>.</p>
5760

5861
<h4>An Example</h4>
5962
<p>Let’s look at a small example theme file, actually a fragment of <code>zenburn.css</code>, which is used for this document.</p>

examples/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php require_once('../hyperlight.php'); ?>
2-
<!DOCTYPE html
1+
<?php require_once '../vendor/autoload.php'; ?>
2+
<!DOCTYPE html
33
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
44
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
55

index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php require('hyperlight.php'); ?>
2-
<!DOCTYPE html
1+
<?php require_once 'vendor/autoload.php'; ?>
2+
<!DOCTYPE html
33
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
44
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
55

hyperlight.php renamed to src/hyperlight.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
* @package hyperlight
4949
*/
5050

51-
require_once('vendor/autoload.php');
52-
5351
/**
5452
* <var>echo</var>s a highlighted code.
5553
*

test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require('hyperlight.php');
3+
require_once 'vendor/autoload.php';
44

55
function hyperlight_test($file, $lang = null) {
66
global $tests;

0 commit comments

Comments
 (0)