Skip to content

Commit

Permalink
refactor: ignore confluence userlink
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkcup committed Aug 13, 2021
1 parent 4cc6092 commit 6b9846a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
1 change: 1 addition & 0 deletions .git-pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

FILES=$(git diff --diff-filter=d --name-only HEAD | grep '.php$')
for file in $FILES; do
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/ConfluenceIgnoreHtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ public function testIgnoreSpaceContributors()
$newMarkdown = $confluence->htmlFile2Markdown($this->dataDir . 'confluence/space-contributors-demo.html');
$this->assertEquals(trim($markdown), $newMarkdown);
}

public function testIgnoreUserLink()
{
$confluence = new Confluence();
$markdown = file_get_contents($this->dataDir . 'confluence/userlink-demo.md');
$newMarkdown = $confluence->htmlFile2Markdown($this->dataDir . 'confluence/userlink-demo.html');
$this->assertEquals(trim($markdown), $newMarkdown);
}
}
8 changes: 0 additions & 8 deletions tests/Unit/ConfluenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ public function testHtmlFile2Markdown()
$this->assertEquals("你好\n==", $markdown);
}

public function testHtmlFile2MarkdownUserLink()
{
$confluence = new Confluence();
$markdown = file_get_contents($this->dataDir . 'confluence/space1/image-demo_65619.md');
$newMarkdown = $confluence->htmlFile2Markdown($this->dataDir . 'confluence/space1/image-demo_65619.html');
$this->assertEquals(trim($markdown), $newMarkdown);
}

public function testParsePagesTree()
{
$document = new DOMDocument();
Expand Down
51 changes: 51 additions & 0 deletions tests/data/confluence/userlink-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>空间 1 : Image Demo</title>
<link rel="stylesheet" href="styles/site.css" type="text/css"/>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>

<body class="theme-default aui-theme-default">
<div id="page">
<div id="main" class="aui-page-panel">
<div id="main-header">
<div id="breadcrumb-section">
<ol id="breadcrumbs">
<li class="first">
<span><a href="index.html">Demo</a></span>
</li>
<li>
<span><a href="65591.html">Demo</a></span>
</li>
</ol>
</div>
<h1 id="title-heading" class="pagetitle">
<span id="title-text">
空间 1 : Image Demo
</span>
</h1>
</div>

<div id="content" class="view">
<div class="page-metadata">


Created by <span class='author'> admin</span>, last modified on 七月 05, 2021
</div>
<div id="main-content" class="wiki-content group">
<a class="confluence-userlink url fn" data-username="admin" href=""><img class="userLogo logo" src="images/icons/profilepics/default.svg" alt="" title="admin"></a>
<p>world</p>
</div>

</div>
</div>
<div id="footer" role="contentinfo">
<section class="footer-body">
<p>Document generated by Confluence on 七月 05, 2021 18:26</p>
<div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
</section>
</div>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions tests/data/confluence/userlink-demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
world

0 comments on commit 6b9846a

Please sign in to comment.