Page MenuHomePhabricator
Paste P2252

Change to Git2Pages PullContentFromRepo function to work inside syntax highlighting
ActivePublic

Authored by Spage on Oct 28 2015, 6:55 PM.
diff --git a/Git2Pages.body.php b/Git2Pages.body.php
index 8887e4b..a3d5ca9 100644
--- a/Git2Pages.body.php
+++ b/Git2Pages.body.php
@@ -86,10 +86,12 @@ class Git2PagesHooks {
try {
$gitRepo->SparseCheckoutNewRepo( $url, $gitFolder, $filename, $branch );
$fileContents = $gitRepo->FindAndReadFile( $filename, $gitFolder, $startLine, $endLine );
- $output = '<pre>' . htmlspecialchars( $fileContents ) . '</pre>';
+ // Spage try changing to support nesting in #tag: source
+ $output = $fileContents;
} catch ( Exception $ex ) {
$output = '<strong class="error">' . $ex->getMessage() . '</strong>';
}
- return array( $output, 'nowiki' => true, 'noparse' => true, 'isHTML' => true );
+ // Spage try changing to support nesting in #tag: source
+ return array( $output, 'nowiki' => false, 'noparse' => true, 'isHTML' => false );
}
}

Event Timeline

Spage changed the title of this paste from untitled to Change to Git2Pages PullContentFromRepo function to work inside syntax highlighting.
Spage updated the paste's language from autodetect to diff.

As I haven't written any code which uses these tags (nowiki, pre etc.) hence, sorry for asking naive questions.

return array( $output, 'nowiki' => false, 'noparse' => true, 'isHTML' => false );

Will it work for text files also? Will nowiki => false not mess with text files?