Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
8a327508
Commit
8a327508
authored
Aug 01, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more tweaks to the website
parent
590955e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
8 deletions
+46
-8
tools/website/drupal/fromfile.module
tools/website/drupal/fromfile.module
+11
-2
tools/website/drupal/mse-drupal-modules/autoformat.inc
tools/website/drupal/mse-drupal-modules/autoformat.inc
+13
-2
tools/website/drupal/mse-drupal-modules/highlight.inc
tools/website/drupal/mse-drupal-modules/highlight.inc
+22
-4
No files found.
tools/website/drupal/fromfile.module
View file @
8a327508
...
@@ -105,9 +105,18 @@ function fromfile_page() {
...
@@ -105,9 +105,18 @@ function fromfile_page() {
}
}
// done
// done
drupal_set_title
(
$title
);
drupal_set_breadcrumb
(
$breadcrumbs
);
drupal_set_breadcrumb
(
$breadcrumbs
);
return
$content
;
// view as a node
$node
=
array
(
'title'
=>
$title
,
'body'
=>
$content
,
'created'
=>
0
,
'links'
=>
FALSE
,
'name'
=>
''
,
'nid'
=>
''
);
//return node_view((object)$node, FALSE, TRUE);
return
theme
(
'node'
,
(
object
)
$node
,
FALSE
,
TRUE
);
}
}
...
...
tools/website/drupal/mse-drupal-modules/autoformat.inc
View file @
8a327508
...
@@ -53,9 +53,12 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
...
@@ -53,9 +53,12 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
$current_prefix
.=
' '
;
$current_prefix
.=
' '
;
}
}
//$line = $line . '{' . $current_prefix . '|' . strlen($prefix) . substr($oldline, 0, strlen($prefix)) . '}';
// Determine line type
// Determine line type
if
(
strlen
(
$oldline
)
<
strlen
(
$prefix
))
{
if
(
strlen
(
$oldline
)
<
strlen
(
$prefix
))
{
// empty line => break out of this level
// empty line => break out of this level
$i
--
;
if
(
$state
==
'|'
)
$text
.=
autoformat__table
(
$table
);
if
(
$state
==
'|'
)
$text
.=
autoformat__table
(
$table
);
return
$text
;
return
$text
;
}
else
if
(
$line
==
''
)
{
}
else
if
(
$line
==
''
)
{
...
@@ -128,7 +131,15 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
...
@@ -128,7 +131,15 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
// source code
// source code
if
(
$state
==
'>'
)
$text
=
substr
(
$text
,
0
,
-
6
);
if
(
$state
==
'>'
)
$text
=
substr
(
$text
,
0
,
-
6
);
else
$text
.=
'<pre>'
;
else
$text
.=
'<pre>'
;
$text
.=
syntax_highlight
(
htmlspecialchars
(
substr
(
$line
,
1
)));
if
(
substr
(
$line
,
0
,
4
)
==
'>>>>'
)
{
// always code, not escaped
$text
.=
highlight_script
(
substr
(
$line
,
4
));
}
else
if
(
substr
(
$line
,
0
,
3
)
==
'>>>'
)
{
// not escaped
$text
.=
syntax_highlight
(
substr
(
$line
,
3
));
}
else
if
(
substr
(
$line
,
0
,
2
)
==
'>>'
)
{
// always code
$text
.=
highlight_script
(
htmlspecialchars
(
substr
(
$line
,
2
)));
}
else
{
$text
.=
syntax_highlight
(
htmlspecialchars
(
substr
(
$line
,
1
)));
}
$text
.=
"
\n
</pre>"
;
$text
.=
"
\n
</pre>"
;
$state
=
'>'
;
$state
=
'>'
;
}
elseif
(
$line
{
0
}
==
']'
)
{
}
elseif
(
$line
{
0
}
==
']'
)
{
...
@@ -142,7 +153,7 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
...
@@ -142,7 +153,7 @@ function autoformat__handle(&$i, $prefix, $first, $fail_same = false) {
// Html
// Html
}
elseif
(
preg_match
(
"@^</?(pre|ul|ol|li|div|blockquote|>)@"
,
$line
))
{
}
elseif
(
preg_match
(
"@^</?(pre|ul|ol|li|div|blockquote|>)@"
,
$line
))
{
$line
=
preg_replace
(
"@^<>@"
,
""
,
$line
);
$line
=
preg_replace
(
"@^<>@"
,
""
,
$line
);
$text
.=
$line
;
$text
.=
$line
.
"
\n
"
;
$state
=
''
;
$state
=
''
;
// Just text
// Just text
...
...
tools/website/drupal/mse-drupal-modules/highlight.inc
View file @
8a327508
...
@@ -54,21 +54,35 @@ function highlight_reader($code) {
...
@@ -54,21 +54,35 @@ function highlight_reader($code) {
function
highlight_script
(
$code
)
{
function
highlight_script
(
$code
)
{
$ret
=
''
;
$ret
=
''
;
$string
=
''
;
while
(
strlen
(
$code
))
{
while
(
strlen
(
$code
))
{
if
(
preg_match
(
"@^(if|then|else|for|in|do|and|or|xor|not|rgb)\b@"
,
$code
,
$matches
))
{
if
(
preg_match
(
"@^<[^>]+>@"
,
$code
,
$matches
))
{
$ret
.=
$matches
[
0
];
// plain tag
}
else
if
(
preg_match
(
"@^(if|then|else|for|in|do|and|or|xor|not|rgb)\b@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-kw'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-kw'>"
.
$matches
[
0
]
.
"</span>"
;
}
else
if
(
preg_match
(
"@^(include file:)(.*)@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^(include file:)(.*)@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-key'>"
.
$matches
[
1
]
.
"</span>"
.
$matches
[
2
];
$ret
.=
"<span class='hl-key'>"
.
$matches
[
1
]
.
"</span>"
.
$matches
[
2
];
}
else
if
(
preg_match
(
"@^([0-9][0-9.]*|true|false)@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^([0-9][0-9.]*|true|false)@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-num'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-num'>"
.
$matches
[
0
]
.
"</span>"
;
}
else
if
(
preg_match
(
"@^(
\"
|")(
\\\\
.|[^
\\\\
])*?(
\"
|")@"
,
$code
,
$matches
))
{
// } else if (preg_match("@^(\"|")(\\\\.|[^\\\\])*?(\"|")@",$code, $matches)) {
$ret
.=
"<span class='hl-str'>"
.
$matches
[
0
]
.
"</span>"
;
// $ret .= "<span class='hl-str'>" . $matches[0] . "</span>";
}
else
if
(
preg_match
(
"@^(
\"
|")(
\\\\
.|[^
\\\\
{])*?(
\"
|"|{)@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-str'>"
.
highlight_script_string
(
$matches
[
0
])
.
"</span>"
;
if
(
$matches
[
3
]
==
'{'
)
$string
.=
's'
;
}
else
if
(
$string
!=
''
&&
$string
{
strlen
(
$string
)
-
1
}
==
's'
&&
preg_match
(
"@^}(
\\\\
.|[^
\\\\
{])*?(
\"
|"|{)@"
,
$code
,
$matches
))
{
// return from string quote
$ret
.=
"<span class='hl-str'>"
.
highlight_script_string
(
$matches
[
0
])
.
"</span>"
;
$string
=
substr
(
$string
,
0
,
-
1
);
if
(
$matches
[
3
]
==
'{'
)
$string
.=
's'
;
}
else
if
(
preg_match
(
"@^
\\
#.*@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^
\\
#.*@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-comment'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-comment'>"
.
$matches
[
0
]
.
"</span>"
;
}
else
if
(
preg_match
(
"@^([-+*/=!.]|<|>)+|^:=@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^([-+*/=!.]|<|>)+|^:=@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-op'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-op'>"
.
$matches
[
0
]
.
"</span>"
;
}
else
if
(
preg_match
(
"@^
[
\\
(
\\
)
\\
[
\\
]{},]+
@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^
([}]|[
\\
(
\\
)
\\
[
\\
]{,]+)
@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-paren'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-paren'>"
.
$matches
[
0
]
.
"</span>"
;
if
(
$matches
[
0
]
==
'{'
)
$string
.=
'p'
;
elseif
(
$matches
[
0
]
==
'}'
)
$string
=
substr
(
$string
,
0
,
-
1
);
}
else
if
(
preg_match
(
"@^[a-zA-Z_][a-zA-Z0-9_]*:@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^[a-zA-Z_][a-zA-Z0-9_]*:@"
,
$code
,
$matches
))
{
$ret
.=
"<span class='hl-ckey'>"
.
$matches
[
0
]
.
"</span>"
;
$ret
.=
"<span class='hl-ckey'>"
.
$matches
[
0
]
.
"</span>"
;
}
else
if
(
preg_match
(
"@^([a-zA-Z0-9_]+\s*|\s+|&#?[a-zA-Z0-9]+;)@"
,
$code
,
$matches
))
{
}
else
if
(
preg_match
(
"@^([a-zA-Z0-9_]+\s*|\s+|&#?[a-zA-Z0-9]+;)@"
,
$code
,
$matches
))
{
...
@@ -84,5 +98,9 @@ function highlight_script($code) {
...
@@ -84,5 +98,9 @@ function highlight_script($code) {
}
}
return
$ret
;
return
$ret
;
}
}
function
highlight_script_string
(
$code
)
{
$code
=
preg_replace
(
"@<.*?(>|>)@"
,
"<span class='hl-tag'>
\\
0</span>"
,
$code
);
return
$code
;
}
?>
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment