{"action":"created","comment":{"url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/comments/35426324","id":35426324,"diff_hunk":"@@ -447,7 +447,7 @@ sub convertXMTextContent {\n   foreach my $node (@nodes) {\n     if ($node->nodeType == XML_TEXT_NODE) {\n       my $string = $node->textContent;\n-      $string =~ s/^\\s+/$NBSP/; $string =~ s/\\s+$/$NBSP/;    # should we???","path":"lib/LaTeXML/Post.pm","position":4,"original_position":4,"commit_id":"88c6c4729eca6e2c58e4dea593ad95ccabca0e90","original_commit_id":"88c6c4729eca6e2c58e4dea593ad95ccabca0e90","user":{"login":"brucemiller","id":2972564,"avatar_url":"https://avatars.githubusercontent.com/u/2972564?v=3","gravatar_id":"","url":"https://api.github.com/users/brucemiller","html_url":"https://github.com/brucemiller","followers_url":"https://api.github.com/users/brucemiller/followers","following_url":"https://api.github.com/users/brucemiller/following{/other_user}","gists_url":"https://api.github.com/users/brucemiller/gists{/gist_id}","starred_url":"https://api.github.com/users/brucemiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brucemiller/subscriptions","organizations_url":"https://api.github.com/users/brucemiller/orgs","repos_url":"https://api.github.com/users/brucemiller/repos","events_url":"https://api.github.com/users/brucemiller/events{/privacy}","received_events_url":"https://api.github.com/users/brucemiller/received_events","type":"User","site_admin":false},"body":"The substitution, or something equivalent, *is* generally needed, at least for MathML.  I don't know why those nbsp should cause problems in sTeX, but I probably *wouldn't* know :> The core of the issue is that sometimes the space matters, such as in\r\n```\r\n$x \\mbox{ if } y$\r\n```\r\nand since the leading & trailing whitespace is trimmed in MathML token elements, you need to replace it by nbsp, or find some alternative using mspace or spacing attributes.\r\n\r\nUnfortunately, this is all complicated by libxml2's heuristic for adding \"ignorable whitespace\" when it indents XML output; it doesn't actually consult the schema to determine if whitespace is ignorable or not.  So there's a dance trying to determine whether the whitespace was intended to be ignorable, or whether it needs to be converted. \r\n\r\nMoreover, I recently fixed one case to *not* preserve the spacing, but it seems I've broken a case where it *should* be preserved (& converted).  I'm going to have to collect all my corner cases and try to fix it so it's \"right\" all (or more) of the time.\r\n\r\nBut perhaps what you're also saying is that the spaces should *always* be trimmed away and not converted to nbsp in OpenMath?","created_at":"2015-07-24T14:20:45Z","updated_at":"2015-07-24T14:20:45Z","html_url":"https://github.com/KWARC/LaTeXML/pull/8#discussion_r35426324","pull_request_url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/comments/35426324"},"html":{"href":"https://github.com/KWARC/LaTeXML/pull/8#discussion_r35426324"},"pull_request":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8","id":40671678,"html_url":"https://github.com/KWARC/LaTeXML/pull/8","diff_url":"https://github.com/KWARC/LaTeXML/pull/8.diff","patch_url":"https://github.com/KWARC/LaTeXML/pull/8.patch","issue_url":"https://api.github.com/repos/KWARC/LaTeXML/issues/8","number":8,"state":"closed","locked":false,"title":"\\text fix ","user":{"login":"angerhang","id":7655454,"avatar_url":"https://avatars.githubusercontent.com/u/7655454?v=3","gravatar_id":"","url":"https://api.github.com/users/angerhang","html_url":"https://github.com/angerhang","followers_url":"https://api.github.com/users/angerhang/followers","following_url":"https://api.github.com/users/angerhang/following{/other_user}","gists_url":"https://api.github.com/users/angerhang/gists{/gist_id}","starred_url":"https://api.github.com/users/angerhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angerhang/subscriptions","organizations_url":"https://api.github.com/users/angerhang/orgs","repos_url":"https://api.github.com/users/angerhang/repos","events_url":"https://api.github.com/users/angerhang/events{/privacy}","received_events_url":"https://api.github.com/users/angerhang/received_events","type":"User","site_admin":false},"body":"See https://github.com/KWARC/sTeX/issues/74 for detail ","created_at":"2015-07-23T13:29:34Z","updated_at":"2015-07-24T14:20:45Z","closed_at":"2015-07-23T16:14:21Z","merged_at":"2015-07-23T16:14:21Z","merge_commit_sha":"89d02baf5b060c8de1332cf4768176d043eec2ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8/commits","review_comments_url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8/comments","review_comment_url":"https://api.github.com/repos/KWARC/LaTeXML/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KWARC/LaTeXML/issues/8/comments","statuses_url":"https://api.github.com/repos/KWARC/LaTeXML/statuses/88c6c4729eca6e2c58e4dea593ad95ccabca0e90","head":{"label":"angerhang:master","ref":"master","sha":"88c6c4729eca6e2c58e4dea593ad95ccabca0e90","user":{"login":"angerhang","id":7655454,"avatar_url":"https://avatars.githubusercontent.com/u/7655454?v=3","gravatar_id":"","url":"https://api.github.com/users/angerhang","html_url":"https://github.com/angerhang","followers_url":"https://api.github.com/users/angerhang/followers","following_url":"https://api.github.com/users/angerhang/following{/other_user}","gists_url":"https://api.github.com/users/angerhang/gists{/gist_id}","starred_url":"https://api.github.com/users/angerhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angerhang/subscriptions","organizations_url":"https://api.github.com/users/angerhang/orgs","repos_url":"https://api.github.com/users/angerhang/repos","events_url":"https://api.github.com/users/angerhang/events{/privacy}","received_events_url":"https://api.github.com/users/angerhang/received_events","type":"User","site_admin":false},"repo":{"id":33404461,"name":"LaTeXML","full_name":"angerhang/LaTeXML","owner":{"login":"angerhang","id":7655454,"avatar_url":"https://avatars.githubusercontent.com/u/7655454?v=3","gravatar_id":"","url":"https://api.github.com/users/angerhang","html_url":"https://github.com/angerhang","followers_url":"https://api.github.com/users/angerhang/followers","following_url":"https://api.github.com/users/angerhang/following{/other_user}","gists_url":"https://api.github.com/users/angerhang/gists{/gist_id}","starred_url":"https://api.github.com/users/angerhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angerhang/subscriptions","organizations_url":"https://api.github.com/users/angerhang/orgs","repos_url":"https://api.github.com/users/angerhang/repos","events_url":"https://api.github.com/users/angerhang/events{/privacy}","received_events_url":"https://api.github.com/users/angerhang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/angerhang/LaTeXML","description":"LaTeXML is a TeX and LaTeX to XML translator.","fork":true,"url":"https://api.github.com/repos/angerhang/LaTeXML","forks_url":"https://api.github.com/repos/angerhang/LaTeXML/forks","keys_url":"https://api.github.com/repos/angerhang/LaTeXML/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angerhang/LaTeXML/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angerhang/LaTeXML/teams","hooks_url":"https://api.github.com/repos/angerhang/LaTeXML/hooks","issue_events_url":"https://api.github.com/repos/angerhang/LaTeXML/issues/events{/number}","events_url":"https://api.github.com/repos/angerhang/LaTeXML/events","assignees_url":"https://api.github.com/repos/angerhang/LaTeXML/assignees{/user}","branches_url":"https://api.github.com/repos/angerhang/LaTeXML/branches{/branch}","tags_url":"https://api.github.com/repos/angerhang/LaTeXML/tags","blobs_url":"https://api.github.com/repos/angerhang/LaTeXML/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angerhang/LaTeXML/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angerhang/LaTeXML/git/refs{/sha}","trees_url":"https://api.github.com/repos/angerhang/LaTeXML/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angerhang/LaTeXML/statuses/{sha}","languages_url":"https://api.github.com/repos/angerhang/LaTeXML/languages","stargazers_url":"https://api.github.com/repos/angerhang/LaTeXML/stargazers","contributors_url":"https://api.github.com/repos/angerhang/LaTeXML/contributors","subscribers_url":"https://api.github.com/repos/angerhang/LaTeXML/subscribers","subscription_url":"https://api.github.com/repos/angerhang/LaTeXML/subscription","commits_url":"https://api.github.com/repos/angerhang/LaTeXML/commits{/sha}","git_commits_url":"https://api.github.com/repos/angerhang/LaTeXML/git/commits{/sha}","comments_url":"https://api.github.com/repos/angerhang/LaTeXML/comments{/number}","issue_comment_url":"https://api.github.com/repos/angerhang/LaTeXML/issues/comments{/number}","contents_url":"https://api.github.com/repos/angerhang/LaTeXML/contents/{+path}","compare_url":"https://api.github.com/repos/angerhang/LaTeXML/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angerhang/LaTeXML/merges","archive_url":"https://api.github.com/repos/angerhang/LaTeXML/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angerhang/LaTeXML/downloads","issues_url":"https://api.github.com/repos/angerhang/LaTeXML/issues{/number}","pulls_url":"https://api.github.com/repos/angerhang/LaTeXML/pulls{/number}","milestones_url":"https://api.github.com/repos/angerhang/LaTeXML/milestones{/number}","notifications_url":"https://api.github.com/repos/angerhang/LaTeXML/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angerhang/LaTeXML/labels{/name}","releases_url":"https://api.github.com/repos/angerhang/LaTeXML/releases{/id}","created_at":"2015-04-04T12:17:29Z","updated_at":"2015-04-04T12:17:31Z","pushed_at":"2015-07-23T13:27:00Z","git_url":"git://github.com/angerhang/LaTeXML.git","ssh_url":"git@github.com:angerhang/LaTeXML.git","clone_url":"https://github.com/angerhang/LaTeXML.git","svn_url":"https://github.com/angerhang/LaTeXML","homepage":null,"size":32281,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KWARC:master","ref":"master","sha":"208e5182645ed8af065fcddb3fc63a794a24ca12","user":{"login":"KWARC","id":3624298,"avatar_url":"https://avatars.githubusercontent.com/u/3624298?v=3","gravatar_id":"","url":"https://api.github.com/users/KWARC","html_url":"https://github.com/KWARC","followers_url":"https://api.github.com/users/KWARC/followers","following_url":"https://api.github.com/users/KWARC/following{/other_user}","gists_url":"https://api.github.com/users/KWARC/gists{/gist_id}","starred_url":"https://api.github.com/users/KWARC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KWARC/subscriptions","organizations_url":"https://api.github.com/users/KWARC/orgs","repos_url":"https://api.github.com/users/KWARC/repos","events_url":"https://api.github.com/users/KWARC/events{/privacy}","received_events_url":"https://api.github.com/users/KWARC/received_events","type":"Organization","site_admin":false},"repo":{"id":13789396,"name":"LaTeXML","full_name":"KWARC/LaTeXML","owner":{"login":"KWARC","id":3624298,"avatar_url":"https://avatars.githubusercontent.com/u/3624298?v=3","gravatar_id":"","url":"https://api.github.com/users/KWARC","html_url":"https://github.com/KWARC","followers_url":"https://api.github.com/users/KWARC/followers","following_url":"https://api.github.com/users/KWARC/following{/other_user}","gists_url":"https://api.github.com/users/KWARC/gists{/gist_id}","starred_url":"https://api.github.com/users/KWARC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KWARC/subscriptions","organizations_url":"https://api.github.com/users/KWARC/orgs","repos_url":"https://api.github.com/users/KWARC/repos","events_url":"https://api.github.com/users/KWARC/events{/privacy}","received_events_url":"https://api.github.com/users/KWARC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KWARC/LaTeXML","description":"LaTeXML is a TeX and LaTeX to XML translator.","fork":true,"url":"https://api.github.com/repos/KWARC/LaTeXML","forks_url":"https://api.github.com/repos/KWARC/LaTeXML/forks","keys_url":"https://api.github.com/repos/KWARC/LaTeXML/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KWARC/LaTeXML/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KWARC/LaTeXML/teams","hooks_url":"https://api.github.com/repos/KWARC/LaTeXML/hooks","issue_events_url":"https://api.github.com/repos/KWARC/LaTeXML/issues/events{/number}","events_url":"https://api.github.com/repos/KWARC/LaTeXML/events","assignees_url":"https://api.github.com/repos/KWARC/LaTeXML/assignees{/user}","branches_url":"https://api.github.com/repos/KWARC/LaTeXML/branches{/branch}","tags_url":"https://api.github.com/repos/KWARC/LaTeXML/tags","blobs_url":"https://api.github.com/repos/KWARC/LaTeXML/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KWARC/LaTeXML/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KWARC/LaTeXML/git/refs{/sha}","trees_url":"https://api.github.com/repos/KWARC/LaTeXML/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KWARC/LaTeXML/statuses/{sha}","languages_url":"https://api.github.com/repos/KWARC/LaTeXML/languages","stargazers_url":"https://api.github.com/repos/KWARC/LaTeXML/stargazers","contributors_url":"https://api.github.com/repos/KWARC/LaTeXML/contributors","subscribers_url":"https://api.github.com/repos/KWARC/LaTeXML/subscribers","subscription_url":"https://api.github.com/repos/KWARC/LaTeXML/subscription","commits_url":"https://api.github.com/repos/KWARC/LaTeXML/commits{/sha}","git_commits_url":"https://api.github.com/repos/KWARC/LaTeXML/git/commits{/sha}","comments_url":"https://api.github.com/repos/KWARC/LaTeXML/comments{/number}","issue_comment_url":"https://api.github.com/repos/KWARC/LaTeXML/issues/comments{/number}","contents_url":"https://api.github.com/repos/KWARC/LaTeXML/contents/{+path}","compare_url":"https://api.github.com/repos/KWARC/LaTeXML/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KWARC/LaTeXML/merges","archive_url":"https://api.github.com/repos/KWARC/LaTeXML/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KWARC/LaTeXML/downloads","issues_url":"https://api.github.com/repos/KWARC/LaTeXML/issues{/number}","pulls_url":"https://api.github.com/repos/KWARC/LaTeXML/pulls{/number}","milestones_url":"https://api.github.com/repos/KWARC/LaTeXML/milestones{/number}","notifications_url":"https://api.github.com/repos/KWARC/LaTeXML/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KWARC/LaTeXML/labels{/name}","releases_url":"https://api.github.com/repos/KWARC/LaTeXML/releases{/id}","created_at":"2013-10-23T00:12:08Z","updated_at":"2015-04-21T17:02:42Z","pushed_at":"2015-07-23T16:14:22Z","git_url":"git://github.com/KWARC/LaTeXML.git","ssh_url":"git@github.com:KWARC/LaTeXML.git","clone_url":"https://github.com/KWARC/LaTeXML.git","svn_url":"https://github.com/KWARC/LaTeXML","homepage":null,"size":33171,"stargazers_count":5,"watchers_count":5,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8"},"html":{"href":"https://github.com/KWARC/LaTeXML/pull/8"},"issue":{"href":"https://api.github.com/repos/KWARC/LaTeXML/issues/8"},"comments":{"href":"https://api.github.com/repos/KWARC/LaTeXML/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KWARC/LaTeXML/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/KWARC/LaTeXML/statuses/88c6c4729eca6e2c58e4dea593ad95ccabca0e90"}}}}